@omnidotdev/rdk 0.5.2 → 0.7.0

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.
Files changed (46) hide show
  1. package/build/engine/useXRStore.d.ts +4 -12
  2. package/build/engine/useXRStore.d.ts.map +1 -1
  3. package/build/fiducial/FiducialAnchor.d.ts.map +1 -1
  4. package/build/fiducial/FiducialSession.d.ts +1 -4
  5. package/build/fiducial/FiducialSession.d.ts.map +1 -1
  6. package/build/fiducial/fiducialBackend.d.ts +18 -1
  7. package/build/fiducial/fiducialBackend.d.ts.map +1 -1
  8. package/build/fiducial/index.d.ts +2 -1
  9. package/build/fiducial/index.d.ts.map +1 -1
  10. package/build/fiducial/useFiducialBackend.d.ts +17 -0
  11. package/build/fiducial/useFiducialBackend.d.ts.map +1 -0
  12. package/build/geolocation/GeolocationAnchor.d.ts.map +1 -1
  13. package/build/geolocation/GeolocationSession.d.ts +1 -4
  14. package/build/geolocation/GeolocationSession.d.ts.map +1 -1
  15. package/build/geolocation/geolocationBackend.d.ts +37 -8
  16. package/build/geolocation/geolocationBackend.d.ts.map +1 -1
  17. package/build/geolocation/index.d.ts +2 -1
  18. package/build/geolocation/index.d.ts.map +1 -1
  19. package/build/geolocation/useGeolocationBackend.d.ts +17 -0
  20. package/build/geolocation/useGeolocationBackend.d.ts.map +1 -0
  21. package/build/immersive/ImmersiveSession.d.ts.map +1 -1
  22. package/build/index.cjs +1 -1
  23. package/build/index.d.ts +2 -1
  24. package/build/index.d.ts.map +1 -1
  25. package/build/index.js +403 -370
  26. package/build/lib/types/engine/backend/Backend.interface.d.ts +20 -4
  27. package/build/lib/types/engine/backend/Backend.interface.d.ts.map +1 -1
  28. package/build/lib/types/engine/backend/index.d.ts +2 -1
  29. package/build/lib/types/engine/backend/index.d.ts.map +1 -1
  30. package/build/lib/types/engine/index.d.ts +2 -2
  31. package/build/lib/types/engine/index.d.ts.map +1 -1
  32. package/package.json +15 -17
  33. package/build/lib/types/engine/context/ContextValue.interface.d.ts +0 -16
  34. package/build/lib/types/engine/context/ContextValue.interface.d.ts.map +0 -1
  35. package/build/lib/types/engine/context/index.d.ts +0 -2
  36. package/build/lib/types/engine/context/index.d.ts.map +0 -1
  37. package/build/lib/types/index.d.ts +0 -3
  38. package/build/lib/types/index.d.ts.map +0 -1
  39. package/build/lib/util/immersive/fromWebXRSessionMode.d.ts +0 -7
  40. package/build/lib/util/immersive/fromWebXRSessionMode.d.ts.map +0 -1
  41. package/build/lib/util/immersive/index.d.ts +0 -4
  42. package/build/lib/util/immersive/index.d.ts.map +0 -1
  43. package/build/lib/util/immersive/isImmersiveModeSupported.d.ts +0 -7
  44. package/build/lib/util/immersive/isImmersiveModeSupported.d.ts.map +0 -1
  45. package/build/lib/util/immersive/toWebXRSessionMode.d.ts +0 -7
  46. package/build/lib/util/immersive/toWebXRSessionMode.d.ts.map +0 -1
@@ -1,19 +1,11 @@
1
1
  import { XRStore as ReactThreeXRStore } from '@react-three/xr';
2
- import { Backend } from 'lib/types/engine';
2
+ import { Backend, BackendType } from 'lib/types/engine';
3
3
  import { Camera, Scene, WebGLRenderer } from 'three';
4
- export declare const SESSION_TYPES: {
5
- readonly FIDUCIAL: "FiducialSession";
6
- readonly GEOLOCATION: "GeolocationSession";
7
- readonly IMMERSIVE: "ImmersiveSession";
8
- };
9
- export type XRSessionType = (typeof SESSION_TYPES)[keyof typeof SESSION_TYPES];
10
4
  interface BaseXRStoreState {
11
5
  /** Shared video element. */
12
6
  video?: HTMLVideoElement | null;
13
7
  /** Active backends registered by sessions. */
14
- backends: Backend[];
15
- /** Active session types for compatibility checking. */
16
- sessionTypes: Set<XRSessionType>;
8
+ backends: Map<BackendType, Backend>;
17
9
  /** Store instance for immersive sessions. */
18
10
  immersiveStore?: ReactThreeXRStore | null;
19
11
  }
@@ -23,9 +15,9 @@ interface BaseXRStoreActions {
23
15
  scene: Scene;
24
16
  camera: Camera;
25
17
  renderer: WebGLRenderer;
26
- }, sessionType?: XRSessionType) => Promise<void>;
18
+ }) => Promise<void>;
27
19
  /** Unregister a backend (called by sessions). */
28
- unregisterBackend: (backend: Backend, sessionType?: XRSessionType) => void;
20
+ unregisterBackend: (backend: Backend) => void;
29
21
  /** Set shared video element. */
30
22
  setVideo: (video: HTMLVideoElement | null) => void;
31
23
  /** Update all registered backends (called per frame). */
