@realsee/five 5.0.0-alpha.14 → 5.0.0-alpha.142

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 (221) hide show
  1. package/README.md +21 -11
  2. package/docs/.nojekyll +1 -0
  3. package/docs/assets/highlight.css +134 -0
  4. package/docs/assets/icons.css +1043 -0
  5. package/docs/assets/{images/icons.png → icons.png} +0 -0
  6. package/docs/assets/{images/icons@2x.png → icons@2x.png} +0 -0
  7. package/docs/assets/main.js +52 -0
  8. package/docs/assets/search.js +1 -0
  9. package/docs/assets/style.css +1413 -0
  10. package/docs/assets/{images/widgets.png → widgets.png} +0 -0
  11. package/docs/assets/{images/widgets@2x.png → widgets@2x.png} +0 -0
  12. package/docs/classes/five.AnimationFrameLoop.html +15 -0
  13. package/docs/classes/five.BVH.html +10 -0
  14. package/docs/classes/five.BVHIntersect.html +1 -0
  15. package/docs/classes/five.BVHNode.html +7 -0
  16. package/docs/classes/five.BVHVector3.html +1 -0
  17. package/docs/classes/five.Camera.html +11 -0
  18. package/docs/classes/five.Five.html +310 -0
  19. package/docs/classes/five.InternalWebGLRenderer.html +1 -0
  20. package/docs/classes/five.IntersectMesh.html +1 -0
  21. package/docs/classes/five.LegacyPanoCircleMesh.html +5 -0
  22. package/docs/classes/five.Model.html +87 -0
  23. package/docs/classes/five.NetworkSubscribe.html +50 -0
  24. package/docs/classes/five.PBMContainer.html +17 -0
  25. package/docs/classes/five.PBMGroup.html +19 -0
  26. package/docs/classes/five.PBMMaterial.html +19 -0
  27. package/docs/classes/five.PBMMesh.html +7 -0
  28. package/docs/classes/five.PanoCircleMesh.html +7 -0
  29. package/docs/classes/five.Scene.html +3 -0
  30. package/docs/classes/five.Subscribe.html +56 -0
  31. package/docs/classes/five.Tile3D.html +34 -0
  32. package/docs/classes/five.Tile3DModel.html +15 -0
  33. package/docs/classes/five.TileBoundingSphere.html +1 -0
  34. package/docs/classes/five.TileCacheNode.html +1 -0
  35. package/docs/classes/five.TileCullingVolume.html +1 -0
  36. package/docs/classes/five.TileOrientedBoundingBox.html +1 -0
  37. package/docs/classes/five.TilePlane.html +1 -0
  38. package/docs/classes/five.TileRequestScheduler.html +16 -0
  39. package/docs/classes/five.Tileset3D.html +11 -0
  40. package/docs/classes/five.Tileset3DTraverser.html +1 -0
  41. package/docs/classes/five.TilesetCache.html +1 -0
  42. package/docs/classes/five.Work.html +30 -0
  43. package/docs/classes/five.XRButton.html +1 -0
  44. package/docs/classes/gltf_loader.GLTFLoader.html +17 -0
  45. package/docs/classes/gltf_loader.GLTFObject.html +7 -0
  46. package/docs/classes/line.Line.html +1 -0
  47. package/docs/classes/line.LineGeometry.html +1 -0
  48. package/docs/classes/line.LineMaterial.html +1 -0
  49. package/docs/classes/line.LineSegmentsGeometry.html +1 -0
  50. package/docs/classes/line.THREE_Line2.html +1 -0
  51. package/docs/classes/line.THREE_LineSegments2.html +1 -0
  52. package/docs/classes/react.Store.html +29 -0
  53. package/docs/classes/server.BVH.html +10 -0
  54. package/docs/classes/server.BVHIntersect.html +1 -0
  55. package/docs/classes/server.BVHNode.html +7 -0
  56. package/docs/classes/server.BVHVector3.html +1 -0
  57. package/docs/classes/server.Model.html +63 -0
  58. package/docs/classes/server.PBMGroup.html +9 -0
  59. package/docs/classes/server.PBMMesh.html +7 -0
  60. package/docs/classes/sticker.Sticker.html +32 -0
  61. package/docs/index.html +166 -422
  62. package/docs/interfaces/five.AddableObject.html +1 -0
  63. package/docs/interfaces/five.AnimationFrame.html +1 -0
  64. package/docs/interfaces/five.CameraPose.html +1 -0
  65. package/docs/interfaces/five.DepthPanoramaControllerCustomInitArgs.html +28 -0
  66. package/docs/interfaces/five.EventCallback.html +399 -0
  67. package/docs/interfaces/five.FiveInitArgs.html +107 -0
  68. package/docs/interfaces/five.FloorplanControllerCustomInitArgs.html +15 -0
  69. package/docs/interfaces/five.ImageOptions.html +18 -0
  70. package/docs/interfaces/five.ImageURLMappings.html +1 -0
  71. package/docs/interfaces/five.ImageURLOptions.html +17 -0
  72. package/docs/interfaces/five.IntersectMeshInterface.html +3 -0
  73. package/docs/interfaces/five.Intersection.html +7 -0
  74. package/docs/interfaces/five.MapviewControllerCustomInitArgs.html +15 -0
  75. package/docs/interfaces/five.ModelControllerCustomInitArgs.html +20 -0
  76. package/docs/interfaces/five.ModelEventCallback.html +22 -0
  77. package/docs/interfaces/five.MovePanoOptions.html +42 -0
  78. package/docs/interfaces/five.PBMPanoPicture.html +7 -0
  79. package/docs/interfaces/five.PBMParameters.html +19 -0
  80. package/docs/interfaces/five.PanoCircleMeshInterface.html +19 -0
  81. package/docs/interfaces/five.PanoramaControllerCustomInitArgs.html +33 -0
  82. package/docs/interfaces/five.PanoramaLikeControllerCustomInitArgs.html +20 -0
  83. package/docs/interfaces/five.Pose.html +37 -0
  84. package/docs/interfaces/five.Scissor.html +14 -0
  85. package/docs/interfaces/five.State.html +21 -0
  86. package/docs/interfaces/five.SubscribeMixinType.emit.html +1 -0
  87. package/docs/interfaces/five.SubscribeMixinType.hasListener.html +1 -0
  88. package/docs/interfaces/five.SubscribeMixinType.off.html +1 -0
  89. package/docs/interfaces/five.SubscribeMixinType.on.html +1 -0
  90. package/docs/interfaces/five.SubscribeMixinType.once.html +1 -0
  91. package/docs/interfaces/five.TextureOptions.html +20 -0
  92. package/docs/interfaces/five.Tile3DModelLoaderOptions.html +3 -0
  93. package/docs/interfaces/five.TileBoundingVolume.html +19 -0
  94. package/docs/interfaces/five.TileContent.html +1 -0
  95. package/docs/interfaces/five.Tileset3dOptions.html +1 -0
  96. package/docs/interfaces/five.TilesetJSON.html +1 -0
  97. package/docs/interfaces/five.TilesetJSONNode.html +1 -0
  98. package/docs/interfaces/five.TopviewControllerCustomInitArgs.html +7 -0
  99. package/docs/interfaces/five.VRPanoramaControllerCustomInitArgs.html +29 -0
  100. package/docs/interfaces/five.WorkCubeImage.html +13 -0
  101. package/docs/interfaces/five.WorkImage.html +21 -0
  102. package/docs/interfaces/five.WorkInitial.html +13 -0
  103. package/docs/interfaces/five.WorkModel.html +11 -0
  104. package/docs/interfaces/five.WorkModelTiles.html +3 -0
  105. package/docs/interfaces/five.WorkObserver.html +25 -0
  106. package/docs/interfaces/five.WorkTile.html +1 -0
  107. package/docs/interfaces/five.WorkVideo.html +9 -0
  108. package/docs/interfaces/five.XRPanoramaControllerCustomInitArgs.html +29 -0
  109. package/docs/interfaces/gltf_loader.GLTF.html +7 -0
  110. package/docs/interfaces/react.FiveActionReactCallbacks.html +62 -0
  111. package/docs/interfaces/react.FiveInjectionTypes.html +191 -0
  112. package/docs/interfaces/react.PropTypeOfFiveFeatures.html +1 -0
  113. package/docs/interfaces/server.Intersection.html +7 -0
  114. package/docs/interfaces/server.ModelEventCallback.html +18 -0
  115. package/docs/interfaces/sticker.IntersectionLike.html +8 -0
  116. package/docs/interfaces/vue.FiveActionVueCallbacks.html +62 -0
  117. package/docs/modules/five.SubscribeMixinType.html +1 -0
  118. package/docs/modules/five.html +496 -0
  119. package/docs/modules/gltf_loader.html +1 -0
  120. package/docs/modules/line.html +1 -0
  121. package/docs/modules/react.html +130 -1374
  122. package/docs/modules/server.html +18 -0
  123. package/docs/modules/sticker.html +1 -0
  124. package/docs/modules/vue.html +112 -0
  125. package/docs/modules.html +1 -120
  126. package/exporters/staticify.js +210 -0
  127. package/{index.d.ts → five/index.d.ts} +1211 -331
  128. package/five/index.js +372 -0
  129. package/gltf-loader/index.d.ts +76 -0
  130. package/gltf-loader/index.js +260 -0
  131. package/line/index.d.ts +69 -0
  132. package/line/index.js +260 -0
  133. package/package.json +25 -17
  134. package/react/index.d.ts +86 -24
  135. package/react/index.js +260 -1
  136. package/resource/{basis_transcoder.js → basis/basis_transcoder.js} +0 -0
  137. package/resource/{basis_transcoder.wasm → basis/basis_transcoder.wasm} +0 -0
  138. package/resource/gltf/draco_decoder.js +31 -0
  139. package/resource/gltf/draco_decoder.wasm +0 -0
  140. package/resource/gltf/draco_wasm_wrapper.js +119 -0
  141. package/scripts/five-staticify.js +26 -0
  142. package/server/index.d.ts +197 -26
  143. package/server/index.js +367 -1
  144. package/sticker/index.d.ts +71 -0
  145. package/sticker/index.js +260 -0
  146. package/templates/quick-start/README.md +1 -1
  147. package/templates/quick-start/package.json +1 -1
  148. package/templates/react-component/lib/index.tsx +3 -3
  149. package/umd/five-gltf-loader.js +2 -0
  150. package/umd/five-gltf-loader.js.LICENSE.txt +14 -0
  151. package/umd/five-line.js +2 -0
  152. package/umd/five-line.js.LICENSE.txt +14 -0
  153. package/umd/five-react.js +2 -0
  154. package/umd/five-react.js.LICENSE.txt +14 -0
  155. package/umd/five-sticker.js +2 -0
  156. package/umd/five-sticker.js.LICENSE.txt +14 -0
  157. package/umd/five-vue.js +1 -0
  158. package/umd/five.js +2 -0
  159. package/umd/five.js.LICENSE.txt +116 -0
  160. package/vue/index.d.ts +433 -0
  161. package/vue/index.js +260 -0
  162. package/bundles/five.js +0 -2
  163. package/bundles/five.js.LICENSE.txt +0 -160
  164. package/docs/assets/css/main.css +0 -2660
  165. package/docs/assets/js/main.js +0 -248
  166. package/docs/assets/js/search.js +0 -1
  167. package/docs/classes/index.five.html +0 -2498
  168. package/docs/classes/index.fivecamera.html +0 -311
  169. package/docs/classes/index.fivehashcubetexture.html +0 -240
  170. package/docs/classes/index.fiveline.html +0 -342
  171. package/docs/classes/index.fivelinegeometry.html +0 -500
  172. package/docs/classes/index.fivelinematerial.html +0 -276
  173. package/docs/classes/index.fivelinesegmentsgeometry.html +0 -447
  174. package/docs/classes/index.fivescene.html +0 -186
  175. package/docs/classes/index.internalwebglrenderer.html +0 -200
  176. package/docs/classes/index.model.html +0 -883
  177. package/docs/classes/index.pbmgroup.html +0 -415
  178. package/docs/classes/index.pbmmaterial.html +0 -521
  179. package/docs/classes/index.pbmmesh.html +0 -242
  180. package/docs/classes/index.subscribe.html +0 -556
  181. package/docs/classes/react.store.html +0 -584
  182. package/docs/interfaces/index.depthpanoramacontrollercustominitargs.html +0 -408
  183. package/docs/interfaces/index.eventcallback.html +0 -2452
  184. package/docs/interfaces/index.fiveinitargs.html +0 -695
  185. package/docs/interfaces/index.floorplancontrollercustominitargs.html +0 -283
  186. package/docs/interfaces/index.imageoptions.html +0 -320
  187. package/docs/interfaces/index.intersection.html +0 -215
  188. package/docs/interfaces/index.intersectmeshinterface.html +0 -176
  189. package/docs/interfaces/index.modelcontrollercustominitargs.html +0 -354
  190. package/docs/interfaces/index.modeleventcallback.html +0 -316
  191. package/docs/interfaces/index.movepanooptions.html +0 -457
  192. package/docs/interfaces/index.panocirclemeshinterface.html +0 -349
  193. package/docs/interfaces/index.panoramacontrollercustominitargs.html +0 -433
  194. package/docs/interfaces/index.panoramalikecontrollercustominitargs.html +0 -352
  195. package/docs/interfaces/index.pbmparameters.html +0 -462
  196. package/docs/interfaces/index.pose.html +0 -258
  197. package/docs/interfaces/index.scissor.html +0 -240
  198. package/docs/interfaces/index.state.html +0 -288
  199. package/docs/interfaces/index.subscribemixintype.emit.html +0 -180
  200. package/docs/interfaces/index.subscribemixintype.haslistener.html +0 -171
  201. package/docs/interfaces/index.subscribemixintype.off.html +0 -198
  202. package/docs/interfaces/index.subscribemixintype.on.html +0 -213
  203. package/docs/interfaces/index.subscribemixintype.once.html +0 -210
  204. package/docs/interfaces/index.topviewcontrollercustominitargs.html +0 -214
  205. package/docs/interfaces/index.vrpanoramacontrollercustominitargs.html +0 -420
  206. package/docs/interfaces/react.fiveactionreactcallbacks.html +0 -559
  207. package/docs/interfaces/react.fiveinjectiontypes.html +0 -1473
  208. package/docs/interfaces/react.injectfivetoprops.html +0 -259
  209. package/docs/modules/index.html +0 -3027
  210. package/docs/modules/index.subscribemixintype.html +0 -143
  211. package/five.js.LICENSE.txt +0 -160
  212. package/index.js +0 -1
  213. package/scripts/export-five-resource/chfs.exe +0 -0
  214. package/scripts/export-five-resource/fileify.js +0 -192
  215. package/scripts/export-five-resource/format-work.js +0 -71
  216. package/scripts/export-five-resource/staticify.js +0 -327
  217. package/scripts/transcode-model/BufferGeometryUtils.js +0 -832
  218. package/scripts/transcode-model/LoaderSupport.js +0 -1545
  219. package/scripts/transcode-model/MTLLoader.js +0 -602
  220. package/scripts/transcode-model/OBJLoader2.js +0 -1470
  221. package/scripts/transcode-model/obj2pbm.js +0 -65
