@realsee/five 6.8.0-alpha.25 → 6.8.0-alpha.26

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 (211) hide show
  1. package/ai_guides/api.md +18 -8
  2. package/ai_guides/features/event.md +99 -8
  3. package/ai_guides/features/flowing-light-2d-pass.md +10 -6
  4. package/ai_guides/features/flowing-light-3d-pass.md +11 -6
  5. package/ai_guides/features/load-external-model.md +1 -0
  6. package/ai_guides/features/state.md +2 -2
  7. package/ai_guides/glossary.md +2 -2
  8. package/ai_guides/release_notes/6.8.md +1 -0
  9. package/docs/assets/hierarchy.js +1 -1
  10. package/docs/assets/navigation.js +1 -1
  11. package/docs/assets/search.js +1 -1
  12. package/docs/classes/five.AdaptiveLuminancePass.html +1 -1
  13. package/docs/classes/five.BoundingMesh.html +1 -1
  14. package/docs/classes/five.Camera.html +1 -1
  15. package/docs/classes/five.EyeDomeLightingPass.html +1 -1
  16. package/docs/classes/five.Five.html +13 -13
  17. package/docs/classes/five.FivePass.html +1 -1
  18. package/docs/classes/five.InternalWebGLRenderer.html +1 -1
  19. package/docs/classes/five.Model.html +1 -1
  20. package/docs/classes/five.ModelScene.html +1 -1
  21. package/docs/classes/five.NetworkSubscribe.html +1 -1
  22. package/docs/classes/five.PBMContainer.html +1 -1
  23. package/docs/classes/five.PBMCustomShader.html +1 -1
  24. package/docs/classes/five.PBMGSObject.html +1 -1
  25. package/docs/classes/five.PBMGroup.html +1 -1
  26. package/docs/classes/five.PBMMesh.html +1 -1
  27. package/docs/classes/five.PBMMeshMaterial.html +1 -1
  28. package/docs/classes/five.PBMPanoFilter.html +1 -1
  29. package/docs/classes/five.PBMPointCloud.html +1 -1
  30. package/docs/classes/five.PBMPointCloudMaterial.html +1 -1
  31. package/docs/classes/five.PBMSkinnedMesh.html +1 -1
  32. package/docs/classes/five.PBMUpdateable.html +1 -1
  33. package/docs/classes/five.PanoCircleMesh.html +1 -1
  34. package/docs/classes/five.PanoCircleMeshCustom.html +1 -1
  35. package/docs/classes/five.PanoCircleMeshSolid.html +1 -1
  36. package/docs/classes/five.Parameter.html +1 -1
  37. package/docs/classes/five.Scene.html +1 -1
  38. package/docs/classes/five.Subscribe.html +1 -1
  39. package/docs/classes/five.Tile3D.html +1 -1
  40. package/docs/classes/five.TileNode.html +1 -1
  41. package/docs/classes/five.TrajectoryNode.html +1 -1
  42. package/docs/classes/five.WorkResolvedObserver.html +1 -1
  43. package/docs/classes/gltf-loader.DDSLoader.html +1 -1
  44. package/docs/classes/gltf-loader.DRACOLoader.html +1 -1
  45. package/docs/classes/gltf-loader.GLTFLoader.html +1 -1
  46. package/docs/classes/gltf-loader.GLTFObject.html +1 -1
  47. package/docs/classes/gltf-loader.THREEGLTFLoader.html +1 -1
  48. package/docs/classes/line.Line.html +1 -1
  49. package/docs/classes/line.LineGeometry.html +1 -1
  50. package/docs/classes/line.LineMaterial.html +1 -1
  51. package/docs/classes/line.LineSegmentsGeometry.html +1 -1
  52. package/docs/classes/line.THREE_Line2.html +1 -1
  53. package/docs/classes/line.THREE_LineSegments2.html +1 -1
  54. package/docs/classes/plugins.BasePlugin.Controller.html +1 -1
  55. package/docs/classes/plugins.RoundedBoxGeometry.html +1 -1
  56. package/docs/classes/sticker.Sticker.html +1 -1
  57. package/docs/classes/vfx.Airflow.html +1 -1
  58. package/docs/classes/vfx.Flame.html +1 -1
  59. package/docs/classes/vfx.Particle.html +1 -1
  60. package/docs/classes/vfx.ParticleGPU.html +1 -1
  61. package/docs/classes/vfx.SpotLight.html +1 -1
  62. package/docs/documents/api.html +58 -8
  63. package/docs/documents/features_event.html +39 -6
  64. package/docs/documents/features_flowing-light-2d-pass.html +12 -109
  65. package/docs/documents/features_flowing-light-3d-pass.html +15 -117
  66. package/docs/documents/features_load-external-model.html +1 -0
  67. package/docs/documents/features_state.html +1 -1
  68. package/docs/documents/glossary.html +3 -3
  69. package/docs/documents/release_notes_6.8.html +1 -0
  70. package/docs/functions/plugins.GaussianSplattingEntranceAnimationPlugin.html +1 -0
  71. package/docs/hierarchy.html +1 -1
  72. package/docs/interfaces/five.AddableObject.html +1 -1
  73. package/docs/interfaces/five.AjaxOptions.html +1 -1
  74. package/docs/interfaces/five.BaseEvent.html +5 -5
  75. package/docs/interfaces/five.BaseExtendableEvent.html +11 -0
  76. package/docs/interfaces/five.EventCallback.html +45 -43
  77. package/docs/interfaces/five.FloorplanControllerCustomInitArgs.html +9 -9
  78. package/docs/interfaces/five.GestureEvent.html +19 -19
  79. package/docs/interfaces/five.GesturePointer.html +9 -9
  80. package/docs/interfaces/five.ImageOptions.html +1 -1
  81. package/docs/interfaces/five.IntersectEvent.html +8 -8
  82. package/docs/interfaces/five.IntersectMesh.html +1 -1
  83. package/docs/interfaces/five.IntersectMeshInterface.html +1 -1
  84. package/docs/interfaces/five.Intersection.html +1 -1
  85. package/docs/interfaces/five.LooseWorkWithExtrinsics.html +1 -1
  86. package/docs/interfaces/five.MapviewControllerCustomInitArgs.html +9 -9
  87. package/docs/interfaces/five.ModeChangeEvent.html +7 -7
  88. package/docs/interfaces/five.ModelControllerCustomInitArgs.html +1 -1
  89. package/docs/interfaces/five.ModelEvent.html +5 -5
  90. package/docs/interfaces/five.ModelSceneEvent.html +5 -5
  91. package/docs/interfaces/five.ModelTileEvent.html +5 -5
  92. package/docs/interfaces/five.MovePanoOptions.html +1 -1
  93. package/docs/interfaces/five.NetworkAbortError.html +1 -1
  94. package/docs/interfaces/five.NetworkFirbiddenError.html +1 -1
  95. package/docs/interfaces/five.NetworkOptions.html +1 -1
  96. package/docs/interfaces/five.NetworkProxyError.html +1 -1
  97. package/docs/interfaces/five.NetworkResourceEvent.html +5 -5
  98. package/docs/interfaces/five.NetworkResponseError.html +1 -1
  99. package/docs/interfaces/five.NetworkTimeoutError.html +1 -1
  100. package/docs/interfaces/five.ObjectEvent.html +5 -5
  101. package/docs/interfaces/five.PBMMaterial.html +1 -1
  102. package/docs/interfaces/five.PBMMeshMaterialParameters.html +1 -1
  103. package/docs/interfaces/five.PBMPointCloudMaterialParameters.html +1 -1
  104. package/docs/interfaces/five.PanoCircleMeshInterface.html +1 -1
  105. package/docs/interfaces/five.PanoEvent.html +13 -11
  106. package/docs/interfaces/five.PanoPrepareEvent.html +15 -0
  107. package/docs/interfaces/five.PanoTextureEvent.html +9 -9
  108. package/docs/interfaces/five.PanoramaControllerCustomInitArgs.html +9 -9
  109. package/docs/interfaces/five.PanoramaLikeControllerCustomInitArgs.html +1 -1
  110. package/docs/interfaces/five.ParameterMaterialValue.html +1 -1
  111. package/docs/interfaces/five.ParameterTilesetValue.html +1 -1
  112. package/docs/interfaces/five.ParameterValue.html +1 -1
  113. package/docs/interfaces/five.Pose.html +1 -1
  114. package/docs/interfaces/five.RenderEvent.html +5 -5
  115. package/docs/interfaces/five.ResolvedParameterValue.html +1 -1
  116. package/docs/interfaces/five.State.html +1 -1
  117. package/docs/interfaces/five.StateEvent.html +7 -7
  118. package/docs/interfaces/five.TextureOptions.html +1 -1
  119. package/docs/interfaces/five.TopviewControllerCustomInitArgs.html +7 -7
  120. package/docs/interfaces/five.VRPanoramaControllerCustomInitArgs.html +9 -9
  121. package/docs/interfaces/five.ViewLayer.html +1 -1
  122. package/docs/interfaces/five.WorkCubeImage.html +1 -1
  123. package/docs/interfaces/five.WorkImage.html +1 -1
  124. package/docs/interfaces/five.WorkObserver.html +1 -1
  125. package/docs/interfaces/five.WorkObserverProto.html +1 -1
  126. package/docs/interfaces/five.WorkTile.html +1 -1
  127. package/docs/interfaces/five.WorksEvent.html +5 -5
  128. package/docs/interfaces/five.XRControllerEvent.html +8 -8
  129. package/docs/interfaces/five.XRControllerState.html +4 -4
  130. package/docs/interfaces/five.XRGestureEvent.html +11 -11
  131. package/docs/interfaces/five.XRPanoramaControllerCustomInitArgs.html +9 -9
  132. package/docs/interfaces/five.XRSessionEvent.html +7 -7
  133. package/docs/interfaces/plugins.BackgroundPluginController.html +1 -1
  134. package/docs/interfaces/plugins.BackgroundPluginType.EventMap.html +1 -1
  135. package/docs/interfaces/plugins.BasePlugin.State.html +1 -1
  136. package/docs/interfaces/plugins.DynamicPathLinePluginController.html +1 -1
  137. package/docs/interfaces/plugins.DynamicPathLinePluginType.EventMap.html +1 -1
  138. package/docs/interfaces/plugins.DynamicPathLinePluginType.State.html +1 -1
  139. package/docs/interfaces/plugins.GaussianSplattingEntranceAnimationController.html +44 -0
  140. package/docs/interfaces/plugins.GaussianSplattingEntranceAnimationPluginType.BoundingAABB2D.html +3 -0
  141. package/docs/interfaces/plugins.GaussianSplattingEntranceAnimationPluginType.Config.html +8 -0
  142. package/docs/interfaces/plugins.GaussianSplattingEntranceAnimationPluginType.EventMap.html +10 -0
  143. package/docs/interfaces/plugins.GaussianSplattingEntranceAnimationPluginType.Keyframe.html +3 -0
  144. package/docs/interfaces/plugins.GaussianSplattingEntranceAnimationPluginType.State.html +8 -0
  145. package/docs/interfaces/plugins.ItemMaskController.html +1 -1
  146. package/docs/interfaces/plugins.ItemMaskPluginType.EventMap.html +1 -1
  147. package/docs/interfaces/plugins.ItemMaskPluginType.State.html +1 -1
  148. package/docs/interfaces/plugins.OrientationPluginController.html +1 -1
  149. package/docs/interfaces/plugins.OrientationPluginType.EventMap.html +1 -1
  150. package/docs/interfaces/plugins.OrientationPluginType.State.html +1 -1
  151. package/docs/interfaces/plugins.PanoAnimeController.html +1 -1
  152. package/docs/interfaces/plugins.PanoAnimePluginType.EventMap.html +1 -1
  153. package/docs/interfaces/plugins.PanoAnimePluginType.State.html +1 -1
  154. package/docs/interfaces/plugins.PluginTemplateType.EventMap.html +1 -1
  155. package/docs/interfaces/plugins.PluginTemplateType.State.html +1 -1
  156. package/docs/interfaces/plugins.TrajectoryController.html +1 -1
  157. package/docs/interfaces/react.FiveInjectionTypes.html +13 -13
  158. package/docs/modules/five.html +1 -1
  159. package/docs/modules/plugins.GaussianSplattingEntranceAnimationPluginType.html +1 -0
  160. package/docs/modules/plugins.html +1 -1
  161. package/docs/types/five.ControllerEventTypes.html +22 -20
  162. package/docs/types/five.EventTypes.html +26 -26
  163. package/docs/types/five.ParseOptions.html +1 -1
  164. package/docs/types/plugins.BasePlugin.EventMap.html +1 -1
  165. package/docs/variables/five.PROXY_CONTROLLER_EVENT_NAMES.html +1 -1
  166. package/five/application/events.d.ts +1 -1
  167. package/five/controllers/events.d.ts +3 -1
  168. package/five/controllers/panorama.d.ts +1 -1
  169. package/five/controllers/xrPanorama.d.ts +1 -1
  170. package/five/index.d.ts +1 -1
  171. package/five/index.js +64 -61
  172. package/five/index.mjs +1926 -1691
  173. package/five/model/loaders/glTF-helpers/extensions/KHR_gaussian_splatting.d.ts +8 -0
  174. package/five/model/loaders/glTF-helpers/extensions/KHR_gaussian_splatting_compression_spz.d.ts +4 -4
  175. package/five/model/loaders/glTF-helpers/extensions/base.d.ts +2 -1
  176. package/five/model/loaders/glTF-helpers/index.d.ts +2 -0
  177. package/five/model/loaders/glTF-helpers/parser.d.ts +2 -1
  178. package/five/utils/error.d.ts +1 -0
  179. package/five/utils/event.d.ts +14 -0
  180. package/gltf-loader/index.js +3 -3
  181. package/gltf-loader/index.mjs +3 -3
  182. package/line/index.js +3 -3
  183. package/line/index.mjs +3 -3
  184. package/package.json +1 -1
  185. package/plugins/GaussianSplattingEntranceAnimationPlugin/Controller.d.ts +30 -0
  186. package/plugins/GaussianSplattingEntranceAnimationPlugin/index.d.ts +5 -0
  187. package/plugins/GaussianSplattingEntranceAnimationPlugin/typing.d.ts +28 -0
  188. package/plugins/index.d.ts +1 -0
  189. package/plugins/index.js +10 -10
  190. package/plugins/index.mjs +164 -4
  191. package/react/index.js +2 -2
  192. package/react/index.mjs +2 -2
  193. package/shader-lib/index.js +2 -2
  194. package/shader-lib/index.mjs +2 -2
  195. package/sticker/index.js +3 -3
  196. package/sticker/index.mjs +3 -3
  197. package/umd/five-gltf-loader.js +3 -3
  198. package/umd/five-line.js +3 -3
  199. package/umd/five-plugins.js +10 -10
  200. package/umd/five-react.js +2 -2
  201. package/umd/five-shader-lib.js +2 -2
  202. package/umd/five-sticker.js +3 -3
  203. package/umd/five-vfx.js +2 -2
  204. package/umd/five-vue.js +2 -2
  205. package/umd/five.js +27 -24
  206. package/vfx/index.js +2 -2
  207. package/vfx/index.mjs +2 -2
  208. package/vue/index.js +2 -2
  209. package/vue/index.mjs +2 -2
  210. package/work-downloader/index.js +2 -2
  211. package/work-downloader/index.mjs +2 -2
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five
4
- * Generated: 3/30/2026
5
- * Version: 6.8.0-alpha.25
4
+ * Generated: 4/1/2026
5
+ * Version: 6.8.0-alpha.26
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
@@ -347,9 +347,9 @@ void main() {
347
347
  gl_FragColor = vec4(1.0, 1.0, 1.0, alpha / 4.0 * opacity);
348
348
  }
349
349
  }
350
- `,side:n.DoubleSide,visible:this.state.selectedId===`${e.category_name}${e.index}`,uniforms:{opacity:{value:this.state.mode===`box`?1:0}},depthWrite:!1,depthTest:!1,transparent:!0}),p=new n.Mesh(d,f);return p.position.copy(u),p.name=`${e.category_name}${e.index}`,p.userData.color=new n.Vector4(...e.mask_color.map(e=>e/255).reverse(),1),p.userData.visible_viewpoint=Object.keys(e.visible_viewpoint),p});this.group.add(...t)})}setState(e,t={}){let n=this.state,r=t.userAction===void 0?!0:t.userAction;if(this.updateState(e,r),e.enabled!==void 0&&n.enabled!==e.enabled){let t={userAction:r};e.enabled?this._enable(t):this._disable(t)}}setMode(e){this.updateState({mode:e},!1),e===`mask`?(this.group.children.forEach(e=>{e.material.uniforms.opacity.value=0}),this.loadPanoMask(this.five.state.panoIndex)):e===`box`&&(this.itemMaskMesh.material.uniforms.color.value=new n.Vector4(0,0,0,1),this.group.children.forEach(e=>{e.material.uniforms.opacity.value=1}),this.five.needsRender=!0)}select(e,t){var n;this.updateState({selectedId:e==null?null:e},(n=t==null?void 0:t.userAction)==null?!1:n),this.group.children.forEach(t=>{t.material.visible=this.state.selectAll||t.name===e}),this.five.needsRender=!0}selectAll(e=!0){this.updateState({selectAll:!!e},!1),this.select()}_enable(e){this.five.on(`panoArrived`,this.onFivePanoArrived),this.five.on(`wantsMoveToPano`,this.onFiveWantsMoveToPano),this.five.on(`gesture.mousemove`,this.onFiveMouseMove),this.five.on(`wantsTapGesture`,this.onFiveTapGesture),this.five.on(`cameraUpdate`,this.onFiveCameraUpdate),this.five.scene.add(this.group),document.head.appendChild(this.style)}_disable(e){this.five.off(`panoArrived`,this.onFivePanoArrived),this.five.off(`wantsMoveToPano`,this.onFiveWantsMoveToPano),this.five.off(`gesture.mousemove`,this.onFiveMouseMove),this.five.off(`wantsTapGesture`,this.onFiveTapGesture),this.five.off(`cameraUpdate`,this.onFiveCameraUpdate),this.five.scene.remove(this.group),document.head.removeChild(this.style)}enable(e){var t;if(this.state.enabled)return;let n=(t=e==null?void 0:e.userAction)==null?!0:t;this.updateState({enabled:!0},n),this._enable({userAction:n})}disable(e){var t;if(this.state.enabled===!1)return;let n=(t=e==null?void 0:e.userAction)==null?!0:t;this.updateState({enabled:!1},n),this._disable({userAction:n})}},k=(e,t)=>new O(e,t),A=(function(e,t,n,r){"use strict";var i=[``,`webkit`,`Moz`,`MS`,`ms`,`o`],a=t.createElement?t.createElement(`div`):r,o=`function`,s=Math.round,c=Math.abs,l=Date.now;function u(e,t,n){return setTimeout(v(e,n),t)}function d(e,t,n){return Array.isArray(e)?(f(e,n[t],n),!0):!1}function f(e,t,n){var i;if(e)if(e.forEach)e.forEach(t,n);else if(e.length!==r)for(i=0;i<e.length;)t.call(n,e[i],i,e),i++;else for(i in e)e.hasOwnProperty(i)&&t.call(n,e[i],i,e)}function p(t,n,r){var i=`DEPRECATED METHOD: `+n+`
350
+ `,side:n.DoubleSide,visible:this.state.selectedId===`${e.category_name}${e.index}`,uniforms:{opacity:{value:this.state.mode===`box`?1:0}},depthWrite:!1,depthTest:!1,transparent:!0}),p=new n.Mesh(d,f);return p.position.copy(u),p.name=`${e.category_name}${e.index}`,p.userData.color=new n.Vector4(...e.mask_color.map(e=>e/255).reverse(),1),p.userData.visible_viewpoint=Object.keys(e.visible_viewpoint),p});this.group.add(...t)})}setState(e,t={}){let n=this.state,r=t.userAction===void 0?!0:t.userAction;if(this.updateState(e,r),e.enabled!==void 0&&n.enabled!==e.enabled){let t={userAction:r};e.enabled?this._enable(t):this._disable(t)}}setMode(e){this.updateState({mode:e},!1),e===`mask`?(this.group.children.forEach(e=>{e.material.uniforms.opacity.value=0}),this.loadPanoMask(this.five.state.panoIndex)):e===`box`&&(this.itemMaskMesh.material.uniforms.color.value=new n.Vector4(0,0,0,1),this.group.children.forEach(e=>{e.material.uniforms.opacity.value=1}),this.five.needsRender=!0)}select(e,t){var n;this.updateState({selectedId:e==null?null:e},(n=t==null?void 0:t.userAction)==null?!1:n),this.group.children.forEach(t=>{t.material.visible=this.state.selectAll||t.name===e}),this.five.needsRender=!0}selectAll(e=!0){this.updateState({selectAll:!!e},!1),this.select()}_enable(e){this.five.on(`panoArrived`,this.onFivePanoArrived),this.five.on(`wantsMoveToPano`,this.onFiveWantsMoveToPano),this.five.on(`gesture.mousemove`,this.onFiveMouseMove),this.five.on(`wantsTapGesture`,this.onFiveTapGesture),this.five.on(`cameraUpdate`,this.onFiveCameraUpdate),this.five.scene.add(this.group),document.head.appendChild(this.style)}_disable(e){this.five.off(`panoArrived`,this.onFivePanoArrived),this.five.off(`wantsMoveToPano`,this.onFiveWantsMoveToPano),this.five.off(`gesture.mousemove`,this.onFiveMouseMove),this.five.off(`wantsTapGesture`,this.onFiveTapGesture),this.five.off(`cameraUpdate`,this.onFiveCameraUpdate),this.five.scene.remove(this.group),document.head.removeChild(this.style)}enable(e){var t;if(this.state.enabled)return;let n=(t=e==null?void 0:e.userAction)==null?!0:t;this.updateState({enabled:!0},n),this._enable({userAction:n})}disable(e){var t;if(this.state.enabled===!1)return;let n=(t=e==null?void 0:e.userAction)==null?!0:t;this.updateState({enabled:!1},n),this._disable({userAction:n})}},k=(e,t)=>new O(e,t),te=(function(e,t,n,r){"use strict";var i=[``,`webkit`,`Moz`,`MS`,`ms`,`o`],a=t.createElement?t.createElement(`div`):r,o=`function`,s=Math.round,c=Math.abs,l=Date.now;function u(e,t,n){return setTimeout(v(e,n),t)}function d(e,t,n){return Array.isArray(e)?(f(e,n[t],n),!0):!1}function f(e,t,n){var i;if(e)if(e.forEach)e.forEach(t,n);else if(e.length!==r)for(i=0;i<e.length;)t.call(n,e[i],i,e),i++;else for(i in e)e.hasOwnProperty(i)&&t.call(n,e[i],i,e)}function p(t,n,r){var i=`DEPRECATED METHOD: `+n+`
351
351
  `+r+` AT