@@ -1 +1 @@
1
- {"version":3,"file":"useXRStore.d.ts","sourceRoot":"","sources":["../../src/engine/useXRStore.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE1D,eAAO,MAAM,aAAa;;;;CAIhB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAE/E,UAAU,gBAAgB;IACxB,4BAA4B;IAC5B,KAAK,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAChC,8CAA8C;IAC9C,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,uDAAuD;IACvD,YAAY,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC;IACjC,6CAA6C;IAC7C,cAAc,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAC;CAC3C;AAED,UAAU,kBAAkB;IAC1B,+CAA+C;IAC/C,eAAe,EAAE,CACf,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE;QAAE,KAAK,EAAE,KAAK,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,aAAa,CAAA;KAAE,EACpE,WAAW,CAAC,EAAE,aAAa,KACxB,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,iDAAiD;IACjD,iBAAiB,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE,aAAa,KAAK,IAAI,CAAC;IAC3E,gCAAgC;IAChC,QAAQ,EAAE,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,KAAK,IAAI,CAAC;IACnD,yDAAyD;IACzD,cAAc,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,oCAAoC;IACpC,iBAAiB,EAAE,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,KAAK,IAAI,CAAC;CAC9D;AAED,KAAK,WAAW,GAAG,gBAAgB,GAAG,kBAAkB,CAAC;AAEzD,MAAM,MAAM,OAAO,GAAG,WAAW,GAAG;IAClC,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,iBAAiB,GAAG,IAAI,CAAC;CACrC,CAAC;AA+FF,eAAO,MAAM,UAAU,mBAAkC,CAAC;AAC1D,eAAO,MAAM,kBAAkB;;;;;;CAA2B,CAAC;AAE3D;;GAEG;AACH,QAAA,MAAM,UAAU,GAAI,CAAC,GAAG,OAAO,EAAE,WAAW,CAAC,KAAK,EAAE,OAAO,KAAK,CAAC,KAc5C,CACpB,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"useXRStore.d.ts","sourceRoot":"","sources":["../../src/engine/useXRStore.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE1D,UAAU,gBAAgB;IACxB,4BAA4B;IAC5B,KAAK,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAChC,8CAA8C;IAC9C,QAAQ,EAAE,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IACpC,6CAA6C;IAC7C,cAAc,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAC;CAC3C;AAED,UAAU,kBAAkB;IAC1B,+CAA+C;IAC/C,eAAe,EAAE,CACf,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE;QAAE,KAAK,EAAE,KAAK,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,aAAa,CAAA;KAAE,KACjE,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,iDAAiD;IACjD,iBAAiB,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC9C,gCAAgC;IAChC,QAAQ,EAAE,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,KAAK,IAAI,CAAC;IACnD,yDAAyD;IACzD,cAAc,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,oCAAoC;IACpC,iBAAiB,EAAE,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,KAAK,IAAI,CAAC;CAC9D;AAED,KAAK,WAAW,GAAG,gBAAgB,GAAG,kBAAkB,CAAC;AAEzD,MAAM,MAAM,OAAO,GAAG,WAAW,GAAG;IAClC,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,iBAAiB,GAAG,IAAI,CAAC;CACrC,CAAC;AA0FF,eAAO,MAAM,UAAU,mBAAkC,CAAC;AAC1D,eAAO,MAAM,kBAAkB;;;;;;CAA2B,CAAC;AAE3D;;GAEG;AACH,QAAA,MAAM,UAAU,GAAI,CAAC,GAAG,OAAO,EAAE,WAAW,CAAC,KAAK,EAAE,OAAO,KAAK,CAAC,KAc5C,CACpB,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"FiducialAnchor.d.ts","sourceRoot":"","sources":["../../src/fiducial/FiducialAnchor.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG/C,MAAM,WAAW,mBAAoB,SAAQ,iBAAiB;IAC5D,mBAAmB;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qBAAqB;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,6BAA6B;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,+CAA+C;IAC/C,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,8CAA8C;IAC9C,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED;;GAEG;AACH,QAAA,MAAM,cAAc,GAAI,8EAOrB,mBAAmB,4CA+HrB,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"FiducialAnchor.d.ts","sourceRoot":"","sources":["../../src/fiducial/FiducialAnchor.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG/C,MAAM,WAAW,mBAAoB,SAAQ,iBAAiB;IAC5D,mBAAmB;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qBAAqB;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,6BAA6B;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,+CAA+C;IAC/C,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,8CAA8C;IAC9C,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED;;GAEG;AACH,QAAA,MAAM,cAAc,GAAI,8EAOrB,mBAAmB,4CA4HrB,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -8,9 +8,6 @@ export interface FiducialSessionProps extends PropsWithChildren {
8
8
  * Manage the fiducial marker detection backend.
9
9
  * Registers with the XR session provider and provides AR.js marker tracking capabilities.
10
10
  */
11
- declare const FiducialSession: {
12
- ({ options, children }: FiducialSessionProps): import('react').ReactNode;
13
- sessionType: string;
14
- };
11
+ declare const FiducialSession: ({ options, children }: FiducialSessionProps) => import('react').ReactNode;
15
12
  export default FiducialSession;
16
13
  //# sourceMappingURL=FiducialSession.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FiducialSession.d.ts","sourceRoot":"","sources":["../../src/fiducial/FiducialSession.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAEhE,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;IAC7D,gCAAgC;IAChC,OAAO,CAAC,EAAE,sBAAsB,CAAC;CAClC;AAED;;;GAGG;AACH,QAAA,MAAM,eAAe;4BAAgC,oBAAoB;;CAgDxE,CAAC;AAKF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"FiducialSession.d.ts","sourceRoot":"","sources":["../../src/fiducial/FiducialSession.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAEhE,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;IAC7D,gCAAgC;IAChC,OAAO,CAAC,EAAE,sBAAsB,CAAC;CAClC;AAED;;;GAGG;AACH,QAAA,MAAM,eAAe,GAAI,uBAA4B,oBAAoB,8BA4CxE,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -1,4 +1,21 @@
1
+ import { ArToolkitContext, ArToolkitSource } from '@ar-js-org/ar.js/three.js/build/ar-threex';
1
2
  import { Backend } from 'lib/types/engine';
3
+ /**
4
+ * Internal state exposed by the fiducial backend.
5
+ */
6
+ export interface FiducialInternal {
7
+ arSource: ArToolkitSource | null;
8
+ arContext: ArToolkitContext | null;
9
+ }
10
+ /**
11
+ * State returned by fiducial backend hook.
12
+ */
13
+ export interface FiducialBackendState extends FiducialInternal {
14
+ /** Whether the backend is still initializing (not yet ready). */
15
+ isPending: boolean;
16
+ /** Whether the backend is initialized and ready to use. */
17
+ isSuccess: boolean;
18
+ }
2
19
  export interface FiducialSessionOptions {
3
20
  /** Input source type. */
4
21
  sourceType?: "webcam" | "image" | "video";
@@ -14,6 +31,6 @@ export interface FiducialSessionOptions {
14
31
  /**
15
32
  * Create a fiducial marker-based AR backend.
16
33
  */
17
- declare const createFiducialBackend: (options?: FiducialSessionOptions) => Backend;
34
+ declare const createFiducialBackend: (options?: FiducialSessionOptions) => Backend<FiducialInternal>;
18
35
  export default createFiducialBackend;
19
36
  //# sourceMappingURL=fiducialBackend.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fiducialBackend.d.ts","sourceRoot":"","sources":["../../src/fiducial/fiducialBackend.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAmB,MAAM,kBAAkB,CAAC;AAGjE,MAAM,WAAW,sBAAsB;IACrC,yBAAyB;IACzB,UAAU,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC;IAC1C,6BAA6B;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,sBAAsB;IACtB,aAAa,CAAC,EAAE,OAAO,GAAG,kBAAkB,GAAG,MAAM,GAAG,iBAAiB,CAAC;IAC1E,qBAAqB;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wBAAwB;IACxB,cAAc,CAAC,EACX,KAAK,GACL,eAAe,GACf,cAAc,GACd,KAAK,GACL,gBAAgB,GAChB,gBAAgB,CAAC;CACtB;AAED;;GAEG;AACH,QAAA,MAAM,qBAAqB,GAAI,UAAU,sBAAsB,KAAG,OAuIjE,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
1
+ {"version":3,"file":"fiducialBackend.d.ts","sourceRoot":"","sources":["../../src/fiducial/fiducialBackend.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,eAAe,EAChB,MAAM,2CAA2C,CAAC;AAInD,OAAO,KAAK,EAAE,OAAO,EAAmB,MAAM,kBAAkB,CAAC;AAGjE;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,eAAe,GAAG,IAAI,CAAC;IACjC,SAAS,EAAE,gBAAgB,GAAG,IAAI,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB;IAC5D,iEAAiE;IACjE,SAAS,EAAE,OAAO,CAAC;IACnB,2DAA2D;IAC3D,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,sBAAsB;IACrC,yBAAyB;IACzB,UAAU,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC;IAC1C,6BAA6B;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,sBAAsB;IACtB,aAAa,CAAC,EAAE,OAAO,GAAG,kBAAkB,GAAG,MAAM,GAAG,iBAAiB,CAAC;IAC1E,qBAAqB;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wBAAwB;IACxB,cAAc,CAAC,EACX,KAAK,GACL,eAAe,GACf,cAAc,GACd,KAAK,GACL,gBAAgB,GAChB,gBAAgB,CAAC;CACtB;AAED;;GAEG;AACH,QAAA,MAAM,qBAAqB,GACzB,UAAU,sBAAsB,KAC/B,OAAO,CAAC,gBAAgB,CA+I1B,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
@@ -1,7 +1,8 @@
1
1
  export { default as FiducialAnchor } from './FiducialAnchor';
2
2
  export { default as FiducialSession } from './FiducialSession';
3
3
  export { default as createFiducialBackend } from './fiducialBackend';
4
+ export { default as useFiducialBackend } from './useFiducialBackend';
4
5
  export type { FiducialAnchorProps } from './FiducialAnchor';
5
6
  export type { FiducialSessionProps } from './FiducialSession';
6
- export type { FiducialSessionOptions } from './fiducialBackend';
7
+ export type { FiducialBackendState, FiducialInternal, FiducialSessionOptions, } from './fiducialBackend';
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fiducial/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAErE,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,YAAY,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fiducial/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAErE,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,YAAY,EACV,oBAAoB,EACpB,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { FiducialBackendState } from './fiducialBackend';
2
+ /**
3
+ * Access the fiducial backend internals.
4
+ * @returns fiducial backend state. `isSuccess` can be checked to verify readiness.
5
+ *
6
+ * @example
7
+ * ```tsx
8
+ * const { arContext, isSuccess } = useFiducialBackend();
9
+ *
10
+ * if (isSuccess && arContext) {
11
+ * // use `arContext`
12
+ * }
13
+ * ```
14
+ */
15
+ declare const useFiducialBackend: () => FiducialBackendState;
16
+ export default useFiducialBackend;
17
+ //# sourceMappingURL=useFiducialBackend.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFiducialBackend.d.ts","sourceRoot":"","sources":["../../src/fiducial/useFiducialBackend.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAoB,MAAM,mBAAmB,CAAC;AAYhF;;;;;;;;;;;;GAYG;AACH,QAAA,MAAM,kBAAkB,QAAO,oBAc9B,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"GeolocationAnchor.d.ts","sourceRoot":"","sources":["../../src/geolocation/GeolocationAnchor.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,KAAK,EAEV,yBAAyB,EAE1B,MAAM,sBAAsB,CAAC;AAyB9B,MAAM,WAAW,sBACf,SAAQ,IAAI,CAAC,yBAAyB,EAAE,aAAa,CAAC,EACpD,iBAAiB;IACnB,wFAAwF;IACxF,QAAQ,EAAE,MAAM,CAAC;IACjB,yFAAyF;IACzF,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAED;;GAEG;AACH,QAAA,MAAM,iBAAiB,GAAI,2GAQxB,sBAAsB,gCAkMxB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"GeolocationAnchor.d.ts","sourceRoot":"","sources":["../../src/geolocation/GeolocationAnchor.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEtE,MAAM,WAAW,sBACf,SAAQ,IAAI,CAAC,yBAAyB,EAAE,aAAa,CAAC,EACpD,iBAAiB;IACnB,wFAAwF;IACxF,QAAQ,EAAE,MAAM,CAAC;IACjB,yFAAyF;IACzF,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAED;;GAEG;AACH,QAAA,MAAM,iBAAiB,GAAI,2GAQxB,sBAAsB,gCA4DxB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -8,9 +8,6 @@ export interface GeolocationSessionProps extends PropsWithChildren {
8
8
  * Manage the GPS-based AR backend.
9
9
  * Registers with the XR session provider and provides LocAR.js geolocation capabilities.
10
10
  */
11
- declare const GeolocationSession: {
12
- ({ options, children, }: GeolocationSessionProps): import('react').ReactNode;
13
- sessionType: string;
14
- };
11
+ declare const GeolocationSession: ({ options, children, }: GeolocationSessionProps) => import('react').ReactNode;
15
12
  export default GeolocationSession;
16
13
  //# sourceMappingURL=GeolocationSession.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GeolocationSession.d.ts","sourceRoot":"","sources":["../../src/geolocation/GeolocationSession.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEtE,MAAM,WAAW,uBAAwB,SAAQ,iBAAiB;IAChE,mCAAmC;IACnC,OAAO,CAAC,EAAE,yBAAyB,CAAC;CACrC;AAED;;;GAGG;AACH,QAAA,MAAM,kBAAkB;6BAGrB,uBAAuB;;CAgDzB,CAAC;AAKF,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"GeolocationSession.d.ts","sourceRoot":"","sources":["../../src/geolocation/GeolocationSession.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEtE,MAAM,WAAW,uBAAwB,SAAQ,iBAAiB;IAChE,mCAAmC;IACnC,OAAO,CAAC,EAAE,yBAAyB,CAAC;CACrC;AAED;;;GAGG;AACH,QAAA,MAAM,kBAAkB,GAAI,wBAGzB,uBAAuB,8BA4CzB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -1,22 +1,51 @@
1
1
  import { DeviceOrientationControls, LocationBased as LocAR, Webcam } from 'locar';
2
2
  import { Backend } from 'lib/types/engine';
3
- import { Camera, Scene } from 'three';
3
+ import { Camera, Group, Scene } from 'three';
4
4
  /**
5
- * Geolocation backend.
5
+ * GPS update event structure emitted by LocAR.
6
+ */
7
+ export interface GpsUpdateEvent {
8
+ position: GeolocationPosition;
9
+ distMoved: number;
10
+ }
11
+ /**
12
+ * Anchor registration for tracking in the geolocation backend.
6
13
  */
7
- export interface GeolocationBackend {
14
+ export interface AnchorEntry {
15
+ anchor: Group;
16
+ isAttached: boolean;
17
+ latitude: number;
18
+ longitude: number;
19
+ altitude: number;
20
+ onAttach?: () => void;
21
+ onGpsUpdate?: (position: GeolocationPosition, distMoved: number) => void;
22
+ }
23
+ /**
24
+ * Internal state exposed by the geolocation backend.
25
+ */
26
+ export interface GeolocationInternal {
8
27
  locar: LocAR | null;
9
28
  webcam: Webcam | null;
10
29
  deviceOrientation: DeviceOrientationControls | null;
11
30
  scene: Scene | null;
12
31
  camera: Camera | null;
32
+ /** Last known GPS position. */
33
+ lastPosition: GeolocationPosition | null;
34
+ /** Register an anchor with the backend. */
35
+ registerAnchor: (id: string, entry: AnchorEntry) => void;
36
+ /** Unregister an anchor from the backend. */
37
+ unregisterAnchor: (id: string) => void;
38
+ /** Get an anchor entry by ID. */
39
+ getAnchor: (id: string) => AnchorEntry | undefined;
13
40
  }
14
41
  /**
15
- * GPS update event structure emitted by LocAR.
42
+ * State returned by geolocation backend hook.
16
43
  */
17
- export interface GpsUpdateEvent {
18
- position: GeolocationPosition;
19
- distMoved: number;
44
+ export interface GeolocationBackendState extends GeolocationInternal {
45
+ /** Whether the backend is still initializing (not yet ready). */
46
+ isPending: boolean;
47
+ /** Whether the backend is initialized and ready to use. */
48
+ isSuccess: boolean;
20
49
  }
21
50
  /**
22
51
  * Options for the geolocation backend.
@@ -38,6 +67,6 @@ export interface GeolocationSessionOptions {
38
67
  /**
39
68
  * Create a location-based AR backend.
40
69
  */
41
- declare const createGeolocationBackend: (options?: GeolocationSessionOptions) => Backend;
70
+ declare const createGeolocationBackend: (options?: GeolocationSessionOptions) => Backend<GeolocationInternal>;
42
71
  export default createGeolocationBackend;
43
72
  //# sourceMappingURL=geolocationBackend.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"geolocationBackend.d.ts","sourceRoot":"","sources":["../../src/geolocation/geolocationBackend.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,aAAa,IAAI,KAAK,EACtB,MAAM,EACP,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,OAAO,EAAmB,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAiB,MAAM,OAAO,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,iBAAiB,EAAE,yBAAyB,GAAG,IAAI,CAAC;IACpD,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED;;GAEG;AAEH,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,2EAA2E;IAC3E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4EAA4E;IAC5E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iCAAiC;IACjC,iBAAiB,CAAC,EAAE,sBAAsB,CAAC;IAC3C;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,QAAQ,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9E;AAED;;GAEG;AACH,QAAA,MAAM,wBAAwB,GAC5B,UAAU,yBAAyB,KAClC,OA0IF,CAAC;AAEF,eAAe,wBAAwB,CAAC"}
1
+ {"version":3,"file":"geolocationBackend.d.ts","sourceRoot":"","sources":["../../src/geolocation/geolocationBackend.ts"],"names":[],"mappings":"AACA,OAAO,EACL,yBAAyB,EACzB,aAAa,IAAI,KAAK,EACtB,MAAM,EACP,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,OAAO,EAAmB,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAiB,MAAM,OAAO,CAAC;AAEjE;;GAEG;AAEH,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,KAAK,CAAC;IACd,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,WAAW,CAAC,EAAE,CAAC,QAAQ,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CAC1E;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,iBAAiB,EAAE,yBAAyB,GAAG,IAAI,CAAC;IACpD,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,+BAA+B;IAC/B,YAAY,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACzC,2CAA2C;IAC3C,cAAc,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IACzD,6CAA6C;IAC7C,gBAAgB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,iCAAiC;IACjC,SAAS,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,WAAW,GAAG,SAAS,CAAC;CACpD;AAED;;GAEG;AACH,MAAM,WAAW,uBAAwB,SAAQ,mBAAmB;IAClE,iEAAiE;IACjE,SAAS,EAAE,OAAO,CAAC;IACnB,2DAA2D;IAC3D,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,2EAA2E;IAC3E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4EAA4E;IAC5E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iCAAiC;IACjC,iBAAiB,CAAC,EAAE,sBAAsB,CAAC;IAC3C;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,QAAQ,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9E;AAED;;GAEG;AACH,QAAA,MAAM,wBAAwB,GAC5B,UAAU,yBAAyB,KAClC,OAAO,CAAC,mBAAmB,CA+N7B,CAAC;AAEF,eAAe,wBAAwB,CAAC"}
@@ -1,7 +1,8 @@
1
1
  export { default as GeolocationAnchor } from './GeolocationAnchor';
2
2
  export { default as GeolocationSession } from './GeolocationSession';
3
3
  export { default as createGeolocationBackend } from './geolocationBackend';
4
+ export { default as useGeolocationBackend } from './useGeolocationBackend';
4
5
  export type { GeolocationAnchorProps } from './GeolocationAnchor';
5
6
  export type { GeolocationSessionProps } from './GeolocationSession';
6
- export type { GeolocationSessionOptions } from './geolocationBackend';
7
+ export type { AnchorEntry, GeolocationBackendState, GeolocationInternal, GeolocationSessionOptions, GpsUpdateEvent, } from './geolocationBackend';
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/geolocation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAE3E,YAAY,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAClE,YAAY,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACpE,YAAY,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/geolocation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAE3E,YAAY,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAClE,YAAY,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACpE,YAAY,EACV,WAAW,EACX,uBAAuB,EACvB,mBAAmB,EACnB,yBAAyB,EACzB,cAAc,GACf,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { GeolocationBackendState } from './geolocationBackend';
2
+ /**
3
+ * Access the geolocation backend internals.
4
+ * @returns geolocation backend state. `isSuccess` can be checked to verify readiness.
5
+ *
6
+ * @example
7
+ * ```tsx
8
+ * const { locar, isSuccess } = useGeolocationBackend();
9
+ *
10
+ * if (isSuccess && locar) {
11
+ * const worldCoords = locar.lonLatToWorldCoords(lon, lat);
12
+ * }
13
+ * ```
14
+ */
15
+ declare const useGeolocationBackend: () => GeolocationBackendState;
16
+ export default useGeolocationBackend;
17
+ //# sourceMappingURL=useGeolocationBackend.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useGeolocationBackend.d.ts","sourceRoot":"","sources":["../../src/geolocation/useGeolocationBackend.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,uBAAuB,EAExB,MAAM,sBAAsB,CAAC;AAmB9B;;;;;;;;;;;;GAYG;AACH,QAAA,MAAM,qBAAqB,QAAO,uBAcjC,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ImmersiveSession.d.ts","sourceRoot":"","sources":["../../src/immersive/ImmersiveSession.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAI/C;;GAEG;AACH,QAAA,MAAM,gBAAgB,GAAI,cAAc,iBAAiB,4CAqBxD,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"ImmersiveSession.d.ts","sourceRoot":"","sources":["../../src/immersive/ImmersiveSession.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAc/C;;GAEG;AACH,QAAA,MAAM,gBAAgB,GAAI,cAAc,iBAAiB,4CAqBxD,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
package/build/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react"),k=require("@react-three/fiber"),L=require("react/jsx-runtime"),v=require("@ar-js-org/ar.js/three.js/build/ar-threex"),V=require("three"),M=require("locar"),B=require("@react-three/xr");var j=typeof document<"u"?document.currentScript:null;const P=t=>{let e;const n=new Set,r=(a,d)=>{const i=typeof a=="function"?a(e):a;if(!Object.is(i,e)){const A=e;e=d??(typeof i!="object"||i===null)?i:Object.assign({},e,i),n.forEach(S=>S(e,A))}},s=()=>e,c={setState:r,getState:s,getInitialState:()=>u,subscribe:a=>(n.add(a),()=>n.delete(a))},u=e=t(r,s,c);return c},Y=(t=>t?P(t):P),$=t=>t;function J(t,e=$){const n=m.useSyncExternalStore(t.subscribe,m.useCallback(()=>e(t.getState()),[t,e]),m.useCallback(()=>e(t.getInitialState()),[t,e]));return m.useDebugValue(n),n}const _=t=>{const e=Y(t),n=r=>J(e,r);return Object.assign(n,e),n},Z=(t=>_),ee=t=>(e,n,r)=>{const s=r.subscribe;return r.subscribe=((l,c,u)=>{let a=l;if(c){const d=u?.equalityFn||Object.is;let i=l(r.getState());a=A=>{const S=l(A);if(!d(i,S)){const f=i;c(i=S,f)}},u?.fireImmediately&&c(i,i)}return s(a)}),t(e,n,r)},te=ee,q=t=>Symbol.iterator in t,U=t=>"entries"in t,X=(t,e)=>{const n=t instanceof Map?t:new Map(t.entries()),r=e instanceof Map?e:new Map(e.entries());if(n.size!==r.size)return!1;for(const[s,o]of n)if(!r.has(s)||!Object.is(o,r.get(s)))return!1;return!0},ne=(t,e)=>{const n=t[Symbol.iterator](),r=e[Symbol.iterator]();let s=n.next(),o=r.next();for(;!s.done&&!o.done;){if(!Object.is(s.value,o.value))return!1;s=n.next(),o=r.next()}return!!s.done&&!!o.done};function re(t,e){return Object.is(t,e)?!0:typeof t!="object"||t===null||typeof e!="object"||e===null||Object.getPrototypeOf(t)!==Object.getPrototypeOf(e)?!1:q(t)&&q(e)?U(t)&&U(e)?X(t,e):ne(t,e):X({entries:()=>Object.entries(t)},{entries:()=>Object.entries(e)})}function oe(t){const e=m.useRef(void 0);return n=>{const r=t(n);return re(e.current,r)?e.current:e.current=r}}const b={FIDUCIAL:"FiducialSession",GEOLOCATION:"GeolocationSession",IMMERSIVE:"ImmersiveSession"},G=Z()(te((t,e)=>({video:null,backends:[],sessionTypes:new Set,immersiveStore:null,registerBackend:async(n,r,s)=>{try{if(s){const o=e(),l=new Set([...o.sessionTypes,s]),c=l.has(b.FIDUCIAL),u=l.has(b.GEOLOCATION);if(c&&u){const a=`❌ [RDK] INCOMPATIBLE SESSIONS: ${b.FIDUCIAL} and ${b.GEOLOCATION} cannot be used together due to camera/video conflicts between AR.js and LocAR.js libraries. Use only one session type per app.`;throw console.error(a),new Error(a)}t(()=>({sessionTypes:l}))}await n.init({scene:r.scene,camera:r.camera,renderer:r.renderer}),t(o=>({backends:[...o.backends,n]}))}catch(o){throw console.error("[XRStore] Failed to register backend:",o),o}},unregisterBackend:(n,r)=>{t(s=>{const o=new Set(s.sessionTypes);r&&o.delete(r);const l=s.backends.filter(c=>c!==n);try{n.dispose?.()}catch(c){console.error("[XRStore] Error disposing backend:",c)}return{backends:l,sessionTypes:o}})},setVideo:n=>{t({video:n})},updateBackends:n=>{const{backends:r}=e();r.forEach(s=>{try{s.update?.(n)}catch(o){console.error("[XRStore] Backend update error:",o)}})},setImmersiveStore:n=>{t({immersiveStore:n})}}))),N=()=>G.getState(),se=G.subscribe,E=t=>G(oe(n=>{const r={...n,isImmersive:n.sessionTypes.has(b.IMMERSIVE),immersive:n.immersiveStore||null};return t?t(r):r})),ie=({children:t})=>{const{updateBackends:e}=E();return k.useFrame((n,r)=>{e(r)}),t},ce=({patternUrl:t,barcodeValue:e,params:n,onMarkerFound:r,onMarkerLost:s,children:o})=>{const l=m.useRef(null),c=E(i=>i.backends),u=m.useRef(!1),a=m.useRef(!1),d=m.useRef(null);return m.useEffect(()=>{let i=!1;return(async()=>{try{const S=c.find(h=>h.getInternal?.()?.arContext);if(!S||i)return;const y=S.getInternal?.()?.arContext,w=l.current;if(!y||!w)return;if(w.visible=!1,a.current=!1,!y.arController){requestAnimationFrame(()=>{if(!l.current||i)return;const I=S.getInternal?.()?.arContext;if(!I?.arController)return;const g=new v.ArMarkerControls(I,l.current,{type:t?"pattern":e?"barcode":"unknown",patternUrl:t,barcodeValue:e,...n});d.current=g,a.current=!0});return}const C=new v.ArMarkerControls(y,w,{type:t?"pattern":e?"barcode":"unknown",patternUrl:t,barcodeValue:e,...n});d.current=C,a.current=!0}catch(S){console.error("Failed to initialize fiducial backend:",S)}})(),()=>{i=!0;const S=d.current;typeof S?.dispose=="function"&&S.dispose(),a.current=!1}},[c,t,e,n]),k.useFrame(()=>{const i=l.current;if(!i||!a.current){i&&(i.visible=!1);return}const A=i.visible;A&&!u.current?(u.current=!0,r?.()):!A&&u.current&&(u.current=!1,s?.())}),L.jsx("group",{ref:l,visible:!1,children:o})},D=({options:t={},children:e})=>{const{scene:n,camera:r,gl:s}=k.useThree(),{registerBackend:o,unregisterBackend:l}=E(),c=m.useRef(null),u=m.useRef(t);return u.current=t,m.useEffect(()=>{if(c.current)return;let a=!1;return(async()=>{try{const i=H(u.current);if(a)return;await o(i,{scene:n,camera:r,renderer:s},b.FIDUCIAL),c.current=i}catch(i){console.error("[FiducialSession] Failed to initialize:",i)}})(),()=>{a=!0,c.current&&(l(c.current,b.FIDUCIAL),c.current=null)}},[n,r,s,o,l]),e};D.sessionType="FiducialSession";const H=t=>{let e=null,n=null,r=null,s;return{async init({camera:o,renderer:l}){e=new v.ArToolkitSource({sourceType:t?.sourceType??"webcam"}),await new Promise((a,d)=>{const i=setTimeout(()=>{d(new Error("AR source initialization timeout"))},1e4);e.init(()=>{clearTimeout(i);const A=e.domElement;A&&(A.style.position="fixed",A.style.top="0",A.style.left="0",A.style.width="100vw",A.style.height="100vh",A.style.objectFit="cover",A.style.zIndex="-1",A.style.pointerEvents="none"),a()})});const c={cameraParametersUrl:t?.cameraParametersUrl??new URL("data:application/octet-stream;base64,AAACgAAAAeBAgwrsW6bUSwAAAAAAAAAAQHQ3KqAAAAAAAAAAAAAAAAAAAAAAAAAAQIL0K3dHyf9AbbNowAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/wAAAAAAAAAAAAAAAAAAA/uWNa4AAAAL+3lTLAAAAAv17YFWAAAAA/VYLXIAAAAECCe0YgAAAAQIJlMOAAAABAdDcqoAAAAEBts2jAAAAAP+8OmzqkDy4=",typeof document>"u"?require("url").pathToFileURL(__filename).href:j&&j.tagName.toUpperCase()==="SCRIPT"&&j.src||new URL("index.cjs",document.baseURI).href).toString(),detectionMode:t?.detectionMode??"mono",patternRatio:t?.patternRatio??.5,matrixCodeType:t?.matrixCodeType??"3x3"};n=new v.ArToolkitContext(c),r=o;const u=()=>{e.onResizeElement();const a=window.innerWidth,d=window.innerHeight;l.setSize(a,d,!1),e.copyElementSizeTo(l.domElement),n?.arController&&e.copyElementSizeTo(n.arController.canvas)};await new Promise((a,d)=>{const i=setTimeout(()=>{d(new Error("AR context initialization timeout"))},1e4);n.init(()=>{clearTimeout(i);try{o.projectionMatrix.copy(n.getProjectionMatrix()),u(),a()}catch(A){d(A)}})}),window.addEventListener("resize",u),s=u},update(){if(!(!e||!n)&&!(!e.ready||!e.domElement))try{n.update(e.domElement),r&&n.getProjectionMatrix&&r.projectionMatrix.copy(n.getProjectionMatrix())}catch(o){console.warn("AR.js update error:",o)}},dispose(){if(s&&(window.removeEventListener("resize",s),s=void 0),n&&typeof n.dispose=="function"&&n.dispose(),e?.domElement){const o=e.domElement.parentNode;o&&o.removeChild(e.domElement)}e=null,n=null,r=null},getInternal(){return{arSource:e,arContext:n}}}},R=new Map;let z=!1,x=null,O=null;const ae=({latitude:t,longitude:e,altitude:n=0,isBillboard:r=!0,onAttach:s,onGpsUpdate:o,children:l})=>{const c=E(f=>f.backends),{camera:u}=k.useThree(),[a]=m.useState(()=>new V.Group),[d]=m.useState(()=>Math.random().toString(36).slice(2,11)),i=m.useRef(!1),A=m.useCallback(()=>{s?.()},[s]),S=m.useCallback((f,y)=>{o?.(f,y)},[o]);return m.useEffect(()=>{let f=!1;return(async()=>{try{const w=c.find(p=>p.getInternal?.()?.locar);if(!w||f)return;const h=w.getInternal?.()?.locar;if(!h)return;const I=p=>{try{h.add(p.anchor,p.longitude,p.latitude,p.altitude),p.isAttached=!0,p.onAttach?.()}catch(T){console.error("❌ Failed to attach anchor:",T)}},g={anchor:a,isAttached:!1,latitude:t,longitude:e,altitude:n||0,onAttach:A,onGpsUpdate:S};if(R.set(d,g),!z){O=({position:T,distMoved:Q})=>{x=T,R.forEach(F=>{F.isAttached||I(F),F.onGpsUpdate?.(T,Q)})};const p=h.getLastKnownLocation();p!==null&&(x={coords:{longitude:p.longitude,latitude:p.latitude,accuracy:0,altitude:null,altitudeAccuracy:null,heading:null,speed:null,toJSON:()=>p},timestamp:Date.now(),toJSON:()=>p}),x!==null&&!g.isAttached&&I(g),h.on?.("gpsupdate",O),z=!0}x!==null&&(g.isAttached||I(g),g.onGpsUpdate?.(x,0)),i.current=!1}catch(w){console.error("Failed to initialize geolocation backend:",w)}})(),()=>{if(f=!0,R.get(d)?.isAttached)try{a.removeFromParent()}catch(C){console.error(`⚠️ Error removing anchor ${d}:`,C)}R.delete(d),R.size===0&&O&&(c.find(g=>g.getInternal?.()?.locar)?.getInternal?.()?.locar?.off?.("gpsupdate",O),O=null,z=!1)}},[c,a,d,t,e,n,A,S]),k.useFrame(()=>{!r||!u||!R.get(d)?.isAttached||a.lookAt(u.position)}),k.createPortal(L.jsx("group",{children:l}),a)},W=({options:t={},children:e})=>{const{scene:n,camera:r,gl:s}=k.useThree(),{registerBackend:o,unregisterBackend:l}=E(),c=m.useRef(null),u=m.useRef(t);return u.current=t,m.useEffect(()=>{if(c.current)return;let a=!1;return(async()=>{try{const i=K(u.current);if(a)return;await o(i,{scene:n,camera:r,renderer:s},b.GEOLOCATION),c.current=i}catch(i){console.error("[GeolocationSession] Failed to initialize:",i)}})(),()=>{a=!0,c.current&&(l(c.current,b.GEOLOCATION),c.current=null)}},[n,r,s,o,l]),e};W.sessionType="GeolocationSession";const K=t=>{let e=null,n=null,r=null,s,o=null,l=null,c=null,u=null;return{async init(a){const{camera:d,renderer:i,scene:A}=a;if(!A)throw new Error("[geolocationBackend] A THREE.Scene is required for location-based AR");l=d,c=i,u=A,e=new M.LocationBased(A,d),n=new M.Webcam(t?.webcamConstraints??{video:{facingMode:"environment"}}),o=f=>{t?.onGpsUpdate?.(f.position,f.distMoved)},e.on("gpsupdate",o),n.on("webcamstarted",f=>{A.background=f.texture}),n.on("webcamerror",f=>{console.error("[geolocationBackend] webcam error:",f)}),r=new M.DeviceOrientationControls(d),r.on("deviceorientationgranted",f=>{f.target?.connect?.()}),r.on("deviceorientationerror",f=>{console.error("[geolocationBackend] Device orientation error:",f)}),r.init?.(),e.on("gpserror",f=>{console.error("[geolocationBackend] gps error:",f)}),e.startGps(),typeof t?.fakeLat=="number"&&typeof t?.fakeLon=="number"&&e.fakeGps(t.fakeLon,t.fakeLat);const S=()=>{if(!c||!l)return;const f=window.innerWidth,y=window.innerHeight;c.setSize(f,y,!1),l.aspect=f/y,l.updateProjectionMatrix?.()};S(),window.addEventListener("resize",S),s=S},update(){r?.update?.()},dispose(){e&&o&&e.off("gpsupdate",o),e?.stopGps?.(),n?.stop?.(),r?.dispose?.(),s&&(window.removeEventListener("resize",s),s=void 0),e=null,n=null,r=null,l=null,c=null,u=null,o=null},getInternal:()=>({locar:e,webcam:n,deviceOrientation:r,scene:u,camera:l})}},le=({children:t})=>{const e=m.useMemo(()=>B.createXRStore(),[]);return m.useEffect(()=>{const n=N();return n.sessionTypes.add(b.IMMERSIVE),n.setImmersiveStore(e),()=>{n.sessionTypes.delete(b.IMMERSIVE),n.setImmersiveStore(null)}},[e]),L.jsx(B.XR,{store:e,children:t})};exports.FiducialAnchor=ce;exports.FiducialSession=D;exports.GeolocationAnchor=ae;exports.GeolocationSession=W;exports.ImmersiveSession=le;exports.XR=ie;exports.createFiducialBackend=H;exports.createGeolocationBackend=K;exports.getXRStore=N;exports.subscribeToXRStore=se;exports.useXRStore=E;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react"),h=require("@react-three/fiber"),v=require("react/jsx-runtime"),I=require("@ar-js-org/ar.js/three.js/build/ar-threex"),N=require("three"),R=require("locar"),x=require("@react-three/xr");var C=typeof document<"u"?document.currentScript:null;const p={FIDUCIAL:"fiducial",GEOLOCATION:"geolocation",IMMERSIVE:"immersive"},M=n=>{let e;const t=new Set,r=(a,f)=>{const l=typeof a=="function"?a(e):a;if(!Object.is(l,e)){const o=e;e=f??(typeof l!="object"||l===null)?l:Object.assign({},e,l),t.forEach(d=>d(e,o))}},c=()=>e,s={setState:r,getState:c,getInitialState:()=>u,subscribe:a=>(t.add(a),()=>t.delete(a))},u=e=n(r,c,s);return s},D=(n=>n?M(n):M),U=n=>n;function q(n,e=U){const t=m.useSyncExternalStore(n.subscribe,m.useCallback(()=>e(n.getState()),[n,e]),m.useCallback(()=>e(n.getInitialState()),[n,e]));return m.useDebugValue(t),t}const X=n=>{const e=D(n),t=r=>q(e,r);return Object.assign(t,e),t},H=(n=>X),W=n=>(e,t,r)=>{const c=r.subscribe;return r.subscribe=((A,s,u)=>{let a=A;if(s){const f=u?.equalityFn||Object.is;let l=A(r.getState());a=o=>{const d=A(o);if(!f(l,d)){const b=l;s(l=d,b)}},u?.fireImmediately&&s(l,l)}return c(a)}),n(e,t,r)},_=W,T=n=>Symbol.iterator in n,F=n=>"entries"in n,j=(n,e)=>{const t=n instanceof Map?n:new Map(n.entries()),r=e instanceof Map?e:new Map(e.entries());if(t.size!==r.size)return!1;for(const[c,i]of t)if(!r.has(c)||!Object.is(i,r.get(c)))return!1;return!0},K=(n,e)=>{const t=n[Symbol.iterator](),r=e[Symbol.iterator]();let c=t.next(),i=r.next();for(;!c.done&&!i.done;){if(!Object.is(c.value,i.value))return!1;c=t.next(),i=r.next()}return!!c.done&&!!i.done};function V(n,e){return Object.is(n,e)?!0:typeof n!="object"||n===null||typeof e!="object"||e===null||Object.getPrototypeOf(n)!==Object.getPrototypeOf(e)?!1:T(n)&&T(e)?F(n)&&F(e)?j(n,e):K(n,e):j({entries:()=>Object.entries(n)},{entries:()=>Object.entries(e)})}function Y(n){const e=m.useRef(void 0);return t=>{const r=n(t);return V(e.current,r)?e.current:e.current=r}}const O=H()(_((n,e)=>({video:null,backends:new Map,immersiveStore:null,registerBackend:async(t,r)=>{try{const c=e(),i=new Set(c.backends.keys()),A=i.has(p.FIDUCIAL)||t.type===p.FIDUCIAL,s=i.has(p.GEOLOCATION)||t.type===p.GEOLOCATION;if(A&&s){const u="❌ [RDK] INCOMPATIBLE SESSIONS: fiducial and geolocation backends cannot be used together due to camera/video conflicts between AR.js and LocAR.js libraries. Use only one session type per app.";throw console.error(u),new Error(u)}await t.init({scene:r.scene,camera:r.camera,renderer:r.renderer}),n(u=>{const a=new Map(u.backends);return a.set(t.type,t),{backends:a}})}catch(c){throw console.error("[XRStore] Failed to register backend:",c),c}},unregisterBackend:t=>{n(r=>{const c=new Map(r.backends);c.delete(t.type);try{t.dispose?.()}catch(i){console.error("[XRStore] Error disposing backend:",i)}return{backends:c}})},setVideo:t=>{n({video:t})},updateBackends:t=>{const{backends:r}=e();for(const c of r.values())try{c.update?.(t)}catch(i){console.error("[XRStore] Backend update error:",i)}},setImmersiveStore:t=>{n({immersiveStore:t})}}))),L=()=>O.getState(),Q=O.subscribe,k=n=>O(Y(t=>{const r={...t,isImmersive:t.backends.has(p.IMMERSIVE),immersive:t.immersiveStore||null};return n?n(r):r})),J=({children:n})=>{const{updateBackends:e}=k();return h.useFrame((t,r)=>{e(r)}),n},$={isPending:!0,isSuccess:!1,arSource:null,arContext:null},B=()=>{const e=k(t=>t.backends).get(p.FIDUCIAL);return e?{...e.getInternal(),isPending:!1,isSuccess:!0}:$},Z=({patternUrl:n,barcodeValue:e,params:t,onMarkerFound:r,onMarkerLost:c,children:i})=>{const A=m.useRef(null),s=B(),u=m.useRef(!1),a=m.useRef(!1),f=m.useRef(null);return m.useEffect(()=>{if(!s.isSuccess)return;let l=!1;return(()=>{try{const{arContext:d}=s,b=A.current;if(!d||!b||l)return;if(b.visible=!1,a.current=!1,!d.arController){requestAnimationFrame(()=>{if(!A.current||l||!s.arContext?.arController)return;const g=new I.ArMarkerControls(s.arContext,A.current,{type:n?"pattern":e?"barcode":"unknown",patternUrl:n,barcodeValue:e,...t});f.current=g,a.current=!0});return}const w=new I.ArMarkerControls(d,b,{type:n?"pattern":e?"barcode":"unknown",patternUrl:n,barcodeValue:e,...t});f.current=w,a.current=!0}catch(d){console.error("Failed to initialize fiducial anchor:",d)}})(),()=>{l=!0;const d=f.current;typeof d?.dispose=="function"&&d.dispose(),a.current=!1}},[s.isSuccess,s.arContext,n,e,t,s]),h.useFrame(()=>{const l=A.current;if(!l||!a.current){l&&(l.visible=!1);return}const o=l.visible;o&&!u.current?(u.current=!0,r?.()):!o&&u.current&&(u.current=!1,c?.())}),v.jsx("group",{ref:A,visible:!1,children:i})},ee=({options:n={},children:e})=>{const{scene:t,camera:r,gl:c}=h.useThree(),{registerBackend:i,unregisterBackend:A}=k(),s=m.useRef(null),u=m.useRef(n);return u.current=n,m.useEffect(()=>{if(s.current)return;let a=!1;return(async()=>{try{const l=G(u.current);if(a)return;await i(l,{scene:t,camera:r,renderer:c}),s.current=l}catch(l){console.error("[FiducialSession] Failed to initialize:",l)}})(),()=>{a=!0,s.current&&(A(s.current),s.current=null)}},[t,r,c,i,A]),e},G=n=>{let e=null,t=null,r=null,c;return{type:p.FIDUCIAL,async init({camera:i,renderer:A}){e=new I.ArToolkitSource({sourceType:n?.sourceType??"webcam"}),await new Promise((a,f)=>{const l=setTimeout(()=>{f(new Error("AR source initialization timeout"))},1e4);e?.init(()=>{clearTimeout(l);const o=e?.domElement;o&&(o.style.position="fixed",o.style.top="0",o.style.left="0",o.style.width="100vw",o.style.height="100vh",o.style.objectFit="cover",o.style.zIndex="-1",o.style.pointerEvents="none"),a()})});const s={cameraParametersUrl:n?.cameraParametersUrl??new URL("data:application/octet-stream;base64,AAACgAAAAeBAgwrsW6bUSwAAAAAAAAAAQHQ3KqAAAAAAAAAAAAAAAAAAAAAAAAAAQIL0K3dHyf9AbbNowAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/wAAAAAAAAAAAAAAAAAAA/uWNa4AAAAL+3lTLAAAAAv17YFWAAAAA/VYLXIAAAAECCe0YgAAAAQIJlMOAAAABAdDcqoAAAAEBts2jAAAAAP+8OmzqkDy4=",typeof document>"u"?require("url").pathToFileURL(__filename).href:C&&C.tagName.toUpperCase()==="SCRIPT"&&C.src||new URL("index.cjs",document.baseURI).href).toString(),detectionMode:n?.detectionMode??"mono",patternRatio:n?.patternRatio??.5,matrixCodeType:n?.matrixCodeType??"3x3"};t=new I.ArToolkitContext(s),r=i;const u=()=>{e?.onResizeElement();const a=window.innerWidth,f=window.innerHeight;A.setSize(a,f,!1),e?.copyElementSizeTo(A.domElement),t?.arController&&e?.copyElementSizeTo(t.arController.canvas)};await new Promise((a,f)=>{const l=setTimeout(()=>{f(new Error("AR context initialization timeout"))},1e4);t?.init(()=>{clearTimeout(l);try{const o=t?.getProjectionMatrix();o&&i.projectionMatrix.copy(o),u(),a()}catch(o){f(o)}})}),window.addEventListener("resize",u),c=u},update(){if(!(!e||!t)&&!(!e.ready||!e.domElement))try{t.update(e.domElement);const i=t.getProjectionMatrix?.();r&&i&&r.projectionMatrix.copy(i)}catch(i){console.warn("AR.js update error:",i)}},dispose(){if(c&&(window.removeEventListener("resize",c),c=void 0),t&&typeof t.dispose=="function"&&t.dispose(),e?.domElement){const i=e.domElement.parentNode;i&&i.removeChild(e.domElement)}e=null,t=null,r=null},getInternal:()=>({arSource:e,arContext:t})}},te={isPending:!0,isSuccess:!1,locar:null,webcam:null,deviceOrientation:null,scene:null,camera:null,lastPosition:null,registerAnchor:()=>{},unregisterAnchor:()=>{},getAnchor:()=>{}},P=()=>{const e=k(t=>t.backends).get(p.GEOLOCATION);return e?{...e.getInternal(),isPending:!1,isSuccess:!0}:te},ne=({latitude:n,longitude:e,altitude:t=0,isBillboard:r=!0,onAttach:c,onGpsUpdate:i,children:A})=>{const s=P(),{camera:u}=h.useThree(),[a]=m.useState(()=>new N.Group),f=m.useMemo(()=>Math.random().toString(36).slice(2,11),[]),l=m.useCallback(()=>{c?.()},[c]),o=m.useCallback((d,b)=>{i?.(d,b)},[i]);return m.useEffect(()=>{if(s.isSuccess)return s.registerAnchor(f,{anchor:a,isAttached:!1,latitude:n,longitude:e,altitude:t,onAttach:l,onGpsUpdate:o}),()=>{s.unregisterAnchor(f)}},[s.isSuccess,s.registerAnchor,s.unregisterAnchor,a,f,n,e,t,l,o]),h.useFrame(()=>{!r||!u||!s.isSuccess||!s.getAnchor(f)?.isAttached||a.lookAt(u.position)}),h.createPortal(v.jsx("group",{children:A}),a)},re=({options:n={},children:e})=>{const{scene:t,camera:r,gl:c}=h.useThree(),{registerBackend:i,unregisterBackend:A}=k(),s=m.useRef(null),u=m.useRef(n);return u.current=n,m.useEffect(()=>{if(s.current)return;let a=!1;return(async()=>{try{const l=z(u.current);if(a)return;await i(l,{scene:t,camera:r,renderer:c}),s.current=l}catch(l){console.error("[GeolocationSession] Failed to initialize:",l)}})(),()=>{a=!0,s.current&&(A(s.current),s.current=null)}},[t,r,c,i,A]),e},z=n=>{let e=null,t=null,r=null,c,i=null,A=null,s=null,u=null;const a=new Map;let f=null;const l=o=>{if(!(!e||o.isAttached))try{e.add(o.anchor,o.longitude,o.latitude,o.altitude),o.isAttached=!0,o.onAttach?.()}catch(d){console.error("❌ Failed to attach anchor:",d)}};return{type:p.GEOLOCATION,async init(o){const{camera:d,renderer:b,scene:w}=o;if(!w)throw new Error("[geolocationBackend] A THREE.Scene is required for location-based AR");A=d,s=b,u=w,e=new R.LocationBased(w,d),t=new R.Webcam(n?.webcamConstraints??{video:{facingMode:"environment"}}),i=S=>{f=S.position;for(const y of a.values())y.isAttached||l(y),y.onGpsUpdate?.(S.position,S.distMoved);n?.onGpsUpdate?.(S.position,S.distMoved)},e.on("gpsupdate",i),t.on("webcamstarted",S=>{w.background=S.texture}),t.on("webcamerror",S=>{console.error("[geolocationBackend] webcam error:",S)}),r=new R.DeviceOrientationControls(d),r.on("deviceorientationgranted",S=>{S.target?.connect?.()}),r.on("deviceorientationerror",S=>{console.error("[geolocationBackend] Device orientation error:",S)}),r.init?.(),e.on("gpserror",S=>{console.error("[geolocationBackend] gps error:",S)}),e.startGps(),typeof n?.fakeLat=="number"&&typeof n?.fakeLon=="number"&&e.fakeGps(n.fakeLon,n.fakeLat);const g=e.getLastKnownLocation();g!==null&&(f={coords:{longitude:g.longitude,latitude:g.latitude,accuracy:0,altitude:null,altitudeAccuracy:null,heading:null,speed:null,toJSON:()=>g},timestamp:Date.now(),toJSON:()=>g});const E=()=>{if(!s||!A)return;const S=window.innerWidth,y=window.innerHeight;s.setSize(S,y,!1),A.aspect=S/y,A.updateProjectionMatrix?.()};E(),window.addEventListener("resize",E),c=E},update(){r?.update?.()},dispose(){e&&i&&e.off("gpsupdate",i),e?.stopGps?.(),t?.stop?.(),r?.dispose?.(),c&&(window.removeEventListener("resize",c),c=void 0);for(const o of a.values())if(o.isAttached)try{o.anchor.removeFromParent()}catch(d){console.error("⚠️ Error removing anchor:",d)}a.clear(),e=null,t=null,r=null,A=null,s=null,u=null,i=null,f=null},getInternal:()=>({locar:e,webcam:t,deviceOrientation:r,scene:u,camera:A,lastPosition:f,registerAnchor:(o,d)=>{a.set(o,d),f!==null&&!d.isAttached&&(l(d),d.onGpsUpdate?.(f,0))},unregisterAnchor:o=>{const d=a.get(o);if(d?.isAttached)try{d.anchor.removeFromParent()}catch(b){console.error(`⚠️ Error removing anchor ${o}:`,b)}a.delete(o)},getAnchor:o=>a.get(o)})}},oe=()=>({type:p.IMMERSIVE,init:()=>{},getInternal:()=>null}),se=({children:n})=>{const e=m.useMemo(()=>x.createXRStore(),[]);return m.useEffect(()=>{const t=L(),r=oe();return t.backends.set(p.IMMERSIVE,r),t.setImmersiveStore(e),()=>{t.backends.delete(p.IMMERSIVE),t.setImmersiveStore(null)}},[e]),v.jsx(x.XR,{store:e,children:n})};exports.BACKEND_TYPES=p;exports.FiducialAnchor=Z;exports.FiducialSession=ee;exports.GeolocationAnchor=ne;exports.GeolocationSession=re;exports.ImmersiveSession=se;exports.XR=J;exports.createFiducialBackend=G;exports.createGeolocationBackend=z;exports.getXRStore=L;exports.subscribeToXRStore=Q;exports.useFiducialBackend=B;exports.useGeolocationBackend=P;exports.useXRStore=k;
package/build/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export { getXRStore, subscribeToXRStore, } from './engine/useXRStore';
3
3
  export * from './fiducial';
4
4
  export * from './geolocation';
5
5
  export * from './immersive';
6
- export type { Backend, ContextValue, } from './lib/types/engine';
6
+ export { BACKEND_TYPES } from './lib/types/engine';
7
+ export type { Backend, BackendType, } from './lib/types/engine';
7
8
  export type { ImmersiveMode } from './lib/types/immersive';
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,OAAO,EACL,UAAU,EACV,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAE5B,YAAY,EACV,OAAO,EACP,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAG3D,OAAO,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,OAAO,EACL,UAAU,EACV,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,YAAY,EACV,OAAO,EACP,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAG3D,OAAO,oBAAoB,CAAC"}