package/react/index.d.ts CHANGED
@@ -1,16 +1,18 @@
1
1
  import { EventCallback } from '@realsee/five';
2
2
  import { Five } from '@realsee/five';
3
3
  import { FiveInitArgs } from '@realsee/five';
4
- import { FiveScene } from '@realsee/five';
5
4
  import { Intersection } from '@realsee/five';
6
5
  import { Model } from '@realsee/five';
7
6
  import { Pose } from '@realsee/five';
8
7
  import * as React_2 from 'react';
8
+ import { Scene } from '@realsee/five';
9
9
  import { State } from '@realsee/five';
10
10
  import * as THREE_2 from 'three';
11
11
  import { Vector2 } from 'three';
12
12
  import { Work } from '@realsee/five';
13
13
 
14
+ export declare function createFiveFeature<T extends FiveInjectionFeature>(...features: T[]): T[];
15
+
14
16
  /**
15
17
  * 创建一个 FiveProvider
16
18
  * 在 React 的体系下,使用 Provider 的方式来组织组件结构。
@@ -29,17 +31,20 @@ import { Work } from '@realsee/five';
29
31
  * ReactDOM.render(<App/>, document.getElementById("app"));
30
32
  * ```
31
33
  */
32
- export declare function createFiveProvider(fiveInitArgs: Omit<FiveInitArgs, "renderer" | "scissor">): {
34
+ export declare function createFiveProvider(fiveInitArgs?: Omit<FiveInitArgs, "renderer" | "scissor">): {
33
35
  new (props: FiveProviderPropTypes): {
34
36
  /**
35
37
  * five 实例,可以通过 FiveProvider 的 ref.five 获取得到
36
38
  * 在一些外部调用方面可以尝试使用
37
39
  */
38
40
  five?: Five;
39
- loadWork(work: Work, state?: "inherit" | "initial" | Partial<Omit<State, "offset">>, duration?: number): void;
41
+ loadWork(work: Work, state?: "inherit" | "initial" | Partial<Omit<State, "offset">>, duration?: number, userAction?: boolean): Promise<void>;
40
42
  shouldComponentUpdate(nextProps: FiveProviderPropTypes): boolean;
41
43
  componentWillUnmount(): void;
42
- render(): JSX.Element;
44
+ render(): React_2.FunctionComponentElement<React_2.ProviderProps<{
45
+ five: Five;
46
+ loadWork: (work: Work, state?: "inherit" | "initial" | Partial<Omit<State, "offset">>, duration?: number, userAction?: boolean) => Promise<void>;
47
+ }>>;
43
48
  context: any;
44
49
  setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<FiveProviderPropTypes>) => {} | Pick<{}, K>) | Pick<{}, K>, callback?: () => void): void;
45
50
  forceUpdate(callback?: () => void): void;
@@ -101,7 +106,7 @@ export declare function createStore<T extends StoreValueMapType, A extends Store
101
106
  onValuesChange?: (value: T, prevValue: T) => void;
102
107
  children: React_2.ReactNode;
103
108
  }): boolean;
104
- render(): JSX.Element;
109
+ render(): React_2.FunctionComponentElement<React_2.ProviderProps<Store<T>>>;
105
110
  context: any;