352
- `;return function(){var n=Error(`get-stack-trace`),r=n&&n.stack?n.stack.replace(/^[^\(]+?[\n$]/gm,``).replace(/^\s+at\s+/gm,``).replace(/^Object.<anonymous>\s*\(/gm,`{anonymous}()@`):`Unknown Stack Trace`,a=e.console&&(e.console.warn||e.console.log);return a&&a.call(e.console,i,r),t.apply(this,arguments)}}var m=typeof Object.assign==`function`?Object.assign:function(e){if(e===r||e===null)throw TypeError(`Cannot convert undefined or null to object`);for(var t=Object(e),n=1;n<arguments.length;n++){var i=arguments[n];if(i!==r&&i!==null)for(var a in i)i.hasOwnProperty(a)&&(t[a]=i[a])}return t},h=p(function(e,t,n){for(var i=Object.keys(t),a=0;a<i.length;)(!n||n&&e[i[a]]===r)&&(e[i[a]]=t[i[a]]),a++;return e},`extend`,"Use `assign`."),g=p(function(e,t){return h(e,t,!0)},`merge`,"Use `assign`.");function _(e,t,n){var r=t.prototype,i=e.prototype=Object.create(r);i.constructor=e,i._super=r,n&&m(i,n)}function v(e,t){return function(){return e.apply(t,arguments)}}function y(e,t){return typeof e==o?e.apply(t&&t[0]||r,t):e}function b(e,t){return e===r?t:e}function x(e,t,n){f(T(t),function(t){e.addEventListener(t,n,!1)})}function S(e,t,n){f(T(t),function(t){e.removeEventListener(t,n,!1)})}function C(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1}function w(e,t){return e.indexOf(t)>-1}function T(e){return e.trim().split(/\s+/g)}function E(e,t,n){if(e.indexOf&&!n)return e.indexOf(t);for(var r=0;r<e.length;){if(n&&e[r][n]==t||!n&&e[r]===t)return r;r++}return-1}function D(e){return Array.prototype.slice.call(e,0)}function ee(e,t,n){for(var r=[],i=[],a=0;a<e.length;){var o=t?e[a][t]:e[a];E(i,o)<0&&r.push(e[a]),i[a]=o,a++}return n&&(r=t?r.sort(function(e,n){return e[t]>n[t]}):r.sort()),r}function O(e,t){for(var n,a,o=t[0].toUpperCase()+t.slice(1),s=0;s<i.length;){if(n=i[s],a=n?n+o:t,a in e)return a;s++}return r}var k=1;function A(){return k++}function j(t){var n=t.ownerDocument||t;return n.defaultView||n.parentWindow||e}var te=/mobile|tablet|ip(ad|hone|od)|android/i,M=`ontouchstart`in e,N=O(e,`PointerEvent`)!==r,ne=M&&te.test(navigator.userAgent),P=`touch`,re=`pen`,F=`mouse`,I=`kinect`,L=25,R=1,z=2,B=4,V=8,ie=1,H=2,U=4,W=8,ae=16,G=H|U,K=W|ae,oe=G|K,se=[`x`,`y`],ce=[`clientX`,`clientY`];function q(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(t){y(e.options.enable,[e])&&n.handler(t)},this.init()}q.prototype={handler:function(){},init:function(){this.evEl&&x(this.element,this.evEl,this.domHandler),this.evTarget&&x(this.target,this.evTarget,this.domHandler),this.evWin&&x(j(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&S(this.element,this.evEl,this.domHandler),this.evTarget&&S(this.target,this.evTarget,this.domHandler),this.evWin&&S(j(this.element),this.evWin,this.domHandler)}};function le(e){var t;return t=e.options.inputClass||(N?Ae:ne?Re:M?He:Te),new t(e,ue)}function ue(e,t,n){var r=n.pointers.length,i=n.changedPointers.length,a=t&R&&r-i===0,o=t&(B|V)&&r-i===0;n.isFirst=!!a,n.isFinal=!!o,a&&(e.session={}),n.eventType=t,de(e,n),e.emit(`hammer.input`,n),e.recognize(n),e.session.prevInput=n}function de(e,t){var n=e.session,r=t.pointers,i=r.length;n.firstInput||(n.firstInput=me(t)),i>1&&!n.firstMultiple?n.firstMultiple=me(t):i===1&&(n.firstMultiple=!1);var a=n.firstInput,o=n.firstMultiple,s=o?o.center:a.center,u=t.center=he(r);t.timeStamp=l(),t.deltaTime=t.timeStamp-a.timeStamp,t.angle=ye(s,u),t.distance=ve(s,u),fe(n,t),t.offsetDirection=_e(t.deltaX,t.deltaY);var d=ge(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=d.x,t.overallVelocityY=d.y,t.overallVelocity=c(d.x)>c(d.y)?d.x:d.y,t.scale=o?xe(o.pointers,r):1,t.rotation=o?be(o.pointers,r):0,t.maxPointers=n.prevInput?t.pointers.length>n.prevInput.maxPointers?t.pointers.length:n.prevInput.maxPointers:t.pointers.length,pe(n,t);var f=e.element;C(t.srcEvent.target,f)&&(f=t.srcEvent.target),t.target=f}function fe(e,t){var n=t.center,r=e.offsetDelta||{},i=e.prevDelta||{},a=e.prevInput||{};(t.eventType===R||a.eventType===B)&&(i=e.prevDelta={x:a.deltaX||0,y:a.deltaY||0},r=e.offsetDelta={x:n.x,y:n.y}),t.deltaX=i.x+(n.x-r.x),t.deltaY=i.y+(n.y-r.y)}function pe(e,t){var n=e.lastInterval||t,i=t.timeStamp-n.timeStamp,a,o,s,l;if(t.eventType!=V&&(i>L||n.velocity===r)){var u=t.deltaX-n.deltaX,d=t.deltaY-n.deltaY,f=ge(i,u,d);o=f.x,s=f.y,a=c(f.x)>c(f.y)?f.x:f.y,l=_e(u,d),e.lastInterval=t}else a=n.velocity,o=n.velocityX,s=n.velocityY,l=n.direction;t.velocity=a,t.velocityX=o,t.velocityY=s,t.direction=l}function me(e){for(var t=[],n=0;n<e.pointers.length;)t[n]={clientX:s(e.pointers[n].clientX),clientY:s(e.pointers[n].clientY)},n++;return{timeStamp:l(),pointers:t,center:he(t),deltaX:e.deltaX,deltaY:e.deltaY}}function he(e){var t=e.length;if(t===1)return{x:s(e[0].clientX),y:s(e[0].clientY)};for(var n=0,r=0,i=0;i<t;)n+=e[i].clientX,r+=e[i].clientY,i++;return{x:s(n/t),y:s(r/t)}}function ge(e,t,n){return{x:t/e||0,y:n/e||0}}function _e(e,t){return e===t?ie:c(e)>=c(t)?e<0?H:U:t<0?W:ae}function ve(e,t,n){n||(n=se);var r=t[n[0]]-e[n[0]],i=t[n[1]]-e[n[1]];return Math.sqrt(r*r+i*i)}function ye(e,t,n){n||(n=se);var r=t[n[0]]-e[n[0]],i=t[n[1]]-e[n[1]];return Math.atan2(i,r)*180/Math.PI}function be(e,t){return ye(t[1],t[0],ce)+ye(e[1],e[0],ce)}function xe(e,t){return ve(t[0],t[1],ce)/ve(e[0],e[1],ce)}var Se={mousedown:R,mousemove:z,mouseup:B},Ce=`mousedown`,we=`mousemove mouseup`;function Te(){this.evEl=Ce,this.evWin=we,this.pressed=!1,q.apply(this,arguments)}_(Te,q,{handler:function(e){var t=Se[e.type];t&R&&(e.button===0||e.button===2)&&(this.pressed=!0),t&z&&e.which!==1&&(t=B),this.pressed&&(t&B&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:F,srcEvent:e}))}});var Ee={pointerdown:R,pointermove:z,pointerup:B,pointercancel:V,pointerout:V},De={2:P,3:re,4:F,5:I},Oe=`pointerdown`,ke=`pointermove pointerup pointercancel`;e.MSPointerEvent&&!e.PointerEvent&&(Oe=`MSPointerDown`,ke=`MSPointerMove MSPointerUp MSPointerCancel`);function Ae(){this.evEl=Oe,this.evWin=ke,q.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}_(Ae,q,{handler:function(e){var t=this.store,n=!1,r=!1,i=Ee[e.type.toLowerCase().replace(`ms`,``)],a=De[e.pointerType]||e.pointerType,o=a==P,s=E(t,e.pointerId,`pointerId`);i&R&&(e.button===0||e.button===2||o)?s<0&&(t.push(e),s=t.length-1):i&(B|V)?n=!0:!o&&e.buttons===0&&(n=!0,r=!0,i=Ee.pointerup),!(s<0)&&(r||(t[s]=e),this.callback(this.manager,i,{pointers:t,changedPointers:[e],pointerType:a,srcEvent:t[s]}),n&&t.splice(s,1))}});var je={touchstart:R,touchmove:z,touchend:B,touchcancel:V},Me=`touchstart`,Ne=`touchstart touchmove touchend touchcancel`;function Pe(){this.evTarget=Me,this.evWin=Ne,this.started=!1,q.apply(this,arguments)}_(Pe,q,{handler:function(e){var t=je[e.type];if(t===R&&(this.started=!0),this.started){var n=Fe.call(this,e,t);t&(B|V)&&n[0].length-n[1].length===0&&(this.started=!1),this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:P,srcEvent:e})}}});function Fe(e,t){var n=D(e.touches),r=D(e.changedTouches);return t&(B|V)&&(n=ee(n.concat(r),`identifier`,!0)),[n,r]}var Ie={touchstart:R,touchmove:z,touchend:B,touchcancel:V},Le=`touchstart touchmove touchend touchcancel`;function Re(){this.evTarget=Le,this.targetIds={},q.apply(this,arguments)}_(Re,q,{handler:function(e){var t=Ie[e.type],n=ze.call(this,e,t);n&&this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:P,srcEvent:e})}});function ze(e,t){var n=D(e.touches),r=this.targetIds;if(t&(R|z)&&n.length===1)return r[n[0].identifier]=!0,[n,n];var i,a,o=D(e.changedTouches),s=[],c=this.target;if(a=n.filter(function(e){return C(e.target,c)}),t===R)for(i=0;i<a.length;)r[a[i].identifier]=!0,i++;for(i=0;i<o.length;)r[o[i].identifier]&&s.push(o[i]),t&(B|V)&&delete r[o[i].identifier],i++;if(s.length)return[ee(a.concat(s),`identifier`,!0),s]}var Be=2500,Ve=25;function He(){q.apply(this,arguments);var e=v(this.handler,this);this.touch=new Re(this.manager,e),this.mouse=new Te(this.manager,e),this.primaryTouch=null,this.lastTouches=[]}_(He,q,{handler:function(e,t,n){var r=n.pointerType==P,i=n.pointerType==F;if(!(i&&n.sourceCapabilities&&n.sourceCapabilities.firesTouchEvents)){if(r)Ue.call(this,t,n);else if(i&&Ge.call(this,n))return;this.callback(e,t,n)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function Ue(e,t){e&R?(this.primaryTouch=t.changedPointers[0].identifier,We.call(this,t)):e&(B|V)&&We.call(this,t)}function We(e){var t=e.changedPointers[0];if(t.identifier===this.primaryTouch){var n={x:t.clientX,y:t.clientY};this.lastTouches.push(n);var r=this.lastTouches;setTimeout(function(){var e=r.indexOf(n);e>-1&&r.splice(e,1)},Be)}}function Ge(e){for(var t=e.srcEvent.clientX,n=e.srcEvent.clientY,r=0;r<this.lastTouches.length;r++){var i=this.lastTouches[r],a=Math.abs(t-i.x),o=Math.abs(n-i.y);if(a<=Ve&&o<=Ve)return!0}return!1}var Ke=a?O(a.style,`touchAction`):r,qe=Ke!==r,Je=`compute`,Ye=`auto`,Xe=`manipulation`,Ze=`none`,Qe=`pan-x`,$e=`pan-y`,et=rt();function tt(e,t){this.manager=e,this.set(t)}tt.prototype={set:function(e){e==Je&&(e=this.compute()),qe&&this.manager.element.style&&et[e]&&(this.manager.element.style[Ke]=e),this.actions=e.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var e=[];return f(this.manager.recognizers,function(t){y(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))}),nt(e.join(` `))},preventDefaults:function(e){var t=e.srcEvent,n=e.offsetDirection;if(this.manager.session.prevented){t.preventDefault();return}var r=this.actions,i=w(r,Ze)&&!et[Ze],a=w(r,$e)&&!et[$e],o=w(r,Qe)&&!et[Qe];if(i){var s=e.pointers.length===1,c=e.distance<2,l=e.deltaTime<250;if(s&&c&&l)return}if(!(o&&a)&&(i||a&&n&G||o&&n&K))return this.preventSrc(t)},preventSrc:function(e){this.manager.session.prevented=!0,e.preventDefault()}};function nt(e){if(w(e,Ze))return Ze;var t=w(e,Qe),n=w(e,$e);return t&&n?Ze:t||n?t?Qe:$e:w(e,Xe)?Xe:Ye}function rt(){if(!qe)return!1;var t={},n=e.CSS&&e.CSS.supports;return[`auto`,`manipulation`,`pan-y`,`pan-x`,`pan-x pan-y`,`none`].forEach(function(r){t[r]=n?e.CSS.supports(`touch-action`,r):!0}),t}var it=1,J=2,at=4,Y=8,X=Y,ot=16,Z=32;function Q(e){this.options=m({},this.defaults,e||{}),this.id=A(),this.manager=null,this.options.enable=b(this.options.enable,!0),this.state=it,this.simultaneous={},this.requireFail=[]}Q.prototype={defaults:{},set:function(e){return m(this.options,e),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(e){if(d(e,`recognizeWith`,this))return this;var t=this.simultaneous;return e=lt(e,this),t[e.id]||(t[e.id]=e,e.recognizeWith(this)),this},dropRecognizeWith:function(e){return d(e,`dropRecognizeWith`,this)?this:(e=lt(e,this),delete this.simultaneous[e.id],this)},requireFailure:function(e){if(d(e,`requireFailure`,this))return this;var t=this.requireFail;return e=lt(e,this),E(t,e)===-1&&(t.push(e),e.requireFailure(this)),this},dropRequireFailure:function(e){if(d(e,`dropRequireFailure`,this))return this;e=lt(e,this);var t=E(this.requireFail,e);return t>-1&&this.requireFail.splice(t,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(e){return!!this.simultaneous[e.id]},emit:function(e){var t=this,n=this.state;function r(n){t.manager.emit(n,e)}n<Y&&r(t.options.event+st(n)),r(t.options.event),e.additionalEvent&&r(e.additionalEvent),n>=Y&&r(t.options.event+st(n))},tryEmit:function(e){if(this.canEmit())return this.emit(e);this.state=Z},canEmit:function(){for(var e=0;e<this.requireFail.length;){if(!(this.requireFail[e].state&(Z|it)))return!1;e++}return!0},recognize:function(e){var t=m({},e);if(!y(this.options.enable,[this,t])){this.reset(),this.state=Z;return}this.state&(X|ot|Z)&&(this.state=it),this.state=this.process(t),this.state&(J|at|Y|ot)&&this.tryEmit(t)},process:function(e){},getTouchAction:function(){},reset:function(){}};function st(e){return e&ot?`cancel`:e&Y?`end`:e&at?`move`:e&J?`start`:``}function ct(e){return e==ae?`down`:e==W?`up`:e==H?`left`:e==U?`right`:``}function lt(e,t){var n=t.manager;return n?n.get(e):e}function $(){Q.apply(this,arguments)}_($,Q,{defaults:{pointers:1},attrTest:function(e){var t=this.options.pointers;return t===0||e.pointers.length===t},process:function(e){var t=this.state,n=e.eventType,r=t&(J|at),i=this.attrTest(e);return r&&(n&V||!i)?t|ot:r||i?n&B?t|Y:t&J?t|at:J:Z}});function ut(){$.apply(this,arguments),this.pX=null,this.pY=null}_(ut,$,{defaults:{event:`pan`,threshold:10,pointers:1,direction:oe},getTouchAction:function(){var e=this.options.direction,t=[];return e&G&&t.push($e),e&K&&t.push(Qe),t},directionTest:function(e){var t=this.options,n=!0,r=e.distance,i=e.direction,a=e.deltaX,o=e.deltaY;return i&t.direction||(t.direction&G?(i=a===0?ie:a<0?H:U,n=a!=this.pX,r=Math.abs(e.deltaX)):(i=o===0?ie:o<0?W:ae,n=o!=this.pY,r=Math.abs(e.deltaY))),e.direction=i,n&&r>t.threshold&&i&t.direction},attrTest:function(e){return $.prototype.attrTest.call(this,e)&&(this.state&J||!(this.state&J)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=ct(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}});function dt(){$.apply(this,arguments)}_(dt,$,{defaults:{event:`pinch`,threshold:0,pointers:2},getTouchAction:function(){return[Ze]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||this.state&J)},emit:function(e){if(e.scale!==1){var t=e.scale<1?`in`:`out`;e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}});function ft(){Q.apply(this,arguments),this._timer=null,this._input=null}_(ft,Q,{defaults:{event:`press`,pointers:1,time:251,threshold:9},getTouchAction:function(){return[Ye]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,r=e.distance<t.threshold,i=e.deltaTime>t.time;if(this._input=e,!r||!n||e.eventType&(B|V)&&!i)this.reset();else if(e.eventType&R)this.reset(),this._timer=u(function(){this.state=X,this.tryEmit()},t.time,this);else if(e.eventType&B)return X;return Z},reset:function(){clearTimeout(this._timer)},emit:function(e){this.state===X&&(e&&e.eventType&B?this.manager.emit(this.options.event+`up`,e):(this._input.timeStamp=l(),this.manager.emit(this.options.event,this._input)))}});function pt(){$.apply(this,arguments)}_(pt,$,{defaults:{event:`rotate`,threshold:0,pointers:2},getTouchAction:function(){return[Ze]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||this.state&J)}});function mt(){$.apply(this,arguments)}_(mt,$,{defaults:{event:`swipe`,threshold:10,velocity:.3,direction:G|K,pointers:1},getTouchAction:function(){return ut.prototype.getTouchAction.call(this)},attrTest:function(e){var t=this.options.direction,n;return t&(G|K)?n=e.overallVelocity:t&G?n=e.overallVelocityX:t&K&&(n=e.overallVelocityY),this._super.attrTest.call(this,e)&&t&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&c(n)>this.options.velocity&&e.eventType&B},emit:function(e){var t=ct(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}});function ht(){Q.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}_(ht,Q,{defaults:{event:`tap`,pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Xe]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,r=e.distance<t.threshold,i=e.deltaTime<t.time;if(this.reset(),e.eventType&R&&this.count===0)return this.failTimeout();if(r&&i&&n){if(e.eventType!=B)return this.failTimeout();var a=this.pTime?e.timeStamp-this.pTime<t.interval:!0,o=!this.pCenter||ve(this.pCenter,e.center)<t.posThreshold;if(this.pTime=e.timeStamp,this.pCenter=e.center,!o||!a?this.count=1:this.count+=1,this._input=e,this.count%t.taps===0)return this.hasRequireFailures()?(this._timer=u(function(){this.state=X,this.tryEmit()},t.interval,this),J):X}return Z},failTimeout:function(){return this._timer=u(function(){this.state=Z},this.options.interval,this),Z},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==X&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function gt(e,t){return t=t||{},t.recognizers=b(t.recognizers,gt.defaults.preset),new yt(e,t)}gt.VERSION=`2.0.7`,gt.defaults={domEvents:!1,touchAction:Je,enable:!0,inputTarget:null,inputClass:null,preset:[[pt,{enable:!1}],[dt,{enable:!1},[`rotate`]],[mt,{direction:G}],[ut,{direction:G},[`swipe`]],[ht],[ht,{event:`doubletap`,taps:2},[`tap`]],[ft]],cssProps:{userSelect:`none`,touchSelect:`none`,touchCallout:`none`,contentZooming:`none`,userDrag:`none`,tapHighlightColor:`rgba(0,0,0,0)`}};var _t=1,vt=2;function yt(e,t){this.options=m({},gt.defaults,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=le(this),this.touchAction=new tt(this,this.options.touchAction),bt(this,!0),f(this.options.recognizers,function(e){var t=this.add(new e[0](e[1]));e[2]&&t.recognizeWith(e[2]),e[3]&&t.requireFailure(e[3])},this)}yt.prototype={set:function(e){return m(this.options,e),e.touchAction&&this.touchAction.update(),e.inputTarget&&(this.input.destroy(),this.input.target=e.inputTarget,this.input.init()),this},stop:function(e){this.session.stopped=e?vt:_t},recognize:function(e){var t=this.session;if(!t.stopped){this.touchAction.preventDefaults(e);var n,r=this.recognizers,i=t.curRecognizer;(!i||i&&i.state&X)&&(i=t.curRecognizer=null);for(var a=0;a<r.length;)n=r[a],t.stopped!==vt&&(!i||n==i||n.canRecognizeWith(i))?n.recognize(e):n.reset(),!i&&n.state&(J|at|Y)&&(i=t.curRecognizer=n),a++}},get:function(e){if(e instanceof Q)return e;for(var t=this.recognizers,n=0;n<t.length;n++)if(t[n].options.event==e)return t[n];return null},add:function(e){if(d(e,`add`,this))return this;var t=this.get(e.options.event);return t&&this.remove(t),this.recognizers.push(e),e.manager=this,this.touchAction.update(),e},remove:function(e){if(d(e,`remove`,this))return this;if(e=this.get(e),e){var t=this.recognizers,n=E(t,e);n!==-1&&(t.splice(n,1),this.touchAction.update())}return this},on:function(e,t){if(e!==r&&t!==r){var n=this.handlers;return f(T(e),function(e){n[e]=n[e]||[],n[e].push(t)}),this}},off:function(e,t){if(e!==r){var n=this.handlers;return f(T(e),function(e){t?n[e]&&n[e].splice(E(n[e],t),1):delete n[e]}),this}},emit:function(e,t){this.options.domEvents&&xt(e,t);var n=this.handlers[e]&&this.handlers[e].slice();if(!(!n||!n.length)){t.type=e,t.preventDefault=function(){t.srcEvent.preventDefault()};for(var r=0;r<n.length;)n[r](t),r++}},destroy:function(){this.element&&bt(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function bt(e,t){var n=e.element;if(n.style){var r;f(e.options.cssProps,function(i,a){r=O(n.style,a),t?(e.oldCssProps[r]=n.style[r],n.style[r]=i):n.style[r]=e.oldCssProps[r]||``}),t||(e.oldCssProps={})}}function xt(e,n){var r=t.createEvent(`Event`);r.initEvent(e,!0,!0),r.gesture=n,n.target.dispatchEvent(r)}return m(gt,{INPUT_START:R,INPUT_MOVE:z,INPUT_END:B,INPUT_CANCEL:V,STATE_POSSIBLE:it,STATE_BEGAN:J,STATE_CHANGED:at,STATE_ENDED:Y,STATE_RECOGNIZED:X,STATE_CANCELLED:ot,STATE_FAILED:Z,DIRECTION_NONE:ie,DIRECTION_LEFT:H,DIRECTION_RIGHT:U,DIRECTION_UP:W,DIRECTION_DOWN:ae,DIRECTION_HORIZONTAL:G,DIRECTION_VERTICAL:K,DIRECTION_ALL:oe,Manager:yt,Input:q,TouchAction:tt,TouchInput:Re,MouseInput:Te,PointerEventInput:Ae,TouchMouseInput:He,SingleTouchInput:Pe,Recognizer:Q,AttrRecognizer:$,Tap:ht,Pan:ut,Swipe:mt,Pinch:dt,Rotate:pt,Press:ft,on:x,off:S,each:f,merge:g,extend:h,assign:m,inherit:_,bindFn:v,prefixed:O}),gt})(typeof window<`u`?window:{},typeof document<`u`?document:{},`Hammer`),j=function(e,t){t===void 0&&console.warn(`THREE.OrbitControls: The second parameter "domElement" is now mandatory.`),t===document&&console.error(`THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.`),this.object=e,this.domElement=t,this.enabled=!0,this.target=new n.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!1,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={LEFT:n.MOUSE.ROTATE,MIDDLE:n.MOUSE.DOLLY,RIGHT:n.MOUSE.PAN},this.touches={ONE:n.TOUCH.ROTATE,TWO:n.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=function(){return u.phi},this.getAzimuthalAngle=function(){return u.theta},this.saveState=function(){r.target0.copy(r.target),r.position0.copy(r.object.position),r.zoom0=r.object.zoom},this.reset=function(){r.target.copy(r.target0),r.object.position.copy(r.position0),r.object.zoom=r.zoom0,r.object.updateProjectionMatrix(),r.dispatchEvent(i),r.update(),c=s.NONE},this.update=function(){var t=new n.Vector3,a=new n.Quaternion().setFromUnitVectors(e.up,new n.Vector3(0,1,0)),o=a.clone().inverse(),h=new n.Vector3,g=new n.Quaternion;return function(){var e=r.object.position;return t.copy(e).sub(r.target),t.applyQuaternion(a),u.setFromVector3(t),r.autoRotate&&c===s.NONE&&E(w()),r.enableDamping?(u.theta+=d.theta*r.dampingFactor,u.phi+=d.phi*r.dampingFactor):(u.theta+=d.theta,u.phi+=d.phi),u.theta=Math.max(r.minAzimuthAngle,Math.min(r.maxAzimuthAngle,u.theta)),u.phi=Math.max(r.minPolarAngle,Math.min(r.maxPolarAngle,u.phi)),u.makeSafe(),u.radius*=f,u.radius=Math.max(r.minDistance,Math.min(r.maxDistance,u.radius)),r.enableDamping===!0?r.target.addScaledVector(p,r.dampingFactor):r.target.add(p),t.setFromSpherical(u),t.applyQuaternion(o),e.copy(r.target).add(t),r.object.lookAt(r.target),r.enableDamping===!0?(d.theta*=1-r.dampingFactor,d.phi*=1-r.dampingFactor,p.multiplyScalar(1-r.dampingFactor)):(d.set(0,0,0),p.set(0,0,0)),f=1,m||h.distanceToSquared(r.object.position)>l||8*(1-g.dot(r.object.quaternion))>l?(r.dispatchEvent(i),h.copy(r.object.position),g.copy(r.object.quaternion),m=!1,!0):!1}}(),this.dispose=function(){r.domElement.removeEventListener(`contextmenu`,de,!1),r.domElement.removeEventListener(`mousedown`,G,!1),r.domElement.removeEventListener(`wheel`,se,!1),r.domElement.removeEventListener(`touchstart`,q,!1),r.domElement.removeEventListener(`touchend`,ue,!1),r.domElement.removeEventListener(`touchmove`,le,!1),document.removeEventListener(`mousemove`,K,!1),document.removeEventListener(`mouseup`,oe,!1),r.domElement.removeEventListener(`keydown`,ce,!1)};var r=this,i={type:`change`},a={type:`start`},o={type:`end`},s={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},c=s.NONE,l=1e-6,u=new n.Spherical,d=new n.Spherical,f=1,p=new n.Vector3,m=!1,h=new n.Vector2,g=new n.Vector2,_=new n.Vector2,v=new n.Vector2,y=new n.Vector2,b=new n.Vector2,x=new n.Vector2,S=new n.Vector2,C=new n.Vector2;function w(){return 2*Math.PI/60/60*r.autoRotateSpeed}function T(){return Math.pow(.95,r.zoomSpeed)}function E(e){d.theta-=e}function D(e){d.phi-=e}var ee=function(){var e=new n.Vector3;return function(t,n){e.setFromMatrixColumn(n,0),e.multiplyScalar(-t),p.add(e)}}(),O=function(){var e=new n.Vector3;return function(t,n){r.screenSpacePanning===!0?e.setFromMatrixColumn(n,1):(e.setFromMatrixColumn(n,0),e.crossVectors(r.object.up,e)),e.multiplyScalar(t),p.add(e)}}(),k=function(){var e=new n.Vector3;return function(t,n){var i=r.domElement;if(r.object.isPerspectiveCamera){var a=r.object.position;e.copy(a).sub(r.target);var o=e.length();o*=Math.tan(r.object.fov/2*Math.PI/180),ee(2*t*o/i.clientHeight,r.object.matrix),O(2*n*o/i.clientHeight,r.object.matrix)}else r.object.isOrthographicCamera?(ee(t*(r.object.right-r.object.left)/r.object.zoom/i.clientWidth,r.object.matrix),O(n*(r.object.top-r.object.bottom)/r.object.zoom/i.clientHeight,r.object.matrix)):(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.`),r.enablePan=!1)}}();function A(e){r.object.isPerspectiveCamera?f/=e:r.object.isOrthographicCamera?(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom*e)),r.object.updateProjectionMatrix(),m=!0):(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.`),r.enableZoom=!1)}function j(e){r.object.isPerspectiveCamera?f*=e:r.object.isOrthographicCamera?(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/e)),r.object.updateProjectionMatrix(),m=!0):(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.`),r.enableZoom=!1)}function te(e){h.set(e.clientX,e.clientY)}function M(e){x.set(e.clientX,e.clientY)}function N(e){v.set(e.clientX,e.clientY)}function ne(e){g.set(e.clientX,e.clientY),_.subVectors(g,h).multiplyScalar(r.rotateSpeed);var t=r.domElement;E(2*Math.PI*_.x/t.clientHeight),D(2*Math.PI*_.y/t.clientHeight),h.copy(g),r.update()}function P(e){S.set(e.clientX,e.clientY),C.subVectors(S,x),C.y>0?A(T()):C.y<0&&j(T()),x.copy(S),r.update()}function re(e){y.set(e.clientX,e.clientY),b.subVectors(y,v).multiplyScalar(r.panSpeed),k(b.x,b.y),v.copy(y),r.update()}function F(e){e.deltaY<0?j(T()):e.deltaY>0&&A(T()),r.update()}function I(e){var t=!1;switch(e.keyCode){case r.keys.UP:k(0,r.keyPanSpeed),t=!0;break;case r.keys.BOTTOM:k(0,-r.keyPanSpeed),t=!0;break;case r.keys.LEFT:k(r.keyPanSpeed,0),t=!0;break;case r.keys.RIGHT:k(-r.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),r.update())}function L(e){if(e.touches.length==1)h.set(e.touches[0].pageX,e.touches[0].pageY);else{var t=.5*(e.touches[0].pageX+e.touches[1].pageX),n=.5*(e.touches[0].pageY+e.touches[1].pageY);h.set(t,n)}}function R(e){if(e.touches.length==1)v.set(e.touches[0].pageX,e.touches[0].pageY);else{var t=.5*(e.touches[0].pageX+e.touches[1].pageX),n=.5*(e.touches[0].pageY+e.touches[1].pageY);v.set(t,n)}}function z(e){var t=e.touches[0].pageX-e.touches[1].pageX,n=e.touches[0].pageY-e.touches[1].pageY,r=Math.sqrt(t*t+n*n);x.set(0,r)}function B(e){r.enableZoom&&z(e),r.enablePan&&R(e)}function V(e){r.enableZoom&&z(e),r.enableRotate&&L(e)}function ie(e){if(e.touches.length==1)g.set(e.touches[0].pageX,e.touches[0].pageY);else{var t=.5*(e.touches[0].pageX+e.touches[1].pageX),n=.5*(e.touches[0].pageY+e.touches[1].pageY);g.set(t,n)}_.subVectors(g,h).multiplyScalar(r.rotateSpeed);var i=r.domElement;E(2*Math.PI*_.x/i.clientHeight),D(2*Math.PI*_.y/i.clientHeight),h.copy(g)}function H(e){if(e.touches.length==1)y.set(e.touches[0].pageX,e.touches[0].pageY);else{var t=.5*(e.touches[0].pageX+e.touches[1].pageX),n=.5*(e.touches[0].pageY+e.touches[1].pageY);y.set(t,n)}b.subVectors(y,v).multiplyScalar(r.panSpeed),k(b.x,b.y),v.copy(y)}function U(e){var t=e.touches[0].pageX-e.touches[1].pageX,n=e.touches[0].pageY-e.touches[1].pageY,i=Math.sqrt(t*t+n*n);S.set(0,i),C.set(0,Math.pow(S.y/x.y,r.zoomSpeed)),A(C.y),x.copy(S)}function W(e){r.enableZoom&&U(e),r.enablePan&&H(e)}function ae(e){r.enableZoom&&U(e),r.enableRotate&&ie(e)}function G(e){if(r.enabled!==!1){e.preventDefault(),r.domElement.focus?r.domElement.focus():window.focus();var t;switch(e.button){case 0:t=r.mouseButtons.LEFT;break;case 1:t=r.mouseButtons.MIDDLE;break;case 2:t=r.mouseButtons.RIGHT;break;default:t=-1}switch(t){case n.MOUSE.DOLLY:if(r.enableZoom===!1)return;M(e),c=s.DOLLY;break;case n.MOUSE.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(r.enablePan===!1)return;N(e),c=s.PAN}else{if(r.enableRotate===!1)return;te(e),c=s.ROTATE}break;case n.MOUSE.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(r.enableRotate===!1)return;te(e),c=s.ROTATE}else{if(r.enablePan===!1)return;N(e),c=s.PAN}break;default:c=s.NONE}c!==s.NONE&&(document.addEventListener(`mousemove`,K,!1),document.addEventListener(`mouseup`,oe,!1),r.dispatchEvent(a))}}function K(e){if(r.enabled!==!1)switch(e.preventDefault(),c){case s.ROTATE:if(r.enableRotate===!1)return;ne(e);break;case s.DOLLY:if(r.enableZoom===!1)return;P(e);break;case s.PAN:if(r.enablePan===!1)return;re(e);break}}function oe(e){r.enabled!==!1&&(document.removeEventListener(`mousemove`,K,!1),document.removeEventListener(`mouseup`,oe,!1),r.dispatchEvent(o),c=s.NONE)}function se(e){r.enabled===!1||r.enableZoom===!1||c!==s.NONE&&c!==s.ROTATE||(e.preventDefault(),e.stopPropagation(),r.dispatchEvent(a),F(e),r.dispatchEvent(o))}function ce(e){r.enabled===!1||r.enableKeys===!1||r.enablePan===!1||I(e)}function q(e){if(r.enabled!==!1){switch(e.preventDefault(),e.touches.length){case 1:switch(r.touches.ONE){case n.TOUCH.ROTATE:if(r.enableRotate===!1)return;L(e),c=s.TOUCH_ROTATE;break;case n.TOUCH.PAN:if(r.enablePan===!1)return;R(e),c=s.TOUCH_PAN;break;default:c=s.NONE}break;case 2:switch(r.touches.TWO){case n.TOUCH.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;B(e),c=s.TOUCH_DOLLY_PAN;break;case n.TOUCH.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;V(e),c=s.TOUCH_DOLLY_ROTATE;break;default:c=s.NONE}break;default:c=s.NONE}c!==s.NONE&&r.dispatchEvent(a)}}function le(e){if(r.enabled!==!1)switch(e.preventDefault(),e.stopPropagation(),c){case s.TOUCH_ROTATE:if(r.enableRotate===!1)return;ie(e),r.update();break;case s.TOUCH_PAN:if(r.enablePan===!1)return;H(e),r.update();break;case s.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;W(e),r.update();break;case s.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;ae(e),r.update();break;default:c=s.NONE}}function ue(e){r.enabled!==!1&&(r.dispatchEvent(o),c=s.NONE)}function de(e){r.enabled!==!1&&e.preventDefault()}r.domElement.addEventListener(`contextmenu`,de,!1),r.domElement.addEventListener(`mousedown`,G,!1),r.domElement.addEventListener(`wheel`,se,!1),r.domElement.addEventListener(`touchstart`,q,!1),r.domElement.addEventListener(`touchend`,ue,!1),r.domElement.addEventListener(`touchmove`,le,!1),r.domElement.addEventListener(`keydown`,ce,!1),r.domElement.tabIndex===-1&&(r.domElement.tabIndex=0),this.update()};j.prototype=Object.create(n.EventDispatcher.prototype),j.prototype.constructor=j;var te=function(e,t){j.call(this,e,t),this.mouseButtons.LEFT=n.MOUSE.PAN,this.mouseButtons.RIGHT=n.MOUSE.ROTATE,this.touches.ONE=n.TOUCH.PAN,this.touches.TWO=n.TOUCH.DOLLY_ROTATE};te.prototype=Object.create(n.EventDispatcher.prototype),te.prototype.constructor=te;var M=function(e){n.Object3D.call(this),this.element=e,this.element.style.position=`absolute`,this.element.style.pointerEvents=`auto`,this.addEventListener(`removed`,function(){this.traverse(function(e){e.element instanceof Element&&e.element.parentNode!==null&&e.element.parentNode.removeChild(e.element)})})};M.prototype=Object.create(n.Object3D.prototype),M.prototype.constructor=M;var N=function(e){M.call(this,e)};N.prototype=Object.create(M.prototype),N.prototype.constructor=N;var ne=function(){var e=this,t,r,i,a,o=new n.Matrix4,s={camera:{fov:0,style:``},objects:new WeakMap},c=document.createElement(`div`);c.style.overflow=`hidden`,this.domElement=c;var l=document.createElement(`div`);l.style.WebkitTransformStyle=`preserve-3d`,l.style.transformStyle=`preserve-3d`,l.style.pointerEvents=`none`,c.appendChild(l);var u=/Trident/i.test(navigator.userAgent);this.getSize=function(){return{width:t,height:r}},this.setSize=function(e,n){t=e,r=n,i=t/2,a=r/2,c.style.width=e+`px`,c.style.height=n+`px`,l.style.width=e+`px`,l.style.height=n+`px`};function d(e){return Math.abs(e)<1e-10?0:e}function f(e){var t=e.elements;return`matrix3d(`+d(t[0])+`,`+d(-t[1])+`,`+d(t[2])+`,`+d(t[3])+`,`+d(t[4])+`,`+d(-t[5])+`,`+d(t[6])+`,`+d(t[7])+`,`+d(t[8])+`,`+d(-t[9])+`,`+d(t[10])+`,`+d(t[11])+`,`+d(t[12])+`,`+d(-t[13])+`,`+d(t[14])+`,`+d(t[15])+`)`}function p(e,t){var n=e.elements,r=`matrix3d(`+d(n[0])+`,`+d(n[1])+`,`+d(n[2])+`,`+d(n[3])+`,`+d(-n[4])+`,`+d(-n[5])+`,`+d(-n[6])+`,`+d(-n[7])+`,`+d(n[8])+`,`+d(n[9])+`,`+d(n[10])+`,`+d(n[11])+`,`+d(n[12])+`,`+d(n[13])+`,`+d(n[14])+`,`+d(n[15])+`)`;return u?`translate(-50%,-50%)translate(`+i+`px,`+a+`px)`+t+r:`translate(-50%,-50%)`+r}function m(t,n,r,i){if(t instanceof M){t.onBeforeRender(e,n,r);var a;t instanceof N?(o.copy(r.matrixWorldInverse),o.transpose(),o.copyPosition(t.matrixWorld),o.scale(t.scale),o.elements[3]=0,o.elements[7]=0,o.elements[11]=0,o.elements[15]=1,a=p(o,i)):a=p(t.matrixWorld,i);var c=t.element,d=s.objects.get(t);if(d===void 0||d.style!==a){c.style.WebkitTransform=a,c.style.transform=a;var f={style:a};u&&(f.distanceToCameraSquared=h(r,t)),s.objects.set(t,f)}c.style.display=t.visible?``:`none`,c.parentNode!==l&&l.appendChild(c),t.onAfterRender(e,n,r)}for(var g=0,_=t.children.length;g<_;g++)m(t.children[g],n,r,i)}var h=function(){var e=new n.Vector3,t=new n.Vector3;return function(n,r){return e.setFromMatrixPosition(n.matrixWorld),t.setFromMatrixPosition(r.matrixWorld),e.distanceToSquared(t)}}();function g(e){var t=[];return e.traverse(function(e){e instanceof M&&t.push(e)}),t}function _(e){for(var t=g(e).sort(function(e,t){return s.objects.get(e).distanceToCameraSquared-s.objects.get(t).distanceToCameraSquared}),n=t.length,r=0,i=t.length;r<i;r++)t[r].element.style.zIndex=n-r}this.render=function(e,t){var n=t.projectionMatrix.elements[5]*a;if(s.camera.fov!==n&&(t.isPerspectiveCamera?(c.style.WebkitPerspective=n+`px`,c.style.perspective=n+`px`):(c.style.WebkitPerspective=``,c.style.perspective=``),s.camera.fov=n),e.autoUpdate===!0&&e.updateMatrixWorld(),t.parent===null&&t.updateMatrixWorld(),t.isOrthographicCamera)var r=-(t.right+t.left)/2,o=(t.top+t.bottom)/2;var p=t.isOrthographicCamera?`scale(`+n+`)translate(`+d(r)+`px,`+d(o)+`px)`+f(t.matrixWorldInverse):`translateZ(`+n+`px)`+f(t.matrixWorldInverse),h=p+`translate(`+i+`px,`+a+`px)`;s.camera.style!==h&&!u&&(l.style.WebkitTransform=h,l.style.transform=h,s.camera.style=h),m(e,e,t,p),u&&_(e)}};function P(e,t,r){let{top:i,left:a,width:o,height:s}=t.getBoundingClientRect();return r&&(a+=o*r.left,i+=s*(1-r.bottom-r.height),o*=r.width,s*=r.height),new n.Vector2((e.x-a)/o*2-1,-(e.y-i)/s*2+1)}var re=class extends n.BufferGeometry{constructor(e,t,r,i,a){super(),this.type=`RoundedBoxGeometry`,a=isNaN(a)?1:Math.max(1,Math.floor(a)),e=isNaN(e)?1:e,t=isNaN(t)?1:t,r=isNaN(r)?1:r,i=isNaN(i)?.15:i,i=Math.min(i,Math.min(e,Math.min(t,Math.min(r)))/2);let o=e/2-i,s=t/2-i,c=r/2-i;this.parameters={width:e,height:t,depth:r,radius:i,radiusSegments:a};let l=a+1,u=l*a+1<<3,d=new n.BufferAttribute(new Float32Array(u*3),3),f=new n.BufferAttribute(new Float32Array(u*3),3),p=[],m=[];new n.Vector3;let h=new n.Vector3,g=[],_=[],v=[],y=l*a,b=l*a+1;x(),C(),S(),w(),E(),T();function x(){let e=[new n.Vector3(1,1,1),new n.Vector3(1,1,-1),new n.Vector3(-1,1,-1),new n.Vector3(-1,1,1),new n.Vector3(1,-1,1),new n.Vector3(1,-1,-1),new n.Vector3(-1,-1,-1),new n.Vector3(-1,-1,1)];for(let e=0;e<8;e++)p.push([]),m.push([]);let t=Math.PI/2,r=new n.Vector3(o,s,c);for(let e=0;e<=a;e++){let n=e/a*t,o=Math.cos(n),s=Math.sin(n);if(e==a){h.set(0,1,0);let e=h.clone().multiplyScalar(i).add(r);p[0].push(e),g.push(e);let t=h.clone();m[0].push(t),_.push(t);continue}for(let e=0;e<=a;e++){let n=e/a*t;h.x=o*Math.cos(n),h.y=s,h.z=o*Math.sin(n);let c=h.clone().multiplyScalar(i).add(r);p[0].push(c),g.push(c);let l=h.clone().normalize();m[0].push(l),_.push(l)}}for(let t=1;t<8;t++)for(let n=0;n<p[0].length;n++){let r=p[0][n].clone().multiply(e[t]);p[t].push(r),g.push(r);let i=m[0][n].clone().multiply(e[t]);m[t].push(i),_.push(i)}}function S(){let e=[!0,!1,!0,!1,!1,!0,!1,!0],t=l*(a-1);for(let n=0;n<8;n++){let r=b*n;for(let t=0;t<a-1;t++){let i=t*l,o=(t+1)*l;for(let t=0;t<a;t++){let a=t+1,s=r+i+t,c=r+i+a,l=r+o+t,u=r+o+a;e[n]?(v.push(s),v.push(l),v.push(c),v.push(c),v.push(l),v.push(u)):(v.push(s),v.push(c),v.push(l),v.push(c),v.push(u),v.push(l))}}for(let i=0;i<a;i++){let a=r+t+i,o=r+t+i+1,s=r+y;e[n]?(v.push(a),v.push(s),v.push(o)):(v.push(a),v.push(o),v.push(s))}}}function C(){let e=y,t=y+b,n=y+b*2,r=y+b*3;v.push(e),v.push(t),v.push(n),v.push(e),v.push(n),v.push(r),e=y+b*4,t=y+b*5,n=y+b*6,r=y+b*7,v.push(e),v.push(n),v.push(t),v.push(e),v.push(r),v.push(n),e=0,t=b,n=b*4,r=b*5,v.push(e),v.push(n),v.push(t),v.push(t),v.push(n),v.push(r),e=b*2,t=b*3,n=b*6,r=b*7,v.push(e),v.push(n),v.push(t),v.push(t),v.push(n),v.push(r),e=a,t=a+b*3,n=a+b*4,r=a+b*7,v.push(e),v.push(t),v.push(n),v.push(t),v.push(r),v.push(n),e=a+b,t=a+b*2,n=a+b*5,r=a+b*6,v.push(e),v.push(n),v.push(t),v.push(t),v.push(n),v.push(r)}function w(){for(let e=0;e<4;e++){let t=e*b,n=4*b+t,r=(e&1)==1;for(let e=0;e<a;e++){let i=e+1,a=t+e,o=t+i,s=n+e,c=n+i;r?(v.push(a),v.push(s),v.push(o),v.push(o),v.push(s),v.push(c)):(v.push(a),v.push(o),v.push(s),v.push(o),v.push(c),v.push(s))}}}function T(){let e=[0,2,4,6],t=[1,3,5,7];for(let n=0;n<4;n++){let r=b*e[n],i=b*t[n],o=1>=n;for(let e=0;e<a;e++){let t=e*l,n=(e+1)*l,a=r+t,s=r+n,c=i+t,u=i+n;o?(v.push(a),v.push(c),v.push(s),v.push(s),v.push(c),v.push(u)):(v.push(a),v.push(s),v.push(c),v.push(s),v.push(u),v.push(c))}}}function E(){let e=a-1,t=[0,1,4,5],n=[3,2,7,6],r=[0,1,1,0];for(let i=0;i<4;i++){let o=t[i]*b,s=n[i]*b;for(let t=0;t<=e;t++){let n=o+a+t*l,c=o+(t==e?b-1:a+(t+1)*l),u=s+a+t*l,d=s+(t==e?b-1:a+(t+1)*l);r[i]?(v.push(n),v.push(u),v.push(c),v.push(c),v.push(u),v.push(d)):(v.push(n),v.push(c),v.push(u),v.push(c),v.push(d),v.push(u))}}}let D=0;for(let e=0;e<g.length;e++)d.setXYZ(D,g[e].x,g[e].y,g[e].z),f.setXYZ(D,_[e].x,_[e].y,_[e].z),D++;this.setIndex(new n.BufferAttribute(new Uint16Array(v),1)),this.setAttribute(`position`,d),this.setAttribute(`normal`,f)}};function F(e,t){return typeof e!=`number`||typeof t!=`number`?!1:Math.abs(e-t)<.001}function I(e,t,n,r=e=>e){let i=r(n);return e*(1-i)+t*i}var L=Number((Math.PI/2).toFixed(5));function R(e,t,r){let i=new n.Shape;return i.moveTo(r,0),i.lineTo(e-r,0),i.absarc(e-r,r,r,-L,0,!1),i.lineTo(e,t-r),i.absarc(e-r,t-r,r,0,L,!1),i.lineTo(r,t),i.absarc(r,t-r,r,L,Math.PI,!1),i.lineTo(0,r),i.absarc(r,r,r,Math.PI,Math.PI*1.5,!1),i}var z=e=>{let t=document.createElement(`div`);t.innerText=e;let n=new M(t);return n.name=e,n.scale.set(.3,.3,.3),t.style.pointerEvents=`none`,t.style.backfaceVisibility=`hidden`,n},B=e=>{let t=new n.PlaneGeometry(5,5),r=new n.MeshBasicMaterial({transparent:!0,opacity:0}),i=new n.Mesh(t,r),a=document.createElement(`div`);a.innerText=e;let o=new M(a);return o.name=e,o.scale.set(.3,.3,.3),a.style.color=`#ffffff`,a.style.opacity=`0.5`,a.style.pointerEvents=`none`,a.style.backfaceVisibility=`hidden`,i.rotateX(-L),i.add(o),i},V=class extends p.Controller{get config(){return Object.assign({},this._config)}updateState(e,t){let n=this.state;this.state=Object.assign(Object.assign({},this.state),e),typeof e.arrowsVisible==`boolean`&&this.handleArrowsVisible(e.arrowsVisible),this.hooks.emit(`stateChange`,{state:this.state,prevState:n,userAction:t})}constructor(e,r){super(e),this.camera=new t.Camera(90),this.scene=new n.Scene,this.renderer=new n.WebGLRenderer({antialias:!0,alpha:!0}),this.css3drenderer=new ne,this.ambientLight=new n.AmbientLight(16777215,.7),this.wrapper=document.createElement(`div`),this.arrows=document.createElement(`div`),this.arrowLeft=document.createElement(`div`),this.arrowRight=document.createElement(`div`),this.arrowFront=document.createElement(`div`),this.arrowBack=document.createElement(`div`),this.arrowTop=document.createElement(`div`),this.arrowBottom=document.createElement(`div`),this.spherical=null,this.dragging=!1,this.style=document.createElement(`style`),this.directionalLight=new n.DirectionalLight(16777215,.2),this.box=new n.Mesh(new re(8,8,8,.5,20),new n.MeshPhongMaterial({color:16777215})),this.faces=new n.Group,this.orient=({longitude:e,latitude:t})=>{this.dragging=!1,this.spherical=null,this.controls.enableDamping=!1,this.five.setState(Object.assign({latitude:t},e===void 0?{}:{longitude:e+this.config.fixedLongitude})),this.five.ready().then(()=>{this.controls.enableDamping=!0,this.setState({arrowsVisible:!0})})},this.onRenderFrame=()=>{var e,t,n,r,i;if(this.renderer.render(this.scene,this.camera),this.css3drenderer.render(this.scene,this.camera),this.directionalLight.position.copy(this.camera.position),(e=this.controls)==null||e.update(),this.dragging){this.camera.computePose(),this.updateByCamera();let{longitude:e,latitude:t}=this.camera.pose;this.five.setState({longitude:e,latitude:t},!0),this.updateArrows({longitude:e,latitude:t})}else if(this.spherical&&(!F(this.spherical.pi,(t=this.controls)==null?void 0:t.getPolarAngle())||!F(this.spherical.theta,(n=this.controls)==null?void 0:n.getAzimuthalAngle()))){this.spherical={pi:(r=this.controls)==null?void 0:r.getPolarAngle(),theta:(i=this.controls)==null?void 0:i.getAzimuthalAngle()},this.camera.computePose(),this.updateByCamera();let{longitude:e,latitude:t}=this.camera.pose;this.five.setState({longitude:e,latitude:t},!0),this.updateArrows({longitude:e,latitude:t})}else this.spherical=null},this.onTapGesture=e=>{let t=e.pointers[0].clientX,r=e.pointers[0].clientY,i=P({x:t,y:r},this.wrapper),a=new n.Raycaster;a.setFromCamera(i,this.camera);let[o]=a.intersectObjects(this.faces.children,!1);if(o){let{longitude:e,latitude:t}=o.object.userData;this.orient({longitude:e,latitude:t})}},this.onFiveWantsGesture=()=>{if(this.spherical)return!1},this.onFiveModeChange=e=>{this.controls&&(this.controls.maxPolarAngle=e===`Topview`?0:L)},this.onCameraUpdate=({state:e})=>{if(this.dragging||this.spherical)return;let{longitude:t,latitude:r}=e;this.camera.pose.longitude===t&&this.camera.pose.latitude===r||(this.camera.setFromPose({longitude:t,latitude:r,distance:20,offset:new n.Vector3(0,0,0)}),this.updateByCamera(),this.updateArrows({longitude:t,latitude:r}))},this.onPanStart=e=>{this.dragging=!0,this.spherical={}},this.onMouseMove=e=>{if(this.dragging)return;let t=P({x:e.clientX,y:e.clientY},this.wrapper),r=new n.Raycaster;r.setFromCamera(t,this.camera);let[i]=r.intersectObjects(this.faces.children,!1);this.faces.children.forEach(e=>{e.material.opacity=0,e.children[0].element.style.color=``}),i&&(i.object.material.opacity=.3,i.object.children[0].element.style.color=`#336dff`)},this.onPanEnd=e=>{this.dragging=!1,this.spherical={pi:this.controls.getPolarAngle(),theta:this.controls.getAzimuthalAngle()}},this.dispose=()=>{this.disable()},this.five=e,this.state=Object.assign({enabled:!1,visible:!0,arrowsVisible:!1},r==null?void 0:r.initialState),this._config=Object.assign({fixedLongitude:0,orthoView:!0},r==null?void 0:r.config),this.state.enabled&&this._enable({userAction:!1}),this.mc=new A.Manager(this.wrapper),this.mc.add(new A.Tap({interval:410})),this.mc.add(new A.Pan({threshold:10,pointers:0})),this.camera.setFromPose({distance:20,offset:new n.Vector3(0,0,0),longitude:e.camera.pose.latitude,latitude:e.camera.pose.latitude}),this.cylinder=new n.Mesh(new n.CylinderGeometry(13.2,14,.01,50,1,!0),new n.ShaderMaterial({uniforms:{radiusTop:{value:13.2},radiusBottom:{value:14},opacity:{value:1}},vertexShader:`
352
+ `;return function(){var n=Error(`get-stack-trace`),r=n&&n.stack?n.stack.replace(/^[^\(]+?[\n$]/gm,``).replace(/^\s+at\s+/gm,``).replace(/^Object.<anonymous>\s*\(/gm,`{anonymous}()@`):`Unknown Stack Trace`,a=e.console&&(e.console.warn||e.console.log);return a&&a.call(e.console,i,r),t.apply(this,arguments)}}var m=typeof Object.assign==`function`?Object.assign:function(e){if(e===r||e===null)throw TypeError(`Cannot convert undefined or null to object`);for(var t=Object(e),n=1;n<arguments.length;n++){var i=arguments[n];if(i!==r&&i!==null)for(var a in i)i.hasOwnProperty(a)&&(t[a]=i[a])}return t},h=p(function(e,t,n){for(var i=Object.keys(t),a=0;a<i.length;)(!n||n&&e[i[a]]===r)&&(e[i[a]]=t[i[a]]),a++;return e},`extend`,"Use `assign`."),g=p(function(e,t){return h(e,t,!0)},`merge`,"Use `assign`.");function _(e,t,n){var r=t.prototype,i=e.prototype=Object.create(r);i.constructor=e,i._super=r,n&&m(i,n)}function v(e,t){return function(){return e.apply(t,arguments)}}function y(e,t){return typeof e==o?e.apply(t&&t[0]||r,t):e}function b(e,t){return e===r?t:e}function x(e,t,n){f(T(t),function(t){e.addEventListener(t,n,!1)})}function S(e,t,n){f(T(t),function(t){e.removeEventListener(t,n,!1)})}function C(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1}function w(e,t){return e.indexOf(t)>-1}function T(e){return e.trim().split(/\s+/g)}function E(e,t,n){if(e.indexOf&&!n)return e.indexOf(t);for(var r=0;r<e.length;){if(n&&e[r][n]==t||!n&&e[r]===t)return r;r++}return-1}function D(e){return Array.prototype.slice.call(e,0)}function ee(e,t,n){for(var r=[],i=[],a=0;a<e.length;){var o=t?e[a][t]:e[a];E(i,o)<0&&r.push(e[a]),i[a]=o,a++}return n&&(r=t?r.sort(function(e,n){return e[t]>n[t]}):r.sort()),r}function O(e,t){for(var n,a,o=t[0].toUpperCase()+t.slice(1),s=0;s<i.length;){if(n=i[s],a=n?n+o:t,a in e)return a;s++}return r}var k=1;function te(){return k++}function A(t){var n=t.ownerDocument||t;return n.defaultView||n.parentWindow||e}var ne=/mobile|tablet|ip(ad|hone|od)|android/i,j=`ontouchstart`in e,re=O(e,`PointerEvent`)!==r,ie=j&&ne.test(navigator.userAgent),M=`touch`,ae=`pen`,N=`mouse`,oe=`kinect`,P=25,F=1,I=2,L=4,R=8,z=1,B=2,V=4,H=8,U=16,W=B|V,G=H|U,se=W|G,ce=[`x`,`y`],K=[`clientX`,`clientY`];function q(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(t){y(e.options.enable,[e])&&n.handler(t)},this.init()}q.prototype={handler:function(){},init:function(){this.evEl&&x(this.element,this.evEl,this.domHandler),this.evTarget&&x(this.target,this.evTarget,this.domHandler),this.evWin&&x(A(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&S(this.element,this.evEl,this.domHandler),this.evTarget&&S(this.target,this.evTarget,this.domHandler),this.evWin&&S(A(this.element),this.evWin,this.domHandler)}};function le(e){var t;return t=e.options.inputClass||(re?Ae:ie?Re:j?He:Te),new t(e,ue)}function ue(e,t,n){var r=n.pointers.length,i=n.changedPointers.length,a=t&F&&r-i===0,o=t&(L|R)&&r-i===0;n.isFirst=!!a,n.isFinal=!!o,a&&(e.session={}),n.eventType=t,de(e,n),e.emit(`hammer.input`,n),e.recognize(n),e.session.prevInput=n}function de(e,t){var n=e.session,r=t.pointers,i=r.length;n.firstInput||(n.firstInput=me(t)),i>1&&!n.firstMultiple?n.firstMultiple=me(t):i===1&&(n.firstMultiple=!1);var a=n.firstInput,o=n.firstMultiple,s=o?o.center:a.center,u=t.center=he(r);t.timeStamp=l(),t.deltaTime=t.timeStamp-a.timeStamp,t.angle=ye(s,u),t.distance=ve(s,u),fe(n,t),t.offsetDirection=_e(t.deltaX,t.deltaY);var d=ge(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=d.x,t.overallVelocityY=d.y,t.overallVelocity=c(d.x)>c(d.y)?d.x:d.y,t.scale=o?xe(o.pointers,r):1,t.rotation=o?be(o.pointers,r):0,t.maxPointers=n.prevInput?t.pointers.length>n.prevInput.maxPointers?t.pointers.length:n.prevInput.maxPointers:t.pointers.length,pe(n,t);var f=e.element;C(t.srcEvent.target,f)&&(f=t.srcEvent.target),t.target=f}function fe(e,t){var n=t.center,r=e.offsetDelta||{},i=e.prevDelta||{},a=e.prevInput||{};(t.eventType===F||a.eventType===L)&&(i=e.prevDelta={x:a.deltaX||0,y:a.deltaY||0},r=e.offsetDelta={x:n.x,y:n.y}),t.deltaX=i.x+(n.x-r.x),t.deltaY=i.y+(n.y-r.y)}function pe(e,t){var n=e.lastInterval||t,i=t.timeStamp-n.timeStamp,a,o,s,l;if(t.eventType!=R&&(i>P||n.velocity===r)){var u=t.deltaX-n.deltaX,d=t.deltaY-n.deltaY,f=ge(i,u,d);o=f.x,s=f.y,a=c(f.x)>c(f.y)?f.x:f.y,l=_e(u,d),e.lastInterval=t}else a=n.velocity,o=n.velocityX,s=n.velocityY,l=n.direction;t.velocity=a,t.velocityX=o,t.velocityY=s,t.direction=l}function me(e){for(var t=[],n=0;n<e.pointers.length;)t[n]={clientX:s(e.pointers[n].clientX),clientY:s(e.pointers[n].clientY)},n++;return{timeStamp:l(),pointers:t,center:he(t),deltaX:e.deltaX,deltaY:e.deltaY}}function he(e){var t=e.length;if(t===1)return{x:s(e[0].clientX),y:s(e[0].clientY)};for(var n=0,r=0,i=0;i<t;)n+=e[i].clientX,r+=e[i].clientY,i++;return{x:s(n/t),y:s(r/t)}}function ge(e,t,n){return{x:t/e||0,y:n/e||0}}function _e(e,t){return e===t?z:c(e)>=c(t)?e<0?B:V:t<0?H:U}function ve(e,t,n){n||(n=ce);var r=t[n[0]]-e[n[0]],i=t[n[1]]-e[n[1]];return Math.sqrt(r*r+i*i)}function ye(e,t,n){n||(n=ce);var r=t[n[0]]-e[n[0]],i=t[n[1]]-e[n[1]];return Math.atan2(i,r)*180/Math.PI}function be(e,t){return ye(t[1],t[0],K)+ye(e[1],e[0],K)}function xe(e,t){return ve(t[0],t[1],K)/ve(e[0],e[1],K)}var Se={mousedown:F,mousemove:I,mouseup:L},Ce=`mousedown`,we=`mousemove mouseup`;function Te(){this.evEl=Ce,this.evWin=we,this.pressed=!1,q.apply(this,arguments)}_(Te,q,{handler:function(e){var t=Se[e.type];t&F&&(e.button===0||e.button===2)&&(this.pressed=!0),t&I&&e.which!==1&&(t=L),this.pressed&&(t&L&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:N,srcEvent:e}))}});var Ee={pointerdown:F,pointermove:I,pointerup:L,pointercancel:R,pointerout:R},De={2:M,3:ae,4:N,5:oe},Oe=`pointerdown`,ke=`pointermove pointerup pointercancel`;e.MSPointerEvent&&!e.PointerEvent&&(Oe=`MSPointerDown`,ke=`MSPointerMove MSPointerUp MSPointerCancel`);function Ae(){this.evEl=Oe,this.evWin=ke,q.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}_(Ae,q,{handler:function(e){var t=this.store,n=!1,r=!1,i=Ee[e.type.toLowerCase().replace(`ms`,``)],a=De[e.pointerType]||e.pointerType,o=a==M,s=E(t,e.pointerId,`pointerId`);i&F&&(e.button===0||e.button===2||o)?s<0&&(t.push(e),s=t.length-1):i&(L|R)?n=!0:!o&&e.buttons===0&&(n=!0,r=!0,i=Ee.pointerup),!(s<0)&&(r||(t[s]=e),this.callback(this.manager,i,{pointers:t,changedPointers:[e],pointerType:a,srcEvent:t[s]}),n&&t.splice(s,1))}});var je={touchstart:F,touchmove:I,touchend:L,touchcancel:R},Me=`touchstart`,Ne=`touchstart touchmove touchend touchcancel`;function Pe(){this.evTarget=Me,this.evWin=Ne,this.started=!1,q.apply(this,arguments)}_(Pe,q,{handler:function(e){var t=je[e.type];if(t===F&&(this.started=!0),this.started){var n=Fe.call(this,e,t);t&(L|R)&&n[0].length-n[1].length===0&&(this.started=!1),this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:M,srcEvent:e})}}});function Fe(e,t){var n=D(e.touches),r=D(e.changedTouches);return t&(L|R)&&(n=ee(n.concat(r),`identifier`,!0)),[n,r]}var Ie={touchstart:F,touchmove:I,touchend:L,touchcancel:R},Le=`touchstart touchmove touchend touchcancel`;function Re(){this.evTarget=Le,this.targetIds={},q.apply(this,arguments)}_(Re,q,{handler:function(e){var t=Ie[e.type],n=ze.call(this,e,t);n&&this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:M,srcEvent:e})}});function ze(e,t){var n=D(e.touches),r=this.targetIds;if(t&(F|I)&&n.length===1)return r[n[0].identifier]=!0,[n,n];var i,a,o=D(e.changedTouches),s=[],c=this.target;if(a=n.filter(function(e){return C(e.target,c)}),t===F)for(i=0;i<a.length;)r[a[i].identifier]=!0,i++;for(i=0;i<o.length;)r[o[i].identifier]&&s.push(o[i]),t&(L|R)&&delete r[o[i].identifier],i++;if(s.length)return[ee(a.concat(s),`identifier`,!0),s]}var Be=2500,Ve=25;function He(){q.apply(this,arguments);var e=v(this.handler,this);this.touch=new Re(this.manager,e),this.mouse=new Te(this.manager,e),this.primaryTouch=null,this.lastTouches=[]}_(He,q,{handler:function(e,t,n){var r=n.pointerType==M,i=n.pointerType==N;if(!(i&&n.sourceCapabilities&&n.sourceCapabilities.firesTouchEvents)){if(r)Ue.call(this,t,n);else if(i&&Ge.call(this,n))return;this.callback(e,t,n)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function Ue(e,t){e&F?(this.primaryTouch=t.changedPointers[0].identifier,We.call(this,t)):e&(L|R)&&We.call(this,t)}function We(e){var t=e.changedPointers[0];if(t.identifier===this.primaryTouch){var n={x:t.clientX,y:t.clientY};this.lastTouches.push(n);var r=this.lastTouches;setTimeout(function(){var e=r.indexOf(n);e>-1&&r.splice(e,1)},Be)}}function Ge(e){for(var t=e.srcEvent.clientX,n=e.srcEvent.clientY,r=0;r<this.lastTouches.length;r++){var i=this.lastTouches[r],a=Math.abs(t-i.x),o=Math.abs(n-i.y);if(a<=Ve&&o<=Ve)return!0}return!1}var Ke=a?O(a.style,`touchAction`):r,qe=Ke!==r,Je=`compute`,Ye=`auto`,Xe=`manipulation`,Ze=`none`,Qe=`pan-x`,$e=`pan-y`,et=rt();function tt(e,t){this.manager=e,this.set(t)}tt.prototype={set:function(e){e==Je&&(e=this.compute()),qe&&this.manager.element.style&&et[e]&&(this.manager.element.style[Ke]=e),this.actions=e.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var e=[];return f(this.manager.recognizers,function(t){y(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))}),nt(e.join(` `))},preventDefaults:function(e){var t=e.srcEvent,n=e.offsetDirection;if(this.manager.session.prevented){t.preventDefault();return}var r=this.actions,i=w(r,Ze)&&!et[Ze],a=w(r,$e)&&!et[$e],o=w(r,Qe)&&!et[Qe];if(i){var s=e.pointers.length===1,c=e.distance<2,l=e.deltaTime<250;if(s&&c&&l)return}if(!(o&&a)&&(i||a&&n&W||o&&n&G))return this.preventSrc(t)},preventSrc:function(e){this.manager.session.prevented=!0,e.preventDefault()}};function nt(e){if(w(e,Ze))return Ze;var t=w(e,Qe),n=w(e,$e);return t&&n?Ze:t||n?t?Qe:$e:w(e,Xe)?Xe:Ye}function rt(){if(!qe)return!1;var t={},n=e.CSS&&e.CSS.supports;return[`auto`,`manipulation`,`pan-y`,`pan-x`,`pan-x pan-y`,`none`].forEach(function(r){t[r]=n?e.CSS.supports(`touch-action`,r):!0}),t}var it=1,J=2,at=4,Y=8,X=Y,ot=16,Z=32;function Q(e){this.options=m({},this.defaults,e||{}),this.id=te(),this.manager=null,this.options.enable=b(this.options.enable,!0),this.state=it,this.simultaneous={},this.requireFail=[]}Q.prototype={defaults:{},set:function(e){return m(this.options,e),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(e){if(d(e,`recognizeWith`,this))return this;var t=this.simultaneous;return e=lt(e,this),t[e.id]||(t[e.id]=e,e.recognizeWith(this)),this},dropRecognizeWith:function(e){return d(e,`dropRecognizeWith`,this)?this:(e=lt(e,this),delete this.simultaneous[e.id],this)},requireFailure:function(e){if(d(e,`requireFailure`,this))return this;var t=this.requireFail;return e=lt(e,this),E(t,e)===-1&&(t.push(e),e.requireFailure(this)),this},dropRequireFailure:function(e){if(d(e,`dropRequireFailure`,this))return this;e=lt(e,this);var t=E(this.requireFail,e);return t>-1&&this.requireFail.splice(t,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(e){return!!this.simultaneous[e.id]},emit:function(e){var t=this,n=this.state;function r(n){t.manager.emit(n,e)}n<Y&&r(t.options.event+st(n)),r(t.options.event),e.additionalEvent&&r(e.additionalEvent),n>=Y&&r(t.options.event+st(n))},tryEmit:function(e){if(this.canEmit())return this.emit(e);this.state=Z},canEmit:function(){for(var e=0;e<this.requireFail.length;){if(!(this.requireFail[e].state&(Z|it)))return!1;e++}return!0},recognize:function(e){var t=m({},e);if(!y(this.options.enable,[this,t])){this.reset(),this.state=Z;return}this.state&(X|ot|Z)&&(this.state=it),this.state=this.process(t),this.state&(J|at|Y|ot)&&this.tryEmit(t)},process:function(e){},getTouchAction:function(){},reset:function(){}};function st(e){return e&ot?`cancel`:e&Y?`end`:e&at?`move`:e&J?`start`:``}function ct(e){return e==U?`down`:e==H?`up`:e==B?`left`:e==V?`right`:``}function lt(e,t){var n=t.manager;return n?n.get(e):e}function $(){Q.apply(this,arguments)}_($,Q,{defaults:{pointers:1},attrTest:function(e){var t=this.options.pointers;return t===0||e.pointers.length===t},process:function(e){var t=this.state,n=e.eventType,r=t&(J|at),i=this.attrTest(e);return r&&(n&R||!i)?t|ot:r||i?n&L?t|Y:t&J?t|at:J:Z}});function ut(){$.apply(this,arguments),this.pX=null,this.pY=null}_(ut,$,{defaults:{event:`pan`,threshold:10,pointers:1,direction:se},getTouchAction:function(){var e=this.options.direction,t=[];return e&W&&t.push($e),e&G&&t.push(Qe),t},directionTest:function(e){var t=this.options,n=!0,r=e.distance,i=e.direction,a=e.deltaX,o=e.deltaY;return i&t.direction||(t.direction&W?(i=a===0?z:a<0?B:V,n=a!=this.pX,r=Math.abs(e.deltaX)):(i=o===0?z:o<0?H:U,n=o!=this.pY,r=Math.abs(e.deltaY))),e.direction=i,n&&r>t.threshold&&i&t.direction},attrTest:function(e){return $.prototype.attrTest.call(this,e)&&(this.state&J||!(this.state&J)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=ct(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}});function dt(){$.apply(this,arguments)}_(dt,$,{defaults:{event:`pinch`,threshold:0,pointers:2},getTouchAction:function(){return[Ze]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||this.state&J)},emit:function(e){if(e.scale!==1){var t=e.scale<1?`in`:`out`;e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}});function ft(){Q.apply(this,arguments),this._timer=null,this._input=null}_(ft,Q,{defaults:{event:`press`,pointers:1,time:251,threshold:9},getTouchAction:function(){return[Ye]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,r=e.distance<t.threshold,i=e.deltaTime>t.time;if(this._input=e,!r||!n||e.eventType&(L|R)&&!i)this.reset();else if(e.eventType&F)this.reset(),this._timer=u(function(){this.state=X,this.tryEmit()},t.time,this);else if(e.eventType&L)return X;return Z},reset:function(){clearTimeout(this._timer)},emit:function(e){this.state===X&&(e&&e.eventType&L?this.manager.emit(this.options.event+`up`,e):(this._input.timeStamp=l(),this.manager.emit(this.options.event,this._input)))}});function pt(){$.apply(this,arguments)}_(pt,$,{defaults:{event:`rotate`,threshold:0,pointers:2},getTouchAction:function(){return[Ze]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||this.state&J)}});function mt(){$.apply(this,arguments)}_(mt,$,{defaults:{event:`swipe`,threshold:10,velocity:.3,direction:W|G,pointers:1},getTouchAction:function(){return ut.prototype.getTouchAction.call(this)},attrTest:function(e){var t=this.options.direction,n;return t&(W|G)?n=e.overallVelocity:t&W?n=e.overallVelocityX:t&G&&(n=e.overallVelocityY),this._super.attrTest.call(this,e)&&t&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&c(n)>this.options.velocity&&e.eventType&L},emit:function(e){var t=ct(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}});function ht(){Q.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}_(ht,Q,{defaults:{event:`tap`,pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Xe]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,r=e.distance<t.threshold,i=e.deltaTime<t.time;if(this.reset(),e.eventType&F&&this.count===0)return this.failTimeout();if(r&&i&&n){if(e.eventType!=L)return this.failTimeout();var a=this.pTime?e.timeStamp-this.pTime<t.interval:!0,o=!this.pCenter||ve(this.pCenter,e.center)<t.posThreshold;if(this.pTime=e.timeStamp,this.pCenter=e.center,!o||!a?this.count=1:this.count+=1,this._input=e,this.count%t.taps===0)return this.hasRequireFailures()?(this._timer=u(function(){this.state=X,this.tryEmit()},t.interval,this),J):X}return Z},failTimeout:function(){return this._timer=u(function(){this.state=Z},this.options.interval,this),Z},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==X&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function gt(e,t){return t=t||{},t.recognizers=b(t.recognizers,gt.defaults.preset),new yt(e,t)}gt.VERSION=`2.0.7`,gt.defaults={domEvents:!1,touchAction:Je,enable:!0,inputTarget:null,inputClass:null,preset:[[pt,{enable:!1}],[dt,{enable:!1},[`rotate`]],[mt,{direction:W}],[ut,{direction:W},[`swipe`]],[ht],[ht,{event:`doubletap`,taps:2},[`tap`]],[ft]],cssProps:{userSelect:`none`,touchSelect:`none`,touchCallout:`none`,contentZooming:`none`,userDrag:`none`,tapHighlightColor:`rgba(0,0,0,0)`}};var _t=1,vt=2;function yt(e,t){this.options=m({},gt.defaults,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=le(this),this.touchAction=new tt(this,this.options.touchAction),bt(this,!0),f(this.options.recognizers,function(e){var t=this.add(new e[0](e[1]));e[2]&&t.recognizeWith(e[2]),e[3]&&t.requireFailure(e[3])},this)}yt.prototype={set:function(e){return m(this.options,e),e.touchAction&&this.touchAction.update(),e.inputTarget&&(this.input.destroy(),this.input.target=e.inputTarget,this.input.init()),this},stop:function(e){this.session.stopped=e?vt:_t},recognize:function(e){var t=this.session;if(!t.stopped){this.touchAction.preventDefaults(e);var n,r=this.recognizers,i=t.curRecognizer;(!i||i&&i.state&X)&&(i=t.curRecognizer=null);for(var a=0;a<r.length;)n=r[a],t.stopped!==vt&&(!i||n==i||n.canRecognizeWith(i))?n.recognize(e):n.reset(),!i&&n.state&(J|at|Y)&&(i=t.curRecognizer=n),a++}},get:function(e){if(e instanceof Q)return e;for(var t=this.recognizers,n=0;n<t.length;n++)if(t[n].options.event==e)return t[n];return null},add:function(e){if(d(e,`add`,this))return this;var t=this.get(e.options.event);return t&&this.remove(t),this.recognizers.push(e),e.manager=this,this.touchAction.update(),e},remove:function(e){if(d(e,`remove`,this))return this;if(e=this.get(e),e){var t=this.recognizers,n=E(t,e);n!==-1&&(t.splice(n,1),this.touchAction.update())}return this},on:function(e,t){if(e!==r&&t!==r){var n=this.handlers;return f(T(e),function(e){n[e]=n[e]||[],n[e].push(t)}),this}},off:function(e,t){if(e!==r){var n=this.handlers;return f(T(e),function(e){t?n[e]&&n[e].splice(E(n[e],t),1):delete n[e]}),this}},emit:function(e,t){this.options.domEvents&&xt(e,t);var n=this.handlers[e]&&this.handlers[e].slice();if(!(!n||!n.length)){t.type=e,t.preventDefault=function(){t.srcEvent.preventDefault()};for(var r=0;r<n.length;)n[r](t),r++}},destroy:function(){this.element&&bt(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function bt(e,t){var n=e.element;if(n.style){var r;f(e.options.cssProps,function(i,a){r=O(n.style,a),t?(e.oldCssProps[r]=n.style[r],n.style[r]=i):n.style[r]=e.oldCssProps[r]||``}),t||(e.oldCssProps={})}}function xt(e,n){var r=t.createEvent(`Event`);r.initEvent(e,!0,!0),r.gesture=n,n.target.dispatchEvent(r)}return m(gt,{INPUT_START:F,INPUT_MOVE:I,INPUT_END:L,INPUT_CANCEL:R,STATE_POSSIBLE:it,STATE_BEGAN:J,STATE_CHANGED:at,STATE_ENDED:Y,STATE_RECOGNIZED:X,STATE_CANCELLED:ot,STATE_FAILED:Z,DIRECTION_NONE:z,DIRECTION_LEFT:B,DIRECTION_RIGHT:V,DIRECTION_UP:H,DIRECTION_DOWN:U,DIRECTION_HORIZONTAL:W,DIRECTION_VERTICAL:G,DIRECTION_ALL:se,Manager:yt,Input:q,TouchAction:tt,TouchInput:Re,MouseInput:Te,PointerEventInput:Ae,TouchMouseInput:He,SingleTouchInput:Pe,Recognizer:Q,AttrRecognizer:$,Tap:ht,Pan:ut,Swipe:mt,Pinch:dt,Rotate:pt,Press:ft,on:x,off:S,each:f,merge:g,extend:h,assign:m,inherit:_,bindFn:v,prefixed:O}),gt})(typeof window<`u`?window:{},typeof document<`u`?document:{},`Hammer`),A=function(e,t){t===void 0&&console.warn(`THREE.OrbitControls: The second parameter "domElement" is now mandatory.`),t===document&&console.error(`THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.`),this.object=e,this.domElement=t,this.enabled=!0,this.target=new n.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!1,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={LEFT:n.MOUSE.ROTATE,MIDDLE:n.MOUSE.DOLLY,RIGHT:n.MOUSE.PAN},this.touches={ONE:n.TOUCH.ROTATE,TWO:n.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=function(){return u.phi},this.getAzimuthalAngle=function(){return u.theta},this.saveState=function(){r.target0.copy(r.target),r.position0.copy(r.object.position),r.zoom0=r.object.zoom},this.reset=function(){r.target.copy(r.target0),r.object.position.copy(r.position0),r.object.zoom=r.zoom0,r.object.updateProjectionMatrix(),r.dispatchEvent(i),r.update(),c=s.NONE},this.update=function(){var t=new n.Vector3,a=new n.Quaternion().setFromUnitVectors(e.up,new n.Vector3(0,1,0)),o=a.clone().inverse(),h=new n.Vector3,g=new n.Quaternion;return function(){var e=r.object.position;return t.copy(e).sub(r.target),t.applyQuaternion(a),u.setFromVector3(t),r.autoRotate&&c===s.NONE&&E(w()),r.enableDamping?(u.theta+=d.theta*r.dampingFactor,u.phi+=d.phi*r.dampingFactor):(u.theta+=d.theta,u.phi+=d.phi),u.theta=Math.max(r.minAzimuthAngle,Math.min(r.maxAzimuthAngle,u.theta)),u.phi=Math.max(r.minPolarAngle,Math.min(r.maxPolarAngle,u.phi)),u.makeSafe(),u.radius*=f,u.radius=Math.max(r.minDistance,Math.min(r.maxDistance,u.radius)),r.enableDamping===!0?r.target.addScaledVector(p,r.dampingFactor):r.target.add(p),t.setFromSpherical(u),t.applyQuaternion(o),e.copy(r.target).add(t),r.object.lookAt(r.target),r.enableDamping===!0?(d.theta*=1-r.dampingFactor,d.phi*=1-r.dampingFactor,p.multiplyScalar(1-r.dampingFactor)):(d.set(0,0,0),p.set(0,0,0)),f=1,m||h.distanceToSquared(r.object.position)>l||8*(1-g.dot(r.object.quaternion))>l?(r.dispatchEvent(i),h.copy(r.object.position),g.copy(r.object.quaternion),m=!1,!0):!1}}(),this.dispose=function(){r.domElement.removeEventListener(`contextmenu`,de,!1),r.domElement.removeEventListener(`mousedown`,W,!1),r.domElement.removeEventListener(`wheel`,ce,!1),r.domElement.removeEventListener(`touchstart`,q,!1),r.domElement.removeEventListener(`touchend`,ue,!1),r.domElement.removeEventListener(`touchmove`,le,!1),document.removeEventListener(`mousemove`,G,!1),document.removeEventListener(`mouseup`,se,!1),r.domElement.removeEventListener(`keydown`,K,!1)};var r=this,i={type:`change`},a={type:`start`},o={type:`end`},s={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},c=s.NONE,l=1e-6,u=new n.Spherical,d=new n.Spherical,f=1,p=new n.Vector3,m=!1,h=new n.Vector2,g=new n.Vector2,_=new n.Vector2,v=new n.Vector2,y=new n.Vector2,b=new n.Vector2,x=new n.Vector2,S=new n.Vector2,C=new n.Vector2;function w(){return 2*Math.PI/60/60*r.autoRotateSpeed}function T(){return Math.pow(.95,r.zoomSpeed)}function E(e){d.theta-=e}function D(e){d.phi-=e}var ee=function(){var e=new n.Vector3;return function(t,n){e.setFromMatrixColumn(n,0),e.multiplyScalar(-t),p.add(e)}}(),O=function(){var e=new n.Vector3;return function(t,n){r.screenSpacePanning===!0?e.setFromMatrixColumn(n,1):(e.setFromMatrixColumn(n,0),e.crossVectors(r.object.up,e)),e.multiplyScalar(t),p.add(e)}}(),k=function(){var e=new n.Vector3;return function(t,n){var i=r.domElement;if(r.object.isPerspectiveCamera){var a=r.object.position;e.copy(a).sub(r.target);var o=e.length();o*=Math.tan(r.object.fov/2*Math.PI/180),ee(2*t*o/i.clientHeight,r.object.matrix),O(2*n*o/i.clientHeight,r.object.matrix)}else r.object.isOrthographicCamera?(ee(t*(r.object.right-r.object.left)/r.object.zoom/i.clientWidth,r.object.matrix),O(n*(r.object.top-r.object.bottom)/r.object.zoom/i.clientHeight,r.object.matrix)):(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.`),r.enablePan=!1)}}();function te(e){r.object.isPerspectiveCamera?f/=e:r.object.isOrthographicCamera?(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom*e)),r.object.updateProjectionMatrix(),m=!0):(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.`),r.enableZoom=!1)}function A(e){r.object.isPerspectiveCamera?f*=e:r.object.isOrthographicCamera?(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/e)),r.object.updateProjectionMatrix(),m=!0):(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.`),r.enableZoom=!1)}function ne(e){h.set(e.clientX,e.clientY)}function j(e){x.set(e.clientX,e.clientY)}function re(e){v.set(e.clientX,e.clientY)}function ie(e){g.set(e.clientX,e.clientY),_.subVectors(g,h).multiplyScalar(r.rotateSpeed);var t=r.domElement;E(2*Math.PI*_.x/t.clientHeight),D(2*Math.PI*_.y/t.clientHeight),h.copy(g),r.update()}function M(e){S.set(e.clientX,e.clientY),C.subVectors(S,x),C.y>0?te(T()):C.y<0&&A(T()),x.copy(S),r.update()}function ae(e){y.set(e.clientX,e.clientY),b.subVectors(y,v).multiplyScalar(r.panSpeed),k(b.x,b.y),v.copy(y),r.update()}function N(e){e.deltaY<0?A(T()):e.deltaY>0&&te(T()),r.update()}function oe(e){var t=!1;switch(e.keyCode){case r.keys.UP:k(0,r.keyPanSpeed),t=!0;break;case r.keys.BOTTOM:k(0,-r.keyPanSpeed),t=!0;break;case r.keys.LEFT:k(r.keyPanSpeed,0),t=!0;break;case r.keys.RIGHT:k(-r.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),r.update())}function P(e){if(e.touches.length==1)h.set(e.touches[0].pageX,e.touches[0].pageY);else{var t=.5*(e.touches[0].pageX+e.touches[1].pageX),n=.5*(e.touches[0].pageY+e.touches[1].pageY);h.set(t,n)}}function F(e){if(e.touches.length==1)v.set(e.touches[0].pageX,e.touches[0].pageY);else{var t=.5*(e.touches[0].pageX+e.touches[1].pageX),n=.5*(e.touches[0].pageY+e.touches[1].pageY);v.set(t,n)}}function I(e){var t=e.touches[0].pageX-e.touches[1].pageX,n=e.touches[0].pageY-e.touches[1].pageY,r=Math.sqrt(t*t+n*n);x.set(0,r)}function L(e){r.enableZoom&&I(e),r.enablePan&&F(e)}function R(e){r.enableZoom&&I(e),r.enableRotate&&P(e)}function z(e){if(e.touches.length==1)g.set(e.touches[0].pageX,e.touches[0].pageY);else{var t=.5*(e.touches[0].pageX+e.touches[1].pageX),n=.5*(e.touches[0].pageY+e.touches[1].pageY);g.set(t,n)}_.subVectors(g,h).multiplyScalar(r.rotateSpeed);var i=r.domElement;E(2*Math.PI*_.x/i.clientHeight),D(2*Math.PI*_.y/i.clientHeight),h.copy(g)}function B(e){if(e.touches.length==1)y.set(e.touches[0].pageX,e.touches[0].pageY);else{var t=.5*(e.touches[0].pageX+e.touches[1].pageX),n=.5*(e.touches[0].pageY+e.touches[1].pageY);y.set(t,n)}b.subVectors(y,v).multiplyScalar(r.panSpeed),k(b.x,b.y),v.copy(y)}function V(e){var t=e.touches[0].pageX-e.touches[1].pageX,n=e.touches[0].pageY-e.touches[1].pageY,i=Math.sqrt(t*t+n*n);S.set(0,i),C.set(0,Math.pow(S.y/x.y,r.zoomSpeed)),te(C.y),x.copy(S)}function H(e){r.enableZoom&&V(e),r.enablePan&&B(e)}function U(e){r.enableZoom&&V(e),r.enableRotate&&z(e)}function W(e){if(r.enabled!==!1){e.preventDefault(),r.domElement.focus?r.domElement.focus():window.focus();var t;switch(e.button){case 0:t=r.mouseButtons.LEFT;break;case 1:t=r.mouseButtons.MIDDLE;break;case 2:t=r.mouseButtons.RIGHT;break;default:t=-1}switch(t){case n.MOUSE.DOLLY:if(r.enableZoom===!1)return;j(e),c=s.DOLLY;break;case n.MOUSE.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(r.enablePan===!1)return;re(e),c=s.PAN}else{if(r.enableRotate===!1)return;ne(e),c=s.ROTATE}break;case n.MOUSE.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(r.enableRotate===!1)return;ne(e),c=s.ROTATE}else{if(r.enablePan===!1)return;re(e),c=s.PAN}break;default:c=s.NONE}c!==s.NONE&&(document.addEventListener(`mousemove`,G,!1),document.addEventListener(`mouseup`,se,!1),r.dispatchEvent(a))}}function G(e){if(r.enabled!==!1)switch(e.preventDefault(),c){case s.ROTATE:if(r.enableRotate===!1)return;ie(e);break;case s.DOLLY:if(r.enableZoom===!1)return;M(e);break;case s.PAN:if(r.enablePan===!1)return;ae(e);break}}function se(e){r.enabled!==!1&&(document.removeEventListener(`mousemove`,G,!1),document.removeEventListener(`mouseup`,se,!1),r.dispatchEvent(o),c=s.NONE)}function ce(e){r.enabled===!1||r.enableZoom===!1||c!==s.NONE&&c!==s.ROTATE||(e.preventDefault(),e.stopPropagation(),r.dispatchEvent(a),N(e),r.dispatchEvent(o))}function K(e){r.enabled===!1||r.enableKeys===!1||r.enablePan===!1||oe(e)}function q(e){if(r.enabled!==!1){switch(e.preventDefault(),e.touches.length){case 1:switch(r.touches.ONE){case n.TOUCH.ROTATE:if(r.enableRotate===!1)return;P(e),c=s.TOUCH_ROTATE;break;case n.TOUCH.PAN:if(r.enablePan===!1)return;F(e),c=s.TOUCH_PAN;break;default:c=s.NONE}break;case 2:switch(r.touches.TWO){case n.TOUCH.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;L(e),c=s.TOUCH_DOLLY_PAN;break;case n.TOUCH.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;R(e),c=s.TOUCH_DOLLY_ROTATE;break;default:c=s.NONE}break;default:c=s.NONE}c!==s.NONE&&r.dispatchEvent(a)}}function le(e){if(r.enabled!==!1)switch(e.preventDefault(),e.stopPropagation(),c){case s.TOUCH_ROTATE:if(r.enableRotate===!1)return;z(e),r.update();break;case s.TOUCH_PAN:if(r.enablePan===!1)return;B(e),r.update();break;case s.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;H(e),r.update();break;case s.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;U(e),r.update();break;default:c=s.NONE}}function ue(e){r.enabled!==!1&&(r.dispatchEvent(o),c=s.NONE)}function de(e){r.enabled!==!1&&e.preventDefault()}r.domElement.addEventListener(`contextmenu`,de,!1),r.domElement.addEventListener(`mousedown`,W,!1),r.domElement.addEventListener(`wheel`,ce,!1),r.domElement.addEventListener(`touchstart`,q,!1),r.domElement.addEventListener(`touchend`,ue,!1),r.domElement.addEventListener(`touchmove`,le,!1),r.domElement.addEventListener(`keydown`,K,!1),r.domElement.tabIndex===-1&&(r.domElement.tabIndex=0),this.update()};A.prototype=Object.create(n.EventDispatcher.prototype),A.prototype.constructor=A;var ne=function(e,t){A.call(this,e,t),this.mouseButtons.LEFT=n.MOUSE.PAN,this.mouseButtons.RIGHT=n.MOUSE.ROTATE,this.touches.ONE=n.TOUCH.PAN,this.touches.TWO=n.TOUCH.DOLLY_ROTATE};ne.prototype=Object.create(n.EventDispatcher.prototype),ne.prototype.constructor=ne;var j=function(e){n.Object3D.call(this),this.element=e,this.element.style.position=`absolute`,this.element.style.pointerEvents=`auto`,this.addEventListener(`removed`,function(){this.traverse(function(e){e.element instanceof Element&&e.element.parentNode!==null&&e.element.parentNode.removeChild(e.element)})})};j.prototype=Object.create(n.Object3D.prototype),j.prototype.constructor=j;var re=function(e){j.call(this,e)};re.prototype=Object.create(j.prototype),re.prototype.constructor=re;var ie=function(){var e=this,t,r,i,a,o=new n.Matrix4,s={camera:{fov:0,style:``},objects:new WeakMap},c=document.createElement(`div`);c.style.overflow=`hidden`,this.domElement=c;var l=document.createElement(`div`);l.style.WebkitTransformStyle=`preserve-3d`,l.style.transformStyle=`preserve-3d`,l.style.pointerEvents=`none`,c.appendChild(l);var u=/Trident/i.test(navigator.userAgent);this.getSize=function(){return{width:t,height:r}},this.setSize=function(e,n){t=e,r=n,i=t/2,a=r/2,c.style.width=e+`px`,c.style.height=n+`px`,l.style.width=e+`px`,l.style.height=n+`px`};function d(e){return Math.abs(e)<1e-10?0:e}function f(e){var t=e.elements;return`matrix3d(`+d(t[0])+`,`+d(-t[1])+`,`+d(t[2])+`,`+d(t[3])+`,`+d(t[4])+`,`+d(-t[5])+`,`+d(t[6])+`,`+d(t[7])+`,`+d(t[8])+`,`+d(-t[9])+`,`+d(t[10])+`,`+d(t[11])+`,`+d(t[12])+`,`+d(-t[13])+`,`+d(t[14])+`,`+d(t[15])+`)`}function p(e,t){var n=e.elements,r=`matrix3d(`+d(n[0])+`,`+d(n[1])+`,`+d(n[2])+`,`+d(n[3])+`,`+d(-n[4])+`,`+d(-n[5])+`,`+d(-n[6])+`,`+d(-n[7])+`,`+d(n[8])+`,`+d(n[9])+`,`+d(n[10])+`,`+d(n[11])+`,`+d(n[12])+`,`+d(n[13])+`,`+d(n[14])+`,`+d(n[15])+`)`;return u?`translate(-50%,-50%)translate(`+i+`px,`+a+`px)`+t+r:`translate(-50%,-50%)`+r}function m(t,n,r,i){if(t instanceof j){t.onBeforeRender(e,n,r);var a;t instanceof re?(o.copy(r.matrixWorldInverse),o.transpose(),o.copyPosition(t.matrixWorld),o.scale(t.scale),o.elements[3]=0,o.elements[7]=0,o.elements[11]=0,o.elements[15]=1,a=p(o,i)):a=p(t.matrixWorld,i);var c=t.element,d=s.objects.get(t);if(d===void 0||d.style!==a){c.style.WebkitTransform=a,c.style.transform=a;var f={style:a};u&&(f.distanceToCameraSquared=h(r,t)),s.objects.set(t,f)}c.style.display=t.visible?``:`none`,c.parentNode!==l&&l.appendChild(c),t.onAfterRender(e,n,r)}for(var g=0,_=t.children.length;g<_;g++)m(t.children[g],n,r,i)}var h=function(){var e=new n.Vector3,t=new n.Vector3;return function(n,r){return e.setFromMatrixPosition(n.matrixWorld),t.setFromMatrixPosition(r.matrixWorld),e.distanceToSquared(t)}}();function g(e){var t=[];return e.traverse(function(e){e instanceof j&&t.push(e)}),t}function _(e){for(var t=g(e).sort(function(e,t){return s.objects.get(e).distanceToCameraSquared-s.objects.get(t).distanceToCameraSquared}),n=t.length,r=0,i=t.length;r<i;r++)t[r].element.style.zIndex=n-r}this.render=function(e,t){var n=t.projectionMatrix.elements[5]*a;if(s.camera.fov!==n&&(t.isPerspectiveCamera?(c.style.WebkitPerspective=n+`px`,c.style.perspective=n+`px`):(c.style.WebkitPerspective=``,c.style.perspective=``),s.camera.fov=n),e.autoUpdate===!0&&e.updateMatrixWorld(),t.parent===null&&t.updateMatrixWorld(),t.isOrthographicCamera)var r=-(t.right+t.left)/2,o=(t.top+t.bottom)/2;var p=t.isOrthographicCamera?`scale(`+n+`)translate(`+d(r)+`px,`+d(o)+`px)`+f(t.matrixWorldInverse):`translateZ(`+n+`px)`+f(t.matrixWorldInverse),h=p+`translate(`+i+`px,`+a+`px)`;s.camera.style!==h&&!u&&(l.style.WebkitTransform=h,l.style.transform=h,s.camera.style=h),m(e,e,t,p),u&&_(e)}};function M(e,t,r){let{top:i,left:a,width:o,height:s}=t.getBoundingClientRect();return r&&(a+=o*r.left,i+=s*(1-r.bottom-r.height),o*=r.width,s*=r.height),new n.Vector2((e.x-a)/o*2-1,-(e.y-i)/s*2+1)}var ae=class extends n.BufferGeometry{constructor(e,t,r,i,a){super(),this.type=`RoundedBoxGeometry`,a=isNaN(a)?1:Math.max(1,Math.floor(a)),e=isNaN(e)?1:e,t=isNaN(t)?1:t,r=isNaN(r)?1:r,i=isNaN(i)?.15:i,i=Math.min(i,Math.min(e,Math.min(t,Math.min(r)))/2);let o=e/2-i,s=t/2-i,c=r/2-i;this.parameters={width:e,height:t,depth:r,radius:i,radiusSegments:a};let l=a+1,u=l*a+1<<3,d=new n.BufferAttribute(new Float32Array(u*3),3),f=new n.BufferAttribute(new Float32Array(u*3),3),p=[],m=[];new n.Vector3;let h=new n.Vector3,g=[],_=[],v=[],y=l*a,b=l*a+1;x(),C(),S(),w(),E(),T();function x(){let e=[new n.Vector3(1,1,1),new n.Vector3(1,1,-1),new n.Vector3(-1,1,-1),new n.Vector3(-1,1,1),new n.Vector3(1,-1,1),new n.Vector3(1,-1,-1),new n.Vector3(-1,-1,-1),new n.Vector3(-1,-1,1)];for(let e=0;e<8;e++)p.push([]),m.push([]);let t=Math.PI/2,r=new n.Vector3(o,s,c);for(let e=0;e<=a;e++){let n=e/a*t,o=Math.cos(n),s=Math.sin(n);if(e==a){h.set(0,1,0);let e=h.clone().multiplyScalar(i).add(r);p[0].push(e),g.push(e);let t=h.clone();m[0].push(t),_.push(t);continue}for(let e=0;e<=a;e++){let n=e/a*t;h.x=o*Math.cos(n),h.y=s,h.z=o*Math.sin(n);let c=h.clone().multiplyScalar(i).add(r);p[0].push(c),g.push(c);let l=h.clone().normalize();m[0].push(l),_.push(l)}}for(let t=1;t<8;t++)for(let n=0;n<p[0].length;n++){let r=p[0][n].clone().multiply(e[t]);p[t].push(r),g.push(r);let i=m[0][n].clone().multiply(e[t]);m[t].push(i),_.push(i)}}function S(){let e=[!0,!1,!0,!1,!1,!0,!1,!0],t=l*(a-1);for(let n=0;n<8;n++){let r=b*n;for(let t=0;t<a-1;t++){let i=t*l,o=(t+1)*l;for(let t=0;t<a;t++){let a=t+1,s=r+i+t,c=r+i+a,l=r+o+t,u=r+o+a;e[n]?(v.push(s),v.push(l),v.push(c),v.push(c),v.push(l),v.push(u)):(v.push(s),v.push(c),v.push(l),v.push(c),v.push(u),v.push(l))}}for(let i=0;i<a;i++){let a=r+t+i,o=r+t+i+1,s=r+y;e[n]?(v.push(a),v.push(s),v.push(o)):(v.push(a),v.push(o),v.push(s))}}}function C(){let e=y,t=y+b,n=y+b*2,r=y+b*3;v.push(e),v.push(t),v.push(n),v.push(e),v.push(n),v.push(r),e=y+b*4,t=y+b*5,n=y+b*6,r=y+b*7,v.push(e),v.push(n),v.push(t),v.push(e),v.push(r),v.push(n),e=0,t=b,n=b*4,r=b*5,v.push(e),v.push(n),v.push(t),v.push(t),v.push(n),v.push(r),e=b*2,t=b*3,n=b*6,r=b*7,v.push(e),v.push(n),v.push(t),v.push(t),v.push(n),v.push(r),e=a,t=a+b*3,n=a+b*4,r=a+b*7,v.push(e),v.push(t),v.push(n),v.push(t),v.push(r),v.push(n),e=a+b,t=a+b*2,n=a+b*5,r=a+b*6,v.push(e),v.push(n),v.push(t),v.push(t),v.push(n),v.push(r)}function w(){for(let e=0;e<4;e++){let t=e*b,n=4*b+t,r=(e&1)==1;for(let e=0;e<a;e++){let i=e+1,a=t+e,o=t+i,s=n+e,c=n+i;r?(v.push(a),v.push(s),v.push(o),v.push(o),v.push(s),v.push(c)):(v.push(a),v.push(o),v.push(s),v.push(o),v.push(c),v.push(s))}}}function T(){let e=[0,2,4,6],t=[1,3,5,7];for(let n=0;n<4;n++){let r=b*e[n],i=b*t[n],o=1>=n;for(let e=0;e<a;e++){let t=e*l,n=(e+1)*l,a=r+t,s=r+n,c=i+t,u=i+n;o?(v.push(a),v.push(c),v.push(s),v.push(s),v.push(c),v.push(u)):(v.push(a),v.push(s),v.push(c),v.push(s),v.push(u),v.push(c))}}}function E(){let e=a-1,t=[0,1,4,5],n=[3,2,7,6],r=[0,1,1,0];for(let i=0;i<4;i++){let o=t[i]*b,s=n[i]*b;for(let t=0;t<=e;t++){let n=o+a+t*l,c=o+(t==e?b-1:a+(t+1)*l),u=s+a+t*l,d=s+(t==e?b-1:a+(t+1)*l);r[i]?(v.push(n),v.push(u),v.push(c),v.push(c),v.push(u),v.push(d)):(v.push(n),v.push(c),v.push(u),v.push(c),v.push(d),v.push(u))}}}let D=0;for(let e=0;e<g.length;e++)d.setXYZ(D,g[e].x,g[e].y,g[e].z),f.setXYZ(D,_[e].x,_[e].y,_[e].z),D++;this.setIndex(new n.BufferAttribute(new Uint16Array(v),1)),this.setAttribute(`position`,d),this.setAttribute(`normal`,f)}};function N(e,t){return typeof e!=`number`||typeof t!=`number`?!1:Math.abs(e-t)<.001}function oe(e,t,n,r=e=>e){let i=r(n);return e*(1-i)+t*i}var P=Number((Math.PI/2).toFixed(5));function F(e,t,r){let i=new n.Shape;return i.moveTo(r,0),i.lineTo(e-r,0),i.absarc(e-r,r,r,-P,0,!1),i.lineTo(e,t-r),i.absarc(e-r,t-r,r,0,P,!1),i.lineTo(r,t),i.absarc(r,t-r,r,P,Math.PI,!1),i.lineTo(0,r),i.absarc(r,r,r,Math.PI,Math.PI*1.5,!1),i}var I=e=>{let t=document.createElement(`div`);t.innerText=e;let n=new j(t);return n.name=e,n.scale.set(.3,.3,.3),t.style.pointerEvents=`none`,t.style.backfaceVisibility=`hidden`,n},L=e=>{let t=new n.PlaneGeometry(5,5),r=new n.MeshBasicMaterial({transparent:!0,opacity:0}),i=new n.Mesh(t,r),a=document.createElement(`div`);a.innerText=e;let o=new j(a);return o.name=e,o.scale.set(.3,.3,.3),a.style.color=`#ffffff`,a.style.opacity=`0.5`,a.style.pointerEvents=`none`,a.style.backfaceVisibility=`hidden`,i.rotateX(-P),i.add(o),i},R=class extends p.Controller{get config(){return Object.assign({},this._config)}updateState(e,t){let n=this.state;this.state=Object.assign(Object.assign({},this.state),e),typeof e.arrowsVisible==`boolean`&&this.handleArrowsVisible(e.arrowsVisible),this.hooks.emit(`stateChange`,{state:this.state,prevState:n,userAction:t})}constructor(e,r){super(e),this.camera=new t.Camera(90),this.scene=new n.Scene,this.renderer=new n.WebGLRenderer({antialias:!0,alpha:!0}),this.css3drenderer=new ie,this.ambientLight=new n.AmbientLight(16777215,.7),this.wrapper=document.createElement(`div`),this.arrows=document.createElement(`div`),this.arrowLeft=document.createElement(`div`),this.arrowRight=document.createElement(`div`),this.arrowFront=document.createElement(`div`),this.arrowBack=document.createElement(`div`),this.arrowTop=document.createElement(`div`),this.arrowBottom=document.createElement(`div`),this.spherical=null,this.dragging=!1,this.style=document.createElement(`style`),this.directionalLight=new n.DirectionalLight(16777215,.2),this.box=new n.Mesh(new ae(8,8,8,.5,20),new n.MeshPhongMaterial({color:16777215})),this.faces=new n.Group,this.orient=({longitude:e,latitude:t})=>{this.dragging=!1,this.spherical=null,this.controls.enableDamping=!1,this.five.setState(Object.assign({latitude:t},e===void 0?{}:{longitude:e+this.config.fixedLongitude})),this.five.ready().then(()=>{this.controls.enableDamping=!0,this.setState({arrowsVisible:!0})})},this.onRenderFrame=()=>{var e,t,n,r,i;if(this.renderer.render(this.scene,this.camera),this.css3drenderer.render(this.scene,this.camera),this.directionalLight.position.copy(this.camera.position),(e=this.controls)==null||e.update(),this.dragging){this.camera.computePose(),this.updateByCamera();let{longitude:e,latitude:t}=this.camera.pose;this.five.setState({longitude:e,latitude:t},!0),this.updateArrows({longitude:e,latitude:t})}else if(this.spherical&&(!N(this.spherical.pi,(t=this.controls)==null?void 0:t.getPolarAngle())||!N(this.spherical.theta,(n=this.controls)==null?void 0:n.getAzimuthalAngle()))){this.spherical={pi:(r=this.controls)==null?void 0:r.getPolarAngle(),theta:(i=this.controls)==null?void 0:i.getAzimuthalAngle()},this.camera.computePose(),this.updateByCamera();let{longitude:e,latitude:t}=this.camera.pose;this.five.setState({longitude:e,latitude:t},!0),this.updateArrows({longitude:e,latitude:t})}else this.spherical=null},this.onTapGesture=e=>{let t=e.pointers[0].clientX,r=e.pointers[0].clientY,i=M({x:t,y:r},this.wrapper),a=new n.Raycaster;a.setFromCamera(i,this.camera);let[o]=a.intersectObjects(this.faces.children,!1);if(o){let{longitude:e,latitude:t}=o.object.userData;this.orient({longitude:e,latitude:t})}},this.onFiveWantsGesture=()=>{if(this.spherical)return!1},this.onFiveModeChange=e=>{this.controls&&(this.controls.maxPolarAngle=e===`Topview`?0:P)},this.onCameraUpdate=({state:e})=>{if(this.dragging||this.spherical)return;let{longitude:t,latitude:r}=e;this.camera.pose.longitude===t&&this.camera.pose.latitude===r||(this.camera.setFromPose({longitude:t,latitude:r,distance:20,offset:new n.Vector3(0,0,0)}),this.updateByCamera(),this.updateArrows({longitude:t,latitude:r}))},this.onPanStart=e=>{this.dragging=!0,this.spherical={}},this.onMouseMove=e=>{if(this.dragging)return;let t=M({x:e.clientX,y:e.clientY},this.wrapper),r=new n.Raycaster;r.setFromCamera(t,this.camera);let[i]=r.intersectObjects(this.faces.children,!1);this.faces.children.forEach(e=>{e.material.opacity=0,e.children[0].element.style.color=``}),i&&(i.object.material.opacity=.3,i.object.children[0].element.style.color=`#336dff`)},this.onPanEnd=e=>{this.dragging=!1,this.spherical={pi:this.controls.getPolarAngle(),theta:this.controls.getAzimuthalAngle()}},this.dispose=()=>{this.disable()},this.five=e,this.state=Object.assign({enabled:!1,visible:!0,arrowsVisible:!1},r==null?void 0:r.initialState),this._config=Object.assign({fixedLongitude:0,orthoView:!0},r==null?void 0:r.config),this.state.enabled&&this._enable({userAction:!1}),this.mc=new te.Manager(this.wrapper),this.mc.add(new te.Tap({interval:410})),this.mc.add(new te.Pan({threshold:10,pointers:0})),this.camera.setFromPose({distance:20,offset:new n.Vector3(0,0,0),longitude:e.camera.pose.latitude,latitude:e.camera.pose.latitude}),this.cylinder=new n.Mesh(new n.CylinderGeometry(13.2,14,.01,50,1,!0),new n.ShaderMaterial({uniforms:{radiusTop:{value:13.2},radiusBottom:{value:14},opacity:{value:1}},vertexShader:`
353
353
  varying vec3 pos;
354
354
  varying mat4 vViewMatrix;
355
355
  void main() {
@@ -379,7 +379,7 @@ void main() {
379
379
  vec4 color = mix(color1, color2, z);
380
380
  gl_FragColor = color;
381
381
  }
382
- `,transparent:!0})),this.init()}appendTo(e){if(!e)return;e.appendChild(this.wrapper);let{width:t,height:n}=this.wrapper.getBoundingClientRect();this.renderer.setSize(t,n),this.css3drenderer.setSize(t,n)}init(){this.renderer.setClearAlpha(0),this.renderer.domElement.style.outline=`none`,this.initDom(),this.initFaces(),this.initControls(),this.initLights();let e=this.cylinder;e.position.y=-3;let t=B(`西`);t.position.set(-19,0,0),e.add(t);let n=B(`东`);n.position.set(19,0,0),e.add(n);let r=B(`北`);r.position.set(0,0,-19),e.add(r);let i=B(`南`);i.position.set(0,0,19),e.add(i),this.updateByCamera(),this.scene.add(e,this.box,this.faces),this.scene.rotation.y=this.config.fixedLongitude}initDom(){this.style.innerHTML=`
382
+ `,transparent:!0})),this.init()}appendTo(e){if(!e)return;e.appendChild(this.wrapper);let{width:t,height:n}=this.wrapper.getBoundingClientRect();this.renderer.setSize(t,n),this.css3drenderer.setSize(t,n)}init(){this.renderer.setClearAlpha(0),this.renderer.domElement.style.outline=`none`,this.initDom(),this.initFaces(),this.initControls(),this.initLights();let e=this.cylinder;e.position.y=-3;let t=L(`西`);t.position.set(-19,0,0),e.add(t);let n=L(`东`);n.position.set(19,0,0),e.add(n);let r=L(`北`);r.position.set(0,0,-19),e.add(r);let i=L(`南`);i.position.set(0,0,19),e.add(i),this.updateByCamera(),this.scene.add(e,this.box,this.faces),this.scene.rotation.y=this.config.fixedLongitude}initDom(){this.style.innerHTML=`
383
383
  .OrientationPlugin .OrientationArrows {
384
384
  position: absolute;
385
385
  top: 0;
@@ -479,7 +479,7 @@ void main() {
479
479
  border-color: transparent transparent var(--color) transparent;
480
480
  transform: translate(0, -15px);
481
481
  }
482
- `,this.wrapper.className=`OrientationPlugin`,this.arrows.className=`OrientationArrows`,this.wrapper.style.cssText=`position: relative; width: 100%; height: 100%`,this.wrapper.appendChild(this.arrows),this.arrowLeft.className=this.arrowRight.className=this.arrowTop.className=this.arrowBack.className=this.arrowFront.className=`OrientationArrow`,this.arrowBottom.className=`OrientationArrow disabled`,this.arrowBack.innerText=`后`,this.arrowFront.innerText=`前`,this.arrowLeft.innerText=`左`,this.arrowRight.innerText=`右`,this.arrowTop.innerText=`上`,this.arrowBottom.innerText=`下`,this.css3drenderer.domElement.style.cssText=`position: absolute; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; color: #00000090;`}bindEvents(){this.five.on(`renderFrame`,this.onRenderFrame),this.five.on(`camera.update`,this.onCameraUpdate),this.five.on(`wantsGesture`,this.onFiveWantsGesture),this.five.on(`modeChange`,this.onFiveModeChange),this.mc.on(`tap`,this.onTapGesture),this.mc.on(`panstart`,this.onPanStart),this.mc.on(`panend`,this.onPanEnd),this.wrapper.addEventListener(`mousemove`,this.onMouseMove),this.arrowTop.onclick=()=>this.orient({longitude:0,latitude:L}),this.arrowLeft.onclick=()=>this.orient({longitude:-L,latitude:0}),this.arrowRight.onclick=()=>this.orient({longitude:L,latitude:0}),this.arrowFront.onclick=()=>this.orient({longitude:0,latitude:0}),this.arrowBack.onclick=()=>this.orient({longitude:Math.PI,latitude:0})}unbindEvents(){this.five.off(`renderFrame`,this.onRenderFrame),this.five.off(`camera.update`,this.onCameraUpdate),this.five.off(`wantsGesture`,this.onFiveWantsGesture),this.five.off(`modeChange`,this.onFiveModeChange),this.mc.off(`tap`,this.onTapGesture),this.mc.off(`panstart`,this.onPanStart),this.mc.off(`panend`,this.onPanEnd),this.wrapper.removeEventListener(`mousemove`,this.onMouseMove),this.arrowTop.onclick=null,this.arrowLeft.onclick=null,this.arrowRight.onclick=null,this.arrowFront.onclick=null,this.arrowBack.onclick=null}updateByCamera(){let e=I(.2,1,this.camera.pose.latitude/Math.PI*2,e=>e*e),t=I(11,13,this.camera.pose.latitude/Math.PI*2,e=>e*e),r=I(12,15,this.camera.pose.latitude/Math.PI*2,e=>e*e),i=I(13,19,this.camera.pose.latitude/Math.PI*2,e=>e*e),a=I(-.2,.5,this.camera.pose.latitude/Math.PI*2,e=>e*e);this.cylinder.geometry=new n.CylinderGeometry(t,r,.01,50,1,!0),this.cylinder.material.uniforms.radiusTop.value=t,this.cylinder.material.uniforms.radiusBottom.value=r,this.cylinder.material.needsUpdate=!0,this.cylinder.children.forEach(t=>{t.position.normalize().multiplyScalar(i),t.scale.set(e,e,e);let n=t.children[0];n&&(n.element.style.opacity=a.toString())})}updateArrows({longitude:e,latitude:t}){let n=L-t<.02;this.setState({arrowsVisible:n})}handleArrowsVisible(e){if(this.state.enabled)if(this.cylinder.material.uniforms.opacity.value=e?.4:1,this.cylinder.material.needsUpdate=!0,e){let{longitude:e,latitude:t}=this.five.getCurrentState();if(L-t<.03)this.five.state.mode===`Topview`||this.five.state.mode===`Mapview`?(this.faces.getObjectByName(`上`).element.className=`active`,this.arrows.innerHTML=``,this.arrows.appendChild(this.arrowBack),this.arrows.appendChild(this.arrowLeft),this.arrows.appendChild(this.arrowRight),this.arrows.appendChild(this.arrowFront),this.arrows.style.transform=`rotate(${(e-this.config.fixedLongitude)/Math.PI*180}deg)`):(this.arrows.innerHTML=``,this.faces.getObjectByName(`上`).element.className=``);else{switch(this.arrows.innerHTML=``,this.arrows.appendChild(this.arrowTop),this.config.orthoView&&this.five.ready().then(()=>{this.five.controller.cameraType=`orthographic`,this.five.ready().then(()=>this.five.controller.cameraMotion.ended=!1)}),!0){case F(0,e-this.config.fixedLongitude):this.arrows.appendChild(this.arrowLeft),this.arrows.appendChild(this.arrowRight),this.arrows.appendChild(this.arrowBottom),this.faces.getObjectByName(`前`).element.className=`active`;break;case F(L,e-this.config.fixedLongitude):this.arrows.appendChild(this.arrowFront),this.arrows.appendChild(this.arrowBack),this.arrows.appendChild(this.arrowBottom),this.faces.getObjectByName(`右`).element.className=`active`;break;case F(Math.PI,e-this.config.fixedLongitude):this.arrows.appendChild(this.arrowRight),this.arrows.appendChild(this.arrowLeft),this.arrows.appendChild(this.arrowBottom),this.faces.getObjectByName(`后`).element.className=`active`;break;default:this.arrows.appendChild(this.arrowBack),this.arrows.appendChild(this.arrowFront),this.arrows.appendChild(this.arrowBottom),this.faces.getObjectByName(`左`).element.className=`active`;break}this.arrows.style.transform=``}this.arrows.style.display=`block`}else this.config.orthoView&&(this.five.controller.cameraType=`auto`,this.five.ready().then(()=>this.five.controller.cameraMotion.ended=!1)),this.arrows.style.display=`none`,this.faces.children.forEach(e=>{e.children[0].element.className=``})}setState(e,t={}){let n=this.state,r=t.userAction===void 0?!0:t.userAction;if(this.updateState(e,r),e.enabled!==void 0&&n.enabled!==e.enabled){let t={userAction:r};e.enabled?this._enable(t):this._disable(t)}}initLights(){this.directionalLight.target=this.box,this.scene.add(this.ambientLight,this.directionalLight)}initFaces(){let e=R(7,7,.5),t=new n.ShapeGeometry(e);t.translate(-3.5,-3.5,0);let r=new n.Mesh(t,new n.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));r.userData={longitude:0,latitude:0},r.position.z=4.1,r.add(z(`前`));let i=new n.Mesh(t,new n.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));i.rotateY(Math.PI),i.position.z=-4.1,i.add(z(`后`)),i.userData={longitude:Math.PI,latitude:0};let a=new n.Mesh(t,new n.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));a.rotateY(L),a.position.x=4.1,a.add(z(`右`)),a.userData={longitude:L,latitude:0};let o=new n.Mesh(t,new n.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));o.rotateY(-L),o.position.x=-4.1,o.add(z(`左`)),o.userData={longitude:-L,latitude:0};let s=new n.Mesh(t,new n.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));s.rotateX(-L),s.position.y=4.1,s.add(z(`上`)),s.userData={longitude:0,latitude:L},this.faces.add(r,i,o,a,s)}initControls(){let e=this.controls=new j(this.camera,this.renderer.domElement);e.enableZoom=!1,e.enableDamping=!0,e.enablePan=!1,e.maxPolarAngle=L,e.dampingFactor=.15,e.rotateSpeed=.25}load(e){return m(this,void 0,void 0,function*(){})}_enable(e){let{longitude:t,latitude:r}=this.five.getCurrentState();this.camera.setFromPose({longitude:t,latitude:r,distance:20,offset:new n.Vector3(0,0,0)}),this.updateByCamera(),this.wrapper.appendChild(this.renderer.domElement),this.wrapper.appendChild(this.css3drenderer.domElement),this.bindEvents()}_disable(e){this.wrapper.removeChild(this.renderer.domElement),this.wrapper.removeChild(this.css3drenderer.domElement),this.unbindEvents()}enable(e){var t;if(this.state.enabled)return;let n=(t=e==null?void 0:e.userAction)==null?!0:t;this.updateState({enabled:!0},n),this._enable({userAction:n}),document.head.appendChild(this.style)}disable(e){var t;if(this.state.enabled===!1)return;let n=(t=e==null?void 0:e.userAction)==null?!0:t;this.updateState({enabled:!1},n),this._disable({userAction:n}),document.head.removeChild(this.style)}},ie=(e,t)=>new V(e,t),H=class extends r.BasePlugin.Controller{constructor(e,t){super(e),this.data={},this.pluginName=`BackgroundPlugin`,this._onFiveCameraUpdate=e=>{let t=(Math.PI/2-Math.max(e.latitude,0))/(Math.PI/2),n=Math.max(.2-t,0)*10;this.gradientBg&&(this.gradientBg.style.transform=`translateY(-${(1-t)*50}%)`),this.groundBg&&(this.groundBg.style.backgroundImage=`radial-gradient(circle, #2E303350 ${n*100}%, transparent ${n*120}%)`)},this._addEventListener=()=>{this.five.on(`cameraUpdate`,this._onFiveCameraUpdate)},this._removeEventListener=()=>{this.five.off(`cameraUpdate`,this._onFiveCameraUpdate)},this.load=()=>m(this,void 0,void 0,function*(){}),this.setState=(e,t={})=>{},this.enable=()=>{var e;let t=(e=this.five.getElement())==null?void 0:e.parentNode;if(!t){this.five.ready().then(()=>this.enable());return}this.state.enabled||(this._onFiveCameraUpdate(this.five.getPose(),!1),this.gradientBg&&t.appendChild(this.gradientBg),this.groundBg&&t.appendChild(this.groundBg),this.style&&document.head.appendChild(this.style),this._addEventListener(),this.hooks.emit(`enable`,{userAction:!0}),this.state.enabled=!0)},this.disable=(e={})=>{var t,n,r,i;this.state.enabled&&((n=(t=this.gradientBg)==null?void 0:t.parentNode)==null||n.removeChild(this.gradientBg),(i=(r=this.groundBg)==null?void 0:r.parentNode)==null||i.removeChild(this.groundBg),this.style&&document.head.removeChild(this.style),this._removeEventListener(),this.hooks.emit(`disable`,{userAction:!0}),this.state.enabled=!1)},this.dispose=()=>{this._removeEventListener(),this.hooks.emit(`disable`,{userAction:!0}),this.state.enabled=!1},this.state={enabled:!1},!(typeof document>`u`)&&(this.gradientBg=document.createElement(`div`),this.groundBg=document.createElement(`div`),this.style=document.createElement(`style`),this.gradientBg.className=`BackgroundPluginBg`,this.groundBg.className=`BackgroundPluginGroundBg`,this.style.innerHTML=`
482
+ `,this.wrapper.className=`OrientationPlugin`,this.arrows.className=`OrientationArrows`,this.wrapper.style.cssText=`position: relative; width: 100%; height: 100%`,this.wrapper.appendChild(this.arrows),this.arrowLeft.className=this.arrowRight.className=this.arrowTop.className=this.arrowBack.className=this.arrowFront.className=`OrientationArrow`,this.arrowBottom.className=`OrientationArrow disabled`,this.arrowBack.innerText=`后`,this.arrowFront.innerText=`前`,this.arrowLeft.innerText=`左`,this.arrowRight.innerText=`右`,this.arrowTop.innerText=`上`,this.arrowBottom.innerText=`下`,this.css3drenderer.domElement.style.cssText=`position: absolute; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; color: #00000090;`}bindEvents(){this.five.on(`renderFrame`,this.onRenderFrame),this.five.on(`camera.update`,this.onCameraUpdate),this.five.on(`wantsGesture`,this.onFiveWantsGesture),this.five.on(`modeChange`,this.onFiveModeChange),this.mc.on(`tap`,this.onTapGesture),this.mc.on(`panstart`,this.onPanStart),this.mc.on(`panend`,this.onPanEnd),this.wrapper.addEventListener(`mousemove`,this.onMouseMove),this.arrowTop.onclick=()=>this.orient({longitude:0,latitude:P}),this.arrowLeft.onclick=()=>this.orient({longitude:-P,latitude:0}),this.arrowRight.onclick=()=>this.orient({longitude:P,latitude:0}),this.arrowFront.onclick=()=>this.orient({longitude:0,latitude:0}),this.arrowBack.onclick=()=>this.orient({longitude:Math.PI,latitude:0})}unbindEvents(){this.five.off(`renderFrame`,this.onRenderFrame),this.five.off(`camera.update`,this.onCameraUpdate),this.five.off(`wantsGesture`,this.onFiveWantsGesture),this.five.off(`modeChange`,this.onFiveModeChange),this.mc.off(`tap`,this.onTapGesture),this.mc.off(`panstart`,this.onPanStart),this.mc.off(`panend`,this.onPanEnd),this.wrapper.removeEventListener(`mousemove`,this.onMouseMove),this.arrowTop.onclick=null,this.arrowLeft.onclick=null,this.arrowRight.onclick=null,this.arrowFront.onclick=null,this.arrowBack.onclick=null}updateByCamera(){let e=oe(.2,1,this.camera.pose.latitude/Math.PI*2,e=>e*e),t=oe(11,13,this.camera.pose.latitude/Math.PI*2,e=>e*e),r=oe(12,15,this.camera.pose.latitude/Math.PI*2,e=>e*e),i=oe(13,19,this.camera.pose.latitude/Math.PI*2,e=>e*e),a=oe(-.2,.5,this.camera.pose.latitude/Math.PI*2,e=>e*e);this.cylinder.geometry=new n.CylinderGeometry(t,r,.01,50,1,!0),this.cylinder.material.uniforms.radiusTop.value=t,this.cylinder.material.uniforms.radiusBottom.value=r,this.cylinder.material.needsUpdate=!0,this.cylinder.children.forEach(t=>{t.position.normalize().multiplyScalar(i),t.scale.set(e,e,e);let n=t.children[0];n&&(n.element.style.opacity=a.toString())})}updateArrows({longitude:e,latitude:t}){let n=P-t<.02;this.setState({arrowsVisible:n})}handleArrowsVisible(e){if(this.state.enabled)if(this.cylinder.material.uniforms.opacity.value=e?.4:1,this.cylinder.material.needsUpdate=!0,e){let{longitude:e,latitude:t}=this.five.getCurrentState();if(P-t<.03)this.five.state.mode===`Topview`||this.five.state.mode===`Mapview`?(this.faces.getObjectByName(`上`).element.className=`active`,this.arrows.innerHTML=``,this.arrows.appendChild(this.arrowBack),this.arrows.appendChild(this.arrowLeft),this.arrows.appendChild(this.arrowRight),this.arrows.appendChild(this.arrowFront),this.arrows.style.transform=`rotate(${(e-this.config.fixedLongitude)/Math.PI*180}deg)`):(this.arrows.innerHTML=``,this.faces.getObjectByName(`上`).element.className=``);else{switch(this.arrows.innerHTML=``,this.arrows.appendChild(this.arrowTop),this.config.orthoView&&this.five.ready().then(()=>{this.five.controller.cameraType=`orthographic`,this.five.ready().then(()=>this.five.controller.cameraMotion.ended=!1)}),!0){case N(0,e-this.config.fixedLongitude):this.arrows.appendChild(this.arrowLeft),this.arrows.appendChild(this.arrowRight),this.arrows.appendChild(this.arrowBottom),this.faces.getObjectByName(`前`).element.className=`active`;break;case N(P,e-this.config.fixedLongitude):this.arrows.appendChild(this.arrowFront),this.arrows.appendChild(this.arrowBack),this.arrows.appendChild(this.arrowBottom),this.faces.getObjectByName(`右`).element.className=`active`;break;case N(Math.PI,e-this.config.fixedLongitude):this.arrows.appendChild(this.arrowRight),this.arrows.appendChild(this.arrowLeft),this.arrows.appendChild(this.arrowBottom),this.faces.getObjectByName(`后`).element.className=`active`;break;default:this.arrows.appendChild(this.arrowBack),this.arrows.appendChild(this.arrowFront),this.arrows.appendChild(this.arrowBottom),this.faces.getObjectByName(`左`).element.className=`active`;break}this.arrows.style.transform=``}this.arrows.style.display=`block`}else this.config.orthoView&&(this.five.controller.cameraType=`auto`,this.five.ready().then(()=>this.five.controller.cameraMotion.ended=!1)),this.arrows.style.display=`none`,this.faces.children.forEach(e=>{e.children[0].element.className=``})}setState(e,t={}){let n=this.state,r=t.userAction===void 0?!0:t.userAction;if(this.updateState(e,r),e.enabled!==void 0&&n.enabled!==e.enabled){let t={userAction:r};e.enabled?this._enable(t):this._disable(t)}}initLights(){this.directionalLight.target=this.box,this.scene.add(this.ambientLight,this.directionalLight)}initFaces(){let e=F(7,7,.5),t=new n.ShapeGeometry(e);t.translate(-3.5,-3.5,0);let r=new n.Mesh(t,new n.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));r.userData={longitude:0,latitude:0},r.position.z=4.1,r.add(I(`前`));let i=new n.Mesh(t,new n.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));i.rotateY(Math.PI),i.position.z=-4.1,i.add(I(`后`)),i.userData={longitude:Math.PI,latitude:0};let a=new n.Mesh(t,new n.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));a.rotateY(P),a.position.x=4.1,a.add(I(`右`)),a.userData={longitude:P,latitude:0};let o=new n.Mesh(t,new n.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));o.rotateY(-P),o.position.x=-4.1,o.add(I(`左`)),o.userData={longitude:-P,latitude:0};let s=new n.Mesh(t,new n.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));s.rotateX(-P),s.position.y=4.1,s.add(I(`上`)),s.userData={longitude:0,latitude:P},this.faces.add(r,i,o,a,s)}initControls(){let e=this.controls=new A(this.camera,this.renderer.domElement);e.enableZoom=!1,e.enableDamping=!0,e.enablePan=!1,e.maxPolarAngle=P,e.dampingFactor=.15,e.rotateSpeed=.25}load(e){return m(this,void 0,void 0,function*(){})}_enable(e){let{longitude:t,latitude:r}=this.five.getCurrentState();this.camera.setFromPose({longitude:t,latitude:r,distance:20,offset:new n.Vector3(0,0,0)}),this.updateByCamera(),this.wrapper.appendChild(this.renderer.domElement),this.wrapper.appendChild(this.css3drenderer.domElement),this.bindEvents()}_disable(e){this.wrapper.removeChild(this.renderer.domElement),this.wrapper.removeChild(this.css3drenderer.domElement),this.unbindEvents()}enable(e){var t;if(this.state.enabled)return;let n=(t=e==null?void 0:e.userAction)==null?!0:t;this.updateState({enabled:!0},n),this._enable({userAction:n}),document.head.appendChild(this.style)}disable(e){var t;if(this.state.enabled===!1)return;let n=(t=e==null?void 0:e.userAction)==null?!0:t;this.updateState({enabled:!1},n),this._disable({userAction:n}),document.head.removeChild(this.style)}},z=(e,t)=>new R(e,t),B=class extends r.BasePlugin.Controller{constructor(e,t){super(e),this.data={},this.pluginName=`BackgroundPlugin`,this._onFiveCameraUpdate=e=>{let t=(Math.PI/2-Math.max(e.latitude,0))/(Math.PI/2),n=Math.max(.2-t,0)*10;this.gradientBg&&(this.gradientBg.style.transform=`translateY(-${(1-t)*50}%)`),this.groundBg&&(this.groundBg.style.backgroundImage=`radial-gradient(circle, #2E303350 ${n*100}%, transparent ${n*120}%)`)},this._addEventListener=()=>{this.five.on(`cameraUpdate`,this._onFiveCameraUpdate)},this._removeEventListener=()=>{this.five.off(`cameraUpdate`,this._onFiveCameraUpdate)},this.load=()=>m(this,void 0,void 0,function*(){}),this.setState=(e,t={})=>{},this.enable=()=>{var e;let t=(e=this.five.getElement())==null?void 0:e.parentNode;if(!t){this.five.ready().then(()=>this.enable());return}this.state.enabled||(this._onFiveCameraUpdate(this.five.getPose(),!1),this.gradientBg&&t.appendChild(this.gradientBg),this.groundBg&&t.appendChild(this.groundBg),this.style&&document.head.appendChild(this.style),this._addEventListener(),this.hooks.emit(`enable`,{userAction:!0}),this.state.enabled=!0)},this.disable=(e={})=>{var t,n,r,i;this.state.enabled&&((n=(t=this.gradientBg)==null?void 0:t.parentNode)==null||n.removeChild(this.gradientBg),(i=(r=this.groundBg)==null?void 0:r.parentNode)==null||i.removeChild(this.groundBg),this.style&&document.head.removeChild(this.style),this._removeEventListener(),this.hooks.emit(`disable`,{userAction:!0}),this.state.enabled=!1)},this.dispose=()=>{this._removeEventListener(),this.hooks.emit(`disable`,{userAction:!0}),this.state.enabled=!1},this.state={enabled:!1},!(typeof document>`u`)&&(this.gradientBg=document.createElement(`div`),this.groundBg=document.createElement(`div`),this.style=document.createElement(`style`),this.gradientBg.className=`BackgroundPluginBg`,this.groundBg.className=`BackgroundPluginGroundBg`,this.style.innerHTML=`
483
483
  .BackgroundPluginBg {
484
484
  position: absolute;
485
485
  top: 0;
@@ -500,7 +500,7 @@ void main() {
500
500
  z-index: -1;
501
501
  pointerEvents: none;
502
502
  }
503
- `,this.enable())}},U=(e,t)=>new H(e,t);new n.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]);var W=class{constructor(e,t,n,r,i){this.R=e,this.Q=t,this.A=n,this.B=r,this.C=i,this.cov=NaN,this.x=NaN}filter(e,t=0){if(isNaN(this.x))this.x=1/this.C*e,this.cov=1/this.C*this.Q*(1/this.C);else{let n=this.A*this.x+this.B*t,r=this.A*this.cov*this.A+this.R,i=r*this.C*(1/(this.C*r*this.C+this.Q));this.x=n+i*(e-this.C*n),this.cov=r-i*this.C*r}return this.x}},ae=class extends p.Controller{get config(){return Object.assign({},this._config)}updateState(e,t){let n=this.state;this.state=Object.assign(Object.assign({},this.state),e),this.hooks.emit(`stateChange`,{state:this.state,prevState:n,userAction:t})}constructor(e,t){super(e),this.dispose=()=>{this.disable()},this.five=e,this.state=Object.assign({enabled:!0,visible:!0},t==null?void 0:t.initialState),this._config=Object.assign({},t==null?void 0:t.config),this.state.enabled&&this._enable({userAction:!1}),this.cancelAnimation=null,this.skipStart=0,this.skipEnd=0,this.location=0,this.totalDistance=0,this.trajectory=null,this.currentKeyFrame=null,this.nextKeyframe=null,this.nextButOneKeyframe=null,this.keyframes=[],this.rate=this.config.rate||1,this.virualCamera=this.five.camera.clone(),this.playingState={keyframeIndex:null,progress:null},this.timeArray=null,this.startTimestamp=null,this.playbackStartTime=null,this.playbackEndTime=null,Object.defineProperties(this,{currentDistance:{get(){return this._currentDistance},set(e){this._currentDistance=e}}})}load(e){return m(this,void 0,void 0,function*(){})}loadTrajectory(e){this.trajectory=e,this.cancelAnimation&&this.cancelAnimation(),this.playingState.keyframeIndex=null,this.playingState.progress=null;let t=.01,r=.1,i=new W(t,r,1,0,1),a=new W(t,r,1,0,1),o=new W(t,r,1,0,1);if(this.trajectory&&this.trajectory.content.loadState===`READY`){let t=this.trajectory.content.data.positionArray;this.timeArray=this.trajectory.content.data.timeArray;let r=new Float32Array(t.length/3);for(let e=0;e<r.length;e++)if(e===0)r[e]=0;else{let i=new n.Vector3(t[e-3],t[e-2],t[e-1]);r[e]=new n.Vector3(t[e],t[e+1],t[e+2]).distanceTo(i)+r[e-1]}this.totalDistance=r[r.length-1];for(let s=0;s<r.length;s++){let c=new n.Vector3(0,0,0),l=0;for(let e=s-5;e<s+6;e++)e>=0&&e<r.length&&(c.add(new n.Vector3(t[e*3],t[e*3+1],t[e*3+2])),l++);c.divideScalar(l).applyMatrix4(e.transform);let u=i.filter(c.x),d=a.filter(c.y),f=o.filter(c.z),p={position:new n.Vector3(u,d,f),location:r[s]};this.keyframes.push(p)}}else throw Error(`trajectory content is not ready`)}setPlayingState(e){(e.keyframeIndex!==null||e.progress!==null)&&(this.cancelAnimation&&this.cancelAnimation(),this.playingState.keyframeIndex=e.keyframeIndex?e.keyframeIndex:this.playingState.keyframeIndex,this.playingState.progress=e.progress?e.progress:this.playingState.progress,this.play())}_enable(e){}play(){let e=this.keyframes.length;if(e<2)throw Error(`keyframes length must be greater than 2`);let r={keyframeIndex:null,progress:null};this.playingState.keyframeIndex!==null&&this.playingState.progress!==null?(r.keyframeIndex=this.playingState.keyframeIndex,r.progress=this.playingState.progress):this.playingState.keyframeIndex===null&&this.playingState.progress===null&&(this.playingState.keyframeIndex=this.skipStart,this.playingState.progress=0,this.virualCamera.position.copy(this.keyframes[this.playingState.keyframeIndex].position.clone()),this.virualCamera.lookAt(this.keyframes[1].position.clone()),this.virualCamera.computePose(),this.five.setState(Object.assign({},this.virualCamera.pose)));let i=this.playingState.keyframeIndex,a=0;this.cancelAnimation=t.AnimationFrameLoop.shared.add((t,o)=>{if(i===e-1-this.skipEnd&&this.cancelAnimation){this.cancelAnimation();return}this.currentKeyFrame=this.keyframes[i],this.nextKeyframe=this.keyframes[i+1],i+2<=e-1?this.nextButOneKeyframe=this.keyframes[i+2]:this.nextButOneKeyframe=null;let s=this.currentKeyFrame.position.clone(),c=this.nextKeyframe.position.clone(),l=this.nextKeyframe.position.clone().sub(this.currentKeyFrame.position.clone()).normalize(),u=s.clone().add(l.clone().multiplyScalar(.01)),d=new n.Vector3;this.nextButOneKeyframe===null?d.copy(l):d=this.nextButOneKeyframe.position.clone().sub(this.nextKeyframe.position.clone()).normalize();let f=c.clone().add(d.clone().multiplyScalar(.01));a+=o/1e3*this.rate;let p=a/s.distanceTo(c);p=p>=1?1:p,r.keyframeIndex!==null&&r.progress!==null&&(p=r.progress,r.keyframeIndex=null,r.progress=null);let m=s.clone().lerp(c,p),h=u.clone().lerp(f,p);this.virualCamera.position.copy(m),this.virualCamera.lookAt(h),this.virualCamera.updateMatrixWorld(),this.virualCamera.updateMatrix(),this.virualCamera.computePose(),this.five.setState(Object.assign({},this.virualCamera.pose)),this.location=this.keyframes[i].location+s.clone().distanceTo(m),p===1?(a=0,i++,this.playingState.keyframeIndex=i,this.playingState.progress=0):(this.playingState.keyframeIndex=i,this.playingState.progress=p)})}pause(){var e;if(this.cancelAnimation){if(this.playingState.keyframeIndex!==null&&this.playingState.keyframeIndex>=0&&this.playingState.keyframeIndex<this.keyframes.length){let t=this.playingState.keyframeIndex,n=(e=this.playingState.progress)==null?0:e,r=this.keyframes[t],i=t+1<this.keyframes.length?this.keyframes[t+1]:r,a=r.position.clone(),o=i.position.clone(),s=a.clone().lerp(o,n),c=o.clone().sub(a).normalize(),l=s.clone().add(c.multiplyScalar(.01));this.virualCamera.position.copy(s),this.virualCamera.lookAt(l),this.virualCamera.updateMatrixWorld(),this.virualCamera.updateMatrix(),this.virualCamera.computePose(),this.five.setState(Object.assign({},this.virualCamera.pose))}else if(this.currentKeyFrame&&this.nextKeyframe){let e=this.currentKeyFrame.position.clone(),t=this.nextKeyframe.position.clone(),n=e.clone(),r=t.clone().sub(e).normalize(),i=n.clone().add(r.multiplyScalar(.01));this.virualCamera.position.copy(n),this.virualCamera.lookAt(i),this.virualCamera.updateMatrixWorld(),this.virualCamera.updateMatrix(),this.virualCamera.computePose(),this.five.setState(Object.assign({},this.virualCamera.pose))}this.cancelAnimation()}this.startTimestamp=null}playByTimestamp(){var e;if(!this.trajectory||!this.timeArray||this.timeArray.length===0)throw Error(`Trajectory or timeArray is not available`);let r=this.keyframes.length;if(r<2)throw Error(`keyframes length must be greater than 2`);this.cancelAnimation&&this.cancelAnimation();let i=this.skipStart,a=this.timeArray.length-1-this.skipEnd;if(i>=a||i<0||a>=this.timeArray.length)throw Error(`Invalid skipStart or skipEnd values`);this.playbackStartTime=this.timeArray[i],this.playbackEndTime=this.timeArray[a],this.playbackEndTime-this.playbackStartTime;let o,s=0,c=null;if(this.playingState.keyframeIndex!==null&&this.playingState.keyframeIndex>=i&&this.playingState.keyframeIndex<r-this.skipEnd){o=this.playingState.keyframeIndex,s=(e=this.playingState.progress)==null?0:e;let t=this.timeArray[o];c=t+((o+1<this.timeArray.length?this.timeArray[o+1]:t)-t)*s}else o=this.skipStart,o>=r-1-this.skipEnd&&(o=r-1-this.skipEnd-1),o<0&&(o=0),c=null;let l=this.playbackStartTime;if(c!==null){let e=c-l;this.startTimestamp=Date.now()-e/this.rate}else this.startTimestamp=Date.now();if(s>0&&o+1<r){let e=this.keyframes[o].position.clone(),t=this.keyframes[o+1].position.clone(),n=e.clone().lerp(t,s),r=t.clone().sub(e).normalize(),i=n.clone().add(r.multiplyScalar(.01));this.virualCamera.position.copy(n),this.virualCamera.lookAt(i)}else this.virualCamera.position.copy(this.keyframes[o].position.clone()),o+1<r&&this.virualCamera.lookAt(this.keyframes[o+1].position.clone());this.virualCamera.computePose(),this.five.setState(Object.assign({},this.virualCamera.pose)),this.cancelAnimation=t.AnimationFrameLoop.shared.add((e,t)=>{if(!this.startTimestamp)return;let i=l+(Date.now()-this.startTimestamp)*this.rate;if(this.playbackEndTime&&i>=this.playbackEndTime){let e=r-1-this.skipEnd;if(e>0&&e<r){if(this.currentKeyFrame=this.keyframes[e-1],this.nextKeyframe=this.keyframes[e],this.virualCamera.position.copy(this.nextKeyframe.position.clone()),e+1<r)this.virualCamera.lookAt(this.keyframes[e+1].position.clone());else{let e=this.nextKeyframe.position.clone().sub(this.currentKeyFrame.position.clone()).normalize();this.virualCamera.lookAt(this.nextKeyframe.position.clone().add(e.multiplyScalar(.01)))}this.virualCamera.computePose(),this.five.setState(Object.assign({},this.virualCamera.pose))}this.cancelAnimation&&(this.cancelAnimation(),this.startTimestamp=null);return}let a=this.findKeyFrameByTimestamp(i);if(a===void 0||a>=r-1-this.skipEnd||(a!==o&&(o=a),o>=r-1-this.skipEnd)||(this.currentKeyFrame=this.keyframes[o],this.nextKeyframe=this.keyframes[o+1],o+2<=r-1?this.nextButOneKeyframe=this.keyframes[o+2]:this.nextButOneKeyframe=null,!this.timeArray))return;let s=this.timeArray[o],c=this.timeArray[o+1]-s,u=c>0?(i-s)/c:0,d=Math.max(0,Math.min(1,u)),f=this.currentKeyFrame.position.clone(),p=this.nextKeyframe.position.clone(),m=this.nextKeyframe.position.clone().sub(this.currentKeyFrame.position.clone()).normalize(),h=f.clone().add(m.clone().multiplyScalar(.01)),g=new n.Vector3;this.nextButOneKeyframe===null?g.copy(m):g=this.nextButOneKeyframe.position.clone().sub(this.nextKeyframe.position.clone()).normalize();let _=p.clone().add(g.clone().multiplyScalar(.01)),v=f.clone().lerp(p,d),y=h.clone().lerp(_,d);this.virualCamera.position.copy(v),this.virualCamera.lookAt(y),this.virualCamera.updateMatrixWorld(),this.virualCamera.updateMatrix(),this.virualCamera.computePose(),this.five.setState(Object.assign({},this.virualCamera.pose)),this.playingState.keyframeIndex=o,this.playingState.progress=d,this.location=this.keyframes[o].location+f.clone().distanceTo(v),this.playingState.keyframeIndex=o,this.playingState.progress=d})}findKeyFrameByLocation(e){if(this.keyframes.length===0)return;let t=0,n=this.keyframes.length-1;for(;t<=n;){let r=Math.floor((t+n)/2);if(this.keyframes[r].location===e)return r;this.keyframes[r].location<e?t=r+1:n=r-1}return{keyframeIndex:t-1,progress:0}}findKeyFrameByTimestamp(e){if(!this.timeArray||this.timeArray.length===0||this.keyframes.length===0)return;let t=0,n=this.timeArray.length-1,r=0,i=Math.abs(this.timeArray[0]-e);for(;t<=n;){let a=Math.floor((t+n)/2),o=this.timeArray[a],s=Math.abs(o-e);if(s<i&&(i=s,r=a),o===e)return a;o<e?t=a+1:n=a-1}return r>0&&Math.abs(this.timeArray[r-1]-e)<i&&--r,r<this.timeArray.length-1&&Math.abs(this.timeArray[r+1]-e)<i&&(r+=1),r}resetPlayingState(){this.playingState.keyframeIndex=null,this.playingState.progress=null}getTotalTime(){if(!this.timeArray||this.timeArray.length===0)return null;let e=this.skipStart,t=this.timeArray.length-1-this.skipEnd;if(e>=t||e<0||t>=this.timeArray.length)return null;let n=this.timeArray[e];return this.timeArray[t]-n}setPlayingStateByTimestamp(e){if(!this.trajectory||!this.timeArray||this.timeArray.length===0)throw Error(`Trajectory or timeArray is not available`);let r=this.keyframes.length;if(e<0||e>=r)throw Error(`Invalid keyframeIndex`);this.cancelAnimation&&this.cancelAnimation();let i=this.skipStart,a=this.timeArray.length-1-this.skipEnd;if(i>=a||i<0||a>=this.timeArray.length)throw Error(`Invalid skipStart or skipEnd values`);this.playbackStartTime=this.timeArray[i],this.playbackEndTime=this.timeArray[a];let o=this.timeArray[e]-this.playbackStartTime;if(this.startTimestamp=Date.now()-o/this.rate,this.playingState.keyframeIndex=e,this.playingState.progress=0,this.virualCamera.position.copy(this.keyframes[e].position.clone()),e+1<r)this.virualCamera.lookAt(this.keyframes[e+1].position.clone());else if(e>0){let t=this.keyframes[e].position.clone().sub(this.keyframes[e-1].position.clone()).normalize();this.virualCamera.lookAt(this.keyframes[e].position.clone().add(t.multiplyScalar(.01)))}this.virualCamera.computePose(),this.five.setState(Object.assign({},this.virualCamera.pose));let s=this.playbackStartTime,c=e;this.cancelAnimation=t.AnimationFrameLoop.shared.add((e,t)=>{if(this.timeArray===null||this.timeArray.length===0||!this.startTimestamp)return;let i=s+(Date.now()-this.startTimestamp)*this.rate;if(this.playbackEndTime&&i>=this.playbackEndTime){let e=r-1-this.skipEnd;if(e>0&&e<r){if(this.currentKeyFrame=this.keyframes[e-1],this.nextKeyframe=this.keyframes[e],this.virualCamera.position.copy(this.nextKeyframe.position.clone()),e+1<r)this.virualCamera.lookAt(this.keyframes[e+1].position.clone());else{let e=this.nextKeyframe.position.clone().sub(this.currentKeyFrame.position.clone()).normalize();this.virualCamera.lookAt(this.nextKeyframe.position.clone().add(e.multiplyScalar(.01)))}this.virualCamera.computePose(),this.five.setState(Object.assign({},this.virualCamera.pose))}this.cancelAnimation&&(this.cancelAnimation(),this.startTimestamp=null);return}let a=this.findKeyFrameByTimestamp(i);if(a===void 0||a>=r-1-this.skipEnd||(a!==c&&(c=a),c>=r-1-this.skipEnd))return;this.currentKeyFrame=this.keyframes[c],this.nextKeyframe=this.keyframes[c+1],c+2<=r-1?this.nextButOneKeyframe=this.keyframes[c+2]:this.nextButOneKeyframe=null;let o=this.currentKeyFrame.position.clone(),l=this.nextKeyframe.position.clone(),u=this.nextKeyframe.position.clone().sub(this.currentKeyFrame.position.clone()).normalize(),d=o.clone().add(u.clone().multiplyScalar(.01)),f=new n.Vector3;this.nextButOneKeyframe===null?f.copy(u):f=this.nextButOneKeyframe.position.clone().sub(this.nextKeyframe.position.clone()).normalize();let p=l.clone().add(f.clone().multiplyScalar(.01)),m=this.timeArray[c],h=this.timeArray[c+1]-m,g=0;if(h>0){let e=i-m;g=Math.max(0,Math.min(1,e/h))}let _=g*g*(3-2*g),v=o.clone().lerp(l,_),y=d.clone().lerp(p,_);this.virualCamera.position.copy(v),this.virualCamera.lookAt(y),this.virualCamera.computePose(),this.five.setState(Object.assign({},this.virualCamera.pose))})}_disable(e){}enable(e){var t;if(this.state.enabled)return;let n=(t=e==null?void 0:e.userAction)==null?!0:t;this.updateState({enabled:!0},n),this._enable({userAction:n})}disable(e){var t;if(this.state.enabled===!1)return;let n=(t=e==null?void 0:e.userAction)==null?!0:t;this.updateState({enabled:!1},n),this._disable({userAction:n})}},G=(e,t)=>new ae(e,t);function K(e,t,n){return e<t?t:e>n?n:e}var oe=`
503
+ `,this.enable())}},V=(e,t)=>new B(e,t);new n.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]);var H=class{constructor(e,t,n,r,i){this.R=e,this.Q=t,this.A=n,this.B=r,this.C=i,this.cov=NaN,this.x=NaN}filter(e,t=0){if(isNaN(this.x))this.x=1/this.C*e,this.cov=1/this.C*this.Q*(1/this.C);else{let n=this.A*this.x+this.B*t,r=this.A*this.cov*this.A+this.R,i=r*this.C*(1/(this.C*r*this.C+this.Q));this.x=n+i*(e-this.C*n),this.cov=r-i*this.C*r}return this.x}},U=class extends p.Controller{get config(){return Object.assign({},this._config)}updateState(e,t){let n=this.state;this.state=Object.assign(Object.assign({},this.state),e),this.hooks.emit(`stateChange`,{state:this.state,prevState:n,userAction:t})}constructor(e,t){super(e),this.dispose=()=>{this.disable()},this.five=e,this.state=Object.assign({enabled:!0,visible:!0},t==null?void 0:t.initialState),this._config=Object.assign({},t==null?void 0:t.config),this.state.enabled&&this._enable({userAction:!1}),this.cancelAnimation=null,this.skipStart=0,this.skipEnd=0,this.location=0,this.totalDistance=0,this.trajectory=null,this.currentKeyFrame=null,this.nextKeyframe=null,this.nextButOneKeyframe=null,this.keyframes=[],this.rate=this.config.rate||1,this.virualCamera=this.five.camera.clone(),this.playingState={keyframeIndex:null,progress:null},this.timeArray=null,this.startTimestamp=null,this.playbackStartTime=null,this.playbackEndTime=null,Object.defineProperties(this,{currentDistance:{get(){return this._currentDistance},set(e){this._currentDistance=e}}})}load(e){return m(this,void 0,void 0,function*(){})}loadTrajectory(e){this.trajectory=e,this.cancelAnimation&&this.cancelAnimation(),this.playingState.keyframeIndex=null,this.playingState.progress=null;let t=.01,r=.1,i=new H(t,r,1,0,1),a=new H(t,r,1,0,1),o=new H(t,r,1,0,1);if(this.trajectory&&this.trajectory.content.loadState===`READY`){let t=this.trajectory.content.data.positionArray;this.timeArray=this.trajectory.content.data.timeArray;let r=new Float32Array(t.length/3);for(let e=0;e<r.length;e++)if(e===0)r[e]=0;else{let i=new n.Vector3(t[e-3],t[e-2],t[e-1]);r[e]=new n.Vector3(t[e],t[e+1],t[e+2]).distanceTo(i)+r[e-1]}this.totalDistance=r[r.length-1];for(let s=0;s<r.length;s++){let c=new n.Vector3(0,0,0),l=0;for(let e=s-5;e<s+6;e++)e>=0&&e<r.length&&(c.add(new n.Vector3(t[e*3],t[e*3+1],t[e*3+2])),l++);c.divideScalar(l).applyMatrix4(e.transform);let u=i.filter(c.x),d=a.filter(c.y),f=o.filter(c.z),p={position:new n.Vector3(u,d,f),location:r[s]};this.keyframes.push(p)}}else throw Error(`trajectory content is not ready`)}setPlayingState(e){(e.keyframeIndex!==null||e.progress!==null)&&(this.cancelAnimation&&this.cancelAnimation(),this.playingState.keyframeIndex=e.keyframeIndex?e.keyframeIndex:this.playingState.keyframeIndex,this.playingState.progress=e.progress?e.progress:this.playingState.progress,this.play())}_enable(e){}play(){let e=this.keyframes.length;if(e<2)throw Error(`keyframes length must be greater than 2`);let r={keyframeIndex:null,progress:null};this.playingState.keyframeIndex!==null&&this.playingState.progress!==null?(r.keyframeIndex=this.playingState.keyframeIndex,r.progress=this.playingState.progress):this.playingState.keyframeIndex===null&&this.playingState.progress===null&&(this.playingState.keyframeIndex=this.skipStart,this.playingState.progress=0,this.virualCamera.position.copy(this.keyframes[this.playingState.keyframeIndex].position.clone()),this.virualCamera.lookAt(this.keyframes[1].position.clone()),this.virualCamera.computePose(),this.five.setState(Object.assign({},this.virualCamera.pose)));let i=this.playingState.keyframeIndex,a=0;this.cancelAnimation=t.AnimationFrameLoop.shared.add((t,o)=>{if(i===e-1-this.skipEnd&&this.cancelAnimation){this.cancelAnimation();return}this.currentKeyFrame=this.keyframes[i],this.nextKeyframe=this.keyframes[i+1],i+2<=e-1?this.nextButOneKeyframe=this.keyframes[i+2]:this.nextButOneKeyframe=null;let s=this.currentKeyFrame.position.clone(),c=this.nextKeyframe.position.clone(),l=this.nextKeyframe.position.clone().sub(this.currentKeyFrame.position.clone()).normalize(),u=s.clone().add(l.clone().multiplyScalar(.01)),d=new n.Vector3;this.nextButOneKeyframe===null?d.copy(l):d=this.nextButOneKeyframe.position.clone().sub(this.nextKeyframe.position.clone()).normalize();let f=c.clone().add(d.clone().multiplyScalar(.01));a+=o/1e3*this.rate;let p=a/s.distanceTo(c);p=p>=1?1:p,r.keyframeIndex!==null&&r.progress!==null&&(p=r.progress,r.keyframeIndex=null,r.progress=null);let m=s.clone().lerp(c,p),h=u.clone().lerp(f,p);this.virualCamera.position.copy(m),this.virualCamera.lookAt(h),this.virualCamera.updateMatrixWorld(),this.virualCamera.updateMatrix(),this.virualCamera.computePose(),this.five.setState(Object.assign({},this.virualCamera.pose)),this.location=this.keyframes[i].location+s.clone().distanceTo(m),p===1?(a=0,i++,this.playingState.keyframeIndex=i,this.playingState.progress=0):(this.playingState.keyframeIndex=i,this.playingState.progress=p)})}pause(){var e;if(this.cancelAnimation){if(this.playingState.keyframeIndex!==null&&this.playingState.keyframeIndex>=0&&this.playingState.keyframeIndex<this.keyframes.length){let t=this.playingState.keyframeIndex,n=(e=this.playingState.progress)==null?0:e,r=this.keyframes[t],i=t+1<this.keyframes.length?this.keyframes[t+1]:r,a=r.position.clone(),o=i.position.clone(),s=a.clone().lerp(o,n),c=o.clone().sub(a).normalize(),l=s.clone().add(c.multiplyScalar(.01));this.virualCamera.position.copy(s),this.virualCamera.lookAt(l),this.virualCamera.updateMatrixWorld(),this.virualCamera.updateMatrix(),this.virualCamera.computePose(),this.five.setState(Object.assign({},this.virualCamera.pose))}else if(this.currentKeyFrame&&this.nextKeyframe){let e=this.currentKeyFrame.position.clone(),t=this.nextKeyframe.position.clone(),n=e.clone(),r=t.clone().sub(e).normalize(),i=n.clone().add(r.multiplyScalar(.01));this.virualCamera.position.copy(n),this.virualCamera.lookAt(i),this.virualCamera.updateMatrixWorld(),this.virualCamera.updateMatrix(),this.virualCamera.computePose(),this.five.setState(Object.assign({},this.virualCamera.pose))}this.cancelAnimation()}this.startTimestamp=null}playByTimestamp(){var e;if(!this.trajectory||!this.timeArray||this.timeArray.length===0)throw Error(`Trajectory or timeArray is not available`);let r=this.keyframes.length;if(r<2)throw Error(`keyframes length must be greater than 2`);this.cancelAnimation&&this.cancelAnimation();let i=this.skipStart,a=this.timeArray.length-1-this.skipEnd;if(i>=a||i<0||a>=this.timeArray.length)throw Error(`Invalid skipStart or skipEnd values`);this.playbackStartTime=this.timeArray[i],this.playbackEndTime=this.timeArray[a],this.playbackEndTime-this.playbackStartTime;let o,s=0,c=null;if(this.playingState.keyframeIndex!==null&&this.playingState.keyframeIndex>=i&&this.playingState.keyframeIndex<r-this.skipEnd){o=this.playingState.keyframeIndex,s=(e=this.playingState.progress)==null?0:e;let t=this.timeArray[o];c=t+((o+1<this.timeArray.length?this.timeArray[o+1]:t)-t)*s}else o=this.skipStart,o>=r-1-this.skipEnd&&(o=r-1-this.skipEnd-1),o<0&&(o=0),c=null;let l=this.playbackStartTime;if(c!==null){let e=c-l;this.startTimestamp=Date.now()-e/this.rate}else this.startTimestamp=Date.now();if(s>0&&o+1<r){let e=this.keyframes[o].position.clone(),t=this.keyframes[o+1].position.clone(),n=e.clone().lerp(t,s),r=t.clone().sub(e).normalize(),i=n.clone().add(r.multiplyScalar(.01));this.virualCamera.position.copy(n),this.virualCamera.lookAt(i)}else this.virualCamera.position.copy(this.keyframes[o].position.clone()),o+1<r&&this.virualCamera.lookAt(this.keyframes[o+1].position.clone());this.virualCamera.computePose(),this.five.setState(Object.assign({},this.virualCamera.pose)),this.cancelAnimation=t.AnimationFrameLoop.shared.add((e,t)=>{if(!this.startTimestamp)return;let i=l+(Date.now()-this.startTimestamp)*this.rate;if(this.playbackEndTime&&i>=this.playbackEndTime){let e=r-1-this.skipEnd;if(e>0&&e<r){if(this.currentKeyFrame=this.keyframes[e-1],this.nextKeyframe=this.keyframes[e],this.virualCamera.position.copy(this.nextKeyframe.position.clone()),e+1<r)this.virualCamera.lookAt(this.keyframes[e+1].position.clone());else{let e=this.nextKeyframe.position.clone().sub(this.currentKeyFrame.position.clone()).normalize();this.virualCamera.lookAt(this.nextKeyframe.position.clone().add(e.multiplyScalar(.01)))}this.virualCamera.computePose(),this.five.setState(Object.assign({},this.virualCamera.pose))}this.cancelAnimation&&(this.cancelAnimation(),this.startTimestamp=null);return}let a=this.findKeyFrameByTimestamp(i);if(a===void 0||a>=r-1-this.skipEnd||(a!==o&&(o=a),o>=r-1-this.skipEnd)||(this.currentKeyFrame=this.keyframes[o],this.nextKeyframe=this.keyframes[o+1],o+2<=r-1?this.nextButOneKeyframe=this.keyframes[o+2]:this.nextButOneKeyframe=null,!this.timeArray))return;let s=this.timeArray[o],c=this.timeArray[o+1]-s,u=c>0?(i-s)/c:0,d=Math.max(0,Math.min(1,u)),f=this.currentKeyFrame.position.clone(),p=this.nextKeyframe.position.clone(),m=this.nextKeyframe.position.clone().sub(this.currentKeyFrame.position.clone()).normalize(),h=f.clone().add(m.clone().multiplyScalar(.01)),g=new n.Vector3;this.nextButOneKeyframe===null?g.copy(m):g=this.nextButOneKeyframe.position.clone().sub(this.nextKeyframe.position.clone()).normalize();let _=p.clone().add(g.clone().multiplyScalar(.01)),v=f.clone().lerp(p,d),y=h.clone().lerp(_,d);this.virualCamera.position.copy(v),this.virualCamera.lookAt(y),this.virualCamera.updateMatrixWorld(),this.virualCamera.updateMatrix(),this.virualCamera.computePose(),this.five.setState(Object.assign({},this.virualCamera.pose)),this.playingState.keyframeIndex=o,this.playingState.progress=d,this.location=this.keyframes[o].location+f.clone().distanceTo(v),this.playingState.keyframeIndex=o,this.playingState.progress=d})}findKeyFrameByLocation(e){if(this.keyframes.length===0)return;let t=0,n=this.keyframes.length-1;for(;t<=n;){let r=Math.floor((t+n)/2);if(this.keyframes[r].location===e)return r;this.keyframes[r].location<e?t=r+1:n=r-1}return{keyframeIndex:t-1,progress:0}}findKeyFrameByTimestamp(e){if(!this.timeArray||this.timeArray.length===0||this.keyframes.length===0)return;let t=0,n=this.timeArray.length-1,r=0,i=Math.abs(this.timeArray[0]-e);for(;t<=n;){let a=Math.floor((t+n)/2),o=this.timeArray[a],s=Math.abs(o-e);if(s<i&&(i=s,r=a),o===e)return a;o<e?t=a+1:n=a-1}return r>0&&Math.abs(this.timeArray[r-1]-e)<i&&--r,r<this.timeArray.length-1&&Math.abs(this.timeArray[r+1]-e)<i&&(r+=1),r}resetPlayingState(){this.playingState.keyframeIndex=null,this.playingState.progress=null}getTotalTime(){if(!this.timeArray||this.timeArray.length===0)return null;let e=this.skipStart,t=this.timeArray.length-1-this.skipEnd;if(e>=t||e<0||t>=this.timeArray.length)return null;let n=this.timeArray[e];return this.timeArray[t]-n}setPlayingStateByTimestamp(e){if(!this.trajectory||!this.timeArray||this.timeArray.length===0)throw Error(`Trajectory or timeArray is not available`);let r=this.keyframes.length;if(e<0||e>=r)throw Error(`Invalid keyframeIndex`);this.cancelAnimation&&this.cancelAnimation();let i=this.skipStart,a=this.timeArray.length-1-this.skipEnd;if(i>=a||i<0||a>=this.timeArray.length)throw Error(`Invalid skipStart or skipEnd values`);this.playbackStartTime=this.timeArray[i],this.playbackEndTime=this.timeArray[a];let o=this.timeArray[e]-this.playbackStartTime;if(this.startTimestamp=Date.now()-o/this.rate,this.playingState.keyframeIndex=e,this.playingState.progress=0,this.virualCamera.position.copy(this.keyframes[e].position.clone()),e+1<r)this.virualCamera.lookAt(this.keyframes[e+1].position.clone());else if(e>0){let t=this.keyframes[e].position.clone().sub(this.keyframes[e-1].position.clone()).normalize();this.virualCamera.lookAt(this.keyframes[e].position.clone().add(t.multiplyScalar(.01)))}this.virualCamera.computePose(),this.five.setState(Object.assign({},this.virualCamera.pose));let s=this.playbackStartTime,c=e;this.cancelAnimation=t.AnimationFrameLoop.shared.add((e,t)=>{if(this.timeArray===null||this.timeArray.length===0||!this.startTimestamp)return;let i=s+(Date.now()-this.startTimestamp)*this.rate;if(this.playbackEndTime&&i>=this.playbackEndTime){let e=r-1-this.skipEnd;if(e>0&&e<r){if(this.currentKeyFrame=this.keyframes[e-1],this.nextKeyframe=this.keyframes[e],this.virualCamera.position.copy(this.nextKeyframe.position.clone()),e+1<r)this.virualCamera.lookAt(this.keyframes[e+1].position.clone());else{let e=this.nextKeyframe.position.clone().sub(this.currentKeyFrame.position.clone()).normalize();this.virualCamera.lookAt(this.nextKeyframe.position.clone().add(e.multiplyScalar(.01)))}this.virualCamera.computePose(),this.five.setState(Object.assign({},this.virualCamera.pose))}this.cancelAnimation&&(this.cancelAnimation(),this.startTimestamp=null);return}let a=this.findKeyFrameByTimestamp(i);if(a===void 0||a>=r-1-this.skipEnd||(a!==c&&(c=a),c>=r-1-this.skipEnd))return;this.currentKeyFrame=this.keyframes[c],this.nextKeyframe=this.keyframes[c+1],c+2<=r-1?this.nextButOneKeyframe=this.keyframes[c+2]:this.nextButOneKeyframe=null;let o=this.currentKeyFrame.position.clone(),l=this.nextKeyframe.position.clone(),u=this.nextKeyframe.position.clone().sub(this.currentKeyFrame.position.clone()).normalize(),d=o.clone().add(u.clone().multiplyScalar(.01)),f=new n.Vector3;this.nextButOneKeyframe===null?f.copy(u):f=this.nextButOneKeyframe.position.clone().sub(this.nextKeyframe.position.clone()).normalize();let p=l.clone().add(f.clone().multiplyScalar(.01)),m=this.timeArray[c],h=this.timeArray[c+1]-m,g=0;if(h>0){let e=i-m;g=Math.max(0,Math.min(1,e/h))}let _=g*g*(3-2*g),v=o.clone().lerp(l,_),y=d.clone().lerp(p,_);this.virualCamera.position.copy(v),this.virualCamera.lookAt(y),this.virualCamera.computePose(),this.five.setState(Object.assign({},this.virualCamera.pose))})}_disable(e){}enable(e){var t;if(this.state.enabled)return;let n=(t=e==null?void 0:e.userAction)==null?!0:t;this.updateState({enabled:!0},n),this._enable({userAction:n})}disable(e){var t;if(this.state.enabled===!1)return;let n=(t=e==null?void 0:e.userAction)==null?!0:t;this.updateState({enabled:!1},n),this._disable({userAction:n})}},W=(e,t)=>new U(e,t);function G(e,t,n){return e<t?t:e>n?n:e}var se=`
504
504
  varying vec2 vUv;
505
505
  varying vec3 vPosition;
506
506
  void main() {
@@ -508,7 +508,7 @@ void main() {
508
508
  vPosition = position;
509
509
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
510
510
  }
511
- `,se=`
511
+ `,ce=`
512
512
  varying vec2 vUv;
513
513
  uniform sampler2D map;
514
514
  uniform float progress;
@@ -527,7 +527,7 @@ void main() {
527
527
  }
528
528
  gl_FragColor.a = gl_FragColor.a * opacity;
529
529
  }
530
- `,ce=[1,5,2,6,3,7,4,8,9,13,10,14,11,15,12,16],q=512,le=512,ue=128,de=class extends r.BasePlugin.Controller{get config(){return Object.assign({},this._config)}updateState(e,t){let n=this.state;this.state=Object.assign(Object.assign({},this.state),e),this.hooks.emit(`stateChange`,{state:this.state,prevState:n,userAction:t})}updateConfig(e,t={}){var n;let r=this.config,i=Object.assign(Object.assign({},r),e);this._config=i,this.hooks.emit(`configChange`,{prevConfig:r,config:i,userAction:(n=t.userAction)==null?!0:n})}constructor(e,r){super(e),this.group=new n.Group,this.mesh=(()=>{let e=new n.CylinderGeometry(.12,.12,1,32,1,!0);e.translate(0,.5,0);let t=new n.ShaderMaterial({vertexShader:oe,fragmentShader:se,uniforms:{map:{value:new n.Texture},progress:{value:0},opacity:{value:0}},transparent:!0,depthTest:!1});return new n.Mesh(e,t)})(),this.panoMesh=new t.PanoCircleMesh({scale:1.5}),this.stop=()=>{},this.drawLine=(e,t)=>{if(!this.ctx)return;let n=(()=>{var t;return(q/16|0)*((t=ce[e])==null?0:t)})(),r=(1-(t+e*150)%1200/1200)*(le+ue),i=this.ctx.createLinearGradient(0,r-ue,0,r);i.addColorStop(0,`rgba(255,255,255,0)`),i.addColorStop(.5,`rgba(255,255,255,1)`),i.addColorStop(1,`rgba(255,255,255,0)`),this.ctx.fillStyle=i,this.ctx.fillRect(n,r-ue,3,ue)},this.anime=e=>{if(!this.ctx||!this.startTime)return;this.ctx.clearRect(0,0,q,le);for(let t=0;t<16;t++)this.drawLine(t,e-this.startTime);let t=K((e-this.startTime)/1e3,0,1),n=K((e-this.startTime)/300,0,this.config.maxOpacity);this.panoMesh.setOpacity(n),this.mesh.material.uniforms.progress.value=t,this.mesh.material.uniforms.opacity.value=n,this.mesh.material.uniforms.map.value.needsUpdate=!0,this.five.needsRender=!0},this.dispose=()=>{this.disable()},this.five=e,this.state=Object.assign({enabled:!1,visible:!0},r==null?void 0:r.initialState),this._config=Object.assign(Object.assign({},r==null?void 0:r.config),{maxOpacity:1}),!(typeof document>`u`)&&(this.canvas=document.createElement(`canvas`),this.ctx=this.canvas.getContext(`2d`),this.canvas.width=q,this.canvas.height=le,this.ctx.shadowColor=`rgba(255,255,255,0.5)`,this.ctx.shadowBlur=6,this.ctx.shadowOffsetX=0,this.ctx.shadowOffsetY=0,this.mesh.material.uniforms.map.value=new n.CanvasTexture(this.canvas),this.group.add(this.mesh),this.panoMesh.setProgress(1),this.panoMesh.setOpacity(0),this.group.add(this.panoMesh),this.state.enabled&&this._enable({userAction:!1}))}load(e){return m(this,void 0,void 0,function*(){})}_enable(e){this.mesh.position.copy(this.five.observers[this.five.state.panoIndex].standingPosition),this.panoMesh.position.copy(this.five.observers[this.five.state.panoIndex].standingPosition),this.five.ready().then(()=>{this.five.scene.add(this.group),this.stop=t.AnimationFrameLoop.shared.add((e,t)=>{this.startTime||(this.startTime=e),this.panoMesh.updateTime(e,t),this.anime(e)})})}_disable(e){this.five.scene.remove(this.group),this.panoMesh.setOpacity(0),this.startTime=void 0,this.stop(),this.five.needsRender=!0}enable(e){var t;if(!this.ctx||this.state.enabled||!this.five.observers[this.five.state.panoIndex])return;let n=(t=e==null?void 0:e.userAction)==null?!0:t;this.updateState({enabled:!0},n),this._enable({userAction:n})}disable(e){var t;if(this.state.enabled===!1)return;let n=(t=e==null?void 0:e.userAction)==null?!0:t;this.updateState({enabled:!1},n),this._disable({userAction:n})}setState(e,t={}){let n=this.state,r=t.userAction===void 0?!0:t.userAction;if(this.updateState(e,r),e.enabled!==void 0&&n.enabled!==e.enabled){let t={userAction:r};e.enabled?this._enable(t):this._disable(t)}}},fe=(e,t)=>new de(e,t),pe=class extends n.InstancedBufferGeometry{constructor(){super(),this.type=`LineSegmentsGeometry`,this.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),this.setAttribute(`position`,new n.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),this.setAttribute(`uv`,new n.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2))}applyMatrix4(e){let t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;t=e instanceof Float32Array?e:Array.isArray(e)?new Float32Array(e):new Float32Array;let r=new n.InstancedInterleavedBuffer(t,6,1);return this.setAttribute(`instanceStart`,new n.InterleavedBufferAttribute(r,3,0)),this.setAttribute(`instanceEnd`,new n.InterleavedBufferAttribute(r,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;t=e instanceof Float32Array?e:Array.isArray(e)?new Float32Array(e):new Float32Array;let r=new n.InstancedInterleavedBuffer(t,6,1);return this.setAttribute(`instanceColorStart`,new n.InterleavedBufferAttribute(r,3,0)),this.setAttribute(`instanceColorEnd`,new n.InterleavedBufferAttribute(r,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new n.WireframeGeometry(e.geometry)),this}fromLineSegments(e){var t=e.geometry;if(t instanceof n.Geometry){let e=new n.BufferGeometry().fromGeometry(t);this.setPositions(e.attributes.position.array)}else t instanceof n.BufferGeometry&&this.setPositions(t.attributes.position.array);return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new n.Box3);let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){let r=new n.Box3;this.boundingBox.setFromBufferAttribute(e),r.setFromBufferAttribute(t),this.boundingBox.union(r)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new n.Sphere),this.boundingBox===null&&this.computeBoundingBox();let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){let r=this.boundingSphere.center;this.boundingBox.getCenter(r);let i=0,a=new n.Vector3;for(let n=0,o=e.count;n<o;n++)a.fromBufferAttribute(e,n),i=Math.max(i,r.distanceToSquared(a)),a.fromBufferAttribute(t,n),i=Math.max(i,r.distanceToSquared(a));this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error(`THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.`,this)}}toJSON(){}};Object.assign(pe.prototype,{isLineSegmentsGeometry:!0});var me={uniforms:n.UniformsUtils.merge([n.UniformsLib.common,n.UniformsLib.fog,{linewidth:{value:1},resolution:{value:new n.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1},opacity:{value:1},totalLength:{value:1},animationProgress:{value:0},time:{value:0},waveAmp:{value:.15},waveFreq:{value:5},waveDir:{value:2},startOffset:{value:0},endOffset:{value:0},range:{value:.3}}]),vertexShader:`
530
+ `,K=[1,5,2,6,3,7,4,8,9,13,10,14,11,15,12,16],q=512,le=512,ue=128,de=class extends r.BasePlugin.Controller{get config(){return Object.assign({},this._config)}updateState(e,t){let n=this.state;this.state=Object.assign(Object.assign({},this.state),e),this.hooks.emit(`stateChange`,{state:this.state,prevState:n,userAction:t})}updateConfig(e,t={}){var n;let r=this.config,i=Object.assign(Object.assign({},r),e);this._config=i,this.hooks.emit(`configChange`,{prevConfig:r,config:i,userAction:(n=t.userAction)==null?!0:n})}constructor(e,r){super(e),this.group=new n.Group,this.mesh=(()=>{let e=new n.CylinderGeometry(.12,.12,1,32,1,!0);e.translate(0,.5,0);let t=new n.ShaderMaterial({vertexShader:se,fragmentShader:ce,uniforms:{map:{value:new n.Texture},progress:{value:0},opacity:{value:0}},transparent:!0,depthTest:!1});return new n.Mesh(e,t)})(),this.panoMesh=new t.PanoCircleMesh({scale:1.5}),this.stop=()=>{},this.drawLine=(e,t)=>{if(!this.ctx)return;let n=(()=>{var t;return(q/16|0)*((t=K[e])==null?0:t)})(),r=(1-(t+e*150)%1200/1200)*(le+ue),i=this.ctx.createLinearGradient(0,r-ue,0,r);i.addColorStop(0,`rgba(255,255,255,0)`),i.addColorStop(.5,`rgba(255,255,255,1)`),i.addColorStop(1,`rgba(255,255,255,0)`),this.ctx.fillStyle=i,this.ctx.fillRect(n,r-ue,3,ue)},this.anime=e=>{if(!this.ctx||!this.startTime)return;this.ctx.clearRect(0,0,q,le);for(let t=0;t<16;t++)this.drawLine(t,e-this.startTime);let t=G((e-this.startTime)/1e3,0,1),n=G((e-this.startTime)/300,0,this.config.maxOpacity);this.panoMesh.setOpacity(n),this.mesh.material.uniforms.progress.value=t,this.mesh.material.uniforms.opacity.value=n,this.mesh.material.uniforms.map.value.needsUpdate=!0,this.five.needsRender=!0},this.dispose=()=>{this.disable()},this.five=e,this.state=Object.assign({enabled:!1,visible:!0},r==null?void 0:r.initialState),this._config=Object.assign(Object.assign({},r==null?void 0:r.config),{maxOpacity:1}),!(typeof document>`u`)&&(this.canvas=document.createElement(`canvas`),this.ctx=this.canvas.getContext(`2d`),this.canvas.width=q,this.canvas.height=le,this.ctx.shadowColor=`rgba(255,255,255,0.5)`,this.ctx.shadowBlur=6,this.ctx.shadowOffsetX=0,this.ctx.shadowOffsetY=0,this.mesh.material.uniforms.map.value=new n.CanvasTexture(this.canvas),this.group.add(this.mesh),this.panoMesh.setProgress(1),this.panoMesh.setOpacity(0),this.group.add(this.panoMesh),this.state.enabled&&this._enable({userAction:!1}))}load(e){return m(this,void 0,void 0,function*(){})}_enable(e){this.mesh.position.copy(this.five.observers[this.five.state.panoIndex].standingPosition),this.panoMesh.position.copy(this.five.observers[this.five.state.panoIndex].standingPosition),this.five.ready().then(()=>{this.five.scene.add(this.group),this.stop=t.AnimationFrameLoop.shared.add((e,t)=>{this.startTime||(this.startTime=e),this.panoMesh.updateTime(e,t),this.anime(e)})})}_disable(e){this.five.scene.remove(this.group),this.panoMesh.setOpacity(0),this.startTime=void 0,this.stop(),this.five.needsRender=!0}enable(e){var t;if(!this.ctx||this.state.enabled||!this.five.observers[this.five.state.panoIndex])return;let n=(t=e==null?void 0:e.userAction)==null?!0:t;this.updateState({enabled:!0},n),this._enable({userAction:n})}disable(e){var t;if(this.state.enabled===!1)return;let n=(t=e==null?void 0:e.userAction)==null?!0:t;this.updateState({enabled:!1},n),this._disable({userAction:n})}setState(e,t={}){let n=this.state,r=t.userAction===void 0?!0:t.userAction;if(this.updateState(e,r),e.enabled!==void 0&&n.enabled!==e.enabled){let t={userAction:r};e.enabled?this._enable(t):this._disable(t)}}},fe=(e,t)=>new de(e,t),pe=class extends n.InstancedBufferGeometry{constructor(){super(),this.type=`LineSegmentsGeometry`,this.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),this.setAttribute(`position`,new n.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),this.setAttribute(`uv`,new n.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2))}applyMatrix4(e){let t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;t=e instanceof Float32Array?e:Array.isArray(e)?new Float32Array(e):new Float32Array;let r=new n.InstancedInterleavedBuffer(t,6,1);return this.setAttribute(`instanceStart`,new n.InterleavedBufferAttribute(r,3,0)),this.setAttribute(`instanceEnd`,new n.InterleavedBufferAttribute(r,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;t=e instanceof Float32Array?e:Array.isArray(e)?new Float32Array(e):new Float32Array;let r=new n.InstancedInterleavedBuffer(t,6,1);return this.setAttribute(`instanceColorStart`,new n.InterleavedBufferAttribute(r,3,0)),this.setAttribute(`instanceColorEnd`,new n.InterleavedBufferAttribute(r,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new n.WireframeGeometry(e.geometry)),this}fromLineSegments(e){var t=e.geometry;if(t instanceof n.Geometry){let e=new n.BufferGeometry().fromGeometry(t);this.setPositions(e.attributes.position.array)}else t instanceof n.BufferGeometry&&this.setPositions(t.attributes.position.array);return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new n.Box3);let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){let r=new n.Box3;this.boundingBox.setFromBufferAttribute(e),r.setFromBufferAttribute(t),this.boundingBox.union(r)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new n.Sphere),this.boundingBox===null&&this.computeBoundingBox();let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){let r=this.boundingSphere.center;this.boundingBox.getCenter(r);let i=0,a=new n.Vector3;for(let n=0,o=e.count;n<o;n++)a.fromBufferAttribute(e,n),i=Math.max(i,r.distanceToSquared(a)),a.fromBufferAttribute(t,n),i=Math.max(i,r.distanceToSquared(a));this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error(`THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.`,this)}}toJSON(){}};Object.assign(pe.prototype,{isLineSegmentsGeometry:!0});var me={uniforms:n.UniformsUtils.merge([n.UniformsLib.common,n.UniformsLib.fog,{linewidth:{value:1},resolution:{value:new n.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1},opacity:{value:1},totalLength:{value:1},animationProgress:{value:0},time:{value:0},waveAmp:{value:.15},waveFreq:{value:5},waveDir:{value:2},startOffset:{value:0},endOffset:{value:0},range:{value:.3}}]),vertexShader:`
531
531
  #include <common>
532
532
  #include <color_pars_vertex>
533
533
  #include <fog_pars_vertex>
@@ -808,4 +808,4 @@ void main() {
808
808
 
809
809
  gl_FragColor = vec4(baseColor, sampledAlpha * globalOpacity);
810
810
  }
811
- `})}projectPointsToScreen(e,t){let r=[],i=0;for(let a=0;a<e.length;a++){let o=e[a];a>0&&(i+=o.distanceTo(e[a-1]));let s=o.clone().project(t),c=s.x<-1||s.x>1||s.y<-1||s.y>1||s.z<-1||s.z>1;r.push({point:o.clone(),screenPos:new n.Vector2(s.x,s.y),distanceFromStart:i,isOffscreen:c})}return r}findNearestOffscreenPoint(e){let t=-1,n=0,r=-1;for(let t=0;t<e.length;t++)if(!e[t].isOffscreen){r=t;break}if(r===-1)return null;for(let i=r-1;i>=0;i--)if(e[i].isOffscreen){t=i,n=e[i].distanceFromStart;break}return t===-1?{index:0,distance:0}:{index:t,distance:n}}findFarestOffscreenPoint(e){var t;let n=((t=e[e.length-1])==null?void 0:t.distanceFromStart)||0,r=-1;for(let t=e.length-1;t>=0;t--)if(!e[t].isOffscreen){r=t;break}if(r===-1)return null;let i=r+1;return i<e.length&&e[i].isOffscreen?{index:i,distance:e[i].distanceFromStart,totalLength:n}:{index:e.length-1,distance:n,totalLength:n}}updatePathAnimation(e){var t,r;let i=this.paths.get(e);if(!i||!i.enabled)return;let a=performance.now()/1e3,{particleCount:o,maxDistance:s}=this._config,c=((t=i.lines[0])==null?void 0:t.material.uniforms.totalLength.value)||1,l=Math.max(.01,c-i.startOffset-i.endOffset),u=i.speed,d=(a-i.cycleStartTime)*u/l%1;if(i.isInitialAnimation){let e=d*l;if(i.enableSubMesh&&e>=1&&!i.subMeshUnfoldStarted&&(i.subMeshUnfoldStarted=!0,i.subMeshUnfoldStartTime=a),i.enableSubMesh&&i.subMeshUnfoldStarted&&i.subMeshUnfoldProgress<1&&!i.isPaused){let e=(r=i.config.range)==null?this._config.range:r,t=a-i.subMeshUnfoldStartTime;i.subMeshUnfoldProgress=Math.min(1,t*u/(l-2*e)),i.subMeshMaterial.uniforms.unfoldProgress.value=i.subMeshUnfoldProgress}d<i.lastAnimationProgress&&(i.isPathlineInitialAnimation=!1,(!i.enableSubMesh||i.subMeshUnfoldProgress>=1)&&(i.isInitialAnimation=!1))}else i.enableSubMesh&&(i.subMeshMaterial.uniforms.unfoldProgress.value=1);if(i.lastAnimationProgress=d,i.lastUpdateTime=a,i.isPathlineInitialAnimation&&i.lines.forEach(e=>{e.material.uniforms.time.value=a,e.material.uniforms.animationProgress.value=d}),i.isPathlineInitialAnimation){let e=null,t=1/0;if(i.lines.forEach(r=>{let i=r.geometry,a=i.attributes.instanceDistanceStart,o=i.attributes.instanceDistanceEnd,s=a.count;for(let c=0;c<s;c++){let s=a.getX(c)/r.material.uniforms.totalLength.value,l=o.getX(c)/r.material.uniforms.totalLength.value;if(d>=s&&d<=l){let r=(d-s)/(l-s),a=new n.Vector3().fromBufferAttribute(i.attributes.instanceStart,c),o=new n.Vector3().fromBufferAttribute(i.attributes.instanceEnd,c),u=new n.Vector3().lerpVectors(a,o,r),f=Math.abs(d-(s+l)/2);f<t&&(t=f,e=u)}}}),e)for(let t=0;t<o;t++){let n=i.particleInfos[t];!n.active&&Math.random()<.05&&(n.active=!0,n.age=0,n.life=3+Math.random()*2,n.velocity.set((Math.random()-.5)*1e-4,(Math.random()-.5)*1e-4,(Math.random()-.5)*1e-4),i.particlePositions[t*3]=e.x,i.particlePositions[t*3+1]=e.y,i.particlePositions[t*3+2]=e.z,n.startPos.copy(e),n.alpha=0)}for(let e=0;e<o;e++){let t=i.particleInfos[e];if(t.active){t.age+=.016;let n=i.particlePositions[e*3]-t.startPos.x,r=i.particlePositions[e*3+1]-t.startPos.y,a=i.particlePositions[e*3+2]-t.startPos.z;(Math.sqrt(n*n+r*r+a*a)>=s||t.age>=t.life)&&(t.active=!1,i.particlePositions[e*3]=9999,i.particlePositions[e*3+1]=9999,i.particlePositions[e*3+2]=9999,t.alpha=0),t.velocity.x+=(Math.random()-.5)*1e-4,t.velocity.z+=(Math.random()-.5)*1e-4,t.velocity.y+=1e-4,t.velocity.multiplyScalar(.99),i.particlePositions[e*3]+=t.velocity.x,i.particlePositions[e*3+1]+=t.velocity.y,i.particlePositions[e*3+2]+=t.velocity.z;let o=t.age/t.life;o<.2?t.alpha=o/.2:o>.8?t.alpha=(1-o)/.2:t.alpha=1}}i.particleGeometry.attributes.position.needsUpdate=!0,i.particleMaterial.opacity=.6}i.enableSubMesh&&(i.subMeshMaterial.uniforms.animationProgress.value=d),this.five.needsRender=!0}startPathAnimation(e,n){var r,i;let a=this.paths.get(e);if(!a)return console.warn(`DynamicPathLinePlugin: 路径 ${e} 不存在`),!1;if(a.animationId!==null)return!1;let o=(r=n==null?void 0:n.startPointIndex)==null?0:r,s=(i=n==null?void 0:n.fromStart)==null?!1:i;if(!a.isPaused||s){let e=0,t=o;if(t>0){let n=a.config.points;t>=n.length&&(console.warn(`DynamicPathLinePlugin: startPointIndex ${t} 超出范围,路径只有 ${n.length} 个点`),t=n.length-1);for(let r=0;r<t;r++)e+=n[r].distanceTo(n[r+1])}a.startOffset=e,a.lines.forEach(t=>{t.material.uniforms.startOffset.value=e}),a.enableSubMesh&&(a.subMeshMaterial.uniforms.startOffset.value=e)}let c=performance.now()/1e3;if(!s&&a.isPaused&&a.pausedProgress>0){let e=a.curve.getLength(),t=Math.max(.01,e-a.startOffset-a.endOffset),n=a.speed;a.cycleStartTime=c-a.pausedProgress*t/n,a.subMeshUnfoldStarted&&a.subMeshUnfoldProgress<1&&(a.subMeshUnfoldStartTime=c-(a.pausedTime-a.subMeshUnfoldStartTime)),a.isPaused=!1}else a.cycleStartTime=c,a.isPaused=!1,a.pausedProgress=0;return a.lastUpdateTime=c,this.highlightPath(e,!0),a.animationId=t.AnimationFrameLoop.shared.add(()=>{this.updatePathAnimation(e)}),!0}stopPathAnimation(e,t=!1){let n=this.paths.get(e);if(!n)return console.warn(`DynamicPathLinePlugin: 路径 ${e} 不存在`),!1;if(this.highlightPath(e,!1),n.animationId!==null){if(t){let e=performance.now()/1e3,t=n.curve.getLength(),r=Math.max(.01,t-n.startOffset-n.endOffset),i=n.speed;n.pausedProgress=(e-n.cycleStartTime)*i/r%1,n.pausedTime=e,n.isPaused=!0,n.subMeshUnfoldStarted&&n.subMeshUnfoldProgress<1&&(n.subMeshUnfoldStartTime=e-(e-n.subMeshUnfoldStartTime))}else n.isPaused=!1,n.pausedProgress=0,n.pausedTime=0;n.animationId(),n.animationId=null}return!0}_enable(e){this.paths.size>0&&this.state.playing&&this.play()}_disable(e){this.pause()}enable(e){var t;if(this.state.enabled)return;let n=(t=e==null?void 0:e.userAction)==null?!0:t;this.updateState({enabled:!0},n),this._enable({userAction:n})}disable(e){var t;if(this.state.enabled===!1)return;let n=(t=e==null?void 0:e.userAction)==null?!0:t;this.updateState({enabled:!1},n),this._disable({userAction:n})}show(e){var t;let n=(t=e==null?void 0:e.userAction)==null?!0:t;this.paths.forEach(e=>{e.lines.forEach(e=>e.visible=!0),e.particles.visible=!0,e.subMesh.visible=!0}),this.updateState({visible:!0},n)}hide(e){var t;let n=(t=e==null?void 0:e.userAction)==null?!0:t;this.paths.forEach(e=>{e.lines.forEach(e=>e.visible=!1),e.particles.visible=!1,e.subMesh.visible=!1}),this.updateState({visible:!1},n)}setState(e,t){t==null||t.userAction,e.enabled!==void 0&&e.enabled!==this.state.enabled&&(e.enabled?this.enable(t):this.disable(t)),e.visible!==void 0&&e.visible!==this.state.visible&&(e.visible?this.show(t):this.hide(t))}play(e=!1){this.paths.forEach((t,n)=>{this.startPathAnimation(n,{fromStart:e})}),this.updateState({playing:!0},!1),this.hooks.emit(`animationStart`)}pause(){this.paths.forEach((e,t)=>{this.stopPathAnimation(t,!0)}),this.updateState({playing:!1},!1),this.hooks.emit(`animationStop`)}reset(){this.paths.forEach((e,t)=>{this.stopPathAnimation(t)}),this.paths.forEach(e=>{e.isInitialAnimation=!0,e.isPathlineInitialAnimation=!0,e.subMeshUnfoldProgress=0,e.subMeshUnfoldStarted=!1,e.subMeshUnfoldStartTime=0,e.lastAnimationProgress=0,e.cycleStartTime=performance.now()/1e3,e.lastUpdateTime=performance.now()/1e3,e.startOffset=0,e.endOffset=0,e.isPaused=!1,e.pausedProgress=0,e.pausedTime=0,e.lines.forEach(e=>{e.visible=!0,e.material.uniforms.time.value=0,e.material.uniforms.animationProgress.value=0,e.material.uniforms.startOffset.value=0,e.material.uniforms.endOffset.value=0}),e.particles.visible=!0;let t=this._config.particleCount;for(let n=0;n<t;n++){let t=e.particleInfos[n];t.active=!1,t.age=0,t.alpha=0,e.particlePositions[n*3]=9999,e.particlePositions[n*3+1]=9999,e.particlePositions[n*3+2]=9999}e.particleGeometry.attributes.position.needsUpdate=!0,e.subMeshMaterial&&(e.subMeshMaterial.uniforms.unfoldProgress.value=0,e.subMeshMaterial.uniforms.animationProgress.value=0,e.subMeshMaterial.uniforms.startOffset.value=0,e.subMeshMaterial.uniforms.endOffset.value=0)})}highlightPath(e,n){let r=this.paths.get(e);if(!r)return;let i=r.lines,a=0,o=t.AnimationFrameLoop.shared.add((e,t)=>{a=Math.min(1,a+t/250),n?(i.forEach(e=>{e.material.uniforms.opacity.value=.3+a*.7}),r.particleMaterial.opacity=.3+a*.7,r.enableSubMesh&&(r.subMeshMaterial.uniforms.globalOpacity.value=.3+a*.7)):(i.forEach(e=>{e.material.uniforms.opacity.value=1-a*.7}),r.particleMaterial.opacity=.6*(1-a*.7),r.enableSubMesh&&(r.subMeshMaterial.uniforms.globalOpacity.value=1-a*.7)),this.five.needsRender=!0,a===1&&o()})}updateScreenProjection(e){let t=e=>{let t=this.projectPointsToScreen(e.config.points,this.five.camera),n=this.findNearestOffscreenPoint(t);n&&(e.startOffset=n.distance);let r=this.findFarestOffscreenPoint(t);r&&(e.endOffset=r.totalLength-r.distance),e.lines.forEach(t=>{t.material.uniforms.startOffset.value=e.startOffset,t.material.uniforms.endOffset.value=e.endOffset}),e.subMeshMaterial.uniforms.startOffset.value=e.startOffset,e.subMeshMaterial.uniforms.endOffset.value=e.endOffset,e.cycleStartTime=performance.now()/1e3,e.lastAnimationProgress=0};if(e){let n=this.paths.get(e);n&&t(n)}else this.paths.forEach(e=>{e.enabled&&t(e)})}disposePathResources(e){e.lines.forEach(e=>{this.five.scene.remove(e),e.geometry.dispose(),e.material.dispose()}),this.five.scene.remove(e.particles),e.particleGeometry.dispose(),e.particleMaterial.dispose(),this.five.scene.remove(e.subMesh),e.subMeshGeometry.dispose(),e.subMeshMaterial.dispose()}dispose(){this.pause(),this.clearAllPaths(),this.hooks.emit(`dispose`)}};e.BackgroundPlugin=U,Object.defineProperty(e,`BasePlugin`,{enumerable:!0,get:function(){return p}}),e.CSS3DRenderer=ne,e.DynamicPathLinePlugin=(e,t)=>new ye(e,t),e.ItemMaskPlugin=k,e.OrbitControls=j,e.OrientationPlugin=ie,e.PanoAnimePlugin=fe,e.RoundedBoxGeometry=re,e.TrajectoryPlugin=G});
811
+ `})}projectPointsToScreen(e,t){let r=[],i=0;for(let a=0;a<e.length;a++){let o=e[a];a>0&&(i+=o.distanceTo(e[a-1]));let s=o.clone().project(t),c=s.x<-1||s.x>1||s.y<-1||s.y>1||s.z<-1||s.z>1;r.push({point:o.clone(),screenPos:new n.Vector2(s.x,s.y),distanceFromStart:i,isOffscreen:c})}return r}findNearestOffscreenPoint(e){let t=-1,n=0,r=-1;for(let t=0;t<e.length;t++)if(!e[t].isOffscreen){r=t;break}if(r===-1)return null;for(let i=r-1;i>=0;i--)if(e[i].isOffscreen){t=i,n=e[i].distanceFromStart;break}return t===-1?{index:0,distance:0}:{index:t,distance:n}}findFarestOffscreenPoint(e){var t;let n=((t=e[e.length-1])==null?void 0:t.distanceFromStart)||0,r=-1;for(let t=e.length-1;t>=0;t--)if(!e[t].isOffscreen){r=t;break}if(r===-1)return null;let i=r+1;return i<e.length&&e[i].isOffscreen?{index:i,distance:e[i].distanceFromStart,totalLength:n}:{index:e.length-1,distance:n,totalLength:n}}updatePathAnimation(e){var t,r;let i=this.paths.get(e);if(!i||!i.enabled)return;let a=performance.now()/1e3,{particleCount:o,maxDistance:s}=this._config,c=((t=i.lines[0])==null?void 0:t.material.uniforms.totalLength.value)||1,l=Math.max(.01,c-i.startOffset-i.endOffset),u=i.speed,d=(a-i.cycleStartTime)*u/l%1;if(i.isInitialAnimation){let e=d*l;if(i.enableSubMesh&&e>=1&&!i.subMeshUnfoldStarted&&(i.subMeshUnfoldStarted=!0,i.subMeshUnfoldStartTime=a),i.enableSubMesh&&i.subMeshUnfoldStarted&&i.subMeshUnfoldProgress<1&&!i.isPaused){let e=(r=i.config.range)==null?this._config.range:r,t=a-i.subMeshUnfoldStartTime;i.subMeshUnfoldProgress=Math.min(1,t*u/(l-2*e)),i.subMeshMaterial.uniforms.unfoldProgress.value=i.subMeshUnfoldProgress}d<i.lastAnimationProgress&&(i.isPathlineInitialAnimation=!1,(!i.enableSubMesh||i.subMeshUnfoldProgress>=1)&&(i.isInitialAnimation=!1))}else i.enableSubMesh&&(i.subMeshMaterial.uniforms.unfoldProgress.value=1);if(i.lastAnimationProgress=d,i.lastUpdateTime=a,i.isPathlineInitialAnimation&&i.lines.forEach(e=>{e.material.uniforms.time.value=a,e.material.uniforms.animationProgress.value=d}),i.isPathlineInitialAnimation){let e=null,t=1/0;if(i.lines.forEach(r=>{let i=r.geometry,a=i.attributes.instanceDistanceStart,o=i.attributes.instanceDistanceEnd,s=a.count;for(let c=0;c<s;c++){let s=a.getX(c)/r.material.uniforms.totalLength.value,l=o.getX(c)/r.material.uniforms.totalLength.value;if(d>=s&&d<=l){let r=(d-s)/(l-s),a=new n.Vector3().fromBufferAttribute(i.attributes.instanceStart,c),o=new n.Vector3().fromBufferAttribute(i.attributes.instanceEnd,c),u=new n.Vector3().lerpVectors(a,o,r),f=Math.abs(d-(s+l)/2);f<t&&(t=f,e=u)}}}),e)for(let t=0;t<o;t++){let n=i.particleInfos[t];!n.active&&Math.random()<.05&&(n.active=!0,n.age=0,n.life=3+Math.random()*2,n.velocity.set((Math.random()-.5)*1e-4,(Math.random()-.5)*1e-4,(Math.random()-.5)*1e-4),i.particlePositions[t*3]=e.x,i.particlePositions[t*3+1]=e.y,i.particlePositions[t*3+2]=e.z,n.startPos.copy(e),n.alpha=0)}for(let e=0;e<o;e++){let t=i.particleInfos[e];if(t.active){t.age+=.016;let n=i.particlePositions[e*3]-t.startPos.x,r=i.particlePositions[e*3+1]-t.startPos.y,a=i.particlePositions[e*3+2]-t.startPos.z;(Math.sqrt(n*n+r*r+a*a)>=s||t.age>=t.life)&&(t.active=!1,i.particlePositions[e*3]=9999,i.particlePositions[e*3+1]=9999,i.particlePositions[e*3+2]=9999,t.alpha=0),t.velocity.x+=(Math.random()-.5)*1e-4,t.velocity.z+=(Math.random()-.5)*1e-4,t.velocity.y+=1e-4,t.velocity.multiplyScalar(.99),i.particlePositions[e*3]+=t.velocity.x,i.particlePositions[e*3+1]+=t.velocity.y,i.particlePositions[e*3+2]+=t.velocity.z;let o=t.age/t.life;o<.2?t.alpha=o/.2:o>.8?t.alpha=(1-o)/.2:t.alpha=1}}i.particleGeometry.attributes.position.needsUpdate=!0,i.particleMaterial.opacity=.6}i.enableSubMesh&&(i.subMeshMaterial.uniforms.animationProgress.value=d),this.five.needsRender=!0}startPathAnimation(e,n){var r,i;let a=this.paths.get(e);if(!a)return console.warn(`DynamicPathLinePlugin: 路径 ${e} 不存在`),!1;if(a.animationId!==null)return!1;let o=(r=n==null?void 0:n.startPointIndex)==null?0:r,s=(i=n==null?void 0:n.fromStart)==null?!1:i;if(!a.isPaused||s){let e=0,t=o;if(t>0){let n=a.config.points;t>=n.length&&(console.warn(`DynamicPathLinePlugin: startPointIndex ${t} 超出范围,路径只有 ${n.length} 个点`),t=n.length-1);for(let r=0;r<t;r++)e+=n[r].distanceTo(n[r+1])}a.startOffset=e,a.lines.forEach(t=>{t.material.uniforms.startOffset.value=e}),a.enableSubMesh&&(a.subMeshMaterial.uniforms.startOffset.value=e)}let c=performance.now()/1e3;if(!s&&a.isPaused&&a.pausedProgress>0){let e=a.curve.getLength(),t=Math.max(.01,e-a.startOffset-a.endOffset),n=a.speed;a.cycleStartTime=c-a.pausedProgress*t/n,a.subMeshUnfoldStarted&&a.subMeshUnfoldProgress<1&&(a.subMeshUnfoldStartTime=c-(a.pausedTime-a.subMeshUnfoldStartTime)),a.isPaused=!1}else a.cycleStartTime=c,a.isPaused=!1,a.pausedProgress=0;return a.lastUpdateTime=c,this.highlightPath(e,!0),a.animationId=t.AnimationFrameLoop.shared.add(()=>{this.updatePathAnimation(e)}),!0}stopPathAnimation(e,t=!1){let n=this.paths.get(e);if(!n)return console.warn(`DynamicPathLinePlugin: 路径 ${e} 不存在`),!1;if(this.highlightPath(e,!1),n.animationId!==null){if(t){let e=performance.now()/1e3,t=n.curve.getLength(),r=Math.max(.01,t-n.startOffset-n.endOffset),i=n.speed;n.pausedProgress=(e-n.cycleStartTime)*i/r%1,n.pausedTime=e,n.isPaused=!0,n.subMeshUnfoldStarted&&n.subMeshUnfoldProgress<1&&(n.subMeshUnfoldStartTime=e-(e-n.subMeshUnfoldStartTime))}else n.isPaused=!1,n.pausedProgress=0,n.pausedTime=0;n.animationId(),n.animationId=null}return!0}_enable(e){this.paths.size>0&&this.state.playing&&this.play()}_disable(e){this.pause()}enable(e){var t;if(this.state.enabled)return;let n=(t=e==null?void 0:e.userAction)==null?!0:t;this.updateState({enabled:!0},n),this._enable({userAction:n})}disable(e){var t;if(this.state.enabled===!1)return;let n=(t=e==null?void 0:e.userAction)==null?!0:t;this.updateState({enabled:!1},n),this._disable({userAction:n})}show(e){var t;let n=(t=e==null?void 0:e.userAction)==null?!0:t;this.paths.forEach(e=>{e.lines.forEach(e=>e.visible=!0),e.particles.visible=!0,e.subMesh.visible=!0}),this.updateState({visible:!0},n)}hide(e){var t;let n=(t=e==null?void 0:e.userAction)==null?!0:t;this.paths.forEach(e=>{e.lines.forEach(e=>e.visible=!1),e.particles.visible=!1,e.subMesh.visible=!1}),this.updateState({visible:!1},n)}setState(e,t){t==null||t.userAction,e.enabled!==void 0&&e.enabled!==this.state.enabled&&(e.enabled?this.enable(t):this.disable(t)),e.visible!==void 0&&e.visible!==this.state.visible&&(e.visible?this.show(t):this.hide(t))}play(e=!1){this.paths.forEach((t,n)=>{this.startPathAnimation(n,{fromStart:e})}),this.updateState({playing:!0},!1),this.hooks.emit(`animationStart`)}pause(){this.paths.forEach((e,t)=>{this.stopPathAnimation(t,!0)}),this.updateState({playing:!1},!1),this.hooks.emit(`animationStop`)}reset(){this.paths.forEach((e,t)=>{this.stopPathAnimation(t)}),this.paths.forEach(e=>{e.isInitialAnimation=!0,e.isPathlineInitialAnimation=!0,e.subMeshUnfoldProgress=0,e.subMeshUnfoldStarted=!1,e.subMeshUnfoldStartTime=0,e.lastAnimationProgress=0,e.cycleStartTime=performance.now()/1e3,e.lastUpdateTime=performance.now()/1e3,e.startOffset=0,e.endOffset=0,e.isPaused=!1,e.pausedProgress=0,e.pausedTime=0,e.lines.forEach(e=>{e.visible=!0,e.material.uniforms.time.value=0,e.material.uniforms.animationProgress.value=0,e.material.uniforms.startOffset.value=0,e.material.uniforms.endOffset.value=0}),e.particles.visible=!0;let t=this._config.particleCount;for(let n=0;n<t;n++){let t=e.particleInfos[n];t.active=!1,t.age=0,t.alpha=0,e.particlePositions[n*3]=9999,e.particlePositions[n*3+1]=9999,e.particlePositions[n*3+2]=9999}e.particleGeometry.attributes.position.needsUpdate=!0,e.subMeshMaterial&&(e.subMeshMaterial.uniforms.unfoldProgress.value=0,e.subMeshMaterial.uniforms.animationProgress.value=0,e.subMeshMaterial.uniforms.startOffset.value=0,e.subMeshMaterial.uniforms.endOffset.value=0)})}highlightPath(e,n){let r=this.paths.get(e);if(!r)return;let i=r.lines,a=0,o=t.AnimationFrameLoop.shared.add((e,t)=>{a=Math.min(1,a+t/250),n?(i.forEach(e=>{e.material.uniforms.opacity.value=.3+a*.7}),r.particleMaterial.opacity=.3+a*.7,r.enableSubMesh&&(r.subMeshMaterial.uniforms.globalOpacity.value=.3+a*.7)):(i.forEach(e=>{e.material.uniforms.opacity.value=1-a*.7}),r.particleMaterial.opacity=.6*(1-a*.7),r.enableSubMesh&&(r.subMeshMaterial.uniforms.globalOpacity.value=1-a*.7)),this.five.needsRender=!0,a===1&&o()})}updateScreenProjection(e){let t=e=>{let t=this.projectPointsToScreen(e.config.points,this.five.camera),n=this.findNearestOffscreenPoint(t);n&&(e.startOffset=n.distance);let r=this.findFarestOffscreenPoint(t);r&&(e.endOffset=r.totalLength-r.distance),e.lines.forEach(t=>{t.material.uniforms.startOffset.value=e.startOffset,t.material.uniforms.endOffset.value=e.endOffset}),e.subMeshMaterial.uniforms.startOffset.value=e.startOffset,e.subMeshMaterial.uniforms.endOffset.value=e.endOffset,e.cycleStartTime=performance.now()/1e3,e.lastAnimationProgress=0};if(e){let n=this.paths.get(e);n&&t(n)}else this.paths.forEach(e=>{e.enabled&&t(e)})}disposePathResources(e){e.lines.forEach(e=>{this.five.scene.remove(e),e.geometry.dispose(),e.material.dispose()}),this.five.scene.remove(e.particles),e.particleGeometry.dispose(),e.particleMaterial.dispose(),this.five.scene.remove(e.subMesh),e.subMeshGeometry.dispose(),e.subMeshMaterial.dispose()}dispose(){this.pause(),this.clearAllPaths(),this.hooks.emit(`dispose`)}},be=(e,t)=>new ye(e,t),xe=class{constructor(e,t,n,r,i){this.R=e,this.Q=t,this.A=n,this.B=r,this.C=i,this.cov=NaN,this.x=NaN}filter(e,t=0){if(isNaN(this.x))this.x=1/this.C*e,this.cov=1/this.C*this.Q*(1/this.C);else{let n=this.A*this.x+this.B*t,r=this.A*this.cov*this.A+this.R,i=r*this.C*(1/(this.C*r*this.C+this.Q));this.x=n+i*(e-this.C*n),this.cov=r-i*this.C*r}return this.x}},Se=class extends p.Controller{updateState(e,t){let n=this.state;this.state=Object.assign(Object.assign({},this.state),e),this.hooks.emit(`stateChange`,{state:this.state,prevState:n,userAction:t})}constructor(e,t){var n,r,i;super(e),this.boundingAABB=null,this.cancelAnimation=null,this.boundsSet=!1,this.keyframes=[],this.five=e,this.state={enabled:!0,visible:!0},this.duration=(n=t==null?void 0:t.duration)==null?6e3:n,this.curveHeight=(r=t==null?void 0:t.curveHeight)==null?1.5:r,this.pointDuration=(i=t==null?void 0:t.pointDuration)==null?4e3:i}load(){return m(this,void 0,void 0,function*(){})}enable(e){var t;if(this.state.enabled)return;let n=(t=e==null?void 0:e.userAction)==null?!0:t;this.updateState({enabled:!0},n)}disable(e){var t;if(this.state.enabled===!1)return;let n=(t=e==null?void 0:e.userAction)==null?!0:t;this.updateState({enabled:!1},n)}dispose(){this.disable(),this.cancelAnimation&&(this.cancelAnimation(),this.cancelAnimation=null);try{let e=this.findRenderMesh();if(e){let t=e.material.uniforms;t.u_aggregationEnabled.value=!1,t.u_aggregationProgress.value=1}}catch(e){}}extractKeyframes(e){let t=[];if(!e.content.data)throw Error(`轨迹数据未加载`);let r=e.content.data.positionArray,i=r.length/3,a=.01,o=.1,s=new xe(a,o,1,0,1),c=new xe(a,o,1,0,1),l=new xe(a,o,1,0,1),u=new Float32Array(i);for(let e=0;e<i;e++)if(e===0)u[e]=0;else{let t=new n.Vector3(r[(e-1)*3],r[(e-1)*3+1],r[(e-1)*3+2]);u[e]=new n.Vector3(r[e*3],r[e*3+1],r[e*3+2]).distanceTo(t)+u[e-1]}for(let a=0;a<i;a++){let o=new n.Vector3(0,0,0),d=0;for(let e=a-5;e<a+6;e++)e>=0&&e<i&&(o.add(new n.Vector3(r[e*3],r[e*3+1],r[e*3+2])),d++);o.divideScalar(d).applyMatrix4(e.transform);let f=s.filter(o.x),p=c.filter(o.y),m=l.filter(o.z);t.push({position:new n.Vector3(f,p,m),location:u[a]})}return t}computeAABB2D(e){let t=1/0,r=-1/0,i=1/0,a=-1/0;for(let n of e)n.position.x<t&&(t=n.position.x),n.position.x>r&&(r=n.position.x),n.position.z<i&&(i=n.position.z),n.position.z>a&&(a=n.position.z);return{min:new n.Vector2(t,i),max:new n.Vector2(r,a)}}findClosestKeyframeToRay(e,t){let r=1/0,i=t[0].position.clone(),a=new n.Vector3;for(let n of t){e.closestPointToPoint(n.position,a);let t=a.distanceTo(n.position);t<r&&(r=t,i=n.position.clone())}return i}getCameraCurve(){return m(this,void 0,void 0,function*(){var e,r,i;let a=(i=(r=(e=this.five.model.viewLayers[0])==null?void 0:e.scene)==null?void 0:r.trajectories)==null?void 0:i[0];if(!a)throw Error(`未找到轨迹数据`);a.visible=!0,yield new Promise(e=>{let n=t.AnimationFrameLoop.shared.add(()=>{a.content.loadState===`READY`&&(n(),e(),a.visible=!1)})});let o=this.extractKeyframes(a);if(o.length<2)throw Error(`轨迹关键帧不足,至少需要2个关键帧`);this.keyframes=o;let s=this.computeAABB2D(o);this.boundingAABB=s;let c=this.curveHeight,l=new n.Vector3((s.min.x+s.max.x)/2,c,(s.min.y+s.max.y)/2),u=(s.max.x-s.min.x)/2,d=(s.max.y-s.min.y)/2,f=Math.sqrt(u*u+d*d),p=e=>{let t=new n.Vector3().subVectors(e,l);return t.length()<.001&&t.set(1,0,0),l.clone().add(t.normalize().multiplyScalar(f))},m=new n.Vector3(o[0].position.x,c,o[0].position.z),h=p(m),g=new n.Vector3().subVectors(l,m).normalize(),_=new n.Ray(m,g),v=new n.Vector3(-g.z,0,g.x).normalize(),y=new n.Ray(l,v),b=this.findClosestKeyframeToRay(y,o),x=p(new n.Vector3(b.x,c,b.z)),S=this.findClosestKeyframeToRay(_,o),C=p(new n.Vector3(S.x,c,S.z));return new n.CatmullRomCurve3([h,x,C],!1,`centripetal`,.5)})}findRenderMesh(){let e=null;if(this.five.scene.traverse(t=>{e||t instanceof n.Mesh&&t.material&&t.material.uniforms&&t.material.uniforms.u_aggregationEnabled&&(e=t)}),!e)throw Error(`未找到 GaussianSplatting 渲染网格`);return e}setBounding(e,t,n){let r=this.findRenderMesh();r.material.uniforms.u_aggregationBoundsMin.value.copy(e),r.material.uniforms.u_aggregationBoundsMax.value.copy(t),this.boundsSet=!0}setBounds(){if(!this.boundingAABB)throw Error(`请先调用 getCameraCurve 计算轨迹边界`);let e=this.boundingAABB,t=this.findRenderMesh(),r=new n.Vector3(e.min.x,0,e.min.y),i=new n.Vector3(e.max.x,3,e.max.y);t.material.uniforms.u_aggregationBoundsMin.value.copy(r),t.material.uniforms.u_aggregationBoundsMax.value.copy(i),this.boundsSet=!0}startAggregation(){if(!this.boundsSet)throw Error(`请先调用 setBounds 设置聚合边界`);let e=this.findRenderMesh().material.uniforms;e.u_aggregationEnabled.value=!0,e.u_aggregationProgress.value=0,e.u_aggregationPointDuration.value=Math.min(this.pointDuration/this.duration,1),this.five.needsRender=!0;let n=performance.now(),r=this.duration;this.cancelAnimation=t.AnimationFrameLoop.shared.add(()=>{let t=performance.now()-n,i=Math.min(t/r,1),a=i*i*(3-2*i);e.u_aggregationProgress.value=a,this.five.needsRender=!0,this.five.modelSceneNeedsRender=!0,i>=1&&(e.u_aggregationEnabled.value=!1,this.cancelAnimation&&(this.cancelAnimation(),this.cancelAnimation=null))})}playEntrance(){return m(this,void 0,void 0,function*(){let e=yield this.getCameraCurve(),r=this.boundingAABB,i=new n.Vector3((r.min.x+r.max.x)/2,this.curveHeight,(r.min.y+r.max.y)/2),a=e.getPointAt(0),o=new t.Camera(90).copy(this.five.camera);o.position.copy(a),o.lookAt(i),o.computePose(0),this.five.setState(Object.assign({},o.pose)),this.setBounds();let s=this.findRenderMesh().material.uniforms;s.u_aggregationEnabled.value=!0,s.u_aggregationProgress.value=0,s.u_aggregationPointDuration.value=Math.min(this.pointDuration/this.duration,1),this.five.needsRender=!0;let c=this.duration,l=performance.now();return new Promise(n=>{this.cancelAnimation=t.AnimationFrameLoop.shared.add(()=>{let t=performance.now()-l,r=Math.min(t/c,1),a=r*r*(3-2*r);s.u_aggregationProgress.value=a,this.five.modelSceneNeedsRender=!0;let u=e.getPointAt(a);o.position.copy(u),o.lookAt(i),o.computePose(0),this.five.setState(Object.assign({},o.pose)),this.five.needsRender=!0,r>=1&&(s.u_aggregationEnabled.value=!1,s.u_aggregationProgress.value=1,this.cancelAnimation&&(this.cancelAnimation(),this.cancelAnimation=null),n())})})})}};e.BackgroundPlugin=V,Object.defineProperty(e,`BasePlugin`,{enumerable:!0,get:function(){return p}}),e.CSS3DRenderer=ie,e.DynamicPathLinePlugin=be,e.GaussianSplattingEntranceAnimationPlugin=(e,t)=>new Se(e,t),e.ItemMaskPlugin=k,e.OrbitControls=A,e.OrientationPlugin=z,e.PanoAnimePlugin=fe,e.RoundedBoxGeometry=ae,e.TrajectoryPlugin=W});
package/umd/five-react.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five
4
- * Generated: 3/30/2026
5
- * Version: 6.8.0-alpha.25
4
+ * Generated: 4/1/2026
5
+ * Version: 6.8.0-alpha.26
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five
4
- * Generated: 3/30/2026
5
- * Version: 6.8.0-alpha.25
4
+ * Generated: 4/1/2026
5
+ * Version: 6.8.0-alpha.26
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five
4
- * Generated: 3/30/2026
5
- * Version: 6.8.0-alpha.25
4
+ * Generated: 4/1/2026
5
+ * Version: 6.8.0-alpha.26
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
@@ -252,4 +252,4 @@
252
252
  * No amendment to or modification of this Agreement will be binding unless in
253
253
  * writing and signed by Realsee. You and Realsee hereto confirm that this
254
254
  * Agreement and all related documents shall be drafted in English.
255
- */(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`three`)):typeof define==`function`&&define.amd?define([`exports`,`three`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.FiveSDK_Sticker={},e.THREE))})(this,function(e,t){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=a(t),l=0,u=c.length,d;l<u;l++)d=c[l],!s.call(e,d)&&d!==n&&r(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(o=i(t,d))||o.enumerable});return e};t=((e,t,i)=>(i=e==null?{}:n(o(e)),c(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)))(t);var l=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),u=new Float32Array([0,0,1,0,0,1,1,1]),d=new Uint8Array([0,1,2,1,3,2]),f=new t.BufferGeometry;f.setAttribute(`position`,new t.BufferAttribute(l,3)),f.setAttribute(`uv`,new t.BufferAttribute(u,2)),f.setIndex(new t.BufferAttribute(d,1));var p=window,m=p.requestAnimationFrame||p.mozRequestAnimationFrame||p.webkitRequestAnimationFrame||p.msRequestAnimationFrame||(e=>setTimeout(e,16)),h=typeof performance<`u`&&performance.timing!==void 0?performance.timing.navigationStart:Date.now(),g=typeof performance<`u`?(()=>h+performance.now()):(()=>Date.now());function _(e,t){e.naturalWidth>0&&m(()=>t());let n=()=>t();return e.addEventListener(`load`,n,!1),()=>e.removeEventListener(`load`,n,!1)}function v(e,t){let n=g(),r=!1,i=()=>{r=!0,t(),g()-n<3e3?m(i):r=!1},a=()=>{n=g(),r===!1&&i()};return e.addEventListener(`timeupdate`,a,!1),()=>{e.removeEventListener(`timeupdate`,a,!1),r=!1}}function y(e,t){let n=e.dispose;e.dispose=()=>{t(),n.call(e)}}e.Sticker=class extends t.Mesh{static get version(){return`6.8.0-alpha.25`}constructor(e,n,r){let i=new t.MeshBasicMaterial;if(super(f,i),this._needsRender=!1,this.scale.set(e,n,1),typeof r==`string`){i.transparent=/\.png$/.test(r);let e=new Image;e.src=r,e.crossOrigin=``,r=e}if(r instanceof HTMLImageElement){let e=i.map=new t.Texture;e.wrapS=t.ClampToEdgeWrapping,e.wrapT=t.ClampToEdgeWrapping,e.minFilter=t.LinearFilter,e.encoding=t.sRGBEncoding,y(e,_(r,()=>{e.image=r,e.needsUpdate=!0,this._needsRender=!0}))}else if(r instanceof HTMLCanvasElement)i.map=new t.CanvasTexture(r);else if(r instanceof HTMLVideoElement){let e=i.map=new t.VideoTexture(r);e.wrapS=t.ClampToEdgeWrapping,e.wrapT=t.ClampToEdgeWrapping,e.minFilter=t.LinearFilter,e.encoding=t.sRGBEncoding,y(e,v(r,()=>{this._needsRender=!0}))}}get needsRender(){return this._needsRender}set needsRender(e){this._needsRender=e,e===!0&&this.material.map&&(this.material.map.needsUpdate=!0)}setSize(e,t){this.scale.set(e,t,1),this._needsRender=!0}setTransparent(e){this.material.transparent=e,this._needsRender=!0}locationWithIntersection(e,t=.005){let{point:n,face:r}=e;this.position.copy(n),r&&(this.position.add(r.normal.clone().setLength(t)),this.lookAt(n.clone().add(r.normal))),this._needsRender=!0}dispose(){var e;(e=this.material.map)==null||e.dispose(),this.material.dispose()}}});
255
+ */(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`three`)):typeof define==`function`&&define.amd?define([`exports`,`three`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.FiveSDK_Sticker={},e.THREE))})(this,function(e,t){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=a(t),l=0,u=c.length,d;l<u;l++)d=c[l],!s.call(e,d)&&d!==n&&r(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(o=i(t,d))||o.enumerable});return e};t=((e,t,i)=>(i=e==null?{}:n(o(e)),c(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)))(t);var l=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),u=new Float32Array([0,0,1,0,0,1,1,1]),d=new Uint8Array([0,1,2,1,3,2]),f=new t.BufferGeometry;f.setAttribute(`position`,new t.BufferAttribute(l,3)),f.setAttribute(`uv`,new t.BufferAttribute(u,2)),f.setIndex(new t.BufferAttribute(d,1));var p=window,m=p.requestAnimationFrame||p.mozRequestAnimationFrame||p.webkitRequestAnimationFrame||p.msRequestAnimationFrame||(e=>setTimeout(e,16)),h=typeof performance<`u`&&performance.timing!==void 0?performance.timing.navigationStart:Date.now(),g=typeof performance<`u`?(()=>h+performance.now()):(()=>Date.now());function _(e,t){e.naturalWidth>0&&m(()=>t());let n=()=>t();return e.addEventListener(`load`,n,!1),()=>e.removeEventListener(`load`,n,!1)}function v(e,t){let n=g(),r=!1,i=()=>{r=!0,t(),g()-n<3e3?m(i):r=!1},a=()=>{n=g(),r===!1&&i()};return e.addEventListener(`timeupdate`,a,!1),()=>{e.removeEventListener(`timeupdate`,a,!1),r=!1}}function y(e,t){let n=e.dispose;e.dispose=()=>{t(),n.call(e)}}e.Sticker=class extends t.Mesh{static get version(){return`6.8.0-alpha.26`}constructor(e,n,r){let i=new t.MeshBasicMaterial;if(super(f,i),this._needsRender=!1,this.scale.set(e,n,1),typeof r==`string`){i.transparent=/\.png$/.test(r);let e=new Image;e.src=r,e.crossOrigin=``,r=e}if(r instanceof HTMLImageElement){let e=i.map=new t.Texture;e.wrapS=t.ClampToEdgeWrapping,e.wrapT=t.ClampToEdgeWrapping,e.minFilter=t.LinearFilter,e.encoding=t.sRGBEncoding,y(e,_(r,()=>{e.image=r,e.needsUpdate=!0,this._needsRender=!0}))}else if(r instanceof HTMLCanvasElement)i.map=new t.CanvasTexture(r);else if(r instanceof HTMLVideoElement){let e=i.map=new t.VideoTexture(r);e.wrapS=t.ClampToEdgeWrapping,e.wrapT=t.ClampToEdgeWrapping,e.minFilter=t.LinearFilter,e.encoding=t.sRGBEncoding,y(e,v(r,()=>{this._needsRender=!0}))}}get needsRender(){return this._needsRender}set needsRender(e){this._needsRender=e,e===!0&&this.material.map&&(this.material.map.needsUpdate=!0)}setSize(e,t){this.scale.set(e,t,1),this._needsRender=!0}setTransparent(e){this.material.transparent=e,this._needsRender=!0}locationWithIntersection(e,t=.005){let{point:n,face:r}=e;this.position.copy(n),r&&(this.position.add(r.normal.clone().setLength(t)),this.lookAt(n.clone().add(r.normal))),this._needsRender=!0}dispose(){var e;(e=this.material.map)==null||e.dispose(),this.material.dispose()}}});
package/umd/five-vfx.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five
4
- * Generated: 3/30/2026
5
- * Version: 6.8.0-alpha.25
4
+ * Generated: 4/1/2026
5
+ * Version: 6.8.0-alpha.26
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
package/umd/five-vue.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five
4
- * Generated: 3/30/2026
5
- * Version: 6.8.0-alpha.25
4
+ * Generated: 4/1/2026
5
+ * Version: 6.8.0-alpha.26
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021