@realsee/five 6.0.0-alpha.7 → 6.0.0-alpha.71

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 (324) hide show
  1. package/TERMS.txt +0 -2
  2. package/docs/assets/highlight.css +20 -20
  3. package/docs/assets/main.js +59 -52
  4. package/docs/assets/navigation.js +1 -0
  5. package/docs/assets/search.js +1 -1
  6. package/docs/assets/style.css +805 -825
  7. package/docs/classes/five.AnimationFrameLoop.html +16 -15
  8. package/docs/classes/five.BoxBoundingVolume.html +18 -1
  9. package/docs/classes/five.Camera.html +37 -11
  10. package/docs/classes/five.CullingVolume.html +10 -1
  11. package/docs/classes/five.Fetcher.html +5 -0
  12. package/docs/classes/five.Five.html +237 -287
  13. package/docs/classes/five.InternalWebGLRenderer.html +2 -1
  14. package/docs/classes/five.IntersectMesh.html +4 -1
  15. package/docs/classes/five.Model.html +62 -55
  16. package/docs/classes/five.NetworkAbortError.html +2 -0
  17. package/docs/classes/five.NetworkFirbiddenError.html +2 -0
  18. package/docs/classes/five.NetworkResponseError.html +3 -0
  19. package/docs/classes/five.NetworkSubscribe.html +42 -56
  20. package/docs/classes/five.NetworkTimeoutError.html +2 -0
  21. package/docs/classes/five.PBMContainer.html +12 -13
  22. package/docs/classes/five.PBMGroup.html +3 -3
  23. package/docs/classes/five.PBMMesh.html +4 -5
  24. package/docs/classes/five.PBMMeshMaterial.html +50 -45
  25. package/docs/classes/five.PanoCircleMesh.html +30 -7
  26. package/docs/classes/five.PanoCircleMeshCustom.html +30 -7
  27. package/docs/classes/five.PanoCircleMeshSolid.html +30 -7
  28. package/docs/classes/five.RegionBoundingVolume.html +21 -1
  29. package/docs/classes/five.RequestScheduler.html +13 -12
  30. package/docs/classes/five.Scene.html +5 -3
  31. package/docs/classes/five.SphereBoundingVolume.html +17 -1
  32. package/docs/classes/five.Subscribe.html +43 -62
  33. package/docs/classes/five.TextureLoader.html +5 -1
  34. package/docs/classes/five.Tile.html +30 -1
  35. package/docs/classes/five.Tile3DModel.html +28 -1
  36. package/docs/classes/five.TileCubeTextureTarget.html +9 -1
  37. package/docs/classes/five.TileNode.html +4 -1
  38. package/docs/classes/five.Tileset.html +31 -5
  39. package/docs/classes/five.TilesetCache.html +8 -1
  40. package/docs/classes/five.TilesetTraverser.html +19 -1
  41. package/docs/classes/five.Work.html +28 -28
  42. package/docs/classes/five.XRButton.html +3 -1
  43. package/docs/classes/gltf_loader.DDSLoader.html +3 -1
  44. package/docs/classes/gltf_loader.DRACOLoader.html +8 -1
  45. package/docs/classes/gltf_loader.GLTFLoader.html +18 -17
  46. package/docs/classes/gltf_loader.GLTFObject.html +8 -6
  47. package/docs/classes/gltf_loader.GLTFParser.html +6 -1
  48. package/docs/classes/gltf_loader.THREEGLTFLoader.html +8 -1
  49. package/docs/classes/line.Line.html +10 -1
  50. package/docs/classes/line.LineGeometry.html +14 -1
  51. package/docs/classes/line.LineMaterial.html +8 -1
  52. package/docs/classes/line.LineSegmentsGeometry.html +12 -1
  53. package/docs/classes/line.THREE_Line2.html +4 -1
  54. package/docs/classes/line.THREE_LineSegments2.html +4 -1
  55. package/docs/classes/react.Store.html +23 -29
  56. package/docs/classes/sticker.Sticker.html +25 -32
  57. package/docs/classes/vfx.Airflow.html +8 -1
  58. package/docs/classes/vfx.Flame.html +10 -1
  59. package/docs/classes/vfx.Particle.html +79 -82
  60. package/docs/classes/vfx.SpotLight.html +7 -1
  61. package/docs/enums/five.VolumePlaneIntersect.html +4 -1
  62. package/docs/functions/five.defaultImageURLTransform.html +5 -0
  63. package/docs/functions/five.getViewportScale.html +1 -0
  64. package/docs/functions/five.imageSupport.html +1 -0
  65. package/docs/functions/five.isPanoId.html +1 -0
  66. package/docs/functions/five.loadAt3d.html +1 -0
  67. package/docs/functions/five.loadB3dm.html +1 -0
  68. package/docs/functions/five.loadDome.html +1 -0
  69. package/docs/functions/five.loadDomez.html +1 -0
  70. package/docs/functions/five.loadPbm.html +1 -0
  71. package/docs/functions/five.loadPnts.html +1 -0
  72. package/docs/functions/five.panoEqual.html +1 -0
  73. package/docs/functions/five.panoParse.html +1 -0
  74. package/docs/functions/five.panoStringify.html +1 -0
  75. package/docs/functions/five.parseWork.html +7 -0
  76. package/docs/functions/react.FiveCanvas-1.html +6 -0
  77. package/docs/functions/react.createFiveFeature.html +1 -0
  78. package/docs/functions/react.createFiveProvider.html +9 -0
  79. package/docs/functions/react.createStore.html +15 -0
  80. package/docs/functions/react.unsafe__useFiveInstance.html +5 -0
  81. package/docs/functions/react.useFiveAction.html +19 -0
  82. package/docs/functions/react.useFiveCameraDirection.html +3 -0
  83. package/docs/functions/react.useFiveCameraRaycaster.html +3 -0
  84. package/docs/functions/react.useFiveCurrentObserver.html +5 -0
  85. package/docs/functions/react.useFiveCurrentState.html +5 -0
  86. package/docs/functions/react.useFiveEventCallback.html +5 -0
  87. package/docs/functions/react.useFiveFloor.html +5 -0
  88. package/docs/functions/react.useFiveHelper.html +5 -0
  89. package/docs/functions/react.useFiveModelIntersectRaycaster.html +7 -0
  90. package/docs/functions/react.useFiveModelReadyState.html +4 -0
  91. package/docs/functions/react.useFiveProject2d.html +7 -0
  92. package/docs/functions/react.useFiveScene.html +2 -0
  93. package/docs/functions/react.useFiveSceneEffect.html +5 -0
  94. package/docs/functions/react.useFiveState.html +1 -0
  95. package/docs/functions/react.useFiveWork.html +8 -0
  96. package/docs/functions/react.withFive.html +1 -0
  97. package/docs/functions/vue.unsafe__useFiveInject.html +5 -0
  98. package/docs/functions/vue.useFiveAction.html +25 -0
  99. package/docs/functions/vue.useFiveCameraDirection.html +3 -0
  100. package/docs/functions/vue.useFiveCameraRaycaster.html +3 -0
  101. package/docs/functions/vue.useFiveCurrentObserver.html +5 -0
  102. package/docs/functions/vue.useFiveCurrentState.html +5 -0
  103. package/docs/functions/vue.useFiveEventCallback.html +5 -0
  104. package/docs/functions/vue.useFiveFloor.html +5 -0
  105. package/docs/functions/vue.useFiveHelper.html +5 -0
  106. package/docs/functions/vue.useFiveModel.html +2 -0
  107. package/docs/functions/vue.useFiveModelBounding.html +2 -0
  108. package/docs/functions/vue.useFiveModelIntersectRaycaster.html +7 -0
  109. package/docs/functions/vue.useFiveModelReadyState.html +4 -0
  110. package/docs/functions/vue.useFiveProject2d.html +7 -0
  111. package/docs/functions/vue.useFiveScene.html +2 -0
  112. package/docs/functions/vue.useFiveState.html +5 -0
  113. package/docs/functions/vue.useFiveWorks.html +8 -0
  114. package/docs/index.html +35 -79
  115. package/docs/interfaces/five.AddableObject.html +9 -9
  116. package/docs/interfaces/five.AjaxOptions.html +11 -0
  117. package/docs/interfaces/five.AnimationFrame.html +5 -1
  118. package/docs/interfaces/five.BaseEvent.html +5 -1
  119. package/docs/interfaces/five.BoundingVolume.html +14 -1
  120. package/docs/interfaces/five.CameraPose.html +6 -1
  121. package/docs/interfaces/five.ClipperParameter.html +3 -1
  122. package/docs/interfaces/five.DepthPanoramaControllerCustomInitArgs.html +25 -25
  123. package/docs/interfaces/five.EventCallback.html +355 -452
  124. package/docs/interfaces/five.FiveInitArgs.html +84 -86
  125. package/docs/interfaces/five.FloorplanControllerCustomInitArgs.html +17 -15
  126. package/docs/interfaces/five.GestureEvent.html +19 -1
  127. package/docs/interfaces/five.ImageOptions.html +16 -18
  128. package/docs/interfaces/five.ImageURLMappings.html +1 -1
  129. package/docs/interfaces/five.ImageURLOptions.html +15 -15
  130. package/docs/interfaces/five.IntersectEvent.html +8 -1
  131. package/docs/interfaces/five.IntersectMeshInterface.html +3 -3
  132. package/docs/interfaces/five.Intersection.html +3 -7
  133. package/docs/interfaces/five.MapviewControllerCustomInitArgs.html +13 -11
  134. package/docs/interfaces/five.ModeChangeEvent.html +9 -1
  135. package/docs/interfaces/five.ModelControllerCustomInitArgs.html +18 -18
  136. package/docs/interfaces/five.ModelEvent.html +8 -1
  137. package/docs/interfaces/five.ModelLodOptions.html +2 -1
  138. package/docs/interfaces/five.ModelsEvent.html +6 -1
  139. package/docs/interfaces/five.MotionKeyframe.html +4 -1
  140. package/docs/interfaces/five.MovePanoOptions.html +29 -30
  141. package/docs/interfaces/five.NetworkOptions.html +9 -9
  142. package/docs/interfaces/five.NetworkResourceEvent.html +9 -1
  143. package/docs/interfaces/five.ObjectEvent.html +6 -1
  144. package/docs/interfaces/five.PBMPanoPicture.html +7 -7
  145. package/docs/interfaces/five.PBMParameters.html +42 -43
  146. package/docs/interfaces/five.PanoCircleMeshCustomOptions.html +9 -1
  147. package/docs/interfaces/five.PanoCircleMeshInterface.html +21 -10
  148. package/docs/interfaces/five.PanoCircleMeshOptions.html +3 -1
  149. package/docs/interfaces/five.PanoCircleMeshSolidOptions.html +3 -1
  150. package/docs/interfaces/five.PanoEvent.html +11 -1
  151. package/docs/interfaces/five.PanoTextureEvent.html +9 -1
  152. package/docs/interfaces/five.PanoramaControllerCustomInitArgs.html +32 -32
  153. package/docs/interfaces/five.PanoramaLikeControllerCustomInitArgs.html +18 -18
  154. package/docs/interfaces/five.Pose.html +15 -32
  155. package/docs/interfaces/five.RenderEvent.html +7 -1
  156. package/docs/interfaces/five.Scissor.html +11 -12
  157. package/docs/interfaces/five.State.html +20 -21
  158. package/docs/interfaces/five.StateEvent.html +7 -1
  159. package/docs/interfaces/five.SubscribeMixinType.emit.html +1 -1
  160. package/docs/interfaces/five.SubscribeMixinType.hasListener.html +1 -1
  161. package/docs/interfaces/five.SubscribeMixinType.off.html +1 -1
  162. package/docs/interfaces/five.SubscribeMixinType.on.html +1 -1
  163. package/docs/interfaces/five.SubscribeMixinType.once.html +1 -1
  164. package/docs/interfaces/five.SubscribeMixinType.waitUnitl.html +1 -1
  165. package/docs/interfaces/five.TextureOptions.html +18 -20
  166. package/docs/interfaces/five.Tile3DModelLoaderOptions.html +6 -3
  167. package/docs/interfaces/five.TileCubeNode.html +7 -1
  168. package/docs/interfaces/five.TileCubeTree.html +2 -1
  169. package/docs/interfaces/five.TileHeader.html +9 -1
  170. package/docs/interfaces/five.TilesetHeader.html +5 -1
  171. package/docs/interfaces/five.TilesetOptions.html +5 -1
  172. package/docs/interfaces/five.TopviewControllerCustomInitArgs.html +9 -9
  173. package/docs/interfaces/five.VRPanoramaControllerCustomInitArgs.html +28 -28
  174. package/docs/interfaces/five.WebXRAxesParams.html +4 -0
  175. package/docs/interfaces/five.WebXRControllerParams.html +2 -1
  176. package/docs/interfaces/five.WorkCubeImage.html +13 -13
  177. package/docs/interfaces/five.WorkImage.html +20 -21
  178. package/docs/interfaces/five.WorkInitial.html +17 -17
  179. package/docs/interfaces/five.WorkModel.html +12 -13
  180. package/docs/interfaces/five.WorkObserver.html +40 -39
  181. package/docs/interfaces/five.WorkOptions.html +17 -15
  182. package/docs/interfaces/five.WorkResolvedObserver.html +41 -37
  183. package/docs/interfaces/five.WorkTile.html +9 -1
  184. package/docs/interfaces/five.WorkVideo.html +8 -9
  185. package/docs/interfaces/five.WorksEvent.html +9 -1
  186. package/docs/interfaces/five.XRControllerEvent.html +8 -0
  187. package/docs/interfaces/five.XRGestureEvent.html +11 -1
  188. package/docs/interfaces/five.XRPanoramaControllerCustomInitArgs.html +29 -28
  189. package/docs/interfaces/five.XRSessionEvent.html +7 -1
  190. package/docs/interfaces/gltf_loader.DDS.html +7 -1
  191. package/docs/interfaces/gltf_loader.GLTF.html +10 -4
  192. package/docs/interfaces/gltf_loader.GLTFReference.html +3 -1
  193. package/docs/interfaces/gltf_loader.THREEGLTF.html +8 -1
  194. package/docs/interfaces/react.FiveActionReactCallbacks.html +27 -37
  195. package/docs/interfaces/react.FiveInjectionTypes.html +113 -138
  196. package/docs/interfaces/react.PropTypeOfFiveFeatures.html +2 -1
  197. package/docs/interfaces/sticker.IntersectionLike.html +7 -8
  198. package/docs/interfaces/vfx.ParticleArgs.html +67 -68
  199. package/docs/interfaces/vfx.ParticleTweenKeyframe.html +3 -1
  200. package/docs/interfaces/vue.FiveActionVueCallbacks.html +31 -42
  201. package/docs/modules/five.SubscribeMixinType.html +7 -1
  202. package/docs/modules/five.html +171 -631
  203. package/docs/modules/gltf_loader.html +11 -1
  204. package/docs/modules/line.html +8 -1
  205. package/docs/modules/react.FiveCanvas.html +8 -0
  206. package/docs/modules/react.html +37 -130
  207. package/docs/modules/sticker.html +3 -1
  208. package/docs/modules/vfx.html +8 -1
  209. package/docs/modules/vue.html +24 -115
  210. package/docs/types/five.AjaxResponseType.html +1 -0
  211. package/docs/types/five.AjaxResponseTypeMapping.html +1 -0
  212. package/docs/types/five.BoundingVolumeJson.html +1 -0
  213. package/docs/types/five.BoxBoundingVolumeJson.html +1 -0
  214. package/docs/types/five.ControllerCustomInitTypes.html +1 -0
  215. package/docs/types/five.ControllerEventTypes.html +32 -0
  216. package/docs/types/five.CoordinatesSystemTransformer.html +1 -0
  217. package/docs/types/five.EventTypes.html +26 -0
  218. package/docs/types/five.FivePlugin.html +71 -0
  219. package/docs/types/five.FivePluginInit.html +3 -0
  220. package/docs/types/five.FivePluginInstance.html +3 -0
  221. package/docs/types/five.GestureTypes.html +1 -0
  222. package/docs/types/five.LegacyEventType.html +203 -0
  223. package/docs/types/five.LooseWork.html +1 -0
  224. package/docs/types/five.LooseWorkInitial.html +1 -0
  225. package/docs/types/five.LooseWorkModel.html +1 -0
  226. package/docs/types/five.LooseWorkObserver.html +1 -0
  227. package/docs/types/five.LooseWorkPanorama.html +1 -0
  228. package/docs/types/five.LooseWorkVideo.html +1 -0
  229. package/docs/types/five.LooseWorkWithExtrinsics.html +8 -0
  230. package/docs/types/five.Mirror.html +1 -0
  231. package/docs/types/five.Mode.html +11 -0
  232. package/docs/types/five.ModelMaterialValues.html +1 -0
  233. package/docs/types/five.Models.html +12 -0
  234. package/docs/types/five.MotionValue.html +1 -0
  235. package/docs/types/five.NetWorkMeta.html +1 -0
  236. package/docs/types/five.NetworkError.html +1 -0
  237. package/docs/types/five.NetworkErrorCallback.html +1 -0
  238. package/docs/types/five.NetworkProgressCallback.html +1 -0
  239. package/docs/types/five.NetworkResponse.html +1 -0
  240. package/docs/types/five.NetworkState.html +1 -0
  241. package/docs/types/five.NetworkSuccessCallback.html +1 -0
  242. package/docs/types/five.NetworkType.html +1 -0
  243. package/docs/types/five.Pano.html +1 -0
  244. package/docs/types/five.PanoId.html +1 -0
  245. package/docs/types/five.ParseWorkOptions.html +13 -0
  246. package/docs/types/five.ParsedResultType.html +1 -0
  247. package/docs/types/five.PostProcessingType.html +1 -0
  248. package/docs/types/five.RegionBoundingVolumeJson.html +1 -0
  249. package/docs/types/five.RequestResult.html +1 -0
  250. package/docs/types/five.SphereBoundingVolumeJson.html +1 -0
  251. package/docs/types/five.SubscribeEventMap.html +1 -0
  252. package/docs/types/five.TileContentData.html +1 -0
  253. package/docs/types/five.TilesetFrameState.html +1 -0
  254. package/docs/types/five.WebXRControllerKey.html +1 -0
  255. package/docs/types/five.WebXRControllerType.html +1 -0
  256. package/docs/types/five.Works.html +1 -0
  257. package/docs/types/line.LineMaterialParameters.html +1 -0
  258. package/docs/types/react.FiveInjectionActionFeature.html +1 -0
  259. package/docs/types/react.FiveInjectionDataFeature.html +1 -0
  260. package/docs/types/react.FiveInjectionFeature.html +1 -0
  261. package/docs/types/react.FiveProviderPropTypes.html +1 -0
  262. package/docs/types/react.FiveProviderType.html +1 -0
  263. package/docs/types/react.StoreActionMapHanlder.html +1 -0
  264. package/docs/types/react.StoreActionMapType.html +1 -0
  265. package/docs/types/react.StoreProviderType.html +1 -0
  266. package/docs/types/react.StoreValueMapType.html +1 -0
  267. package/docs/types/vfx.ParticleType.html +1 -0
  268. package/docs/types/vue.FiveModelIntersectRaycaster.html +1 -0
  269. package/docs/types/vue.FiveProviderComponent.html +1 -0
  270. package/docs/types/vue.Project2d.html +1 -0
  271. package/docs/variables/five.PROXY_CONTROLLER_EVENT_NAMES.html +1 -0
  272. package/docs/variables/five.defaultPbmParameters.html +1 -0
  273. package/docs/variables/react.INJECTION_PROPNAME.html +1 -0
  274. package/docs/variables/vue.FiveCanvas.html +8 -0
  275. package/docs/variables/vue.FiveProvider.html +8 -0
  276. package/five/index.d.ts +381 -240
  277. package/five/index.js +203 -208
  278. package/five/index.mjs +36481 -0
  279. package/gltf-loader/index.js +198 -203
  280. package/gltf-loader/index.mjs +2696 -0
  281. package/line/index.js +198 -203
  282. package/line/index.mjs +790 -0
  283. package/package.json +43 -7
  284. package/react/index.js +198 -203
  285. package/react/index.mjs +1365 -0
  286. package/scripts/five-plugin-init.js +1 -1
  287. package/scripts/five-quick-start-init.js +1 -1
  288. package/scripts/five-react-component-init.js +1 -1
  289. package/sticker/index.js +198 -203
  290. package/sticker/index.mjs +464 -0
  291. package/templates/plugin/devtools/webpack.example.js +1 -1
  292. package/templates/react-component/devtools/webpack.example.js +1 -1
  293. package/umd/five-gltf-loader.js +255 -1
  294. package/umd/five-line.js +255 -1
  295. package/umd/five-react.js +255 -1
  296. package/umd/five-sticker.js +255 -1
  297. package/umd/five-vfx.js +255 -1
  298. package/umd/five-vue.js +255 -1
  299. package/umd/five.js +357 -2
  300. package/vfx/index.js +198 -203
  301. package/vfx/index.mjs +972 -0
  302. package/vue/index.d.ts +1 -1
  303. package/vue/index.js +198 -203
  304. package/vue/index.mjs +715 -0
  305. package/docs/assets/icons.css +0 -1043
  306. package/docs/assets/icons.png +0 -0
  307. package/docs/assets/icons@2x.png +0 -0
  308. package/docs/assets/widgets.png +0 -0
  309. package/docs/assets/widgets@2x.png +0 -0
  310. package/docs/classes/five.BVH.html +0 -10
  311. package/docs/classes/five.BVHIntersect.html +0 -1
  312. package/docs/classes/five.BVHNode.html +0 -7
  313. package/docs/classes/five.BVHVector3.html +0 -1
  314. package/docs/classes/five.Clipper.html +0 -1
  315. package/docs/classes/five.PBMMaterialReferenceCache.html +0 -1
  316. package/docs/enums/five.PBMPointColorType.html +0 -1
  317. package/docs/enums/five.PBMPointShapeType.html +0 -1
  318. package/docs/enums/five.PBMPointSizeType.html +0 -1
  319. package/docs/modules.html +0 -1
  320. package/umd/five-gltf-loader.js.LICENSE.txt +0 -14
  321. package/umd/five-line.js.LICENSE.txt +0 -14
  322. package/umd/five-react.js.LICENSE.txt +0 -14
  323. package/umd/five-sticker.js.LICENSE.txt +0 -14
  324. package/umd/five.js.LICENSE.txt +0 -100