106
111
  setState<K_3 extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<{
107
112
  initialValue: T;
@@ -190,7 +195,7 @@ export declare interface FiveActionReactCallbacks {
190
195
  *
191
196
  * // 使用指定解析器
192
197
  * // 会调用这个目录下的 basis_transcoder.js basis_transcoder.wasm 文件作为解析器
193
- * initialBasisLoader("https://vrlab-public.ljcdn.com/release/static/image/release/five/basis/");
198
+ * initialBasisLoader("https://vr-public.realsee-cdn.cn/release/static/image/release/five/basis/");
194
199
  * ```
195
200
  */
196
201
  initBasisLoader(transcoderResourcePath?: string): void;
@@ -253,9 +258,9 @@ export declare const FiveCanvas: React_2.FC<{
253
258
  height: number;
254
259
  }>;
255
260
 
256
- export declare type FiveInjectionActionFeature = "loadWork" | "setState" | "on" | "off" | "intersectRaycaster" | "project2d" | "updateCamera" | "initBasisLoader" | "getPixels" | "render" | "needsRender" | "preloadPano";
261
+ export declare type FiveInjectionActionFeature = "loadWork" | "setState" | "on" | "off" | "intersectRaycaster" | "project2d" | "updateCamera" | "initBasisLoader" | "getPixels" | "render" | "needsRender" | "preloadPano" | "showFloor" | "toggleHelperVisible";
257
262
 
258
- export declare type FiveInjectionDataFeature = "unsafe__fiveInstance" | "currentState" | "state" | "work" | "scene" | "cameraDirection" | "cameraRaycaster" | "modelReadyState";
263
+ export declare type FiveInjectionDataFeature = "unsafe__fiveInstance" | "currentState" | "currentObserver" | "state" | "work" | "model" | "scene" | "cameraDirection" | "cameraRaycaster" | "modelReadyState" | "shownFloor" | "totalFloorLength" | "helperVisible";
259
264
 
260
265
  export declare type FiveInjectionFeature = FiveInjectionDataFeature | FiveInjectionActionFeature;
261
266
 
@@ -414,7 +419,7 @@ export declare interface FiveInjectionTypes extends Record<FiveInjectionFeature,
414
419
  *
415
420
  * // 使用指定解析器
416
421
  * // 会调用这个目录下的 basis_transcoder.js basis_transcoder.wasm 文件作为解析器
417
- * five.initialBasisLoader("https://vrlab-public.ljcdn.com/release/static/image/release/five/basis/");
422
+ * five.initialBasisLoader("https://vr-public.realsee-cdn.cn/release/static/image/release/five/basis/");
418
423
  * ```
419
424
  */
420
425
  initBasisLoader: Five["initBasisLoader"];
@@ -458,26 +463,38 @@ export declare interface FiveInjectionTypes extends Record<FiveInjectionFeature,
458
463
  * @returns 加载完成的 Promise 参数同 callback
459
464
  */
460
465
  preloadPano: Five["preloadPano"];
466
+ /**
467
+ * 显示楼层
468
+ * @param floorIndex - 楼层,如果不传则都显示
469
+ */
470
+ showFloor: (floorIndex?: number) => void;
471
+ /**
472
+ * 帮助元素的隐藏/显示
473
+ * @param visible - 隐藏/显示
474
+ */
475
+ toggleHelperVisible: (visible: boolean) => void;
461
476
  }
462
477
 
463
478
  export declare type FiveProviderPropTypes = {
464
479
  work?: Work;
465
- initialWork?: Work;
480
+ initialWork?: Work | Promise<Work>;
466
481
  initialState?: "inherit" | "initial" | Partial<Omit<State, "offset">>;
482
+ initialUserAction?: boolean;
467
483
  onWorkChange?: (work: Work) => void;
468
484
  onStateChange?: (state: State, userAction: boolean) => void;
469
485
  onCurrentStateChange?: (state: State, userAction: boolean) => void;
486
+ onError?: (error: Error) => void;
470
487
  children: React_2.ReactNode;
471
488
  };
472
489
 
473
490
  export declare type FiveProviderType = ReturnType<typeof createFiveProvider>;
474
491
 
475
- export declare interface InjectFiveToProps<F extends FiveInjectionFeature> {
476
- [INJECTION_PROPNAME]: Pick<FiveInjectionTypes, F>;
477
- }
478
-
479
492
  export declare const INJECTION_PROPNAME = "$five";
480
493
 
494
+ export declare interface PropTypeOfFiveFeatures<F extends FiveInjectionFeature[]> {
495
+ [INJECTION_PROPNAME]: Pick<FiveInjectionTypes, F[number]>;
496
+ }
497
+
481
498
  /**
482
499
  * 监听者模式
483
500
  * @template T - 预设的监听回调类型
@@ -629,6 +646,16 @@ export declare function useFiveCameraDirection(): THREE_2.Vector3;
629
646
  */
630
647
  export declare function useFiveCameraRaycaster(): THREE_2.Raycaster;
631
648
 
649
+ /**
650
+ * Five React Hooks: Five 的当前观测点
651
+ * @returns Work.observers[number] 当前观测点, 如果 work 未加载则为 null
652
+ * @example
653
+ * ```
654
+ * const observer = useFiveCurrentObserver();
655
+ * ```
656
+ */
657
+ export declare function useFiveCurrentObserver(): Work["observers"][number] | null;
658
+
632
659
  /**
633
660
  * Five React Hooks: Five 的实时状态
634
661
  * @returns
@@ -640,7 +667,7 @@ export declare function useFiveCameraRaycaster(): THREE_2.Raycaster;
640
667
  */
641
668
  export declare function useFiveCurrentState(): [
642
669
  currentState: State,
643
- setState: (state: Partial<State>, immediately?: boolean) => void
670
+ setState: (state: Partial<State> | ((prevState: State) => Partial<State>), immediately?: boolean, userAction?: boolean) => void
644
671
  ];
645
672
 
646
673
  /**
@@ -651,7 +678,36 @@ setState: (state: Partial<State>, immediately?: boolean) => void
651
678
  * useFiveEvent("cameraUpdate", pose => {});
652
679
  * ```
653
680
  */
654
- export declare function useFiveEvent<T extends keyof EventCallback>(name: T, callback: EventCallback[T], deps?: React_2.DependencyList | undefined): void;
681
+ export declare function useFiveEventCallback<T extends keyof EventCallback>(name: T, callback: EventCallback[T], deps?: React_2.DependencyList | undefined): void;
682
+
683
+ /**
684
+ * Five React Hooks: Five 楼层
685
+ * @returns
686
+ * [ shownFloor: Five 当前显示的楼层, null 为都显示, showFloor: 设置显示楼层,不传参数为都显示 ]
687
+ * @example
688
+ * ```
689
+ * const [ shownFloor, showFloor ] = useFiveFloor;
690
+ * ```
691
+ */
692
+ export declare function useFiveFloor(): [
693
+ shownFloor: number | null,
694
+ totalFloorLength: number,
695
+ showFloor: (floorIndex?: number) => void
696
+ ];
697
+
698
+ /**
699
+ * Five React Hooks: Five 帮助元素的隐藏/显示
700
+ * @returns
701
+ * [ helperVisible: Five 帮助元素是否显示显示, toggleHelperVisible: 设置 帮助元素的隐藏/显示 ]
702
+ * @example
703
+ * ```
704
+ * const [ helperVisible, toggleHelperVisible ] = useFiveHelper;
705
+ * ```
706
+ */
707
+ export declare function useFiveHelper(): [
708
+ helperVisible: boolean,
709
+ toggleHelperVisible: (visible: boolean) => void
710
+ ];
655
711
 
656
712
  /**
657
713
  * Five React Hooks: 获取当前模型碰撞检测方法
@@ -674,7 +730,7 @@ export declare function useFiveEvent<T extends keyof EventCallback>(name: T, cal
674
730
  export declare function useFiveModelIntersectRaycaster(): (raycaster: THREE_2.Raycaster) => Intersection[];
675
731
 
676
732
  /**
677
- * Five React Hooks: 获取当前模型碰加载状态
733
+ * Five React Hooks: 获取当前模型加载状态
678
734
  * @returns
679
735
  * "Loaded": 加载完成
680
736
  * "Empty" 加载未完成
@@ -701,23 +757,29 @@ export declare function useFiveModelReadyState(): "Loaded" | "Empty";
701
757
  */
702
758
  export declare function useFiveProject2d(): (vector: THREE.Vector3, testModel: boolean) => Vector2;
703
759
 
760
+ /**
761
+ * @deprecated
762
+ * 请使用 `useFiveSceneEffect` 替代
763
+ */
764
+ export declare const useFiveScene: typeof useFiveSceneEffect;
765
+
704
766
  /**
705
767
  * Five React Hooks: 操作 Five 的 Scene
706
768
  * @param callback - 获取 Five 的 Scene 的回调函数
707
769
  * @example
708
770
  * ```
709
- * useFiveScene(scene => {
771
+ * useFiveSceneEffect(scene => {
710
772
  * // object is a THREE.Object3D
711
773
  * scene.add(object);
712
- * return () => scene.remove(object);
774
+ * return () => scene.remove(object); // 析构函数
713
775
  * });
714
776
  * ```
715
777
  */
716
- export declare function useFiveScene(callback: (scene: FiveScene) => void | (() => void), deps?: React_2.DependencyList | undefined): void;
778
+ export declare function useFiveSceneEffect(callback: (scene: Scene) => void | (() => void), deps?: React_2.DependencyList | undefined): void;
717
779
 
718
780
  export declare function useFiveState(): [
719
781
  state: State,
720
- setState: (state: Partial<State>, immediately?: boolean) => void
782
+ setState: (state: Partial<State> | ((prevState: State) => Partial<State>), immediately?: boolean, userAction?: boolean) => void
721
783
  ];
722
784
 
723
785
  /**
@@ -744,10 +806,10 @@ setState: (state: Partial<State>, immediately?: boolean) => void
744
806
  * ```
745
807
  */
746
808
  export declare function useFiveWork(): [
747
- work: Work,
748
- loadWork: (work: Work, state?: "inherit" | "initial" | Partial<Omit<State, "offset">>, duration?: number) => void
809
+ work: Work | undefined,
810
+ loadWork: (work: Work, state?: "inherit" | "initial" | Partial<Omit<State, "offset">>, duration?: number, userAction?: boolean) => Promise<void>
749
811
  ];
750
812
 
751
- export declare function withFive<F extends FiveInjectionFeature>(...features: F[]): <P extends InjectFiveToProps<F>, C extends React_2.ComponentClass<P, any>>(Component: C & React_2.ComponentClass<P, any>) => React_2.ForwardRefExoticComponent<React_2.PropsWithoutRef<Omit<P, "$five">> & React_2.RefAttributes<Omit<InstanceType<C>, "state" | "setState" | "render" | "componentDidMount" | "shouldComponentUpdate" | "componentWillUnmount" | "componentDidCatch" | "getSnapshotBeforeUpdate" | "componentDidUpdate" | "componentWillMount" | "UNSAFE_componentWillMount" | "componentWillReceiveProps" | "UNSAFE_componentWillReceiveProps" | "componentWillUpdate" | "UNSAFE_componentWillUpdate" | "context" | "forceUpdate" | "props" | "refs">>>;
813
+ export declare function withFive<F extends FiveInjectionFeature[]>(features: F): <P extends PropTypeOfFiveFeatures<F>, C extends React_2.ComponentClass<P, any>>(Component: C & React_2.ComponentClass<P, any>) => React_2.ForwardRefExoticComponent<React_2.PropsWithoutRef<Omit<P, "$five">> & React_2.RefAttributes<Omit<InstanceType<C>, "state" | "setState" | "render" | "componentDidMount" | "shouldComponentUpdate" | "componentWillUnmount" | "componentDidCatch" | "getSnapshotBeforeUpdate" | "componentDidUpdate" | "componentWillMount" | "UNSAFE_componentWillMount" | "componentWillReceiveProps" | "UNSAFE_componentWillReceiveProps" | "componentWillUpdate" | "UNSAFE_componentWillUpdate" | "context" | "forceUpdate" | "props" | "refs">>>;
752
814
 
753
815
  export { }
package/react/index.js CHANGED
@@ -1 +1,260 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three"),r=require("tslib"),t=require("react"),n=require("@realsee/five");function o(e){if(e&&e.__esModule)return e;var r=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}})),r.default=e,Object.freeze(r)}var u=o(e),i=o(t),a=Number(u.REVISION);if(a<115||a>117)throw new Error('"Five" needs "THREE.js" version between 125 - 117.');var f=[];var s=i.createContext(null);function c(){var e=i.useContext(s);if(!e)throw new Error("FiveProvider never found.");return e.five}function l(){var e=i.useContext(s);if(!e)throw new Error("FiveProvider never found.");return e.loadWork}var v={display:"inline-block",overflow:"hidden"};function d(e){return r.__assign({},e.state)}function p(e){var r=e.camera.getWorldDirection(new u.Vector3);return new u.Raycaster(e.camera.position,r)}function h(e){return e.camera.getWorldDirection(new u.Vector3)}function y(e){return e.model.empty?"Empty":"Loaded"}function m(e,r){return r.indexOf(e)>=0}function g(e,r){for(var t=0,n=Object.keys(r);t<n.length;t++){var o=n[t];void 0!==r[o]&&(e[o]=r[o])}}function S(e,t){var n=m("state",t),o=i.useState(Symbol()),u=o[0],a=o[1],f=i.useMemo((function(){if(n)return r.__assign({},e.state)}),[e,u]);return i.useLayoutEffect((function(){if(n)return e.on("stateChange",(function(){return a(Symbol())}))}),[e]),[f,u]}function C(e,r){var t=m("currentState",r),n=i.useState(Symbol()),o=n[0],u=n[1],a=i.useMemo((function(){if(t)return e.getCurrentState()}),[e,o]);return i.useLayoutEffect((function(){if(t)return e.on("currentStateChange",(function(){return u(Symbol())}))}),[e]),[a,o]}function w(e,r){return[m("unsafe__fiveInstance",r)?e:void 0]}function k(e,r){var t=m("work",r),n=i.useState(Symbol()),o=n[0],u=n[1],a=i.useMemo((function(){if(t)return e.work}),[e,o]);return i.useLayoutEffect((function(){if(t)return e.on("load",(function(){return u(Symbol())}))}),[e]),[a,o]}function E(e,r){return[m("scene",r)?e.scene:void 0]}function x(e,r){var t=m("cameraDirection",r),n=i.useState(Symbol()),o=n[0],a=n[1],f=i.useMemo((function(){if(t)return e.camera.getWorldDirection(new u.Vector3)}),[e,o]);return i.useLayoutEffect((function(){if(t)return e.on("cameraUpdate",(function(){return a(Symbol())}))}),[e]),[f,o]}function b(e,r){var t=m("cameraRaycaster",r),n=i.useState(Symbol()),o=n[0],a=n[1],f=i.useMemo((function(){if(t){var r=e.camera.getWorldDirection(new u.Vector3);return new u.Raycaster(e.camera.position,r)}}),[e,o]);return i.useLayoutEffect((function(){if(t)return e.on("cameraUpdate",(function(){return a(Symbol())}))}),[e]),[f,o]}function _(e,r){var t=m("modelReadyState",r),n=i.useState(Symbol()),o=n[0],u=n[1],a=i.useMemo((function(){if(t)return e.model.empty?"Empty":"Loaded"}),[e,o]);return i.useLayoutEffect((function(){if(t)return e.on("modelLoaded",(function(){return u(Symbol())}))}),[e]),[a,o]}function P(e,r){if(m("loadWork",r))return e}function R(e,r){if(m("setState",r))return function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return e.setState.apply(e,r)}}function L(e,r){if(m("on",r))return function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return e.on.apply(e,r)}}function V(e,r){if(m("on",r))return function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return e.once.apply(e,r)}}function F(e,r){if(m("off",r))return function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return e.off.apply(e,r)}}function W(e,r){if(m("intersectRaycaster",r))return function(){for(var r,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return(r=e.model).intersectRaycaster.apply(r,t)}}function O(e,r){if(m("project2d",r))return function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return e.project2d.apply(e,r)}}function j(e,r){if(m("updateCamera",r))return function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return e.updateCamera.apply(e,r)}}function M(e,r){if(m("initBasisLoader",r))return function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return e.initBasisLoader.apply(e,r)}}function N(e,r){if(m("getPixels",r))return function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return e.getPixels.apply(e,r)}}function A(e,r){if(m("render",r))return function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return e.render.apply(e,r)}}function D(e,r){if(m("needsRender",r))return function(){e.needsRender=!0}}function I(e,r){if(m("preloadPano",r))return function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return e.preloadPano.apply(e,r)}}function U(e,r){for(var t={},n=r.length,o=-1;++o<n;){var u=r[o];u in e&&(t[u]=e[u])}return t}function B(e,r){for(var t=0;t<e.length;t++)for(var n=0;t<r.length;n++)if(e[t]===r[n])return!0;return!1}var q=function(){function e(e,r){this.values=e,this.listeners=[],this.onValuesChange=r}return e.prototype.on=function(e,r){var t=this,n=[e,r];return this.listeners.push(n),function(){var e=t.listeners.indexOf(n);e>=0&&t.listeners.splice(e,1)}},e.prototype.getValues=function(e){return U(this.values,e)},e.prototype.setValues=function(e,t){var n,o,u=[];for(var i in t)e.indexOf(i)>=0&&(n=t[i],o=this.values[i],!("number"==typeof n&&"number"==typeof o&&isNaN(n)&&isNaN(o)||n===o))&&u.push(i);if(0!==u.length){for(var a=r.__assign({},this.values),f=0,s=u;f<s.length;f++){var c=s[f];this.values[c]=t[c]}this.onValuesChange&&this.onValuesChange(this.values,a);for(var l=0,v=this.listeners;l<v.length;l++){var d=v[l],p=d[0],h=d[1];if(B(p,u)){var y=U(a,p);h(U(this.values,p),y)}}}},e}();exports.FiveCanvas=function(e){var t=e.width,n=e.height,o=c(),u=i.createRef(),a=r.__assign({width:t,height:n},v);return i.useLayoutEffect((function(){if(u.current){if(null!==o.renderer.domElement.parentNode&&o.renderer.domElement.parentNode!==u.current)throw new Error("There are more than 2 fiveCanvas in this context.");o.renderer.domElement.parentNode!==u.current&&u.current.appendChild(o.renderer.domElement),o.renderer.setSize(t,n)}}),[t,n,u.current]),i.createElement("div",{ref:u,style:a})},exports.INJECTION_PROPNAME="$five",exports.Store=q,exports.createFiveProvider=function(e){return function(t){function o(o){var i=t.call(this,o)||this;if(!o.work&&!o.initialWork)throw new Error("props 'work' or 'initialWork' is never set.");var a=function(e){var r=void 0===e?{}:e,t=r.backgroundColor,n=void 0===t?1579548:t,o=r.backgroundAlpha,i=void 0===o?1:o,a=r.pixelRatio,s=void 0===a?1:a,c=f.shift();return c||(c=new u.WebGLRenderer({antialias:!1,alpha:!0})),c.setPixelRatio(s),c.setClearColor(n,i),c.autoClear=!0,c}({pixelRatio:1===n.getViewportScale()?window.devicePixelRatio:1});return i.five=new n.Five(r.__assign({renderer:a},e)),i.five.load(o.work||o.initialWork,o.initialState),i.five.on("load",(function(){var e;i.props.onWorkChange&&i.props.onWorkChange(null===(e=i.five)||void 0===e?void 0:e.work)})),i.five.on("stateChange",(function(e,r){i.props.onStateChange&&i.props.onStateChange(e,r)})),i.five.on("currentStateChange",(function(e,r){i.props.onCurrentStateChange&&i.props.onCurrentStateChange(e,r)})),i}return r.__extends(o,t),o.prototype.loadWork=function(e,r,t){var n;if(this.props.work)throw new Error("props 'work' is set in fiveProvider, if you need modify work internal, use 'initialWork' instead.");null===(n=this.five)||void 0===n||n.load(e,r,t)},o.prototype.shouldComponentUpdate=function(e){var r,t;return e.work&&e.work!==(null===(r=this.five)||void 0===r?void 0:r.work)&&(null===(t=this.five)||void 0===t||t.load(e.work,e.initialState)),e.children!==this.props.children},o.prototype.componentWillUnmount=function(){var e;this.five&&(this.five.dispose(),e=this.five.renderer,-1===f.indexOf(e)&&f.push(e),delete this.five)},o.prototype.render=function(){var e=this;return i.createElement(s.Provider,{value:{five:this.five,loadWork:function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return e.loadWork.apply(e,r)}}},this.props.children)},o}(i.Component)},exports.createStore=function(e){var t=i.createContext(null);return{useStore:function(e){var n=i.useContext(t);if(null===n)throw new Error("StoreProvider never found.");var o=i.useRef(!0),u=i.useState(n.getValues(e)),a=u[0],f=u[1],s=r.__spreadArray([n],e);return i.useLayoutEffect((function(){return o.current?o.current=!1:f(n.getValues(e)),n.on(e,(function(e){return f(e)}))}),s),[a,i.useCallback((function(r){return n.setValues(e,r)}),s)]},useStoreSetter:function(e){var n=i.useContext(t);if(null===n)throw new Error("StoreProvider never found.");return i.useCallback((function(r){return n.setValues(e,r)}),r.__spreadArray([n],e))},watchStore:function(e,n,o){var u=i.useContext(t);if(null===u)throw new Error("StoreProvider never found.");var a=r.__spreadArray([u],e);void 0!==o&&(a=a.concat(o)),i.useLayoutEffect((function(){return u.on(e,n)}),a)},useStoreAction:function(n){var o=i.useContext(t);if(null===o)throw new Error("StoreProvider never found.");return i.useCallback((function(){for(var t=[],u=0;u<arguments.length;u++)t[u]=arguments[u];var i=e[n],a=i[0],f=i.slice(1),s=function(){return o.getValues(f)},c=function(e){return o.setValues(f,e)};return a.apply(void 0,r.__spreadArray([s,c],t))}),[])},StoreProvider:function(e){function n(r){var t=e.call(this,r)||this;return t.store=new q(r.initialValue,(function(){for(var e,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];t.props.onValuesChange&&(e=t.props).onValuesChange.apply(e,r)})),t}return r.__extends(n,e),n.prototype.shouldComponentUpdate=function(e){return e.children!==this.props.children},n.prototype.render=function(){return i.createElement(t.Provider,{value:this.store},this.props.children)},n}(i.Component)}},exports.unsafe__useFiveInstance=function(){return c()},exports.useFiveAction=function(){var e=c();return{updateCamera:i.useCallback((function(r,t){return e.updateCamera(r,t)}),[e]),initBasisLoader:i.useCallback((function(r){return e.initBasisLoader(r)}),[e]),getPixels:i.useCallback((function(r,t,n,o,u){return e.getPixels(r,t,n,o,u)}),[e]),render:i.useCallback((function(r){return e.render(r)}),[e]),needsRender:i.useCallback((function(){return e.needsRender=!0}),[e]),preloadPano:i.useCallback((function(r,t){return e.preloadPano(r,t)}),[e])}},exports.useFiveCameraDirection=function(){var e=c(),r=i.useState((function(){return h(e)})),t=r[0],n=r[1];return i.useLayoutEffect((function(){return e.on("cameraUpdate",(function(){return n(h(e))}))}),[e]),t},exports.useFiveCameraRaycaster=function(){var e=c(),r=i.useState((function(){return p(e)})),t=r[0],n=r[1];return i.useLayoutEffect((function(){return e.on("cameraUpdate",(function(){return n(p(e))}))}),[e]),t},exports.useFiveCurrentState=function(){var e=c(),r=i.useState((function(){return e.getCurrentState()})),t=r[0],n=r[1],o=i.useCallback((function(r,t){void 0===t&&(t=!1),e.setState(r,t)}),[e]);return i.useLayoutEffect((function(){return e.on("currentStateChange",(function(){return n(e.getCurrentState())}))}),[e]),[t,o]},exports.useFiveEvent=function(e,r,t){var n=i.useState({});n[0],n[1];var o=c();if(!o)throw new Error("fiveProvider never found.");var u=[o,e];void 0!==t&&(u=u.concat(t)),i.useLayoutEffect((function(){return o.on(e,r)}),u)},exports.useFiveModelIntersectRaycaster=function(){var e=c();return i.useCallback((function(r){return e.model.intersectRaycaster(r)}),[e])},exports.useFiveModelReadyState=function(){var e=c(),r=i.useState((function(){return y(e)})),t=r[0],n=r[1];return i.useLayoutEffect((function(){return e.on("modelLoaded",(function(){return n(y(e))}))}),[e]),t},exports.useFiveProject2d=function(){var e=c();return i.useCallback((function(r,t){return e.project2d(r,t)}),[e])},exports.useFiveScene=function(e,r){var t=c(),n=[t];void 0!==r&&(n=n.concat(r)),i.useLayoutEffect((function(){return e(t.scene)}),n)},exports.useFiveState=function(){var e=c(),r=i.useState((function(){return d(e)})),t=r[0],n=r[1],o=i.useCallback((function(r,t){void 0===t&&(t=!1),e.setState(r,t)}),[e]);return i.useLayoutEffect((function(){return e.on("stateChange",(function(){return n(d(e))}))}),[e]),[t,o]},exports.useFiveWork=function(){var e=c(),r=l(),t=i.useState((function(){return e.work})),n=t[0],o=t[1];return i.useLayoutEffect((function(){return e.on("load",(function(){return o(e.work)}))}),[e]),[n,r]},exports.withFive=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){return i.forwardRef((function(n,o){var u=c(),a=l(),f=w(u,e)[0],s=S(u,e),v=s[0],d=s[1],p=C(u,e),h=p[0],y=p[1],m=k(u,e),U=m[0],B=m[1],q=E(u,e)[0],T=x(u,e),z=T[0],$=T[1],G=b(u,e),H=G[0],J=G[1],K=_(u,e),Q=K[0],X=K[1],Y=i.useMemo((function(){var r={};return g(r,{setState:R(u,e),loadWork:P(a,e),on:L(u,e),once:V(u,e),off:F(u,e),intersectRaycaster:W(u,e),project2d:O(u,e),updateCamera:j(u,e),initBasisLoader:M(u,e),getPixels:N(u,e),render:A(u,e),needsRender:D(u,e),preloadPano:I(u,e)}),r}),[u,a]),Z=i.useMemo((function(){var e=r.__assign({},Y);return g(e,{unsafe__fiveInstance:f,state:v,currentState:h,work:U,scene:q,cameraDirection:z,cameraRaycaster:H,modelReadyState:Q}),e}),[u,Y,d,y,B,$,J,X]);return i.createElement(t,r.__assign({ref:o,$five:Z},n))}))}};
1
+ /**
2
+ * @realsee/five
3
+ *
4
+ * Generated: 2022-08-03
5
+ * Version: 5.0.0-alpha.142
6
+ *
7
+ * Terms:
8
+ * Realsee SDK License Agreement
9
+ *
10
+ * Update: July 28, 2021
11
+ *
12
+ * THIS LICENSE AGREEMENT BETWEEN YOU AND 【BEIKE REALSEE TECHNOLOGY (HK)
13
+ * LIMITED】(“Realsee”) FORMS A LEGALLY BINDING CONTRACT BETWEEN YOU AND REALSEE IN
14
+ * RELATION TO YOUR USE OF THE SDK. This License Agreement accompanies the Realsee
15
+ * Software Development Kit(s) for the software and related explanatory materials
16
+ * (the "SDK") and includes any upgrades, modified versions, updates, additions,
17
+ * and copies of the SDK licensed to You by Realsee.
18
+ * BY DOWNLOADING, INSTALLING, OR OTHERWISE ACCESSING OR USING THE SDK, YOU AGREE
19
+ * THAT YOU HAVE READ, UNDERSTOOD, AND AGREE TO BE BOUND BY THIS AGREEMENT. YOU ARE
20
+ * AGREEING ON YOUR OWN BEHALF AND/OR ON BEHALF OF YOUR COMPANY OR ORGANIZATION TO
21
+ * THE TERMS AND CONDITIONS STATED BELOW.
22
+ * This Agreement applies to Your use of the SDK in the country in which You
23
+ * legally install it (“Territory”) and is subject to the laws of such Territory
24
+ * and further subject to Section 12 below. Different terms, conditions, and
25
+ * limitations may apply to the use of the SDK in any additional countries.
26
+ * 1. DEFINITIONS.
27
+ * “Agreement” means this Realsee SDK License Agreement.
28
+ * “Developer”, “You” and “Your” means the person(s) or entity acquiring or using
29
+ * the SDK or otherwise exercising rights under the terms of this Agreement.
30
+ * “Documentation” means the technical or other specifications or documentation
31
+ * that Realsee may provide to You for use in connection with the SDK.
32
+ * “Integrated Product” means any software, website, or on-line service developed
33
+ * by You based on or using the SDK (collectively, the “Integrated Product”).
34
+ * “Intellectual Property” means any patents, patent rights, trademarks, service
35
+ * marks, registered and unregistered designs, applications for any of the
36
+ * foregoing, copyright, and any other similar protected rights in any country and
37
+ * to the extent recognised by any relevant jurisdiction as intellectual property,
38
+ * trade secrets, know-how and confidential information. Realsee reserves all
39
+ * rights not expressly granted to You.
40
+ * “Realsee” means [Beike Realsee Technology (HK) Limited, a company incorporated
41
+ * and validly existing under the laws of Hong Kong].
42
+ * “SDK” means the Realsee-proprietary Software Development Kits (SDK) provided
43
+ * hereunder, includes all development tools (including any compiler and debugger),
44
+ * application programming interfaces (“APIs”), libraries, binary utilities, header
45
+ * files, Documentation, content, data, code samples, and other materials provided
46
+ * to You in connection with this Agreement, whether delivered through a download,
47
+ * or any other media or form, and is licensed, not sold, to You by Realsee for use
48
+ * only under the terms of this Agreement. The terms of this Agreement will govern
49
+ * any updates provided by Realsee that replace and/or supplement the original SDK
50
+ * delivered to You, unless such update is accompanied by a separate license, in
51
+ * which case the terms of such license will govern.
52
+ * 2. LICENSED USES AND RESTRICTIONS.
53
+ * 2.1 Subject to the restrictions contained in this Section 2, Realsee grants to
54
+ * You during the term, a limited, non-exclusive, revocable, non-sublicensable,
55
+ * non-transferable license to install and use the SDK within the Territory only
56
+ * for the purpose of internal development.
57
+ * 2.2 Restrictions. You acknowledge and agree that, You shall not, and shall
58
+ * ensure that Your affiliates, employees, agents, representatives, officers,
59
+ * representatives, and subcontractors do not (directly or indirectly):
60
+ * 2.2.1 decompile, reverse engineer, disassemble or attempt to derive the source
61
+ * code of, those components of the SDK provided in object code form, or any part
62
+ * thereof;
63
+ * 2.2.2 remove, alter, or obscure any copyright notice or other proprietary rights
64
+ * notice on any part of the SDK;
65
+ * 2.2.3 sell, assign, pledge, rent, lease, lend, upload to or host on any website
66
+ * or server for use by any third party except You, redistribute, or sublicense the
67
+ * SDK (or any part thereof), or operate the SDK (or any part thereof) in the
68
+ * capacity of a service bureau or other hosted services provider, in whole or in
69
+ * part, nor may You enable others to do so;
70
+ * 2.2.4 or alter, modify, customize or improve the SDK, or any part thereof;
71
+ * 2.2.5 use the SDK (or any part thereof) for any illegal purpose, in any manner
72
+ * that is inconsistent with the terms of this Agreement, or to engage in any
73
+ * illegal activity;
74
+ * 2.2.6 use the SDK (or any part thereof) in any manner that may damage the
75
+ * operation of Realsee’s products or services; or
76
+ * 2.2.7 use the SDK or any information contained therein or otherwise provided by
77
+ * Realsee for the purpose of developing, or having developed, any product
78
+ * competitive with any Realsee product or service, as determined by Realsee in its
79
+ * sole discretion;
80
+ * 2.2.8 include any portion of the SDK in Your Developer products.
81
+ * 2.3 Realsee has the right to impose reasonable conditions such as a reasonable
82
+ * fee for use of the SDK in Integrated Product in the future.
83
+ * 2.4 You may make a limited number of copies of the SDK to be used by Your
84
+ * employees or consultants as provided herein, and not for general business
85
+ * purposes, and such employees or consultants shall be subject to the obligations
86
+ * and restrictions in this Agreement.
87
+ * 2.5 All licenses not expressly granted in this Agreement are reserved and no
88
+ * other licenses, immunity, or rights, express or implied, are granted by Realsee,
89
+ * by implication, estoppel, or otherwise.
90
+ * 3. CONFIDENTIALITY.
91
+ * The SDK and all source code, Documentation, specifications, engineering details,
92
+ * and related information pertaining to the SDK, whether in oral, written,
93
+ * graphic, or electronic form, are and shall remain the confidential and
94
+ * proprietary information of Realsee or its licensors (collectively, the
95
+ * “Confidential Information”). You shall (i) disclose Confidential Information to
96
+ * only those directors and employees (collectively, “Affiliates”) whose duties
97
+ * justify their need to know such information and who have been clearly informed
98
+ * of their obligation to maintain the confidential, proprietary, and/or trade
99
+ * secret status of such Confidential Information; and (ii) use Confidential
100
+ * Information solely in accordance with the license granted hereunder. In any
101
+ * event, You and Your Affiliates shall treat Confidential Information as strictly
102
+ * confidential and shall use the same care to prevent disclosure of such
103
+ * information as You use with respect to Your own similar confidential and/or
104
+ * proprietary information, which shall not be less than the care a reasonable
105
+ * person would use under similar circumstances. All Confidential Information, and
106
+ * any copies thereof, shall be returned promptly to Realsee upon request. You
107
+ * shall ensure that Your Affiliates comply with the provisions of this Section 3,
108
+ * and You shall be liable for any breach of this Section 3 resulting from the act
109
+ * or omission of any of Your Affiliates. You shall not disclose Confidential
110
+ * Information to any third party, including, without limitation, any of Your
111
+ * subcontractors.
112
+ * 4. PROPRIETARY RIGHTS.
113
+ * 4.1 As between You and Realsee, Realsee and/or its licensors retain ownership of
114
+ * all right, title, and interest in, to, and under the SDK, including, without
115
+ * limitation, all patents, copyrights, trade secrets, trademarks and other
116
+ * intellectual property and other proprietary rights therein, and reserve all
117
+ * rights not expressly granted to You.
118
+ * 4.2 The items contained in the SDK are the intellectual property of Realsee and
119
+ * its licensors and are protected by PRC copyright and patent law, international
120
+ * treaty provisions and applicable laws of the country in which it is being used.
121
+ * You agree to protect all copyright and other ownership interests of Realsee
122
+ * and/or its licensors in all items in the SDK supplied under this License
123
+ * Agreement. You agree that all copies of the items in the SDK, reproduced for any
124
+ * reason by You, contain the same copyright notices, and other proprietary notices
125
+ * as appropriate, as appear on or in the original items delivered by Realsee in
126
+ * the SDK. Realsee and/or its licensors retain title and ownership of the items in
127
+ * the SDK, the media on which it is loaded, and all subsequent copies, regardless
128
+ * of the form or media in or on which the original and other copies may exist.
129
+ * Except as stated above, this Agreement does not grant You any rights to patents,
130
+ * copyrights, trade secrets, trademarks or any other rights in respect to the
131
+ * items in the SDK.
132
+ * 5. TERM AND TERMINATION.
133
+ * 5.1 This Agreement is effective until terminated. Realsee has the right to
134
+ * terminate this Agreement immediately, without judicial intervention, if You fail
135
+ * to comply with any term herein. Upon any such termination You must remove all
136
+ * full and partial copies of the items in the SDK from Your computer and
137
+ * discontinue the use of the items in the SDK.
138
+ * 5.2 Realsee may at any time, terminate the Agreement with You if: (A) You have
139
+ * breached any provision of the Agreement; or (B) Realsee is required to do so by
140
+ * law; or (C) Realsee decides to no longer provide the SDK or certain parts of the
141
+ * SDK to users in the country in which You are resident or from which You use the
142
+ * service, or the provision of the SDK or certain SDK services to You by Realsee
143
+ * is, in Realsee's sole discretion, no longer legally or commercially viable.
144
+ * 5.3 When the Agreement comes to an end, all of the legal rights, obligations and
145
+ * liabilities that You and Realsee have benefited from, been subject to (or which
146
+ * have accrued over time whilst the Agreement has been in force) or which are
147
+ * expressed to continue indefinitely, shall be unaffected by this cessation, and
148
+ * the provisions of Section 3, 4, 6, 7 and 8 shall continue to apply to such
149
+ * rights, obligations and liabilities indefinitely.
150
+ * 6. DISCLAIMER OF WARRANTY.
151
+ * YOU EXPRESSLY ACKNOWLEDGE AND AGREE THAT, TO THE EXTENT PERMITTED BY APPLICABLE
152
+ * LAW, USE OF THE SDK (OR ANY PART THEREOF) IS AT YOUR SOLE RISK AND THAT THE
153
+ * ENTIRE RISK AS TO SATISFACTORY QUALITY, PERFORMANCE, ACCURACY, AND EFFORT IS
154
+ * WITH YOU. REALSEE LICENSES THE SDK TO YOU ONLY ON AN "AS-IS" BASIS. REALSEE
155
+ * MAKES NO REPRESENTATION WITH RESPECT TO THE ADEQUACY OF ANY ITEMS IN THE SDK,
156
+ * WHETHER OR NOT USED BY YOU IN THE DEVELOPMENT OF INTEGRATED PRODUCT, FOR ANY
157
+ * PARTICULAR PURPOSE OR WITH RESPECT TO THEIR ADEQUACY TO PRODUCE ANY PARTICULAR
158
+ * RESULT. REALSEE AND ITS LICENSORS SHALL NOT BE LIABLE FOR LOSS OR DAMAGE ARISING
159
+ * OUT OF THIS AGREEMENT OR FROM THE DISTRIBUTION OR USE OF INTEGRATED PRODUCT
160
+ * CONTAINING PORTIONS OF THE SDK. REALSEE AND ITS LICENSORS DISCLAIM ALL
161
+ * WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED
162
+ * CONDITIONS OR WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
163
+ * OR NONINFRINGEMENT OF ANY THIRD PARTY RIGHT IN RESPECT OF THE ITEMS IN THE SDK
164
+ * OR ANY SERVICES RELATED TO THE SDK.
165
+ * REALSEE IS UNDER NO OBLIGATION TO PROVIDE ANY SUPPORT UNDER THIS LICENSE
166
+ * AGREEMENT, INCLUDING UPGRADES OR FUTURE VERSIONS OF THE SDK OR ANY PORTIONS
167
+ * THEREOF, TO YOU, END USER OR TO ANY OTHER PARTY.
168
+ * 7. LIMITATION OF LIABILITY.
169
+ * TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, IN NO EVENT WILL REALSEE OR ITS
170
+ * LICENSORS BE LIABLE FOR ANY DIRECT, INCIDENTAL, SPECIAL, INDIRECT, OR
171
+ * CONSEQUENTIAL DAMAGES, INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF USE,
172
+ * LOSS OF BUSINESS, REVENUE, OR PROFITS, LOSS OF OPPORTUNITY (WHETHER DIRECT OR
173
+ * INDIRECT), CORRUPTION OR LOSS OF DATA, LOSS OF REPUTATION OR SAVINGS, DOWNTIME,
174
+ * OR DAMAGE TO, LOSS OF OR REPLACEMENT OF DATA OR TRANSACTIONS, COST OF
175
+ * PROCUREMENT OF SUBSTITUTE SERVICES, BUSINESS INTERRUPTION, OR ANY OTHER
176
+ * COMMERCIAL DAMAGES OR LOSSES, ARISING OUT OF OR RELATED TO YOUR USE OR INABILITY
177
+ * TO USE THE SDK (OR ANY PART THEREOF), ANY INTEGRATED PRODUCT, OR ANY THIRD PARTY
178
+ * SOFTWARE, APPLICATIONS, OR SERVICES IN CONJUNCTION WITH THE SDK (OR ANY PART
179
+ * THEREOF), HOWEVER CAUSED, REGARDLESS OF THE THEORY OF LIABILITY (CONTRACT, TORT,
180
+ * OR OTHERWISE) AND EVEN IF REALSEE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
181
+ * DAMAGES. IN NO EVENT WILL REALSEE’S TOTAL LIABILITY TO YOU FOR ALL DAMAGES
182
+ * EXCEED ONE HUNDRED DOLLARS ($100.00). THE FOREGOING LIMITATIONS WILL APPLY EVEN
183
+ * IF THE ABOVE STATED REMEDY FAILS OF ITS ESSENTIAL PURPOSE. THE LIMITATIONS
184
+ * CONTAINED IN SECTIONS 6 AND THIS SECTION 7 ARE A FUNDAMENTAL PART OF THE BASIS
185
+ * OF REALSEE’S BARGAIN HEREUNDER, AND REALSEE WOULD NOT ENTER INTO THIS AGREEMENT
186
+ * OR PROVIDE YOU WITH ACCESS TO THE SDK ABSENT SUCH LIMITATIONS.
187
+ * 8. INDEMNIFICATION.
188
+ * To the extent permitted by applicable law, You agree to indemnify, defend and
189
+ * hold harmless Realsee, its affiliates and each of their directors, officers,
190
+ * employees, independent contractors, and agents (each a “Realsee Indemnified
191
+ * Party”) from any and all claims, losses, liabilities, damages, expenses, and
192
+ * costs (including without limitation attorneys’ fees and court costs) incurred by
193
+ * a Realsee Indemnified Party as a result of: (i) Your non-compliance with any
194
+ * terms of this Agreement; (ii) Your use of the SDK (or any part thereof); or
195
+ * (iii) Your use of any Integrated Product, including any claim that Integrated
196
+ * Product infringes the copyright, trademark, trade secret or other intellectual
197
+ * property right of a third party.
198
+ * 9. ACKNOWLEDGEMENTS.
199
+ * Portions of the SDK may utilize or include third party software and other
200
+ * copyrighted material. Acknowledgments, licensing terms, and disclaimers for such
201
+ * material are contained in Documentation for the SDK or may otherwise accompany
202
+ * such material, and Your use of such materials governed by their respective
203
+ * terms. In the event of conflict between the terms of this Agreement and an
204
+ * applicable open source or third party agreement, the open source or third party
205
+ * agreement will control solely with respect to the open source software or third
206
+ * party software. Moreover, You shall not subject any items (including not limited
207
+ * to source code, object code, and any software) included in the SDK to any open
208
+ * source license.
209
+ * 10. NON-BLOCKING OF REALSEE DEVELOPMENT.
210
+ * You acknowledge that Realsee is currently developing or may develop technologies
211
+ * and products in the future that have or may have design and/or functionality
212
+ * similar to Integrated Product that You may develop based on Your license herein.
213
+ * Nothing in this Agreement shall impair, limit or curtail Realsee's right to
214
+ * continue with its development, maintenance and/or distribution of Realsee's
215
+ * technology or products.
216
+ * 11. GENERAL.
217
+ * 11.1 Export Control. You may not use or otherwise export or re-export the SDK
218
+ * (or any part thereof) except as authorized by United States law and the laws of
219
+ * the jurisdiction(s) in which the SDK (or any part thereof) was obtained. In
220
+ * particular, but without limitation, the SDK may not be exported or re-exported
221
+ * (i) into any U.S. embargoed countries or (ii) to anyone on the U.S. Treasury
222
+ * Department's list of Specially Designated Nationals or the U.S. Department of
223
+ * Commerce Denied Person's List or Entity List. By using the SDK (or any part
224
+ * thereof), You represent and warrant that You are not located in any such country
225
+ * or on any such list.
226
+ * 11.2 Governing Law. This Agreement and the rights of the parties hereunder shall
227
+ * be governed by and construed in accordance with the laws of People’s Republic of
228
+ * China (for purpose of this Agreement, excluding Hong Kong, Taiwan, and Macau),
229
+ * without reference to its conflict of laws principles. Any dispute, controversy
230
+ * or claim arising from or in connection with this Agreement, or the breach,
231
+ * termination or invalidity thereof, shall be submitted to China International
232
+ * Economic and Trade Arbitration Commission (“CIETAC”) for arbitration in Beijing
233
+ * which shall be conducted in accordance with the CIETAC's arbitration rules in
234
+ * effect at the time of applying for arbitration. The arbitral award is final and
235
+ * binding upon both parties.
236
+ * 11.3 Severability. If any provision of this Agreement is held by a court of
237
+ * competent jurisdiction to be unenforceable for any reason, the remaining
238
+ * provisions hereof will be unaffected and remain in full force and effect.
239
+ * 11.4. Modifications. Realsee reserves the right, from time to time, with or
240
+ * without notice to You, to make revisions to this Agreement in our sole and
241
+ * absolute discretion. The most current version of this Agreement will supersede
242
+ * all previous versions and shall be made available on the website where the SDK
243
+ * is made available, or by such other means as Realsee may determine in its
244
+ * discretion. Any modified versions of this Agreement hereto shall take effect
245
+ * from the time that it is made available. You shall be responsible for regularly
246
+ * checking for notice of any such modifications. You agree that Your continued use
247
+ * of the SDK constitutes Your agreement to the modified Agreement.
248
+ * 11.5 Relationship of the Parties. This Agreement will not be construed as
249
+ * creating an agency, partnership, joint venture, fiduciary duty, or any other
250
+ * form of legal association between You and Realsee, and You will not represent to
251
+ * the contrary, whether expressly, by implication, appearance, or otherwise.
252
+ * 11.6 Entire Agreement; Governing Language. This Agreement constitutes the entire
253
+ * agreement between You and Realsee with respect to the use of the SDK licensed
254
+ * hereunder and supersedes all prior understandings regarding such subject matter.
255
+ * No amendment to or modification of this Agreement will be binding unless in
256
+ * writing and signed by Realsee. You and Realsee hereto confirm that this
257
+ * Agreement and all related documents shall be drafted in English.
258
+ */
259
+
260
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react"),n=require("three"),r=require("@realsee/five");function o(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var u=o(t),i=o(n),a=[],f=[];var c=u.createContext(null);function s(){var e=u.useContext(c);if(!e)throw new Error("FiveProvider never found.");return e.five}function l(){var e=u.useContext(c);if(!e)throw new Error("FiveProvider never found.");return e.loadWork}var d={display:"inline-block",overflow:"hidden"};function v(e,t){var n=s(),r=[n];void 0!==t&&(r=r.concat(t)),u.useLayoutEffect((function(){return e(n.scene)}),r)}var p=v;function h(t){return e.__assign({},t.state)}function m(e){var t=e.camera.getWorldDirection(new i.Vector3);return new i.Raycaster(e.camera.position,t)}function y(e){return e.camera.getWorldDirection(new i.Vector3)}function g(e){return e.model.empty?"Empty":"Loaded"}function S(e,t){return t.indexOf(e)>=0}function b(e,t){for(var n=0,r=Object.keys(t);n<r.length;n++){var o=r[n];void 0!==t[o]&&(e[o]=t[o])}}function C(e,t){if(S("loadWork",t))return e}function w(e,t){if(S("setState",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.setState.apply(e,t)}}function k(e,t){if(S("on",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.on.apply(e,t)}}function x(e,t){if(S("on",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.once.apply(e,t)}}function E(e,t){if(S("off",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.off.apply(e,t)}}function L(e,t){if(S("intersectRaycaster",t))return function(){for(var t,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return(t=e.model).intersectRaycaster.apply(t,n)}}function F(e,t){if(S("project2d",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.project2d.apply(e,t)}}function _(e,t){if(S("updateCamera",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.updateCamera.apply(e,t)}}function P(e,t){if(S("initBasisLoader",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.initBasisLoader.apply(e,t)}}function R(e,t){if(S("getPixels",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.getPixels.apply(e,t)}}function V(e,t){if(S("render",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.render.apply(e,t)}}function W(e,t){if(S("needsRender",t))return function(){e.needsRender=!0}}function M(e,t){if(S("preloadPano",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.preloadPano.apply(e,t)}}function O(e,t){if(S("showFloor",t))return function(t){"number"==typeof t?e.model.show(t):e.model.show()}}function j(e,t){if(S("toggleHelperVisible",t))return function(t){e.helperVisible=t}}function A(e,t){for(var n={},r=t.length,o=-1;++o<r;){var u=t[o];u in e&&(n[u]=e[u])}return n}function N(e,t){for(var n=0;n<e.length;n++)for(var r=0;r<t.length;r++)if(e[n]===t[r])return!0;return!1}var U=function(){function t(e,t){this.values=e,this.listeners=[],this.onValuesChange=t}return t.prototype.on=function(e,t){var n=this,r=[e,t];return this.listeners.push(r),function(){var e=n.listeners.indexOf(r);e>=0&&n.listeners.splice(e,1)}},t.prototype.getValues=function(e){return A(this.values,e)},t.prototype.setValues=function(t,n){var r,o,u=[];for(var i in n)t.indexOf(i)>=0&&(r=n[i],o=this.values[i],!("number"==typeof r&&"number"==typeof o&&isNaN(r)&&isNaN(o)||r===o))&&u.push(i);if(0!==u.length){for(var a=e.__assign({},this.values),f=0,c=u;f<c.length;f++){var s=c[f];this.values[s]=n[s]}this.onValuesChange&&this.onValuesChange(this.values,a);for(var l=0,d=this.listeners;l<d.length;l++){var v=d[l],p=v[0],h=v[1];if(N(p,u)){var m=A(a,p);h(A(this.values,p),m)}}}},t}();exports.FiveCanvas=function(t){var n=t.width,r=t.height,o=s(),i=u.createRef(),a=e.__assign({width:n,height:r},d);return u.useLayoutEffect((function(){if(i.current&&o.renderer){if(null!==o.renderer.domElement.parentNode&&o.renderer.domElement.parentNode!==i.current)throw new Error("There are more than 2 fiveCanvas in this context.");o.renderer.domElement.parentNode!==i.current&&i.current.appendChild(o.renderer.domElement),o.camera.aspect=n/r,o.camera.updateProjectionMatrix(),o.renderer.setSize(n,r),o.needsRender=!0}}),[n,r,i.current]),u.createElement("div",{ref:i,style:a})},exports.INJECTION_PROPNAME="$five",exports.Store=U,exports.createFiveFeature=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e},exports.createFiveProvider=function(t){return void 0===t&&(t={}),function(n){function o(o){var u,c=this;c=n.call(this,o)||this;var s=function(e){var t=void 0===e?{}:e,n=t.backgroundColor,r=void 0===n?1579548:n,o=t.backgroundAlpha,u=void 0===o?1:o,c=t.pixelRatio,s=void 0===c?1:c,l=t.webgl2,d=void 0!==l&&l;if("undefined"!=typeof window){var v=null;if(!(v=d?a.shift():f.shift())){if(d){var p=document.createElement("canvas"),h=p.getContext("webgl2");if(null===h)throw new Error("error occurred when getting webgl2 canvas context");v=new i.WebGLRenderer({antialias:!1,alpha:!0,canvas:p,context:h})}else v=new i.WebGLRenderer({antialias:!1,alpha:!0});v.outputEncoding=i.sRGBEncoding}return v.setPixelRatio(s),v.setClearColor(r,u),v.autoClear=!0,v}}({pixelRatio:1===r.getViewportScale()?window.devicePixelRatio:1,backgroundAlpha:t.backgroundAlpha,backgroundColor:t.backgroundColor,webgl2:null==t?void 0:t.webgl2});return c.five=new r.Five(e.__assign({renderer:s},t)),(o.work||o.initialWork)&&c.five.load(o.work||o.initialWork,o.initialState,void 0,null===(u=o.initialUserAction)||void 0===u||u),c.five.on("load",(function(){var e;c.props.onWorkChange&&c.props.onWorkChange(null===(e=c.five)||void 0===e?void 0:e.work)})),c.five.on("stateChange",(function(e,t){c.props.onStateChange&&c.props.onStateChange(e,t)})),c.five.on("currentStateChange",(function(e,t){c.props.onCurrentStateChange&&c.props.onCurrentStateChange(e,t)})),c.five.on("error",(function(e){c.props.onError?c.props.onError(e):console.warn(e.message)})),c}return e.__extends(o,n),o.prototype.loadWork=function(e,t,n,r){if(void 0===r&&(r=!0),this.props.work)throw new Error("props 'work' is set in fiveProvider, if you need modify work internal, use 'initialWork' instead.");return this.five.load(e,t,n,r)},o.prototype.shouldComponentUpdate=function(e){var t,n;return e.work&&e.work!==(null===(t=this.five)||void 0===t?void 0:t.work)&&(null===(n=this.five)||void 0===n||n.load(e.work,e.initialState)),!0},o.prototype.componentWillUnmount=function(){var e;this.five&&(this.five.dispose(),(e=this.five.renderer)&&(e.capabilities.isWebGL2?-1===f.indexOf(e)&&f.push(e):-1===a.indexOf(e)&&a.push(e)),delete this.five)},o.prototype.render=function(){var e=this;return u.createElement(c.Provider,{value:{five:this.five,loadWork:function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.loadWork.apply(e,t)}}},this.props.children)},o}(u.Component)},exports.createStore=function(t){var n=u.createContext(null);return{useStore:function(t){var r=u.useContext(n);if(null===r)throw new Error("StoreProvider never found.");var o=u.useRef(!0),i=u.useState(r.getValues(t)),a=i[0],f=i[1],c=e.__spreadArray([r],t,!0);return u.useLayoutEffect((function(){return o.current?o.current=!1:f(r.getValues(t)),r.on(t,(function(e){return f(e)}))}),c),[a,u.useCallback((function(e){return r.setValues(t,e)}),c)]},useStoreSetter:function(t){var r=u.useContext(n);if(null===r)throw new Error("StoreProvider never found.");return u.useCallback((function(e){return r.setValues(t,e)}),e.__spreadArray([r],t,!0))},watchStore:function(t,r,o){var i=u.useContext(n);if(null===i)throw new Error("StoreProvider never found.");var a=e.__spreadArray([i],t,!0);void 0!==o&&(a=a.concat(o)),u.useLayoutEffect((function(){return i.on(t,r)}),a)},useStoreAction:function(r){var o=u.useContext(n);if(null===o)throw new Error("StoreProvider never found.");return u.useCallback((function(){for(var n=[],u=0;u<arguments.length;u++)n[u]=arguments[u];var i=t[r],a=i[0],f=i.slice(1),c=function(){return o.getValues(f)},s=function(e){return o.setValues(f,e)};return a.apply(void 0,e.__spreadArray([c,s],n,!1))}),[])},StoreProvider:function(t){function r(e){var n=t.call(this,e)||this;return n.store=new U(e.initialValue,(function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];n.props.onValuesChange&&(e=n.props).onValuesChange.apply(e,t)})),n}return e.__extends(r,t),r.prototype.shouldComponentUpdate=function(e){return e.children!==this.props.children},r.prototype.render=function(){return u.createElement(n.Provider,{value:this.store},this.props.children)},r}(u.Component)}},exports.unsafe__useFiveInstance=function(){return s()},exports.useFiveAction=function(){var e=s();return{updateCamera:u.useCallback((function(t,n){return e.updateCamera(t,n)}),[e]),initBasisLoader:u.useCallback((function(t){return e.initBasisLoader(t)}),[e]),getPixels:u.useCallback((function(t,n,r,o,u){return e.getPixels(t,n,r,o,u)}),[e]),render:u.useCallback((function(t){return e.render(t)}),[e]),needsRender:u.useCallback((function(){return e.needsRender=!0}),[e]),preloadPano:u.useCallback((function(t,n){return e.preloadPano(t,n)}),[e])}},exports.useFiveCameraDirection=function(){var e=s(),t=u.useState((function(){return y(e)})),n=t[0],r=t[1];return u.useLayoutEffect((function(){return e.on("cameraUpdate",(function(){return r(y(e))}))}),[e]),n},exports.useFiveCameraRaycaster=function(){var e=s(),t=u.useState((function(){return m(e)})),n=t[0],r=t[1];return u.useLayoutEffect((function(){return e.on("cameraUpdate",(function(){return r(m(e))}))}),[e]),n},exports.useFiveCurrentObserver=function(){var e=s(),t=u.useState((function(){return e.getCurrentState()})),n=t[0],r=t[1];return u.useLayoutEffect((function(){return e.on("currentStateChange",(function(){return r(e.getCurrentState())}))}),[e]),e.work?e.work.observers[n.panoIndex]:null},exports.useFiveCurrentState=function(){var e=s(),t=u.useState((function(){return e.getCurrentState()})),n=t[0],r=t[1],o=u.useCallback((function(t,n,r){void 0===n&&(n=!1),void 0===r&&(r=!0);var o="function"==typeof t?t(e.getCurrentState()):t;e.setState(o,n,r)}),[e]);return u.useLayoutEffect((function(){return e.on("currentStateChange",(function(){return r(e.getCurrentState())}))}),[e]),[n,o]},exports.useFiveEventCallback=function(e,t,n){var r=s(),o=[r,e];void 0!==n&&(o=o.concat(n)),u.useLayoutEffect((function(){return r.on(e,t)}),o)},exports.useFiveFloor=function(){var e=s(),t=u.useState(e.model.shownFloor),n=t[0],r=t[1],o=u.useState(e.model.floorLength),i=o[0],a=o[1],f=u.useCallback((function(t){"number"==typeof t?e.model.show(t):e.model.show()}),[e]);return u.useLayoutEffect((function(){var t=[];return t.push(e.on("modelShownFloorChange",(function(){return r(e.model.shownFloor)}))),t.push(e.on("modelLoaded",(function(){return a(e.model.floorLength)}))),function(){for(var e;e=t.shift();)e()}}),[e]),[n,i,f]},exports.useFiveHelper=function(){var e=s(),t=u.useState(e.helperVisible),n=t[0],r=t[1],o=u.useCallback((function(t){e.helperVisible=t}),[e]);return u.useLayoutEffect((function(){return e.on("helpersVisibleChange",(function(e){return r(e)}))}),[e]),[n,o]},exports.useFiveModelIntersectRaycaster=function(){var e=s();return u.useCallback((function(t){return e.model.intersectRaycaster(t)}),[e])},exports.useFiveModelReadyState=function(){var e=s(),t=u.useState((function(){return g(e)})),n=t[0],r=t[1];return u.useLayoutEffect((function(){return e.on("modelLoaded",(function(){return r(g(e))}))}),[e]),n},exports.useFiveProject2d=function(){var e=s(),t=u.useState((function(){return Symbol()}));t[0];var n=t[1];return u.useLayoutEffect((function(){return e.on("cameraUpdate",(function(){return n(Symbol())}))}),[e]),u.useCallback((function(t,n){return e.project2d(t,n)}),[e])},exports.useFiveScene=p,exports.useFiveSceneEffect=v,exports.useFiveState=function(){var e=s(),t=u.useState((function(){return h(e)})),n=t[0],r=t[1],o=u.useCallback((function(t,n,r){void 0===n&&(n=!1),void 0===r&&(r=!0);var o="function"==typeof t?t(e.getCurrentState()):t;e.setState(o,n,r)}),[e]);return u.useLayoutEffect((function(){return e.on("stateChange",(function(){return r(h(e))}))}),[e]),[n,o]},exports.useFiveWork=function(){var e=s(),t=l(),n=u.useState((function(){return e.work})),r=n[0],o=n[1];return u.useLayoutEffect((function(){return e.on("load",(function(){return o(e.work)}))}),[e]),[r,t]},exports.withFive=function(t){return function(n){return u.forwardRef((function(r,o){var a=s(),f=l(),c=function(e,t){return[S("unsafe__fiveInstance",t)?e:void 0]}(a,t)[0],d=function(t,n){var r=S("state",n),o=u.useState(Symbol()),i=o[0],a=o[1],f=u.useMemo((function(){if(r)return e.__assign({},t.state)}),[t,i]);return u.useLayoutEffect((function(){if(r)return t.on("stateChange",(function(){return a(Symbol())}))}),[t]),[f,i]}(a,t),v=d[0],p=d[1],h=function(e,t){var n=S("currentState",t),r=u.useState(Symbol()),o=r[0],i=r[1],a=u.useMemo((function(){if(n)return e.getCurrentState()}),[e,o]);return u.useLayoutEffect((function(){if(n)return e.on("currentStateChange",(function(){return i(Symbol())}))}),[e]),[a,o]}(a,t),m=h[0],y=h[1],g=function(e,t){var n=S("currentObserver",t),r=u.useState(Symbol()),o=r[0],i=r[1],a=u.useMemo((function(){if(n)return e.getCurrentState()}),[e,o]);return u.useLayoutEffect((function(){if(n)return e.on("currentStateChange",(function(){return i(Symbol())}))}),[e]),[a?e.work?e.work.observers[a.panoIndex]:null:void 0,o]}(a,t),A=g[0],N=g[1],U=function(e,t){var n=S("work",t),r=u.useState(Symbol()),o=r[0],i=r[1],a=u.useMemo((function(){if(n)return e.work}),[e,o]);return u.useLayoutEffect((function(){if(n)return e.on("load",(function(){return i(Symbol())}))}),[e]),[a,o]}(a,t),D=U[0],I=U[1],B=function(e,t){var n=S("model",t),r=u.useState(Symbol()),o=r[0],i=r[1],a=u.useMemo((function(){if(n)return e.model}),[e,o]);return u.useLayoutEffect((function(){if(n)return e.on("modelLoaded",(function(){return i(Symbol())}))}),[e]),[a,o]}(a,t),q=B[0],G=B[1],H=function(e,t){return[S("scene",t)?e.scene:void 0]}(a,t)[0],z=function(e,t){var n=S("cameraDirection",t),r=u.useState(Symbol()),o=r[0],a=r[1],f=u.useMemo((function(){if(n)return e.camera.getWorldDirection(new i.Vector3)}),[e,o]);return u.useLayoutEffect((function(){if(n)return e.on("cameraUpdate",(function(){return a(Symbol())}))}),[e]),[f,o]}(a,t),T=z[0],$=z[1],J=function(e,t){var n=S("cameraRaycaster",t),r=u.useState(Symbol()),o=r[0],a=r[1],f=u.useMemo((function(){if(n){var t=e.camera.getWorldDirection(new i.Vector3);return new i.Raycaster(e.camera.position,t)}}),[e,o]);return u.useLayoutEffect((function(){if(n)return e.on("cameraUpdate",(function(){return a(Symbol())}))}),[e]),[f,o]}(a,t),K=J[0],Q=J[1],X=function(e,t){var n=S("modelReadyState",t),r=u.useState(Symbol()),o=r[0],i=r[1],a=u.useMemo((function(){if(n)return e.model.empty?"Empty":"Loaded"}),[e,o]);return u.useLayoutEffect((function(){if(n)return e.on("modelLoaded",(function(){return i(Symbol())}))}),[e]),[a,o]}(a,t),Y=X[0],Z=X[1],ee=function(e,t){var n=S("shownFloor",t),r=u.useState(Symbol()),o=r[0],i=r[1],a=u.useMemo((function(){if(n)return e.model.shownFloor}),[e,o]);return u.useLayoutEffect((function(){if(n)return e.on("modelShownFloorChange",(function(){return i(Symbol())}))}),[e]),[a,o]}(a,t),te=ee[0],ne=ee[1],re=function(e,t){var n=S("totalFloorLength",t),r=u.useState(Symbol()),o=r[0],i=r[1],a=u.useMemo((function(){if(n)return e.model.hasFloors()}),[e,o]);return u.useLayoutEffect((function(){if(n)return e.on("modelLoaded",(function(){return i(Symbol())}))}),[e]),[a,o]}(a,t),oe=re[0],ue=re[1],ie=function(e,t){var n=S("helperVisible",t),r=u.useState(Symbol()),o=r[0],i=r[1],a=u.useMemo((function(){if(n)return e.helperVisible}),[e,o]);return u.useLayoutEffect((function(){if(n)return e.on("helpersVisibleChange",(function(){return i(Symbol())}))}),[e]),[a,o]}(a,t),ae=ie[0],fe=ie[1],ce=u.useMemo((function(){var e={};return b(e,{setState:w(a,t),loadWork:C(f,t),on:k(a,t),once:x(a,t),off:E(a,t),intersectRaycaster:L(a,t),project2d:F(a,t),updateCamera:_(a,t),initBasisLoader:P(a,t),getPixels:R(a,t),render:V(a,t),needsRender:W(a,t),preloadPano:M(a,t),showFloor:O(a,t),toggleHelperVisible:j(a,t)}),e}),[a,f]),se=u.useMemo((function(){var t=e.__assign({},ce);return b(t,{unsafe__fiveInstance:c,state:v,currentState:m,currentObserver:A,work:D,model:q,scene:H,cameraDirection:T,cameraRaycaster:K,modelReadyState:Y,shownFloor:te,totalFloorLength:oe,helperVisible:ae}),t}),[a,ce,p,y,N,I,G,$,Q,Z,ne,ue,fe]);return u.createElement(n,e.__assign({ref:o,$five:se},r))}))}};