@@ -0,0 +1,1365 @@
1
+ /**
2
+ * @license
3
+ * @realsee/five
4
+ * Generated: 12/20/2023
5
+ * Version: 6.0.0-alpha.71
6
+ * Terms:
7
+ * Realsee SDK License Agreement
8
+ * Update: July 28, 2021
9
+ * THIS LICENSE AGREEMENT BETWEEN YOU AND 【BEIKE REALSEE TECHNOLOGY (HK)
10
+ * LIMITED】(“Realsee”) FORMS A LEGALLY BINDING CONTRACT BETWEEN YOU AND REALSEE IN
11
+ * RELATION TO YOUR USE OF THE SDK. This License Agreement accompanies the Realsee
12
+ * Software Development Kit(s) for the software and related explanatory materials
13
+ * (the "SDK") and includes any upgrades, modified versions, updates, additions,
14
+ * and copies of the SDK licensed to You by Realsee.
15
+ * BY DOWNLOADING, INSTALLING, OR OTHERWISE ACCESSING OR USING THE SDK, YOU AGREE
16
+ * THAT YOU HAVE READ, UNDERSTOOD, AND AGREE TO BE BOUND BY THIS AGREEMENT. YOU ARE
17
+ * AGREEING ON YOUR OWN BEHALF AND/OR ON BEHALF OF YOUR COMPANY OR ORGANIZATION TO
18
+ * THE TERMS AND CONDITIONS STATED BELOW.
19
+ * This Agreement applies to Your use of the SDK in the country in which You
20
+ * legally install it (“Territory”) and is subject to the laws of such Territory
21
+ * and further subject to Section 12 below. Different terms, conditions, and
22
+ * limitations may apply to the use of the SDK in any additional countries.
23
+ * 1. DEFINITIONS.
24
+ * “Agreement” means this Realsee SDK License Agreement.
25
+ * “Developer”, “You” and “Your” means the person(s) or entity acquiring or using
26
+ * the SDK or otherwise exercising rights under the terms of this Agreement.
27
+ * “Documentation” means the technical or other specifications or documentation
28
+ * that Realsee may provide to You for use in connection with the SDK.
29
+ * “Integrated Product” means any software, website, or on-line service developed
30
+ * by You based on or using the SDK (collectively, the “Integrated Product”).
31
+ * “Intellectual Property” means any patents, patent rights, trademarks, service
32
+ * marks, registered and unregistered designs, applications for any of the
33
+ * foregoing, copyright, and any other similar protected rights in any country and
34
+ * to the extent recognised by any relevant jurisdiction as intellectual property,
35
+ * trade secrets, know-how and confidential information. Realsee reserves all
36
+ * rights not expressly granted to You.
37
+ * “Realsee” means [Beike Realsee Technology (HK) Limited, a company incorporated
38
+ * and validly existing under the laws of Hong Kong].
39
+ * “SDK” means the Realsee-proprietary Software Development Kits (SDK) provided
40
+ * hereunder, includes all development tools (including any compiler and debugger),
41
+ * application programming interfaces (“APIs”), libraries, binary utilities, header
42
+ * files, Documentation, content, data, code samples, and other materials provided
43
+ * to You in connection with this Agreement, whether delivered through a download,
44
+ * or any other media or form, and is licensed, not sold, to You by Realsee for use
45
+ * only under the terms of this Agreement. The terms of this Agreement will govern
46
+ * any updates provided by Realsee that replace and/or supplement the original SDK
47
+ * delivered to You, unless such update is accompanied by a separate license, in
48
+ * which case the terms of such license will govern.
49
+ * 2. LICENSED USES AND RESTRICTIONS.
50
+ * 2.1 Subject to the restrictions contained in this Section 2, Realsee grants to
51
+ * You during the term, a limited, non-exclusive, revocable, non-sublicensable,
52
+ * non-transferable license to install and use the SDK within the Territory only
53
+ * for the purpose of internal development.
54
+ * 2.2 Restrictions. You acknowledge and agree that, You shall not, and shall
55
+ * ensure that Your affiliates, employees, agents, representatives, officers,
56
+ * representatives, and subcontractors do not (directly or indirectly):
57
+ * 2.2.1 decompile, reverse engineer, disassemble or attempt to derive the source
58
+ * code of, those components of the SDK provided in object code form, or any part
59
+ * thereof;
60
+ * 2.2.2 remove, alter, or obscure any copyright notice or other proprietary rights
61
+ * notice on any part of the SDK;
62
+ * 2.2.3 sell, assign, pledge, rent, lease, lend, upload to or host on any website
63
+ * or server for use by any third party except You, redistribute, or sublicense the
64
+ * SDK (or any part thereof), or operate the SDK (or any part thereof) in the
65
+ * capacity of a service bureau or other hosted services provider, in whole or in
66
+ * part, nor may You enable others to do so;
67
+ * 2.2.4 or alter, modify, customize or improve the SDK, or any part thereof;
68
+ * 2.2.5 use the SDK (or any part thereof) for any illegal purpose, in any manner
69
+ * that is inconsistent with the terms of this Agreement, or to engage in any
70
+ * illegal activity;
71
+ * 2.2.6 use the SDK (or any part thereof) in any manner that may damage the
72
+ * operation of Realsee’s products or services; or
73
+ * 2.2.7 use the SDK or any information contained therein or otherwise provided by
74
+ * Realsee for the purpose of developing, or having developed, any product
75
+ * competitive with any Realsee product or service, as determined by Realsee in its
76
+ * sole discretion;
77
+ * 2.2.8 include any portion of the SDK in Your Developer products.
78
+ * 2.3 Realsee has the right to impose reasonable conditions such as a reasonable
79
+ * fee for use of the SDK in Integrated Product in the future.
80
+ * 2.4 You may make a limited number of copies of the SDK to be used by Your
81
+ * employees or consultants as provided herein, and not for general business
82
+ * purposes, and such employees or consultants shall be subject to the obligations
83
+ * and restrictions in this Agreement.
84
+ * 2.5 All licenses not expressly granted in this Agreement are reserved and no
85
+ * other licenses, immunity, or rights, express or implied, are granted by Realsee,
86
+ * by implication, estoppel, or otherwise.
87
+ * 3. CONFIDENTIALITY.
88
+ * The SDK and all source code, Documentation, specifications, engineering details,
89
+ * and related information pertaining to the SDK, whether in oral, written,
90
+ * graphic, or electronic form, are and shall remain the confidential and
91
+ * proprietary information of Realsee or its licensors (collectively, the
92
+ * “Confidential Information”). You shall (i) disclose Confidential Information to
93
+ * only those directors and employees (collectively, “Affiliates”) whose duties
94
+ * justify their need to know such information and who have been clearly informed
95
+ * of their obligation to maintain the confidential, proprietary, and/or trade
96
+ * secret status of such Confidential Information; and (ii) use Confidential
97
+ * Information solely in accordance with the license granted hereunder. In any
98
+ * event, You and Your Affiliates shall treat Confidential Information as strictly
99
+ * confidential and shall use the same care to prevent disclosure of such
100
+ * information as You use with respect to Your own similar confidential and/or
101
+ * proprietary information, which shall not be less than the care a reasonable
102
+ * person would use under similar circumstances. All Confidential Information, and
103
+ * any copies thereof, shall be returned promptly to Realsee upon request. You
104
+ * shall ensure that Your Affiliates comply with the provisions of this Section 3,
105
+ * and You shall be liable for any breach of this Section 3 resulting from the act
106
+ * or omission of any of Your Affiliates. You shall not disclose Confidential
107
+ * Information to any third party, including, without limitation, any of Your
108
+ * subcontractors.
109
+ * 4. PROPRIETARY RIGHTS.
110
+ * 4.1 As between You and Realsee, Realsee and/or its licensors retain ownership of
111
+ * all right, title, and interest in, to, and under the SDK, including, without
112
+ * limitation, all patents, copyrights, trade secrets, trademarks and other
113
+ * intellectual property and other proprietary rights therein, and reserve all
114
+ * rights not expressly granted to You.
115
+ * 4.2 The items contained in the SDK are the intellectual property of Realsee and
116
+ * its licensors and are protected by PRC copyright and patent law, international
117
+ * treaty provisions and applicable laws of the country in which it is being used.
118
+ * You agree to protect all copyright and other ownership interests of Realsee
119
+ * and/or its licensors in all items in the SDK supplied under this License
120
+ * Agreement. You agree that all copies of the items in the SDK, reproduced for any
121
+ * reason by You, contain the same copyright notices, and other proprietary notices
122
+ * as appropriate, as appear on or in the original items delivered by Realsee in
123
+ * the SDK. Realsee and/or its licensors retain title and ownership of the items in
124
+ * the SDK, the media on which it is loaded, and all subsequent copies, regardless
125
+ * of the form or media in or on which the original and other copies may exist.
126
+ * Except as stated above, this Agreement does not grant You any rights to patents,
127
+ * copyrights, trade secrets, trademarks or any other rights in respect to the
128
+ * items in the SDK.
129
+ * 5. TERM AND TERMINATION.
130
+ * 5.1 This Agreement is effective until terminated. Realsee has the right to
131
+ * terminate this Agreement immediately, without judicial intervention, if You fail
132
+ * to comply with any term herein. Upon any such termination You must remove all
133
+ * full and partial copies of the items in the SDK from Your computer and
134
+ * discontinue the use of the items in the SDK.
135
+ * 5.2 Realsee may at any time, terminate the Agreement with You if: (A) You have
136
+ * breached any provision of the Agreement; or (B) Realsee is required to do so by
137
+ * law; or (C) Realsee decides to no longer provide the SDK or certain parts of the
138
+ * SDK to users in the country in which You are resident or from which You use the
139
+ * service, or the provision of the SDK or certain SDK services to You by Realsee
140
+ * is, in Realsee's sole discretion, no longer legally or commercially viable.
141
+ * 5.3 When the Agreement comes to an end, all of the legal rights, obligations and
142
+ * liabilities that You and Realsee have benefited from, been subject to (or which
143
+ * have accrued over time whilst the Agreement has been in force) or which are
144
+ * expressed to continue indefinitely, shall be unaffected by this cessation, and
145
+ * the provisions of Section 3, 4, 6, 7 and 8 shall continue to apply to such
146
+ * rights, obligations and liabilities indefinitely.
147
+ * 6. DISCLAIMER OF WARRANTY.
148
+ * YOU EXPRESSLY ACKNOWLEDGE AND AGREE THAT, TO THE EXTENT PERMITTED BY APPLICABLE
149
+ * LAW, USE OF THE SDK (OR ANY PART THEREOF) IS AT YOUR SOLE RISK AND THAT THE
150
+ * ENTIRE RISK AS TO SATISFACTORY QUALITY, PERFORMANCE, ACCURACY, AND EFFORT IS
151
+ * WITH YOU. REALSEE LICENSES THE SDK TO YOU ONLY ON AN "AS-IS" BASIS. REALSEE
152
+ * MAKES NO REPRESENTATION WITH RESPECT TO THE ADEQUACY OF ANY ITEMS IN THE SDK,
153
+ * WHETHER OR NOT USED BY YOU IN THE DEVELOPMENT OF INTEGRATED PRODUCT, FOR ANY
154
+ * PARTICULAR PURPOSE OR WITH RESPECT TO THEIR ADEQUACY TO PRODUCE ANY PARTICULAR
155
+ * RESULT. REALSEE AND ITS LICENSORS SHALL NOT BE LIABLE FOR LOSS OR DAMAGE ARISING
156
+ * OUT OF THIS AGREEMENT OR FROM THE DISTRIBUTION OR USE OF INTEGRATED PRODUCT
157
+ * CONTAINING PORTIONS OF THE SDK. REALSEE AND ITS LICENSORS DISCLAIM ALL
158
+ * WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED
159
+ * CONDITIONS OR WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
160
+ * OR NONINFRINGEMENT OF ANY THIRD PARTY RIGHT IN RESPECT OF THE ITEMS IN THE SDK
161
+ * OR ANY SERVICES RELATED TO THE SDK.
162
+ * REALSEE IS UNDER NO OBLIGATION TO PROVIDE ANY SUPPORT UNDER THIS LICENSE
163
+ * AGREEMENT, INCLUDING UPGRADES OR FUTURE VERSIONS OF THE SDK OR ANY PORTIONS
164
+ * THEREOF, TO YOU, END USER OR TO ANY OTHER PARTY.
165
+ * 7. LIMITATION OF LIABILITY.
166
+ * TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, IN NO EVENT WILL REALSEE OR ITS
167
+ * LICENSORS BE LIABLE FOR ANY DIRECT, INCIDENTAL, SPECIAL, INDIRECT, OR
168
+ * CONSEQUENTIAL DAMAGES, INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF USE,
169
+ * LOSS OF BUSINESS, REVENUE, OR PROFITS, LOSS OF OPPORTUNITY (WHETHER DIRECT OR
170
+ * INDIRECT), CORRUPTION OR LOSS OF DATA, LOSS OF REPUTATION OR SAVINGS, DOWNTIME,
171
+ * OR DAMAGE TO, LOSS OF OR REPLACEMENT OF DATA OR TRANSACTIONS, COST OF
172
+ * PROCUREMENT OF SUBSTITUTE SERVICES, BUSINESS INTERRUPTION, OR ANY OTHER
173
+ * COMMERCIAL DAMAGES OR LOSSES, ARISING OUT OF OR RELATED TO YOUR USE OR INABILITY
174
+ * TO USE THE SDK (OR ANY PART THEREOF), ANY INTEGRATED PRODUCT, OR ANY THIRD PARTY
175
+ * SOFTWARE, APPLICATIONS, OR SERVICES IN CONJUNCTION WITH THE SDK (OR ANY PART
176
+ * THEREOF), HOWEVER CAUSED, REGARDLESS OF THE THEORY OF LIABILITY (CONTRACT, TORT,
177
+ * OR OTHERWISE) AND EVEN IF REALSEE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
178
+ * DAMAGES. IN NO EVENT WILL REALSEE’S TOTAL LIABILITY TO YOU FOR ALL DAMAGES
179
+ * EXCEED ONE HUNDRED DOLLARS ($100.00). THE FOREGOING LIMITATIONS WILL APPLY EVEN
180
+ * IF THE ABOVE STATED REMEDY FAILS OF ITS ESSENTIAL PURPOSE. THE LIMITATIONS
181
+ * CONTAINED IN SECTIONS 6 AND THIS SECTION 7 ARE A FUNDAMENTAL PART OF THE BASIS
182
+ * OF REALSEE’S BARGAIN HEREUNDER, AND REALSEE WOULD NOT ENTER INTO THIS AGREEMENT
183
+ * OR PROVIDE YOU WITH ACCESS TO THE SDK ABSENT SUCH LIMITATIONS.
184
+ * 8. INDEMNIFICATION.
185
+ * To the extent permitted by applicable law, You agree to indemnify, defend and
186
+ * hold harmless Realsee, its affiliates and each of their directors, officers,
187
+ * employees, independent contractors, and agents (each a “Realsee Indemnified
188
+ * Party”) from any and all claims, losses, liabilities, damages, expenses, and
189
+ * costs (including without limitation attorneys’ fees and court costs) incurred by
190
+ * a Realsee Indemnified Party as a result of: (i) Your non-compliance with any
191
+ * terms of this Agreement; (ii) Your use of the SDK (or any part thereof); or
192
+ * (iii) Your use of any Integrated Product, including any claim that Integrated
193
+ * Product infringes the copyright, trademark, trade secret or other intellectual
194
+ * property right of a third party.
195
+ * 9. ACKNOWLEDGEMENTS.
196
+ * Portions of the SDK may utilize or include third party software and other
197
+ * copyrighted material. Acknowledgments, licensing terms, and disclaimers for such
198
+ * material are contained in Documentation for the SDK or may otherwise accompany
199
+ * such material, and Your use of such materials governed by their respective
200
+ * terms. In the event of conflict between the terms of this Agreement and an
201
+ * applicable open source or third party agreement, the open source or third party
202
+ * agreement will control solely with respect to the open source software or third
203
+ * party software. Moreover, You shall not subject any items (including not limited
204
+ * to source code, object code, and any software) included in the SDK to any open
205
+ * source license.
206
+ * 10. NON-BLOCKING OF REALSEE DEVELOPMENT.
207
+ * You acknowledge that Realsee is currently developing or may develop technologies
208
+ * and products in the future that have or may have design and/or functionality
209
+ * similar to Integrated Product that You may develop based on Your license herein.
210
+ * Nothing in this Agreement shall impair, limit or curtail Realsee's right to
211
+ * continue with its development, maintenance and/or distribution of Realsee's
212
+ * technology or products.
213
+ * 11. GENERAL.
214
+ * 11.1 Export Control. You may not use or otherwise export or re-export the SDK
215
+ * (or any part thereof) except as authorized by United States law and the laws of
216
+ * the jurisdiction(s) in which the SDK (or any part thereof) was obtained. In
217
+ * particular, but without limitation, the SDK may not be exported or re-exported
218
+ * (i) into any U.S. embargoed countries or (ii) to anyone on the U.S. Treasury
219
+ * Department's list of Specially Designated Nationals or the U.S. Department of
220
+ * Commerce Denied Person's List or Entity List. By using the SDK (or any part
221
+ * thereof), You represent and warrant that You are not located in any such country
222
+ * or on any such list.
223
+ * 11.2 Governing Law. This Agreement and the rights of the parties hereunder shall
224
+ * be governed by and construed in accordance with the laws of People’s Republic of
225
+ * China (for purpose of this Agreement, excluding Hong Kong, Taiwan, and Macau),
226
+ * without reference to its conflict of laws principles. Any dispute, controversy
227
+ * or claim arising from or in connection with this Agreement, or the breach,
228
+ * termination or invalidity thereof, shall be submitted to China International
229
+ * Economic and Trade Arbitration Commission (“CIETAC”) for arbitration in Beijing
230
+ * which shall be conducted in accordance with the CIETAC's arbitration rules in
231
+ * effect at the time of applying for arbitration. The arbitral award is final and
232
+ * binding upon both parties.
233
+ * 11.3 Severability. If any provision of this Agreement is held by a court of
234
+ * competent jurisdiction to be unenforceable for any reason, the remaining
235
+ * provisions hereof will be unaffected and remain in full force and effect.
236
+ * 11.4. Modifications. Realsee reserves the right, from time to time, with or
237
+ * without notice to You, to make revisions to this Agreement in our sole and
238
+ * absolute discretion. The most current version of this Agreement will supersede
239
+ * all previous versions and shall be made available on the website where the SDK
240
+ * is made available, or by such other means as Realsee may determine in its
241
+ * discretion. Any modified versions of this Agreement hereto shall take effect
242
+ * from the time that it is made available. You shall be responsible for regularly
243
+ * checking for notice of any such modifications. You agree that Your continued use
244
+ * of the SDK constitutes Your agreement to the modified Agreement.
245
+ * 11.5 Relationship of the Parties. This Agreement will not be construed as
246
+ * creating an agency, partnership, joint venture, fiduciary duty, or any other
247
+ * form of legal association between You and Realsee, and You will not represent to
248
+ * the contrary, whether expressly, by implication, appearance, or otherwise.
249
+ * 11.6 Entire Agreement; Governing Language. This Agreement constitutes the entire
250
+ * agreement between You and Realsee with respect to the use of the SDK licensed
251
+ * hereunder and supersedes all prior understandings regarding such subject matter.
252
+ * No amendment to or modification of this Agreement will be binding unless in
253
+ * writing and signed by Realsee. You and Realsee hereto confirm that this
254
+ * Agreement and all related documents shall be drafted in English.
255
+ */import * as React from "react";
256
+ import * as THREE from "three";
257
+ import { getViewportScale, Five } from "@realsee/five";
258
+ var extendStatics = function(d, b) {
259
+ extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
260
+ d2.__proto__ = b2;
261
+ } || function(d2, b2) {
262
+ for (var p in b2)
263
+ if (Object.prototype.hasOwnProperty.call(b2, p))
264
+ d2[p] = b2[p];
265
+ };
266
+ return extendStatics(d, b);
267
+ };
268
+ function __extends(d, b) {
269
+ if (typeof b !== "function" && b !== null)
270
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
271
+ extendStatics(d, b);
272
+ function __() {
273
+ this.constructor = d;
274
+ }
275
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
276
+ }
277
+ var __assign = function() {
278
+ __assign = Object.assign || function __assign2(t) {
279
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
280
+ s = arguments[i];
281
+ for (var p in s)
282
+ if (Object.prototype.hasOwnProperty.call(s, p))
283
+ t[p] = s[p];
284
+ }
285
+ return t;
286
+ };
287
+ return __assign.apply(this, arguments);
288
+ };
289
+ function __spreadArray(to, from, pack) {
290
+ if (pack || arguments.length === 2)
291
+ for (var i = 0, l = from.length, ar; i < l; i++) {
292
+ if (ar || !(i in from)) {
293
+ if (!ar)
294
+ ar = Array.prototype.slice.call(from, 0, i);
295
+ ar[i] = from[i];
296
+ }
297
+ }
298
+ return to.concat(ar || Array.prototype.slice.call(from));
299
+ }
300
+ typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
301
+ var e = new Error(message);
302
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
303
+ };
304
+ var webglPool = [];
305
+ var webgl2Pool = [];
306
+ function getRenderer(_a) {
307
+ var _b = _a === void 0 ? {} : _a, _c = _b.backgroundColor, backgroundColor = _c === void 0 ? 1579548 : _c, _d = _b.backgroundAlpha, backgroundAlpha = _d === void 0 ? 1 : _d, _e = _b.pixelRatio, pixelRatio = _e === void 0 ? 1 : _e, _f = _b.webgl2, webgl2 = _f === void 0 ? false : _f;
308
+ if (typeof window === "undefined")
309
+ return;
310
+ var renderer = null;
311
+ if (webgl2) {
312
+ renderer = webglPool.shift();
313
+ } else {
314
+ renderer = webgl2Pool.shift();
315
+ }
316
+ if (!renderer) {
317
+ if (webgl2) {
318
+ var canvas = document.createElement("canvas");
319
+ var context = canvas.getContext("webgl2");
320
+ if (context === null) {
321
+ throw new Error("error occurred when getting webgl2 canvas context");
322
+ }
323
+ renderer = new THREE.WebGLRenderer({ antialias: false, alpha: true, canvas, context });
324
+ } else {
325
+ renderer = new THREE.WebGLRenderer({ antialias: false, alpha: true });
326
+ }
327
+ renderer.outputEncoding = THREE.sRGBEncoding;
328
+ }
329
+ renderer.setPixelRatio(pixelRatio);
330
+ renderer.setClearColor(backgroundColor, backgroundAlpha);
331
+ renderer.autoClear = true;
332
+ return renderer;
333
+ }
334
+ function revokeRenderer(renderer) {
335
+ if (!renderer)
336
+ return;
337
+ var webgl2 = renderer.capabilities.isWebGL2;
338
+ if (webgl2) {
339
+ if (webgl2Pool.indexOf(renderer) === -1) {
340
+ webgl2Pool.push(renderer);
341
+ }
342
+ } else {
343
+ if (webglPool.indexOf(renderer) === -1) {
344
+ webglPool.push(renderer);
345
+ }
346
+ }
347
+ }
348
+ var FiveContext = React.createContext(null);
349
+ function useFiveInstance() {
350
+ var context = React.useContext(FiveContext);
351
+ if (!context)
352
+ throw new Error("FiveProvider never found.");
353
+ return context.five;
354
+ }
355
+ function useFiveWorkLoader() {
356
+ var context = React.useContext(FiveContext);
357
+ if (!context)
358
+ throw new Error("FiveProvider never found.");
359
+ return context.loadWork;
360
+ }
361
+ function workEqual(work1, work2) {
362
+ var work1Array = Array.isArray(work1) ? work1 : [work1];
363
+ var work2Array = Array.isArray(work2) ? work2 : [work2];
364
+ if (work1Array.length !== work2Array.length) {
365
+ return false;
366
+ }
367
+ for (var i = 0; i < work1Array.length; i++) {
368
+ if (work1Array[i].workCode !== work2Array[i].workCode) {
369
+ return false;
370
+ }
371
+ }
372
+ return true;
373
+ }
374
+ function createFiveProvider(fiveInitArgs) {
375
+ if (fiveInitArgs === void 0) {
376
+ fiveInitArgs = {};
377
+ }
378
+ return (
379
+ /** @class */
380
+ function(_super) {
381
+ __extends(FiveProvider, _super);
382
+ function FiveProvider() {
383
+ var _this = _super !== null && _super.apply(this, arguments) || this;
384
+ _this.unmout = false;
385
+ return _this;
386
+ }
387
+ FiveProvider.prototype.loadWork = function(works, state, duration, userAction) {
388
+ if (userAction === void 0) {
389
+ userAction = true;
390
+ }
391
+ if (this.props.work) {
392
+ throw new Error("props 'works' is set in fiveProvider, if you need modify work internal, use 'initialWork' instead.");
393
+ }
394
+ return this.five.load(works, state, duration, userAction);
395
+ };
396
+ FiveProvider.prototype.shouldComponentUpdate = function(nextProps) {
397
+ if (this.five && nextProps.work && !workEqual(nextProps.work, this.five.works)) {
398
+ this.five.load(nextProps.work, nextProps.initialState);
399
+ }
400
+ return true;
401
+ };
402
+ FiveProvider.prototype.componentWillUnmount = function() {
403
+ this.unmout = true;
404
+ if (this.five) {
405
+ this.five.dispose();
406
+ revokeRenderer(this.five.renderer);
407
+ delete this.five;
408
+ }
409
+ };
410
+ FiveProvider.prototype.render = function() {
411
+ var _this = this;
412
+ var _a;
413
+ if (this.unmout) {
414
+ return null;
415
+ }
416
+ if (!this.five) {
417
+ var viewportScale = getViewportScale();
418
+ var pixelRatio = viewportScale === 1 ? window.devicePixelRatio : 1;
419
+ var renderer = getRenderer({
420
+ pixelRatio,
421
+ backgroundAlpha: fiveInitArgs.backgroundAlpha,
422
+ backgroundColor: fiveInitArgs.backgroundColor,
423
+ webgl2: fiveInitArgs === null || fiveInitArgs === void 0 ? void 0 : fiveInitArgs.webgl2
424
+ });
425
+ this.five = new Five(__assign({ renderer }, fiveInitArgs));
426
+ var inputWork = this.props.work || this.props.initialWork;
427
+ if (inputWork) {
428
+ this.five.load(inputWork, this.props.initialState, void 0, (_a = this.props.initialUserAction) !== null && _a !== void 0 ? _a : true);
429
+ }
430
+ this.five.on("load", function() {
431
+ if (_this.props.onWorksChange) {
432
+ _this.props.onWorksChange(_this.five.works);
433
+ }
434
+ });
435
+ this.five.on("stateChange", function(state, userAction) {
436
+ if (_this.props.onStateChange) {
437
+ _this.props.onStateChange(state, userAction);
438
+ }
439
+ });
440
+ this.five.on("currentStateChange", function(state, userAction) {
441
+ if (_this.props.onCurrentStateChange) {
442
+ _this.props.onCurrentStateChange(state, userAction);
443
+ }
444
+ });
445
+ this.five.on("error", function(error) {
446
+ if (_this.props.onError) {
447
+ _this.props.onError(error);
448
+ } else {
449
+ console.warn(error.message);
450
+ }
451
+ });
452
+ }
453
+ return React.createElement(FiveContext.Provider, {
454
+ value: {
455
+ five: this.five,
456
+ loadWork: function() {
457
+ var args = [];
458
+ for (var _i = 0; _i < arguments.length; _i++) {
459
+ args[_i] = arguments[_i];
460
+ }
461
+ return _this.loadWork.apply(_this, args);
462
+ }
463
+ }
464
+ }, this.props.children);
465
+ };
466
+ return FiveProvider;
467
+ }(React.Component)
468
+ );
469
+ }
470
+ var baseStyle = {
471
+ display: "inline-block",
472
+ overflow: "hidden"
473
+ };
474
+ var FiveCanvas = function(_a) {
475
+ var width = _a.width, height = _a.height;
476
+ var five = useFiveInstance();
477
+ var containerRef = React.createRef();
478
+ var style = __assign({ width, height }, baseStyle);
479
+ React.useLayoutEffect(function() {
480
+ if (!containerRef.current)
481
+ return;
482
+ if (!five.renderer)
483
+ return;
484
+ if (five.renderer.domElement.parentNode !== null && five.renderer.domElement.parentNode !== containerRef.current) {
485
+ throw new Error("There are more than 2 fiveCanvas in this context.");
486
+ }
487
+ if (five.renderer.domElement.parentNode !== containerRef.current) {
488
+ containerRef.current.appendChild(five.renderer.domElement);
489
+ }
490
+ five.camera.aspect = width / height;
491
+ five.camera.updateProjectionMatrix();
492
+ five.renderer.setSize(width, height);
493
+ five.needsRender = true;
494
+ }, [width, height, containerRef.current]);
495
+ return React.createElement("div", { ref: containerRef, style });
496
+ };
497
+ function unsafe__useFiveInstance() {
498
+ return useFiveInstance();
499
+ }
500
+ function useFiveSceneEffect(callback, deps) {
501
+ var five = useFiveInstance();
502
+ var dependencyList = [five];
503
+ if (deps !== void 0) {
504
+ dependencyList = dependencyList.concat(deps);
505
+ }
506
+ React.useLayoutEffect(function() {
507
+ return callback(five.scene);
508
+ }, dependencyList);
509
+ }
510
+ var useFiveScene$1 = useFiveSceneEffect;
511
+ function useFiveWork$1() {
512
+ var five = useFiveInstance();
513
+ var loadWork = useFiveWorkLoader();
514
+ var _a = React.useState(function() {
515
+ return five.works;
516
+ }), works = _a[0], updateWorks = _a[1];
517
+ React.useLayoutEffect(function() {
518
+ return five.on("load", function() {
519
+ return updateWorks(five.works);
520
+ });
521
+ }, [five]);
522
+ return [works, loadWork];
523
+ }
524
+ function getState(five) {
525
+ return __assign({}, five.state);
526
+ }
527
+ function useFiveState$1() {
528
+ var five = useFiveInstance();
529
+ var _a = React.useState(function() {
530
+ return getState(five);
531
+ }), state = _a[0], updateState = _a[1];
532
+ var setState = React.useCallback(function(state2, immediately, userAction) {
533
+ if (immediately === void 0) {
534
+ immediately = false;
535
+ }
536
+ if (userAction === void 0) {
537
+ userAction = true;
538
+ }
539
+ var nextState = typeof state2 === "function" ? state2(five.getCurrentState()) : state2;
540
+ five.setState(nextState, immediately, userAction);
541
+ }, [five]);
542
+ React.useLayoutEffect(function() {
543
+ return five.on("stateChange", function() {
544
+ return updateState(getState(five));
545
+ });
546
+ }, [five]);
547
+ return [state, setState];
548
+ }
549
+ function useFiveCurrentState$1() {
550
+ var five = useFiveInstance();
551
+ var _a = React.useState(function() {
552
+ return five.getCurrentState();
553
+ }), currentState = _a[0], updateCurrentState = _a[1];
554
+ var setState = React.useCallback(function(state, immediately, userAction) {
555
+ if (immediately === void 0) {
556
+ immediately = false;
557
+ }
558
+ if (userAction === void 0) {
559
+ userAction = true;
560
+ }
561
+ var nextState = typeof state === "function" ? state(five.getCurrentState()) : state;
562
+ five.setState(nextState, immediately, userAction);
563
+ }, [five]);
564
+ React.useLayoutEffect(function() {
565
+ return five.on("currentStateChange", function() {
566
+ return updateCurrentState(five.getCurrentState());
567
+ });
568
+ }, [five]);
569
+ return [currentState, setState];
570
+ }
571
+ function useFiveCurrentObserver() {
572
+ var five = useFiveInstance();
573
+ var _a = React.useState(function() {
574
+ return five.getCurrentState();
575
+ }), currentState = _a[0], updateCurrentState = _a[1];
576
+ React.useLayoutEffect(function() {
577
+ return five.on("currentStateChange", function() {
578
+ return updateCurrentState(five.getCurrentState());
579
+ });
580
+ }, [five]);
581
+ return five.works.getResolvedObserver(currentState);
582
+ }
583
+ function useFiveEventCallback(name, callback, deps) {
584
+ var five = useFiveInstance();
585
+ var dependencyList = [five, name];
586
+ if (deps !== void 0) {
587
+ dependencyList = dependencyList.concat(deps);
588
+ }
589
+ React.useLayoutEffect(function() {
590
+ return five.on(name, callback);
591
+ }, dependencyList);
592
+ }
593
+ function useFiveAction() {
594
+ var five = useFiveInstance();
595
+ var updateCamera = React.useCallback(function(pose, duration) {
596
+ return five.updateCamera(pose, duration);
597
+ }, [five]);
598
+ var getPixels = React.useCallback(function(x, y, width, height, pixelRatio) {
599
+ return five.getPixels(x, y, width, height, pixelRatio);
600
+ }, [five]);
601
+ var render = React.useCallback(function(callback) {
602
+ return five.render(callback);
603
+ }, [five]);
604
+ var needsRender = React.useCallback(function() {
605
+ return five.needsRender = true;
606
+ }, [five]);
607
+ var preloadPano = React.useCallback(function(pano, callback) {
608
+ return five.preloadPano(pano, callback);
609
+ }, [five]);
610
+ return { updateCamera, getPixels, render, needsRender, preloadPano };
611
+ }
612
+ function useFiveProject2d$1() {
613
+ var five = useFiveInstance();
614
+ var _a = React.useState(function() {
615
+ return Symbol();
616
+ });
617
+ _a[0];
618
+ var upadte = _a[1];
619
+ React.useLayoutEffect(function() {
620
+ return five.on("cameraUpdate", function() {
621
+ return upadte(Symbol());
622
+ });
623
+ }, [five]);
624
+ var preject2d = React.useCallback(function(vector, testModel) {
625
+ return five.project2d(vector, testModel);
626
+ }, [five]);
627
+ return preject2d;
628
+ }
629
+ function getRaycaster(five) {
630
+ var direction = five.camera.getWorldDirection(new THREE.Vector3());
631
+ var raycaster = new THREE.Raycaster(five.camera.position, direction);
632
+ return raycaster;
633
+ }
634
+ function useFiveCameraRaycaster$1() {
635
+ var five = useFiveInstance();
636
+ var _a = React.useState(function() {
637
+ return getRaycaster(five);
638
+ }), raycaster = _a[0], updateRaycaster = _a[1];
639
+ React.useLayoutEffect(function() {
640
+ return five.on("cameraUpdate", function() {
641
+ return updateRaycaster(getRaycaster(five));
642
+ });
643
+ }, [five]);
644
+ return raycaster;
645
+ }
646
+ function getDirection(five) {
647
+ return five.camera.getWorldDirection(new THREE.Vector3());
648
+ }
649
+ function useFiveCameraDirection$1() {
650
+ var five = useFiveInstance();
651
+ var _a = React.useState(function() {
652
+ return getDirection(five);
653
+ }), direction = _a[0], updateDirection = _a[1];
654
+ React.useLayoutEffect(function() {
655
+ return five.on("cameraUpdate", function() {
656
+ return updateDirection(getDirection(five));
657
+ });
658
+ }, [five]);
659
+ return direction;
660
+ }
661
+ function useFiveModelIntersectRaycaster$1() {
662
+ var five = useFiveInstance();
663
+ var fiveModelIntersectRaycaster = React.useCallback(function(raycaster) {
664
+ return five.model.intersectRaycaster(raycaster);
665
+ }, [five]);
666
+ return fiveModelIntersectRaycaster;
667
+ }
668
+ function getReadyState(five) {
669
+ return five.model.empty ? "Empty" : "Loaded";
670
+ }
671
+ function useFiveModelReadyState$1() {
672
+ var five = useFiveInstance();
673
+ var _a = React.useState(function() {
674
+ return getReadyState(five);
675
+ }), readyState = _a[0], updateReadyState = _a[1];
676
+ React.useLayoutEffect(function() {
677
+ return five.on("modelLoaded", function() {
678
+ return updateReadyState(getReadyState(five));
679
+ });
680
+ }, [five]);
681
+ return readyState;
682
+ }
683
+ function useFiveFloor() {
684
+ var five = useFiveInstance();
685
+ var _a = React.useState(five.model.shownFloor), shownFloor = _a[0], updateShownFloor = _a[1];
686
+ var _b = React.useState(five.model.floorLength), totalFloorLength = _b[0], updateTotalFloorLength = _b[1];
687
+ var showFloor = React.useCallback(function(floorIndex) {
688
+ if (typeof floorIndex === "number") {
689
+ five.model.show(floorIndex);
690
+ } else {
691
+ five.model.show();
692
+ }
693
+ }, [five]);
694
+ React.useLayoutEffect(function() {
695
+ var off = [];
696
+ off.push(five.on("modelShownFloorChange", function() {
697
+ return updateShownFloor(five.model.shownFloor);
698
+ }));
699
+ off.push(five.on("modelLoaded", function() {
700
+ return updateTotalFloorLength(five.model.floorLength);
701
+ }));
702
+ return function() {
703
+ var callback;
704
+ while (callback = off.shift()) {
705
+ callback();
706
+ }
707
+ };
708
+ }, [five]);
709
+ return [shownFloor, totalFloorLength, showFloor];
710
+ }
711
+ function useFiveHelper() {
712
+ var five = useFiveInstance();
713
+ var _a = React.useState(five.helperVisible), helperVisible = _a[0], updateHelperVisible = _a[1];
714
+ var toggleHelperVisible = React.useCallback(function(visible) {
715
+ five.helperVisible = visible;
716
+ }, [five]);
717
+ React.useLayoutEffect(function() {
718
+ return five.on("helpersVisibleChange", function(visible) {
719
+ return updateHelperVisible(visible);
720
+ });
721
+ }, [five]);
722
+ return [helperVisible, toggleHelperVisible];
723
+ }
724
+ var INJECTION_PROPNAME = "$five";
725
+ function hasFeature(feature, features) {
726
+ return features.indexOf(feature) >= 0;
727
+ }
728
+ function injectObject(object, assign) {
729
+ for (var _i = 0, _a = Object.keys(assign); _i < _a.length; _i++) {
730
+ var name_1 = _a[_i];
731
+ if (assign[name_1] !== void 0)
732
+ object[name_1] = assign[name_1];
733
+ }
734
+ }
735
+ function useFiveState(five, features) {
736
+ var enable = hasFeature("state", features);
737
+ var _a = React.useState(Symbol()), updated = _a[0], update = _a[1];
738
+ var state = React.useMemo(function() {
739
+ if (enable) {
740
+ return __assign({}, five.state);
741
+ }
742
+ }, [five, updated]);
743
+ React.useLayoutEffect(function() {
744
+ if (enable) {
745
+ return five.on("stateChange", function() {
746
+ return update(Symbol());
747
+ });
748
+ }
749
+ }, [five]);
750
+ return [state, updated];
751
+ }
752
+ function useFiveCurrentState(five, features) {
753
+ var enable = hasFeature("currentState", features);
754
+ var _a = React.useState(Symbol()), updated = _a[0], update = _a[1];
755
+ var currentState = React.useMemo(function() {
756
+ if (enable) {
757
+ return five.getCurrentState();
758
+ }
759
+ }, [five, updated]);
760
+ React.useLayoutEffect(function() {
761
+ if (enable) {
762
+ return five.on("currentStateChange", function() {
763
+ return update(Symbol());
764
+ });
765
+ }
766
+ }, [five]);
767
+ return [currentState, updated];
768
+ }
769
+ function useFivecurrentObserver(five, features) {
770
+ var enable = hasFeature("currentObserver", features);
771
+ var _a = React.useState(Symbol()), updated = _a[0], update = _a[1];
772
+ var currentState = React.useMemo(function() {
773
+ if (enable) {
774
+ return five.getCurrentState();
775
+ }
776
+ }, [five, updated]);
777
+ React.useLayoutEffect(function() {
778
+ if (enable) {
779
+ return five.on("currentStateChange", function() {
780
+ return update(Symbol());
781
+ });
782
+ }
783
+ }, [five]);
784
+ var observer = void 0;
785
+ if (currentState) {
786
+ observer = five.works.getResolvedObserver(currentState);
787
+ }
788
+ return [observer, updated];
789
+ }
790
+ function useUnsafe__fiveInstance(five, features) {
791
+ var enable = hasFeature("unsafe__fiveInstance", features);
792
+ return [enable ? five : void 0];
793
+ }
794
+ function useFiveWork(five, features) {
795
+ var enable = hasFeature("works", features);
796
+ var _a = React.useState(Symbol()), updated = _a[0], update = _a[1];
797
+ var work = React.useMemo(function() {
798
+ if (enable) {
799
+ return five.works;
800
+ }
801
+ }, [five, updated]);
802
+ React.useLayoutEffect(function() {
803
+ if (enable) {
804
+ return five.on("load", function() {
805
+ return update(Symbol());
806
+ });
807
+ }
808
+ }, [five]);
809
+ return [work, updated];
810
+ }
811
+ function useFiveModel(five, features) {
812
+ var enable = hasFeature("model", features);
813
+ var _a = React.useState(Symbol()), updated = _a[0], update = _a[1];
814
+ var model = React.useMemo(function() {
815
+ if (enable) {
816
+ return five.model;
817
+ }
818
+ }, [five, updated]);
819
+ React.useLayoutEffect(function() {
820
+ if (enable) {
821
+ return five.on("modelLoaded", function() {
822
+ return update(Symbol());
823
+ });
824
+ }
825
+ }, [five]);
826
+ return [model, updated];
827
+ }
828
+ function useFiveScene(five, features) {
829
+ var enable = hasFeature("scene", features);
830
+ return [enable ? five.scene : void 0];
831
+ }
832
+ function useFiveCameraDirection(five, features) {
833
+ var enable = hasFeature("cameraDirection", features);
834
+ var _a = React.useState(Symbol()), updated = _a[0], update = _a[1];
835
+ var cameraDirection = React.useMemo(function() {
836
+ if (enable) {
837
+ return five.camera.getWorldDirection(new THREE.Vector3());
838
+ }
839
+ }, [five, updated]);
840
+ React.useLayoutEffect(function() {
841
+ if (enable) {
842
+ return five.on("cameraUpdate", function() {
843
+ return update(Symbol());
844
+ });
845
+ }
846
+ }, [five]);
847
+ return [cameraDirection, updated];
848
+ }
849
+ function useFiveCameraRaycaster(five, features) {
850
+ var enable = hasFeature("cameraRaycaster", features);
851
+ var _a = React.useState(Symbol()), updated = _a[0], update = _a[1];
852
+ var cameraRaycaster = React.useMemo(function() {
853
+ if (enable) {
854
+ var direction = five.camera.getWorldDirection(new THREE.Vector3());
855
+ var raycaster = new THREE.Raycaster(five.camera.position, direction);
856
+ return raycaster;
857
+ }
858
+ }, [five, updated]);
859
+ React.useLayoutEffect(function() {
860
+ if (enable) {
861
+ return five.on("cameraUpdate", function() {
862
+ return update(Symbol());
863
+ });
864
+ }
865
+ }, [five]);
866
+ return [cameraRaycaster, updated];
867
+ }
868
+ function useFiveModelReadyState(five, features) {
869
+ var enable = hasFeature("modelReadyState", features);
870
+ var _a = React.useState(Symbol()), updated = _a[0], update = _a[1];
871
+ var modelReadyState = React.useMemo(function() {
872
+ if (enable) {
873
+ return five.model.empty ? "Empty" : "Loaded";
874
+ }
875
+ }, [five, updated]);
876
+ React.useLayoutEffect(function() {
877
+ if (enable) {
878
+ return five.on("modelLoaded", function() {
879
+ return update(Symbol());
880
+ });
881
+ }
882
+ }, [five]);
883
+ return [modelReadyState, updated];
884
+ }
885
+ function useFiveShownFloor(five, features) {
886
+ var enable = hasFeature("shownFloor", features);
887
+ var _a = React.useState(Symbol()), updated = _a[0], update = _a[1];
888
+ var shownFloor = React.useMemo(function() {
889
+ if (enable) {
890
+ return five.model.shownFloor;
891
+ }
892
+ }, [five, updated]);
893
+ React.useLayoutEffect(function() {
894
+ if (enable) {
895
+ return five.on("modelShownFloorChange", function() {
896
+ return update(Symbol());
897
+ });
898
+ }
899
+ }, [five]);
900
+ return [shownFloor, updated];
901
+ }
902
+ function useHelperVisible(five, features) {
903
+ var enable = hasFeature("helperVisible", features);
904
+ var _a = React.useState(Symbol()), updated = _a[0], update = _a[1];
905
+ var helperVisible = React.useMemo(function() {
906
+ if (enable) {
907
+ return five.helperVisible;
908
+ }
909
+ }, [five, updated]);
910
+ React.useLayoutEffect(function() {
911
+ if (enable) {
912
+ return five.on("helpersVisibleChange", function() {
913
+ return update(Symbol());
914
+ });
915
+ }
916
+ }, [five]);
917
+ return [helperVisible, updated];
918
+ }
919
+ function useFiveLoadWork(loadWork, features) {
920
+ if (hasFeature("loadWork", features)) {
921
+ return loadWork;
922
+ }
923
+ }
924
+ function useFiveSetState(five, features) {
925
+ if (hasFeature("setState", features)) {
926
+ return function() {
927
+ var args = [];
928
+ for (var _i = 0; _i < arguments.length; _i++) {
929
+ args[_i] = arguments[_i];
930
+ }
931
+ return five.setState.apply(five, args);
932
+ };
933
+ }
934
+ }
935
+ function useFiveOn(five, features) {
936
+ if (hasFeature("on", features)) {
937
+ return function() {
938
+ var args = [];
939
+ for (var _i = 0; _i < arguments.length; _i++) {
940
+ args[_i] = arguments[_i];
941
+ }
942
+ return five.on.apply(five, args);
943
+ };
944
+ }
945
+ }
946
+ function useFiveOnce(five, features) {
947
+ if (hasFeature("on", features)) {
948
+ return function() {
949
+ var args = [];
950
+ for (var _i = 0; _i < arguments.length; _i++) {
951
+ args[_i] = arguments[_i];
952
+ }
953
+ return five.once.apply(five, args);
954
+ };
955
+ }
956
+ }
957
+ function useFiveOff(five, features) {
958
+ if (hasFeature("off", features)) {
959
+ return function() {
960
+ var args = [];
961
+ for (var _i = 0; _i < arguments.length; _i++) {
962
+ args[_i] = arguments[_i];
963
+ }
964
+ return five.off.apply(five, args);
965
+ };
966
+ }
967
+ }
968
+ function useFiveModelIntersectRaycaster(five, features) {
969
+ if (hasFeature("intersectRaycaster", features)) {
970
+ return function() {
971
+ var _a;
972
+ var args = [];
973
+ for (var _i = 0; _i < arguments.length; _i++) {
974
+ args[_i] = arguments[_i];
975
+ }
976
+ return (_a = five.model).intersectRaycaster.apply(_a, args);
977
+ };
978
+ }
979
+ }
980
+ function useFiveProject2d(five, features) {
981
+ if (hasFeature("project2d", features)) {
982
+ return function() {
983
+ var args = [];
984
+ for (var _i = 0; _i < arguments.length; _i++) {
985
+ args[_i] = arguments[_i];
986
+ }
987
+ return five.project2d.apply(five, args);
988
+ };
989
+ }
990
+ }
991
+ function useFiveUpdateCamera(five, features) {
992
+ if (hasFeature("updateCamera", features)) {
993
+ return function() {
994
+ var args = [];
995
+ for (var _i = 0; _i < arguments.length; _i++) {
996
+ args[_i] = arguments[_i];
997
+ }
998
+ return five.updateCamera.apply(five, args);
999
+ };
1000
+ }
1001
+ }
1002
+ function useFiveGetPixels(five, features) {
1003
+ if (hasFeature("getPixels", features)) {
1004
+ return function() {
1005
+ var args = [];
1006
+ for (var _i = 0; _i < arguments.length; _i++) {
1007
+ args[_i] = arguments[_i];
1008
+ }
1009
+ return five.getPixels.apply(five, args);
1010
+ };
1011
+ }
1012
+ }
1013
+ function useFiveRender(five, features) {
1014
+ if (hasFeature("render", features)) {
1015
+ return function() {
1016
+ var args = [];
1017
+ for (var _i = 0; _i < arguments.length; _i++) {
1018
+ args[_i] = arguments[_i];
1019
+ }
1020
+ return five.render.apply(five, args);
1021
+ };
1022
+ }
1023
+ }
1024
+ function useFiveNeedsRender(five, features) {
1025
+ if (hasFeature("needsRender", features)) {
1026
+ return function() {
1027
+ five.needsRender = true;
1028
+ };
1029
+ }
1030
+ }
1031
+ function useFivePreloadPano(five, features) {
1032
+ if (hasFeature("preloadPano", features)) {
1033
+ return function() {
1034
+ var args = [];
1035
+ for (var _i = 0; _i < arguments.length; _i++) {
1036
+ args[_i] = arguments[_i];
1037
+ }
1038
+ return five.preloadPano.apply(five, args);
1039
+ };
1040
+ }
1041
+ }
1042
+ function useFiveShowFloor(five, features) {
1043
+ if (hasFeature("showFloor", features)) {
1044
+ return function(floorIndex) {
1045
+ if (typeof floorIndex === "number") {
1046
+ five.model.show(floorIndex);
1047
+ } else {
1048
+ five.model.show();
1049
+ }
1050
+ };
1051
+ }
1052
+ }
1053
+ function useFiveToggleHelperVisible(five, features) {
1054
+ if (hasFeature("toggleHelperVisible", features)) {
1055
+ return function(visible) {
1056
+ five.helperVisible = visible;
1057
+ };
1058
+ }
1059
+ }
1060
+ function withFive(features) {
1061
+ return function(Component) {
1062
+ return React.forwardRef(function(props, ref) {
1063
+ var five = useFiveInstance();
1064
+ var loadWork = useFiveWorkLoader();
1065
+ var unsafe__fiveInstance = useUnsafe__fiveInstance(five, features)[0];
1066
+ var _a = useFiveState(five, features), state = _a[0], stateUpdated = _a[1];
1067
+ var _b = useFiveCurrentState(five, features), currentState = _b[0], currentStateUpdated = _b[1];
1068
+ var _c = useFivecurrentObserver(five, features), currentObserver = _c[0], currentObserverUpdated = _c[1];
1069
+ var _d = useFiveWork(five, features), work = _d[0], workUpdated = _d[1];
1070
+ var _e = useFiveModel(five, features), model = _e[0], modelUpdated = _e[1];
1071
+ var scene = useFiveScene(five, features)[0];
1072
+ var _f = useFiveCameraDirection(five, features), cameraDirection = _f[0], cameraDirectionUpdated = _f[1];
1073
+ var _g = useFiveCameraRaycaster(five, features), cameraRaycaster = _g[0], cameraRaycasterUpdated = _g[1];
1074
+ var _h = useFiveModelReadyState(five, features), modelReadyState = _h[0], modelReadyStateUpdated = _h[1];
1075
+ var _j = useFiveShownFloor(five, features), shownFloor = _j[0], shownFloorUpdated = _j[1];
1076
+ var _k = useHelperVisible(five, features), helperVisible = _k[0], helperVisibleUpdated = _k[1];
1077
+ var actions = React.useMemo(function() {
1078
+ var injection2 = {};
1079
+ injectObject(injection2, {
1080
+ setState: useFiveSetState(five, features),
1081
+ loadWork: useFiveLoadWork(loadWork, features),
1082
+ on: useFiveOn(five, features),
1083
+ once: useFiveOnce(five, features),
1084
+ off: useFiveOff(five, features),
1085
+ intersectRaycaster: useFiveModelIntersectRaycaster(five, features),
1086
+ project2d: useFiveProject2d(five, features),
1087
+ updateCamera: useFiveUpdateCamera(five, features),
1088
+ getPixels: useFiveGetPixels(five, features),
1089
+ render: useFiveRender(five, features),
1090
+ needsRender: useFiveNeedsRender(five, features),
1091
+ preloadPano: useFivePreloadPano(five, features),
1092
+ showFloor: useFiveShowFloor(five, features),
1093
+ toggleHelperVisible: useFiveToggleHelperVisible(five, features)
1094
+ });
1095
+ return injection2;
1096
+ }, [five, loadWork]);
1097
+ var injection = React.useMemo(function() {
1098
+ var injection2 = __assign({}, actions);
1099
+ injectObject(injection2, {
1100
+ unsafe__fiveInstance,
1101
+ state,
1102
+ currentState,
1103
+ currentObserver,
1104
+ work,
1105
+ model,
1106
+ scene,
1107
+ cameraDirection,
1108
+ cameraRaycaster,
1109
+ modelReadyState,
1110
+ shownFloor,
1111
+ helperVisible
1112
+ });
1113
+ return injection2;
1114
+ }, [
1115
+ five,
1116
+ actions,
1117
+ stateUpdated,
1118
+ currentStateUpdated,
1119
+ currentObserverUpdated,
1120
+ workUpdated,
1121
+ modelUpdated,
1122
+ cameraDirectionUpdated,
1123
+ cameraRaycasterUpdated,
1124
+ modelReadyStateUpdated,
1125
+ shownFloorUpdated,
1126
+ helperVisibleUpdated
1127
+ ]);
1128
+ return React.createElement(Component, __assign({ ref, $five: injection }, props));
1129
+ });
1130
+ };
1131
+ }
1132
+ function createFiveFeature() {
1133
+ var features = [];
1134
+ for (var _i = 0; _i < arguments.length; _i++) {
1135
+ features[_i] = arguments[_i];
1136
+ }
1137
+ return features;
1138
+ }
1139
+ function pick(obj, keys) {
1140
+ var res = {};
1141
+ var len = keys.length;
1142
+ var idx = -1;
1143
+ while (++idx < len) {
1144
+ var key = keys[idx];
1145
+ if (key in obj) {
1146
+ res[key] = obj[key];
1147
+ }
1148
+ }
1149
+ return res;
1150
+ }
1151
+ function valueEquals(value1, value2) {
1152
+ if (typeof value1 === "number" && typeof value2 === "number") {
1153
+ if (isNaN(value1) && isNaN(value2))
1154
+ return true;
1155
+ }
1156
+ return value1 === value2;
1157
+ }
1158
+ function hasSameItemInBothStringArray(array1, array2) {
1159
+ for (var i = 0; i < array1.length; i++) {
1160
+ for (var j = 0; j < array2.length; j++) {
1161
+ if (array1[i] === array2[j])
1162
+ return true;
1163
+ }
1164
+ }
1165
+ return false;
1166
+ }
1167
+ var Store = (
1168
+ /** @class */
1169
+ function() {
1170
+ function Store2(initialValue, onValuesChange) {
1171
+ this.values = initialValue;
1172
+ this.listeners = [];
1173
+ this.onValuesChange = onValuesChange;
1174
+ }
1175
+ Store2.prototype.on = function(names, callback) {
1176
+ var _this = this;
1177
+ var listener = [names, callback];
1178
+ this.listeners.push(listener);
1179
+ return function() {
1180
+ var index = _this.listeners.indexOf(listener);
1181
+ if (index >= 0) {
1182
+ _this.listeners.splice(index, 1);
1183
+ }
1184
+ };
1185
+ };
1186
+ Store2.prototype.getValues = function(names) {
1187
+ return pick(this.values, names);
1188
+ };
1189
+ Store2.prototype.setValues = function(names, values) {
1190
+ var modifyNames = [];
1191
+ for (var name_1 in values) {
1192
+ if (names.indexOf(name_1) >= 0 && !valueEquals(values[name_1], this.values[name_1])) {
1193
+ modifyNames.push(name_1);
1194
+ }
1195
+ }
1196
+ if (modifyNames.length === 0)
1197
+ return;
1198
+ var prevValue = __assign({}, this.values);
1199
+ for (var _i = 0, modifyNames_1 = modifyNames; _i < modifyNames_1.length; _i++) {
1200
+ var name_2 = modifyNames_1[_i];
1201
+ this.values[name_2] = values[name_2];
1202
+ }
1203
+ if (this.onValuesChange) {
1204
+ this.onValuesChange(this.values, prevValue);
1205
+ }
1206
+ for (var _a = 0, _b = this.listeners; _a < _b.length; _a++) {
1207
+ var _c = _b[_a], names_1 = _c[0], callback = _c[1];
1208
+ if (!hasSameItemInBothStringArray(names_1, modifyNames)) {
1209
+ continue;
1210
+ }
1211
+ var prevValue_ = pick(prevValue, names_1);
1212
+ var nextValue_ = pick(this.values, names_1);
1213
+ callback(nextValue_, prevValue_);
1214
+ }
1215
+ };
1216
+ return Store2;
1217
+ }()
1218
+ );
1219
+ function createStore(actionHandler) {
1220
+ var StoreContext = React.createContext(null);
1221
+ return {
1222
+ /**
1223
+ * 使用 Store
1224
+ * @param names - 获取的 Store 字段
1225
+ * @returns [值, 修改值方法]
1226
+ */
1227
+ useStore: function(names) {
1228
+ var store = React.useContext(StoreContext);
1229
+ if (store === null) {
1230
+ throw new Error("StoreProvider never found.");
1231
+ }
1232
+ var firstUpdate = React.useRef(true);
1233
+ var _a = React.useState(store.getValues(names)), values = _a[0], setValues_ = _a[1];
1234
+ var dependencyList = __spreadArray([store], names, true);
1235
+ React.useLayoutEffect(function() {
1236
+ if (firstUpdate.current) {
1237
+ firstUpdate.current = false;
1238
+ } else {
1239
+ setValues_(store.getValues(names));
1240
+ }
1241
+ return store.on(names, function(value) {
1242
+ return setValues_(value);
1243
+ });
1244
+ }, dependencyList);
1245
+ var setValues = React.useCallback(function(values2) {
1246
+ return store.setValues(names, values2);
1247
+ }, dependencyList);
1248
+ return [values, setValues];
1249
+ },
1250
+ /**
1251
+ * 使用 Store (仅设置值)
1252
+ * @param names - 获取的 Store 字段
1253
+ * @returns 修改值方法
1254
+ */
1255
+ useStoreSetter: function(names) {
1256
+ var store = React.useContext(StoreContext);
1257
+ if (store === null) {
1258
+ throw new Error("StoreProvider never found.");
1259
+ }
1260
+ var setValues = React.useCallback(function(values) {
1261
+ return store.setValues(names, values);
1262
+ }, __spreadArray([store], names, true));
1263
+ return setValues;
1264
+ },
1265
+ /**
1266
+ * 监听 Store 变化
1267
+ * @param names - Store 字段
1268
+ * @param callback - 监听变化的回调函数
1269
+ * @param deps - 依赖对象
1270
+ */
1271
+ watchStore: function(names, callback, deps) {
1272
+ var store = React.useContext(StoreContext);
1273
+ if (store === null) {
1274
+ throw new Error("StoreProvider never found.");
1275
+ }
1276
+ var dependencyList = __spreadArray([store], names, true);
1277
+ if (deps !== void 0) {
1278
+ dependencyList = dependencyList.concat(deps);
1279
+ }
1280
+ React.useLayoutEffect(function() {
1281
+ return store.on(names, callback);
1282
+ }, dependencyList);
1283
+ },
1284
+ useStoreAction: function(actionName) {
1285
+ var store = React.useContext(StoreContext);
1286
+ if (store === null) {
1287
+ throw new Error("StoreProvider never found.");
1288
+ }
1289
+ var action = React.useCallback(function() {
1290
+ var args = [];
1291
+ for (var _i = 0; _i < arguments.length; _i++) {
1292
+ args[_i] = arguments[_i];
1293
+ }
1294
+ var _a = actionHandler[actionName], callback = _a[0], deps = _a.slice(1);
1295
+ var getValues = function() {
1296
+ return store.getValues(deps);
1297
+ };
1298
+ var setValues = function(values) {
1299
+ return store.setValues(deps, values);
1300
+ };
1301
+ return callback.apply(void 0, __spreadArray([getValues, setValues], args, false));
1302
+ }, []);
1303
+ return action;
1304
+ },
1305
+ /**
1306
+ * Store Provider.
1307
+ * 内部组件均可和 store 交互
1308
+ */
1309
+ StoreProvider: (
1310
+ /** @class */
1311
+ function(_super) {
1312
+ __extends(StoreProvider, _super);
1313
+ function StoreProvider(props) {
1314
+ var _this = _super.call(this, props) || this;
1315
+ _this.store = new Store(props.initialValue, function() {
1316
+ var _a;
1317
+ var args = [];
1318
+ for (var _i = 0; _i < arguments.length; _i++) {
1319
+ args[_i] = arguments[_i];
1320
+ }
1321
+ if (_this.props.onValuesChange) {
1322
+ (_a = _this.props).onValuesChange.apply(_a, args);
1323
+ }
1324
+ });
1325
+ return _this;
1326
+ }
1327
+ StoreProvider.prototype.shouldComponentUpdate = function(nextProps) {
1328
+ if (nextProps.children === this.props.children) {
1329
+ return false;
1330
+ }
1331
+ return true;
1332
+ };
1333
+ StoreProvider.prototype.render = function() {
1334
+ return React.createElement(StoreContext.Provider, { value: this.store }, this.props.children);
1335
+ };
1336
+ return StoreProvider;
1337
+ }(React.Component)
1338
+ )
1339
+ };
1340
+ }
1341
+ export {
1342
+ FiveCanvas,
1343
+ INJECTION_PROPNAME,
1344
+ Store,
1345
+ createFiveFeature,
1346
+ createFiveProvider,
1347
+ createStore,
1348
+ unsafe__useFiveInstance,
1349
+ useFiveAction,
1350
+ useFiveCameraDirection$1 as useFiveCameraDirection,
1351
+ useFiveCameraRaycaster$1 as useFiveCameraRaycaster,
1352
+ useFiveCurrentObserver,
1353
+ useFiveCurrentState$1 as useFiveCurrentState,
1354
+ useFiveEventCallback,
1355
+ useFiveFloor,
1356
+ useFiveHelper,
1357
+ useFiveModelIntersectRaycaster$1 as useFiveModelIntersectRaycaster,
1358
+ useFiveModelReadyState$1 as useFiveModelReadyState,
1359
+ useFiveProject2d$1 as useFiveProject2d,
1360
+ useFiveScene$1 as useFiveScene,
1361
+ useFiveSceneEffect,
1362
+ useFiveState$1 as useFiveState,
1363
+ useFiveWork$1 as useFiveWork,
1364
+ withFive
1365
+ };