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

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 +104 -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 +29 -29
  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 +42 -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 +1 -1
  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 +1 -1
  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 +1 -1
  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 +83 -80
  172. package/five/index.mjs +2087 -1772
  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
package/plugins/index.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.27
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:l.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 l.Mesh(d,f);return p.position.copy(u),p.name=`${e.category_name}${e.index}`,p.userData.color=new l.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 l.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:l.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 l.Mesh(d,f);return p.position.copy(u),p.name=`${e.category_name}${e.index}`,p.userData.color=new l.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 l.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 l.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:l.MOUSE.ROTATE,MIDDLE:l.MOUSE.DOLLY,RIGHT:l.MOUSE.PAN},this.touches={ONE:l.TOUCH.ROTATE,TWO:l.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(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(r),n.update(),s=o.NONE},this.update=function(){var t=new l.Vector3,i=new l.Quaternion().setFromUnitVectors(e.up,new l.Vector3(0,1,0)),a=i.clone().inverse(),h=new l.Vector3,g=new l.Quaternion;return function(){var e=n.object.position;return t.copy(e).sub(n.target),t.applyQuaternion(i),u.setFromVector3(t),n.autoRotate&&s===o.NONE&&E(w()),n.enableDamping?(u.theta+=d.theta*n.dampingFactor,u.phi+=d.phi*n.dampingFactor):(u.theta+=d.theta,u.phi+=d.phi),u.theta=Math.max(n.minAzimuthAngle,Math.min(n.maxAzimuthAngle,u.theta)),u.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,u.phi)),u.makeSafe(),u.radius*=f,u.radius=Math.max(n.minDistance,Math.min(n.maxDistance,u.radius)),n.enableDamping===!0?n.target.addScaledVector(p,n.dampingFactor):n.target.add(p),t.setFromSpherical(u),t.applyQuaternion(a),e.copy(n.target).add(t),n.object.lookAt(n.target),n.enableDamping===!0?(d.theta*=1-n.dampingFactor,d.phi*=1-n.dampingFactor,p.multiplyScalar(1-n.dampingFactor)):(d.set(0,0,0),p.set(0,0,0)),f=1,m||h.distanceToSquared(n.object.position)>c||8*(1-g.dot(n.object.quaternion))>c?(n.dispatchEvent(r),h.copy(n.object.position),g.copy(n.object.quaternion),m=!1,!0):!1}}(),this.dispose=function(){n.domElement.removeEventListener(`contextmenu`,de,!1),n.domElement.removeEventListener(`mousedown`,G,!1),n.domElement.removeEventListener(`wheel`,se,!1),n.domElement.removeEventListener(`touchstart`,q,!1),n.domElement.removeEventListener(`touchend`,ue,!1),n.domElement.removeEventListener(`touchmove`,le,!1),document.removeEventListener(`mousemove`,K,!1),document.removeEventListener(`mouseup`,oe,!1),n.domElement.removeEventListener(`keydown`,ce,!1)};var n=this,r={type:`change`},i={type:`start`},a={type:`end`},o={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},s=o.NONE,c=1e-6,u=new l.Spherical,d=new l.Spherical,f=1,p=new l.Vector3,m=!1,h=new l.Vector2,g=new l.Vector2,_=new l.Vector2,v=new l.Vector2,y=new l.Vector2,b=new l.Vector2,x=new l.Vector2,S=new l.Vector2,C=new l.Vector2;function w(){return 2*Math.PI/60/60*n.autoRotateSpeed}function T(){return Math.pow(.95,n.zoomSpeed)}function E(e){d.theta-=e}function D(e){d.phi-=e}var ee=function(){var e=new l.Vector3;return function(t,n){e.setFromMatrixColumn(n,0),e.multiplyScalar(-t),p.add(e)}}(),O=function(){var e=new l.Vector3;return function(t,r){n.screenSpacePanning===!0?e.setFromMatrixColumn(r,1):(e.setFromMatrixColumn(r,0),e.crossVectors(n.object.up,e)),e.multiplyScalar(t),p.add(e)}}(),k=function(){var e=new l.Vector3;return function(t,r){var i=n.domElement;if(n.object.isPerspectiveCamera){var a=n.object.position;e.copy(a).sub(n.target);var o=e.length();o*=Math.tan(n.object.fov/2*Math.PI/180),ee(2*t*o/i.clientHeight,n.object.matrix),O(2*r*o/i.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(ee(t*(n.object.right-n.object.left)/n.object.zoom/i.clientWidth,n.object.matrix),O(r*(n.object.top-n.object.bottom)/n.object.zoom/i.clientHeight,n.object.matrix)):(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.`),n.enablePan=!1)}}();function A(e){n.object.isPerspectiveCamera?f/=e:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom*e)),n.object.updateProjectionMatrix(),m=!0):(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.`),n.enableZoom=!1)}function j(e){n.object.isPerspectiveCamera?f*=e:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/e)),n.object.updateProjectionMatrix(),m=!0):(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.`),n.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(n.rotateSpeed);var t=n.domElement;E(2*Math.PI*_.x/t.clientHeight),D(2*Math.PI*_.y/t.clientHeight),h.copy(g),n.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),n.update()}function re(e){y.set(e.clientX,e.clientY),b.subVectors(y,v).multiplyScalar(n.panSpeed),k(b.x,b.y),v.copy(y),n.update()}function F(e){e.deltaY<0?j(T()):e.deltaY>0&&A(T()),n.update()}function I(e){var t=!1;switch(e.keyCode){case n.keys.UP:k(0,n.keyPanSpeed),t=!0;break;case n.keys.BOTTOM:k(0,-n.keyPanSpeed),t=!0;break;case n.keys.LEFT:k(n.keyPanSpeed,0),t=!0;break;case n.keys.RIGHT:k(-n.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),n.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){n.enableZoom&&z(e),n.enablePan&&R(e)}function V(e){n.enableZoom&&z(e),n.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),r=.5*(e.touches[0].pageY+e.touches[1].pageY);g.set(t,r)}_.subVectors(g,h).multiplyScalar(n.rotateSpeed);var i=n.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),r=.5*(e.touches[0].pageY+e.touches[1].pageY);y.set(t,r)}b.subVectors(y,v).multiplyScalar(n.panSpeed),k(b.x,b.y),v.copy(y)}function U(e){var t=e.touches[0].pageX-e.touches[1].pageX,r=e.touches[0].pageY-e.touches[1].pageY,i=Math.sqrt(t*t+r*r);S.set(0,i),C.set(0,Math.pow(S.y/x.y,n.zoomSpeed)),A(C.y),x.copy(S)}function W(e){n.enableZoom&&U(e),n.enablePan&&H(e)}function ae(e){n.enableZoom&&U(e),n.enableRotate&&ie(e)}function G(e){if(n.enabled!==!1){e.preventDefault(),n.domElement.focus?n.domElement.focus():window.focus();var t;switch(e.button){case 0:t=n.mouseButtons.LEFT;break;case 1:t=n.mouseButtons.MIDDLE;break;case 2:t=n.mouseButtons.RIGHT;break;default:t=-1}switch(t){case l.MOUSE.DOLLY:if(n.enableZoom===!1)return;M(e),s=o.DOLLY;break;case l.MOUSE.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(n.enablePan===!1)return;N(e),s=o.PAN}else{if(n.enableRotate===!1)return;te(e),s=o.ROTATE}break;case l.MOUSE.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(n.enableRotate===!1)return;te(e),s=o.ROTATE}else{if(n.enablePan===!1)return;N(e),s=o.PAN}break;default:s=o.NONE}s!==o.NONE&&(document.addEventListener(`mousemove`,K,!1),document.addEventListener(`mouseup`,oe,!1),n.dispatchEvent(i))}}function K(e){if(n.enabled!==!1)switch(e.preventDefault(),s){case o.ROTATE:if(n.enableRotate===!1)return;ne(e);break;case o.DOLLY:if(n.enableZoom===!1)return;P(e);break;case o.PAN:if(n.enablePan===!1)return;re(e);break}}function oe(e){n.enabled!==!1&&(document.removeEventListener(`mousemove`,K,!1),document.removeEventListener(`mouseup`,oe,!1),n.dispatchEvent(a),s=o.NONE)}function se(e){n.enabled===!1||n.enableZoom===!1||s!==o.NONE&&s!==o.ROTATE||(e.preventDefault(),e.stopPropagation(),n.dispatchEvent(i),F(e),n.dispatchEvent(a))}function ce(e){n.enabled===!1||n.enableKeys===!1||n.enablePan===!1||I(e)}function q(e){if(n.enabled!==!1){switch(e.preventDefault(),e.touches.length){case 1:switch(n.touches.ONE){case l.TOUCH.ROTATE:if(n.enableRotate===!1)return;L(e),s=o.TOUCH_ROTATE;break;case l.TOUCH.PAN:if(n.enablePan===!1)return;R(e),s=o.TOUCH_PAN;break;default:s=o.NONE}break;case 2:switch(n.touches.TWO){case l.TOUCH.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;B(e),s=o.TOUCH_DOLLY_PAN;break;case l.TOUCH.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;V(e),s=o.TOUCH_DOLLY_ROTATE;break;default:s=o.NONE}break;default:s=o.NONE}s!==o.NONE&&n.dispatchEvent(i)}}function le(e){if(n.enabled!==!1)switch(e.preventDefault(),e.stopPropagation(),s){case o.TOUCH_ROTATE:if(n.enableRotate===!1)return;ie(e),n.update();break;case o.TOUCH_PAN:if(n.enablePan===!1)return;H(e),n.update();break;case o.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;W(e),n.update();break;case o.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;ae(e),n.update();break;default:s=o.NONE}}function ue(e){n.enabled!==!1&&(n.dispatchEvent(a),s=o.NONE)}function de(e){n.enabled!==!1&&e.preventDefault()}n.domElement.addEventListener(`contextmenu`,de,!1),n.domElement.addEventListener(`mousedown`,G,!1),n.domElement.addEventListener(`wheel`,se,!1),n.domElement.addEventListener(`touchstart`,q,!1),n.domElement.addEventListener(`touchend`,ue,!1),n.domElement.addEventListener(`touchmove`,le,!1),n.domElement.addEventListener(`keydown`,ce,!1),n.domElement.tabIndex===-1&&(n.domElement.tabIndex=0),this.update()};j.prototype=Object.create(l.EventDispatcher.prototype),j.prototype.constructor=j;var te=function(e,t){j.call(this,e,t),this.mouseButtons.LEFT=l.MOUSE.PAN,this.mouseButtons.RIGHT=l.MOUSE.ROTATE,this.touches.ONE=l.TOUCH.PAN,this.touches.TWO=l.TOUCH.DOLLY_ROTATE};te.prototype=Object.create(l.EventDispatcher.prototype),te.prototype.constructor=te;var M=function(e){l.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(l.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,n,r,i,a=new l.Matrix4,o={camera:{fov:0,style:``},objects:new WeakMap},s=document.createElement(`div`);s.style.overflow=`hidden`,this.domElement=s;var c=document.createElement(`div`);c.style.WebkitTransformStyle=`preserve-3d`,c.style.transformStyle=`preserve-3d`,c.style.pointerEvents=`none`,s.appendChild(c);var u=/Trident/i.test(navigator.userAgent);this.getSize=function(){return{width:t,height:n}},this.setSize=function(e,a){t=e,n=a,r=t/2,i=n/2,s.style.width=e+`px`,s.style.height=a+`px`,c.style.width=e+`px`,c.style.height=a+`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,a=`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(`+r+`px,`+i+`px)`+t+a:`translate(-50%,-50%)`+a}function m(t,n,r,i){if(t instanceof M){t.onBeforeRender(e,n,r);var s;t instanceof N?(a.copy(r.matrixWorldInverse),a.transpose(),a.copyPosition(t.matrixWorld),a.scale(t.scale),a.elements[3]=0,a.elements[7]=0,a.elements[11]=0,a.elements[15]=1,s=p(a,i)):s=p(t.matrixWorld,i);var l=t.element,d=o.objects.get(t);if(d===void 0||d.style!==s){l.style.WebkitTransform=s,l.style.transform=s;var f={style:s};u&&(f.distanceToCameraSquared=h(r,t)),o.objects.set(t,f)}l.style.display=t.visible?``:`none`,l.parentNode!==c&&c.appendChild(l),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 l.Vector3,t=new l.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 o.objects.get(e).distanceToCameraSquared-o.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]*i;if(o.camera.fov!==n&&(t.isPerspectiveCamera?(s.style.WebkitPerspective=n+`px`,s.style.perspective=n+`px`):(s.style.WebkitPerspective=``,s.style.perspective=``),o.camera.fov=n),e.autoUpdate===!0&&e.updateMatrixWorld(),t.parent===null&&t.updateMatrixWorld(),t.isOrthographicCamera)var a=-(t.right+t.left)/2,l=(t.top+t.bottom)/2;var p=t.isOrthographicCamera?`scale(`+n+`)translate(`+d(a)+`px,`+d(l)+`px)`+f(t.matrixWorldInverse):`translateZ(`+n+`px)`+f(t.matrixWorldInverse),h=p+`translate(`+r+`px,`+i+`px)`;o.camera.style!==h&&!u&&(c.style.WebkitTransform=h,c.style.transform=h,o.camera.style=h),m(e,e,t,p),u&&_(e)}};function P(e,t,n){let{top:r,left:i,width:a,height:o}=t.getBoundingClientRect();return n&&(i+=a*n.left,r+=o*(1-n.bottom-n.height),a*=n.width,o*=n.height),new l.Vector2((e.x-i)/a*2-1,-(e.y-r)/o*2+1)}var re=class extends l.BufferGeometry{constructor(e,t,n,r,i){super(),this.type=`RoundedBoxGeometry`,i=isNaN(i)?1:Math.max(1,Math.floor(i)),e=isNaN(e)?1:e,t=isNaN(t)?1:t,n=isNaN(n)?1:n,r=isNaN(r)?.15:r,r=Math.min(r,Math.min(e,Math.min(t,Math.min(n)))/2);let a=e/2-r,o=t/2-r,s=n/2-r;this.parameters={width:e,height:t,depth:n,radius:r,radiusSegments:i};let c=i+1,u=c*i+1<<3,d=new l.BufferAttribute(new Float32Array(u*3),3),f=new l.BufferAttribute(new Float32Array(u*3),3),p=[],m=[];new l.Vector3;let h=new l.Vector3,g=[],_=[],v=[],y=c*i,b=c*i+1;x(),C(),S(),w(),E(),T();function x(){let e=[new l.Vector3(1,1,1),new l.Vector3(1,1,-1),new l.Vector3(-1,1,-1),new l.Vector3(-1,1,1),new l.Vector3(1,-1,1),new l.Vector3(1,-1,-1),new l.Vector3(-1,-1,-1),new l.Vector3(-1,-1,1)];for(let e=0;e<8;e++)p.push([]),m.push([]);let t=Math.PI/2,n=new l.Vector3(a,o,s);for(let e=0;e<=i;e++){let a=e/i*t,o=Math.cos(a),s=Math.sin(a);if(e==i){h.set(0,1,0);let e=h.clone().multiplyScalar(r).add(n);p[0].push(e),g.push(e);let t=h.clone();m[0].push(t),_.push(t);continue}for(let e=0;e<=i;e++){let a=e/i*t;h.x=o*Math.cos(a),h.y=s,h.z=o*Math.sin(a);let c=h.clone().multiplyScalar(r).add(n);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=c*(i-1);for(let n=0;n<8;n++){let r=b*n;for(let t=0;t<i-1;t++){let a=t*c,o=(t+1)*c;for(let t=0;t<i;t++){let i=t+1,s=r+a+t,c=r+a+i,l=r+o+t,u=r+o+i;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 a=0;a<i;a++){let i=r+t+a,o=r+t+a+1,s=r+y;e[n]?(v.push(i),v.push(s),v.push(o)):(v.push(i),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=i,t=i+b*3,n=i+b*4,r=i+b*7,v.push(e),v.push(t),v.push(n),v.push(t),v.push(r),v.push(n),e=i+b,t=i+b*2,n=i+b*5,r=i+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<i;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],a=b*t[n],o=1>=n;for(let e=0;e<i;e++){let t=e*c,n=(e+1)*c,i=r+t,s=r+n,l=a+t,u=a+n;o?(v.push(i),v.push(l),v.push(s),v.push(s),v.push(l),v.push(u)):(v.push(i),v.push(s),v.push(l),v.push(s),v.push(u),v.push(l))}}}function E(){let e=i-1,t=[0,1,4,5],n=[3,2,7,6],r=[0,1,1,0];for(let a=0;a<4;a++){let o=t[a]*b,s=n[a]*b;for(let t=0;t<=e;t++){let n=o+i+t*c,l=o+(t==e?b-1:i+(t+1)*c),u=s+i+t*c,d=s+(t==e?b-1:i+(t+1)*c);r[a]?(v.push(n),v.push(u),v.push(l),v.push(l),v.push(u),v.push(d)):(v.push(n),v.push(l),v.push(u),v.push(l),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 l.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,n){let r=new l.Shape;return r.moveTo(n,0),r.lineTo(e-n,0),r.absarc(e-n,n,n,-L,0,!1),r.lineTo(e,t-n),r.absarc(e-n,t-n,n,0,L,!1),r.lineTo(n,t),r.absarc(n,t-n,n,L,Math.PI,!1),r.lineTo(0,n),r.absarc(n,n,n,Math.PI,Math.PI*1.5,!1),r}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 l.PlaneGeometry(5,5),n=new l.MeshBasicMaterial({transparent:!0,opacity:0}),r=new l.Mesh(t,n),i=document.createElement(`div`);i.innerText=e;let a=new M(i);return a.name=e,a.scale.set(.3,.3,.3),i.style.color=`#ffffff`,i.style.opacity=`0.5`,i.style.pointerEvents=`none`,i.style.backfaceVisibility=`hidden`,r.rotateX(-L),r.add(a),r},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,t){super(e),this.camera=new c.Camera(90),this.scene=new l.Scene,this.renderer=new l.WebGLRenderer({antialias:!0,alpha:!0}),this.css3drenderer=new ne,this.ambientLight=new l.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 l.DirectionalLight(16777215,.2),this.box=new l.Mesh(new re(8,8,8,.5,20),new l.MeshPhongMaterial({color:16777215})),this.faces=new l.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,n=e.pointers[0].clientY,r=P({x:t,y:n},this.wrapper),i=new l.Raycaster;i.setFromCamera(r,this.camera);let[a]=i.intersectObjects(this.faces.children,!1);if(a){let{longitude:e,latitude:t}=a.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:n}=e;this.camera.pose.longitude===t&&this.camera.pose.latitude===n||(this.camera.setFromPose({longitude:t,latitude:n,distance:20,offset:new l.Vector3(0,0,0)}),this.updateByCamera(),this.updateArrows({longitude:t,latitude:n}))},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),n=new l.Raycaster;n.setFromCamera(t,this.camera);let[r]=n.intersectObjects(this.faces.children,!1);this.faces.children.forEach(e=>{e.material.opacity=0,e.children[0].element.style.color=``}),r&&(r.object.material.opacity=.3,r.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},t==null?void 0:t.initialState),this._config=Object.assign({fixedLongitude:0,orthoView:!0},t==null?void 0:t.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 l.Vector3(0,0,0),longitude:e.camera.pose.latitude,latitude:e.camera.pose.latitude}),this.cylinder=new l.Mesh(new l.CylinderGeometry(13.2,14,.01,50,1,!0),new l.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 l.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:l.MOUSE.ROTATE,MIDDLE:l.MOUSE.DOLLY,RIGHT:l.MOUSE.PAN},this.touches={ONE:l.TOUCH.ROTATE,TWO:l.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(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(r),n.update(),s=o.NONE},this.update=function(){var t=new l.Vector3,i=new l.Quaternion().setFromUnitVectors(e.up,new l.Vector3(0,1,0)),a=i.clone().inverse(),h=new l.Vector3,g=new l.Quaternion;return function(){var e=n.object.position;return t.copy(e).sub(n.target),t.applyQuaternion(i),u.setFromVector3(t),n.autoRotate&&s===o.NONE&&E(w()),n.enableDamping?(u.theta+=d.theta*n.dampingFactor,u.phi+=d.phi*n.dampingFactor):(u.theta+=d.theta,u.phi+=d.phi),u.theta=Math.max(n.minAzimuthAngle,Math.min(n.maxAzimuthAngle,u.theta)),u.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,u.phi)),u.makeSafe(),u.radius*=f,u.radius=Math.max(n.minDistance,Math.min(n.maxDistance,u.radius)),n.enableDamping===!0?n.target.addScaledVector(p,n.dampingFactor):n.target.add(p),t.setFromSpherical(u),t.applyQuaternion(a),e.copy(n.target).add(t),n.object.lookAt(n.target),n.enableDamping===!0?(d.theta*=1-n.dampingFactor,d.phi*=1-n.dampingFactor,p.multiplyScalar(1-n.dampingFactor)):(d.set(0,0,0),p.set(0,0,0)),f=1,m||h.distanceToSquared(n.object.position)>c||8*(1-g.dot(n.object.quaternion))>c?(n.dispatchEvent(r),h.copy(n.object.position),g.copy(n.object.quaternion),m=!1,!0):!1}}(),this.dispose=function(){n.domElement.removeEventListener(`contextmenu`,de,!1),n.domElement.removeEventListener(`mousedown`,W,!1),n.domElement.removeEventListener(`wheel`,ce,!1),n.domElement.removeEventListener(`touchstart`,q,!1),n.domElement.removeEventListener(`touchend`,ue,!1),n.domElement.removeEventListener(`touchmove`,le,!1),document.removeEventListener(`mousemove`,G,!1),document.removeEventListener(`mouseup`,se,!1),n.domElement.removeEventListener(`keydown`,K,!1)};var n=this,r={type:`change`},i={type:`start`},a={type:`end`},o={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},s=o.NONE,c=1e-6,u=new l.Spherical,d=new l.Spherical,f=1,p=new l.Vector3,m=!1,h=new l.Vector2,g=new l.Vector2,_=new l.Vector2,v=new l.Vector2,y=new l.Vector2,b=new l.Vector2,x=new l.Vector2,S=new l.Vector2,C=new l.Vector2;function w(){return 2*Math.PI/60/60*n.autoRotateSpeed}function T(){return Math.pow(.95,n.zoomSpeed)}function E(e){d.theta-=e}function D(e){d.phi-=e}var ee=function(){var e=new l.Vector3;return function(t,n){e.setFromMatrixColumn(n,0),e.multiplyScalar(-t),p.add(e)}}(),O=function(){var e=new l.Vector3;return function(t,r){n.screenSpacePanning===!0?e.setFromMatrixColumn(r,1):(e.setFromMatrixColumn(r,0),e.crossVectors(n.object.up,e)),e.multiplyScalar(t),p.add(e)}}(),k=function(){var e=new l.Vector3;return function(t,r){var i=n.domElement;if(n.object.isPerspectiveCamera){var a=n.object.position;e.copy(a).sub(n.target);var o=e.length();o*=Math.tan(n.object.fov/2*Math.PI/180),ee(2*t*o/i.clientHeight,n.object.matrix),O(2*r*o/i.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(ee(t*(n.object.right-n.object.left)/n.object.zoom/i.clientWidth,n.object.matrix),O(r*(n.object.top-n.object.bottom)/n.object.zoom/i.clientHeight,n.object.matrix)):(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.`),n.enablePan=!1)}}();function te(e){n.object.isPerspectiveCamera?f/=e:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom*e)),n.object.updateProjectionMatrix(),m=!0):(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.`),n.enableZoom=!1)}function A(e){n.object.isPerspectiveCamera?f*=e:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/e)),n.object.updateProjectionMatrix(),m=!0):(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.`),n.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(n.rotateSpeed);var t=n.domElement;E(2*Math.PI*_.x/t.clientHeight),D(2*Math.PI*_.y/t.clientHeight),h.copy(g),n.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),n.update()}function ae(e){y.set(e.clientX,e.clientY),b.subVectors(y,v).multiplyScalar(n.panSpeed),k(b.x,b.y),v.copy(y),n.update()}function N(e){e.deltaY<0?A(T()):e.deltaY>0&&te(T()),n.update()}function oe(e){var t=!1;switch(e.keyCode){case n.keys.UP:k(0,n.keyPanSpeed),t=!0;break;case n.keys.BOTTOM:k(0,-n.keyPanSpeed),t=!0;break;case n.keys.LEFT:k(n.keyPanSpeed,0),t=!0;break;case n.keys.RIGHT:k(-n.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),n.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){n.enableZoom&&I(e),n.enablePan&&F(e)}function R(e){n.enableZoom&&I(e),n.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),r=.5*(e.touches[0].pageY+e.touches[1].pageY);g.set(t,r)}_.subVectors(g,h).multiplyScalar(n.rotateSpeed);var i=n.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),r=.5*(e.touches[0].pageY+e.touches[1].pageY);y.set(t,r)}b.subVectors(y,v).multiplyScalar(n.panSpeed),k(b.x,b.y),v.copy(y)}function V(e){var t=e.touches[0].pageX-e.touches[1].pageX,r=e.touches[0].pageY-e.touches[1].pageY,i=Math.sqrt(t*t+r*r);S.set(0,i),C.set(0,Math.pow(S.y/x.y,n.zoomSpeed)),te(C.y),x.copy(S)}function H(e){n.enableZoom&&V(e),n.enablePan&&B(e)}function U(e){n.enableZoom&&V(e),n.enableRotate&&z(e)}function W(e){if(n.enabled!==!1){e.preventDefault(),n.domElement.focus?n.domElement.focus():window.focus();var t;switch(e.button){case 0:t=n.mouseButtons.LEFT;break;case 1:t=n.mouseButtons.MIDDLE;break;case 2:t=n.mouseButtons.RIGHT;break;default:t=-1}switch(t){case l.MOUSE.DOLLY:if(n.enableZoom===!1)return;j(e),s=o.DOLLY;break;case l.MOUSE.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(n.enablePan===!1)return;re(e),s=o.PAN}else{if(n.enableRotate===!1)return;ne(e),s=o.ROTATE}break;case l.MOUSE.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(n.enableRotate===!1)return;ne(e),s=o.ROTATE}else{if(n.enablePan===!1)return;re(e),s=o.PAN}break;default:s=o.NONE}s!==o.NONE&&(document.addEventListener(`mousemove`,G,!1),document.addEventListener(`mouseup`,se,!1),n.dispatchEvent(i))}}function G(e){if(n.enabled!==!1)switch(e.preventDefault(),s){case o.ROTATE:if(n.enableRotate===!1)return;ie(e);break;case o.DOLLY:if(n.enableZoom===!1)return;M(e);break;case o.PAN:if(n.enablePan===!1)return;ae(e);break}}function se(e){n.enabled!==!1&&(document.removeEventListener(`mousemove`,G,!1),document.removeEventListener(`mouseup`,se,!1),n.dispatchEvent(a),s=o.NONE)}function ce(e){n.enabled===!1||n.enableZoom===!1||s!==o.NONE&&s!==o.ROTATE||(e.preventDefault(),e.stopPropagation(),n.dispatchEvent(i),N(e),n.dispatchEvent(a))}function K(e){n.enabled===!1||n.enableKeys===!1||n.enablePan===!1||oe(e)}function q(e){if(n.enabled!==!1){switch(e.preventDefault(),e.touches.length){case 1:switch(n.touches.ONE){case l.TOUCH.ROTATE:if(n.enableRotate===!1)return;P(e),s=o.TOUCH_ROTATE;break;case l.TOUCH.PAN:if(n.enablePan===!1)return;F(e),s=o.TOUCH_PAN;break;default:s=o.NONE}break;case 2:switch(n.touches.TWO){case l.TOUCH.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;L(e),s=o.TOUCH_DOLLY_PAN;break;case l.TOUCH.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;R(e),s=o.TOUCH_DOLLY_ROTATE;break;default:s=o.NONE}break;default:s=o.NONE}s!==o.NONE&&n.dispatchEvent(i)}}function le(e){if(n.enabled!==!1)switch(e.preventDefault(),e.stopPropagation(),s){case o.TOUCH_ROTATE:if(n.enableRotate===!1)return;z(e),n.update();break;case o.TOUCH_PAN:if(n.enablePan===!1)return;B(e),n.update();break;case o.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;H(e),n.update();break;case o.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;U(e),n.update();break;default:s=o.NONE}}function ue(e){n.enabled!==!1&&(n.dispatchEvent(a),s=o.NONE)}function de(e){n.enabled!==!1&&e.preventDefault()}n.domElement.addEventListener(`contextmenu`,de,!1),n.domElement.addEventListener(`mousedown`,W,!1),n.domElement.addEventListener(`wheel`,ce,!1),n.domElement.addEventListener(`touchstart`,q,!1),n.domElement.addEventListener(`touchend`,ue,!1),n.domElement.addEventListener(`touchmove`,le,!1),n.domElement.addEventListener(`keydown`,K,!1),n.domElement.tabIndex===-1&&(n.domElement.tabIndex=0),this.update()};A.prototype=Object.create(l.EventDispatcher.prototype),A.prototype.constructor=A;var ne=function(e,t){A.call(this,e,t),this.mouseButtons.LEFT=l.MOUSE.PAN,this.mouseButtons.RIGHT=l.MOUSE.ROTATE,this.touches.ONE=l.TOUCH.PAN,this.touches.TWO=l.TOUCH.DOLLY_ROTATE};ne.prototype=Object.create(l.EventDispatcher.prototype),ne.prototype.constructor=ne;var j=function(e){l.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(l.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,n,r,i,a=new l.Matrix4,o={camera:{fov:0,style:``},objects:new WeakMap},s=document.createElement(`div`);s.style.overflow=`hidden`,this.domElement=s;var c=document.createElement(`div`);c.style.WebkitTransformStyle=`preserve-3d`,c.style.transformStyle=`preserve-3d`,c.style.pointerEvents=`none`,s.appendChild(c);var u=/Trident/i.test(navigator.userAgent);this.getSize=function(){return{width:t,height:n}},this.setSize=function(e,a){t=e,n=a,r=t/2,i=n/2,s.style.width=e+`px`,s.style.height=a+`px`,c.style.width=e+`px`,c.style.height=a+`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,a=`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(`+r+`px,`+i+`px)`+t+a:`translate(-50%,-50%)`+a}function m(t,n,r,i){if(t instanceof j){t.onBeforeRender(e,n,r);var s;t instanceof re?(a.copy(r.matrixWorldInverse),a.transpose(),a.copyPosition(t.matrixWorld),a.scale(t.scale),a.elements[3]=0,a.elements[7]=0,a.elements[11]=0,a.elements[15]=1,s=p(a,i)):s=p(t.matrixWorld,i);var l=t.element,d=o.objects.get(t);if(d===void 0||d.style!==s){l.style.WebkitTransform=s,l.style.transform=s;var f={style:s};u&&(f.distanceToCameraSquared=h(r,t)),o.objects.set(t,f)}l.style.display=t.visible?``:`none`,l.parentNode!==c&&c.appendChild(l),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 l.Vector3,t=new l.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 o.objects.get(e).distanceToCameraSquared-o.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]*i;if(o.camera.fov!==n&&(t.isPerspectiveCamera?(s.style.WebkitPerspective=n+`px`,s.style.perspective=n+`px`):(s.style.WebkitPerspective=``,s.style.perspective=``),o.camera.fov=n),e.autoUpdate===!0&&e.updateMatrixWorld(),t.parent===null&&t.updateMatrixWorld(),t.isOrthographicCamera)var a=-(t.right+t.left)/2,l=(t.top+t.bottom)/2;var p=t.isOrthographicCamera?`scale(`+n+`)translate(`+d(a)+`px,`+d(l)+`px)`+f(t.matrixWorldInverse):`translateZ(`+n+`px)`+f(t.matrixWorldInverse),h=p+`translate(`+r+`px,`+i+`px)`;o.camera.style!==h&&!u&&(c.style.WebkitTransform=h,c.style.transform=h,o.camera.style=h),m(e,e,t,p),u&&_(e)}};function M(e,t,n){let{top:r,left:i,width:a,height:o}=t.getBoundingClientRect();return n&&(i+=a*n.left,r+=o*(1-n.bottom-n.height),a*=n.width,o*=n.height),new l.Vector2((e.x-i)/a*2-1,-(e.y-r)/o*2+1)}var ae=class extends l.BufferGeometry{constructor(e,t,n,r,i){super(),this.type=`RoundedBoxGeometry`,i=isNaN(i)?1:Math.max(1,Math.floor(i)),e=isNaN(e)?1:e,t=isNaN(t)?1:t,n=isNaN(n)?1:n,r=isNaN(r)?.15:r,r=Math.min(r,Math.min(e,Math.min(t,Math.min(n)))/2);let a=e/2-r,o=t/2-r,s=n/2-r;this.parameters={width:e,height:t,depth:n,radius:r,radiusSegments:i};let c=i+1,u=c*i+1<<3,d=new l.BufferAttribute(new Float32Array(u*3),3),f=new l.BufferAttribute(new Float32Array(u*3),3),p=[],m=[];new l.Vector3;let h=new l.Vector3,g=[],_=[],v=[],y=c*i,b=c*i+1;x(),C(),S(),w(),E(),T();function x(){let e=[new l.Vector3(1,1,1),new l.Vector3(1,1,-1),new l.Vector3(-1,1,-1),new l.Vector3(-1,1,1),new l.Vector3(1,-1,1),new l.Vector3(1,-1,-1),new l.Vector3(-1,-1,-1),new l.Vector3(-1,-1,1)];for(let e=0;e<8;e++)p.push([]),m.push([]);let t=Math.PI/2,n=new l.Vector3(a,o,s);for(let e=0;e<=i;e++){let a=e/i*t,o=Math.cos(a),s=Math.sin(a);if(e==i){h.set(0,1,0);let e=h.clone().multiplyScalar(r).add(n);p[0].push(e),g.push(e);let t=h.clone();m[0].push(t),_.push(t);continue}for(let e=0;e<=i;e++){let a=e/i*t;h.x=o*Math.cos(a),h.y=s,h.z=o*Math.sin(a);let c=h.clone().multiplyScalar(r).add(n);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=c*(i-1);for(let n=0;n<8;n++){let r=b*n;for(let t=0;t<i-1;t++){let a=t*c,o=(t+1)*c;for(let t=0;t<i;t++){let i=t+1,s=r+a+t,c=r+a+i,l=r+o+t,u=r+o+i;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 a=0;a<i;a++){let i=r+t+a,o=r+t+a+1,s=r+y;e[n]?(v.push(i),v.push(s),v.push(o)):(v.push(i),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=i,t=i+b*3,n=i+b*4,r=i+b*7,v.push(e),v.push(t),v.push(n),v.push(t),v.push(r),v.push(n),e=i+b,t=i+b*2,n=i+b*5,r=i+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<i;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],a=b*t[n],o=1>=n;for(let e=0;e<i;e++){let t=e*c,n=(e+1)*c,i=r+t,s=r+n,l=a+t,u=a+n;o?(v.push(i),v.push(l),v.push(s),v.push(s),v.push(l),v.push(u)):(v.push(i),v.push(s),v.push(l),v.push(s),v.push(u),v.push(l))}}}function E(){let e=i-1,t=[0,1,4,5],n=[3,2,7,6],r=[0,1,1,0];for(let a=0;a<4;a++){let o=t[a]*b,s=n[a]*b;for(let t=0;t<=e;t++){let n=o+i+t*c,l=o+(t==e?b-1:i+(t+1)*c),u=s+i+t*c,d=s+(t==e?b-1:i+(t+1)*c);r[a]?(v.push(n),v.push(u),v.push(l),v.push(l),v.push(u),v.push(d)):(v.push(n),v.push(l),v.push(u),v.push(l),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 l.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,n){let r=new l.Shape;return r.moveTo(n,0),r.lineTo(e-n,0),r.absarc(e-n,n,n,-P,0,!1),r.lineTo(e,t-n),r.absarc(e-n,t-n,n,0,P,!1),r.lineTo(n,t),r.absarc(n,t-n,n,P,Math.PI,!1),r.lineTo(0,n),r.absarc(n,n,n,Math.PI,Math.PI*1.5,!1),r}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 l.PlaneGeometry(5,5),n=new l.MeshBasicMaterial({transparent:!0,opacity:0}),r=new l.Mesh(t,n),i=document.createElement(`div`);i.innerText=e;let a=new j(i);return a.name=e,a.scale.set(.3,.3,.3),i.style.color=`#ffffff`,i.style.opacity=`0.5`,i.style.pointerEvents=`none`,i.style.backfaceVisibility=`hidden`,r.rotateX(-P),r.add(a),r},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,t){super(e),this.camera=new c.Camera(90),this.scene=new l.Scene,this.renderer=new l.WebGLRenderer({antialias:!0,alpha:!0}),this.css3drenderer=new ie,this.ambientLight=new l.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 l.DirectionalLight(16777215,.2),this.box=new l.Mesh(new ae(8,8,8,.5,20),new l.MeshPhongMaterial({color:16777215})),this.faces=new l.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,n=e.pointers[0].clientY,r=M({x:t,y:n},this.wrapper),i=new l.Raycaster;i.setFromCamera(r,this.camera);let[a]=i.intersectObjects(this.faces.children,!1);if(a){let{longitude:e,latitude:t}=a.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:n}=e;this.camera.pose.longitude===t&&this.camera.pose.latitude===n||(this.camera.setFromPose({longitude:t,latitude:n,distance:20,offset:new l.Vector3(0,0,0)}),this.updateByCamera(),this.updateArrows({longitude:t,latitude:n}))},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),n=new l.Raycaster;n.setFromCamera(t,this.camera);let[r]=n.intersectObjects(this.faces.children,!1);this.faces.children.forEach(e=>{e.material.opacity=0,e.children[0].element.style.color=``}),r&&(r.object.material.opacity=.3,r.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},t==null?void 0:t.initialState),this._config=Object.assign({fixedLongitude:0,orthoView:!0},t==null?void 0:t.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 l.Vector3(0,0,0),longitude:e.camera.pose.latitude,latitude:e.camera.pose.latitude}),this.cylinder=new l.Mesh(new l.CylinderGeometry(13.2,14,.01,50,1,!0),new l.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),n=I(12,15,this.camera.pose.latitude/Math.PI*2,e=>e*e),r=I(13,19,this.camera.pose.latitude/Math.PI*2,e=>e*e),i=I(-.2,.5,this.camera.pose.latitude/Math.PI*2,e=>e*e);this.cylinder.geometry=new l.CylinderGeometry(t,n,.01,50,1,!0),this.cylinder.material.uniforms.radiusTop.value=t,this.cylinder.material.uniforms.radiusBottom.value=n,this.cylinder.material.needsUpdate=!0,this.cylinder.children.forEach(t=>{t.position.normalize().multiplyScalar(r),t.scale.set(e,e,e);let n=t.children[0];n&&(n.element.style.opacity=i.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 l.ShapeGeometry(e);t.translate(-3.5,-3.5,0);let n=new l.Mesh(t,new l.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));n.userData={longitude:0,latitude:0},n.position.z=4.1,n.add(z(`前`));let r=new l.Mesh(t,new l.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));r.rotateY(Math.PI),r.position.z=-4.1,r.add(z(`后`)),r.userData={longitude:Math.PI,latitude:0};let i=new l.Mesh(t,new l.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));i.rotateY(L),i.position.x=4.1,i.add(z(`右`)),i.userData={longitude:L,latitude:0};let a=new l.Mesh(t,new l.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 l.Mesh(t,new l.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));o.rotateX(-L),o.position.y=4.1,o.add(z(`上`)),o.userData={longitude:0,latitude:L},this.faces.add(n,r,a,i,o)}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:n}=this.five.getCurrentState();this.camera.setFromPose({longitude:t,latitude:n,distance:20,offset:new l.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 u.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),n=oe(12,15,this.camera.pose.latitude/Math.PI*2,e=>e*e),r=oe(13,19,this.camera.pose.latitude/Math.PI*2,e=>e*e),i=oe(-.2,.5,this.camera.pose.latitude/Math.PI*2,e=>e*e);this.cylinder.geometry=new l.CylinderGeometry(t,n,.01,50,1,!0),this.cylinder.material.uniforms.radiusTop.value=t,this.cylinder.material.uniforms.radiusBottom.value=n,this.cylinder.material.needsUpdate=!0,this.cylinder.children.forEach(t=>{t.position.normalize().multiplyScalar(r),t.scale.set(e,e,e);let n=t.children[0];n&&(n.element.style.opacity=i.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 l.ShapeGeometry(e);t.translate(-3.5,-3.5,0);let n=new l.Mesh(t,new l.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));n.userData={longitude:0,latitude:0},n.position.z=4.1,n.add(I(`前`));let r=new l.Mesh(t,new l.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));r.rotateY(Math.PI),r.position.z=-4.1,r.add(I(`后`)),r.userData={longitude:Math.PI,latitude:0};let i=new l.Mesh(t,new l.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));i.rotateY(P),i.position.x=4.1,i.add(I(`右`)),i.userData={longitude:P,latitude:0};let a=new l.Mesh(t,new l.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 l.Mesh(t,new l.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));o.rotateX(-P),o.position.y=4.1,o.add(I(`上`)),o.userData={longitude:0,latitude:P},this.faces.add(n,r,a,i,o)}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:n}=this.five.getCurrentState();this.camera.setFromPose({longitude:t,latitude:n,distance:20,offset:new l.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 u.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 l.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,n=.1,r=new W(t,n,1,0,1),i=new W(t,n,1,0,1),a=new W(t,n,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 n=new Float32Array(t.length/3);for(let e=0;e<n.length;e++)if(e===0)n[e]=0;else{let r=new l.Vector3(t[e-3],t[e-2],t[e-1]);n[e]=new l.Vector3(t[e],t[e+1],t[e+2]).distanceTo(r)+n[e-1]}this.totalDistance=n[n.length-1];for(let o=0;o<n.length;o++){let s=new l.Vector3(0,0,0),c=0;for(let e=o-5;e<o+6;e++)e>=0&&e<n.length&&(s.add(new l.Vector3(t[e*3],t[e*3+1],t[e*3+2])),c++);s.divideScalar(c).applyMatrix4(e.transform);let u=r.filter(s.x),d=i.filter(s.y),f=a.filter(s.z),p={position:new l.Vector3(u,d,f),location:n[o]};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 t={keyframeIndex:null,progress:null};this.playingState.keyframeIndex!==null&&this.playingState.progress!==null?(t.keyframeIndex=this.playingState.keyframeIndex,t.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 n=this.playingState.keyframeIndex,r=0;this.cancelAnimation=c.AnimationFrameLoop.shared.add((i,a)=>{if(n===e-1-this.skipEnd&&this.cancelAnimation){this.cancelAnimation();return}this.currentKeyFrame=this.keyframes[n],this.nextKeyframe=this.keyframes[n+1],n+2<=e-1?this.nextButOneKeyframe=this.keyframes[n+2]:this.nextButOneKeyframe=null;let o=this.currentKeyFrame.position.clone(),s=this.nextKeyframe.position.clone(),c=this.nextKeyframe.position.clone().sub(this.currentKeyFrame.position.clone()).normalize(),u=o.clone().add(c.clone().multiplyScalar(.01)),d=new l.Vector3;this.nextButOneKeyframe===null?d.copy(c):d=this.nextButOneKeyframe.position.clone().sub(this.nextKeyframe.position.clone()).normalize();let f=s.clone().add(d.clone().multiplyScalar(.01));r+=a/1e3*this.rate;let p=r/o.distanceTo(s);p=p>=1?1:p,t.keyframeIndex!==null&&t.progress!==null&&(p=t.progress,t.keyframeIndex=null,t.progress=null);let m=o.clone().lerp(s,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[n].location+o.clone().distanceTo(m),p===1?(r=0,n++,this.playingState.keyframeIndex=n,this.playingState.progress=0):(this.playingState.keyframeIndex=n,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 t=this.keyframes.length;if(t<2)throw Error(`keyframes length must be greater than 2`);this.cancelAnimation&&this.cancelAnimation();let n=this.skipStart,r=this.timeArray.length-1-this.skipEnd;if(n>=r||n<0||r>=this.timeArray.length)throw Error(`Invalid skipStart or skipEnd values`);this.playbackStartTime=this.timeArray[n],this.playbackEndTime=this.timeArray[r],this.playbackEndTime-this.playbackStartTime;let i,a=0,o=null;if(this.playingState.keyframeIndex!==null&&this.playingState.keyframeIndex>=n&&this.playingState.keyframeIndex<t-this.skipEnd){i=this.playingState.keyframeIndex,a=(e=this.playingState.progress)==null?0:e;let t=this.timeArray[i];o=t+((i+1<this.timeArray.length?this.timeArray[i+1]:t)-t)*a}else i=this.skipStart,i>=t-1-this.skipEnd&&(i=t-1-this.skipEnd-1),i<0&&(i=0),o=null;let s=this.playbackStartTime;if(o!==null){let e=o-s;this.startTimestamp=Date.now()-e/this.rate}else this.startTimestamp=Date.now();if(a>0&&i+1<t){let e=this.keyframes[i].position.clone(),t=this.keyframes[i+1].position.clone(),n=e.clone().lerp(t,a),r=t.clone().sub(e).normalize(),o=n.clone().add(r.multiplyScalar(.01));this.virualCamera.position.copy(n),this.virualCamera.lookAt(o)}else this.virualCamera.position.copy(this.keyframes[i].position.clone()),i+1<t&&this.virualCamera.lookAt(this.keyframes[i+1].position.clone());this.virualCamera.computePose(),this.five.setState(Object.assign({},this.virualCamera.pose)),this.cancelAnimation=c.AnimationFrameLoop.shared.add((e,n)=>{if(!this.startTimestamp)return;let r=s+(Date.now()-this.startTimestamp)*this.rate;if(this.playbackEndTime&&r>=this.playbackEndTime){let e=t-1-this.skipEnd;if(e>0&&e<t){if(this.currentKeyFrame=this.keyframes[e-1],this.nextKeyframe=this.keyframes[e],this.virualCamera.position.copy(this.nextKeyframe.position.clone()),e+1<t)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(r);if(a===void 0||a>=t-1-this.skipEnd||(a!==i&&(i=a),i>=t-1-this.skipEnd)||(this.currentKeyFrame=this.keyframes[i],this.nextKeyframe=this.keyframes[i+1],i+2<=t-1?this.nextButOneKeyframe=this.keyframes[i+2]:this.nextButOneKeyframe=null,!this.timeArray))return;let o=this.timeArray[i],c=this.timeArray[i+1]-o,u=c>0?(r-o)/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 l.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=i,this.playingState.progress=d,this.location=this.keyframes[i].location+f.clone().distanceTo(v),this.playingState.keyframeIndex=i,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 t=this.keyframes.length;if(e<0||e>=t)throw Error(`Invalid keyframeIndex`);this.cancelAnimation&&this.cancelAnimation();let n=this.skipStart,r=this.timeArray.length-1-this.skipEnd;if(n>=r||n<0||r>=this.timeArray.length)throw Error(`Invalid skipStart or skipEnd values`);this.playbackStartTime=this.timeArray[n],this.playbackEndTime=this.timeArray[r];let i=this.timeArray[e]-this.playbackStartTime;if(this.startTimestamp=Date.now()-i/this.rate,this.playingState.keyframeIndex=e,this.playingState.progress=0,this.virualCamera.position.copy(this.keyframes[e].position.clone()),e+1<t)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 a=this.playbackStartTime,o=e;this.cancelAnimation=c.AnimationFrameLoop.shared.add((e,n)=>{if(this.timeArray===null||this.timeArray.length===0||!this.startTimestamp)return;let r=a+(Date.now()-this.startTimestamp)*this.rate;if(this.playbackEndTime&&r>=this.playbackEndTime){let e=t-1-this.skipEnd;if(e>0&&e<t){if(this.currentKeyFrame=this.keyframes[e-1],this.nextKeyframe=this.keyframes[e],this.virualCamera.position.copy(this.nextKeyframe.position.clone()),e+1<t)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 i=this.findKeyFrameByTimestamp(r);if(i===void 0||i>=t-1-this.skipEnd||(i!==o&&(o=i),o>=t-1-this.skipEnd))return;this.currentKeyFrame=this.keyframes[o],this.nextKeyframe=this.keyframes[o+1],o+2<=t-1?this.nextButOneKeyframe=this.keyframes[o+2]:this.nextButOneKeyframe=null;let s=this.currentKeyFrame.position.clone(),c=this.nextKeyframe.position.clone(),u=this.nextKeyframe.position.clone().sub(this.currentKeyFrame.position.clone()).normalize(),d=s.clone().add(u.clone().multiplyScalar(.01)),f=new l.Vector3;this.nextButOneKeyframe===null?f.copy(u):f=this.nextButOneKeyframe.position.clone().sub(this.nextKeyframe.position.clone()).normalize();let p=c.clone().add(f.clone().multiplyScalar(.01)),m=this.timeArray[o],h=this.timeArray[o+1]-m,g=0;if(h>0){let e=r-m;g=Math.max(0,Math.min(1,e/h))}let _=g*g*(3-2*g),v=s.clone().lerp(c,_),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 l.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,n=.1,r=new H(t,n,1,0,1),i=new H(t,n,1,0,1),a=new H(t,n,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 n=new Float32Array(t.length/3);for(let e=0;e<n.length;e++)if(e===0)n[e]=0;else{let r=new l.Vector3(t[e-3],t[e-2],t[e-1]);n[e]=new l.Vector3(t[e],t[e+1],t[e+2]).distanceTo(r)+n[e-1]}this.totalDistance=n[n.length-1];for(let o=0;o<n.length;o++){let s=new l.Vector3(0,0,0),c=0;for(let e=o-5;e<o+6;e++)e>=0&&e<n.length&&(s.add(new l.Vector3(t[e*3],t[e*3+1],t[e*3+2])),c++);s.divideScalar(c).applyMatrix4(e.transform);let u=r.filter(s.x),d=i.filter(s.y),f=a.filter(s.z),p={position:new l.Vector3(u,d,f),location:n[o]};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 t={keyframeIndex:null,progress:null};this.playingState.keyframeIndex!==null&&this.playingState.progress!==null?(t.keyframeIndex=this.playingState.keyframeIndex,t.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 n=this.playingState.keyframeIndex,r=0;this.cancelAnimation=c.AnimationFrameLoop.shared.add((i,a)=>{if(n===e-1-this.skipEnd&&this.cancelAnimation){this.cancelAnimation();return}this.currentKeyFrame=this.keyframes[n],this.nextKeyframe=this.keyframes[n+1],n+2<=e-1?this.nextButOneKeyframe=this.keyframes[n+2]:this.nextButOneKeyframe=null;let o=this.currentKeyFrame.position.clone(),s=this.nextKeyframe.position.clone(),c=this.nextKeyframe.position.clone().sub(this.currentKeyFrame.position.clone()).normalize(),u=o.clone().add(c.clone().multiplyScalar(.01)),d=new l.Vector3;this.nextButOneKeyframe===null?d.copy(c):d=this.nextButOneKeyframe.position.clone().sub(this.nextKeyframe.position.clone()).normalize();let f=s.clone().add(d.clone().multiplyScalar(.01));r+=a/1e3*this.rate;let p=r/o.distanceTo(s);p=p>=1?1:p,t.keyframeIndex!==null&&t.progress!==null&&(p=t.progress,t.keyframeIndex=null,t.progress=null);let m=o.clone().lerp(s,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[n].location+o.clone().distanceTo(m),p===1?(r=0,n++,this.playingState.keyframeIndex=n,this.playingState.progress=0):(this.playingState.keyframeIndex=n,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 t=this.keyframes.length;if(t<2)throw Error(`keyframes length must be greater than 2`);this.cancelAnimation&&this.cancelAnimation();let n=this.skipStart,r=this.timeArray.length-1-this.skipEnd;if(n>=r||n<0||r>=this.timeArray.length)throw Error(`Invalid skipStart or skipEnd values`);this.playbackStartTime=this.timeArray[n],this.playbackEndTime=this.timeArray[r],this.playbackEndTime-this.playbackStartTime;let i,a=0,o=null;if(this.playingState.keyframeIndex!==null&&this.playingState.keyframeIndex>=n&&this.playingState.keyframeIndex<t-this.skipEnd){i=this.playingState.keyframeIndex,a=(e=this.playingState.progress)==null?0:e;let t=this.timeArray[i];o=t+((i+1<this.timeArray.length?this.timeArray[i+1]:t)-t)*a}else i=this.skipStart,i>=t-1-this.skipEnd&&(i=t-1-this.skipEnd-1),i<0&&(i=0),o=null;let s=this.playbackStartTime;if(o!==null){let e=o-s;this.startTimestamp=Date.now()-e/this.rate}else this.startTimestamp=Date.now();if(a>0&&i+1<t){let e=this.keyframes[i].position.clone(),t=this.keyframes[i+1].position.clone(),n=e.clone().lerp(t,a),r=t.clone().sub(e).normalize(),o=n.clone().add(r.multiplyScalar(.01));this.virualCamera.position.copy(n),this.virualCamera.lookAt(o)}else this.virualCamera.position.copy(this.keyframes[i].position.clone()),i+1<t&&this.virualCamera.lookAt(this.keyframes[i+1].position.clone());this.virualCamera.computePose(),this.five.setState(Object.assign({},this.virualCamera.pose)),this.cancelAnimation=c.AnimationFrameLoop.shared.add((e,n)=>{if(!this.startTimestamp)return;let r=s+(Date.now()-this.startTimestamp)*this.rate;if(this.playbackEndTime&&r>=this.playbackEndTime){let e=t-1-this.skipEnd;if(e>0&&e<t){if(this.currentKeyFrame=this.keyframes[e-1],this.nextKeyframe=this.keyframes[e],this.virualCamera.position.copy(this.nextKeyframe.position.clone()),e+1<t)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(r);if(a===void 0||a>=t-1-this.skipEnd||(a!==i&&(i=a),i>=t-1-this.skipEnd)||(this.currentKeyFrame=this.keyframes[i],this.nextKeyframe=this.keyframes[i+1],i+2<=t-1?this.nextButOneKeyframe=this.keyframes[i+2]:this.nextButOneKeyframe=null,!this.timeArray))return;let o=this.timeArray[i],c=this.timeArray[i+1]-o,u=c>0?(r-o)/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 l.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=i,this.playingState.progress=d,this.location=this.keyframes[i].location+f.clone().distanceTo(v),this.playingState.keyframeIndex=i,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 t=this.keyframes.length;if(e<0||e>=t)throw Error(`Invalid keyframeIndex`);this.cancelAnimation&&this.cancelAnimation();let n=this.skipStart,r=this.timeArray.length-1-this.skipEnd;if(n>=r||n<0||r>=this.timeArray.length)throw Error(`Invalid skipStart or skipEnd values`);this.playbackStartTime=this.timeArray[n],this.playbackEndTime=this.timeArray[r];let i=this.timeArray[e]-this.playbackStartTime;if(this.startTimestamp=Date.now()-i/this.rate,this.playingState.keyframeIndex=e,this.playingState.progress=0,this.virualCamera.position.copy(this.keyframes[e].position.clone()),e+1<t)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 a=this.playbackStartTime,o=e;this.cancelAnimation=c.AnimationFrameLoop.shared.add((e,n)=>{if(this.timeArray===null||this.timeArray.length===0||!this.startTimestamp)return;let r=a+(Date.now()-this.startTimestamp)*this.rate;if(this.playbackEndTime&&r>=this.playbackEndTime){let e=t-1-this.skipEnd;if(e>0&&e<t){if(this.currentKeyFrame=this.keyframes[e-1],this.nextKeyframe=this.keyframes[e],this.virualCamera.position.copy(this.nextKeyframe.position.clone()),e+1<t)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 i=this.findKeyFrameByTimestamp(r);if(i===void 0||i>=t-1-this.skipEnd||(i!==o&&(o=i),o>=t-1-this.skipEnd))return;this.currentKeyFrame=this.keyframes[o],this.nextKeyframe=this.keyframes[o+1],o+2<=t-1?this.nextButOneKeyframe=this.keyframes[o+2]:this.nextButOneKeyframe=null;let s=this.currentKeyFrame.position.clone(),c=this.nextKeyframe.position.clone(),u=this.nextKeyframe.position.clone().sub(this.currentKeyFrame.position.clone()).normalize(),d=s.clone().add(u.clone().multiplyScalar(.01)),f=new l.Vector3;this.nextButOneKeyframe===null?f.copy(u):f=this.nextButOneKeyframe.position.clone().sub(this.nextKeyframe.position.clone()).normalize();let p=c.clone().add(f.clone().multiplyScalar(.01)),m=this.timeArray[o],h=this.timeArray[o+1]-m,g=0;if(h>0){let e=r-m;g=Math.max(0,Math.min(1,e/h))}let _=g*g*(3-2*g),v=s.clone().lerp(c,_),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 u.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,t){super(e),this.group=new l.Group,this.mesh=(()=>{let e=new l.CylinderGeometry(.12,.12,1,32,1,!0);e.translate(0,.5,0);let t=new l.ShaderMaterial({vertexShader:oe,fragmentShader:se,uniforms:{map:{value:new l.Texture},progress:{value:0},opacity:{value:0}},transparent:!0,depthTest:!1});return new l.Mesh(e,t)})(),this.panoMesh=new c.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},t==null?void 0:t.initialState),this._config=Object.assign(Object.assign({},t==null?void 0:t.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 l.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=c.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 l.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 l.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 l.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 n=new l.InstancedInterleavedBuffer(t,6,1);return this.setAttribute(`instanceStart`,new l.InterleavedBufferAttribute(n,3,0)),this.setAttribute(`instanceEnd`,new l.InterleavedBufferAttribute(n,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 n=new l.InstancedInterleavedBuffer(t,6,1);return this.setAttribute(`instanceColorStart`,new l.InterleavedBufferAttribute(n,3,0)),this.setAttribute(`instanceColorEnd`,new l.InterleavedBufferAttribute(n,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 l.WireframeGeometry(e.geometry)),this}fromLineSegments(e){var t=e.geometry;if(t instanceof l.Geometry){let e=new l.BufferGeometry().fromGeometry(t);this.setPositions(e.attributes.position.array)}else t instanceof l.BufferGeometry&&this.setPositions(t.attributes.position.array);return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new l.Box3);let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){let n=new l.Box3;this.boundingBox.setFromBufferAttribute(e),n.setFromBufferAttribute(t),this.boundingBox.union(n)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new l.Sphere),this.boundingBox===null&&this.computeBoundingBox();let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){let n=this.boundingSphere.center;this.boundingBox.getCenter(n);let r=0,i=new l.Vector3;for(let a=0,o=e.count;a<o;a++)i.fromBufferAttribute(e,a),r=Math.max(r,n.distanceToSquared(i)),i.fromBufferAttribute(t,a),r=Math.max(r,n.distanceToSquared(i));this.boundingSphere.radius=Math.sqrt(r),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:l.UniformsUtils.merge([l.UniformsLib.common,l.UniformsLib.fog,{linewidth:{value:1},resolution:{value:new l.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 u.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,t){super(e),this.group=new l.Group,this.mesh=(()=>{let e=new l.CylinderGeometry(.12,.12,1,32,1,!0);e.translate(0,.5,0);let t=new l.ShaderMaterial({vertexShader:se,fragmentShader:ce,uniforms:{map:{value:new l.Texture},progress:{value:0},opacity:{value:0}},transparent:!0,depthTest:!1});return new l.Mesh(e,t)})(),this.panoMesh=new c.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},t==null?void 0:t.initialState),this._config=Object.assign(Object.assign({},t==null?void 0:t.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 l.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=c.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 l.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 l.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 l.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 n=new l.InstancedInterleavedBuffer(t,6,1);return this.setAttribute(`instanceStart`,new l.InterleavedBufferAttribute(n,3,0)),this.setAttribute(`instanceEnd`,new l.InterleavedBufferAttribute(n,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 n=new l.InstancedInterleavedBuffer(t,6,1);return this.setAttribute(`instanceColorStart`,new l.InterleavedBufferAttribute(n,3,0)),this.setAttribute(`instanceColorEnd`,new l.InterleavedBufferAttribute(n,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 l.WireframeGeometry(e.geometry)),this}fromLineSegments(e){var t=e.geometry;if(t instanceof l.Geometry){let e=new l.BufferGeometry().fromGeometry(t);this.setPositions(e.attributes.position.array)}else t instanceof l.BufferGeometry&&this.setPositions(t.attributes.position.array);return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new l.Box3);let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){let n=new l.Box3;this.boundingBox.setFromBufferAttribute(e),n.setFromBufferAttribute(t),this.boundingBox.union(n)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new l.Sphere),this.boundingBox===null&&this.computeBoundingBox();let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){let n=this.boundingSphere.center;this.boundingBox.getCenter(n);let r=0,i=new l.Vector3;for(let a=0,o=e.count;a<o;a++)i.fromBufferAttribute(e,a),r=Math.max(r,n.distanceToSquared(i)),i.fromBufferAttribute(t,a),r=Math.max(r,n.distanceToSquared(i));this.boundingSphere.radius=Math.sqrt(r),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:l.UniformsUtils.merge([l.UniformsLib.common,l.UniformsLib.fog,{linewidth:{value:1},resolution:{value:new l.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 n=[],r=0;for(let i=0;i<e.length;i++){let a=e[i];i>0&&(r+=a.distanceTo(e[i-1]));let o=a.clone().project(t),s=o.x<-1||o.x>1||o.y<-1||o.y>1||o.z<-1||o.z>1;n.push({point:a.clone(),screenPos:new l.Vector2(o.x,o.y),distanceFromStart:r,isOffscreen:s})}return n}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,n;let r=this.paths.get(e);if(!r||!r.enabled)return;let i=performance.now()/1e3,{particleCount:a,maxDistance:o}=this._config,s=((t=r.lines[0])==null?void 0:t.material.uniforms.totalLength.value)||1,c=Math.max(.01,s-r.startOffset-r.endOffset),u=r.speed,d=(i-r.cycleStartTime)*u/c%1;if(r.isInitialAnimation){let e=d*c;if(r.enableSubMesh&&e>=1&&!r.subMeshUnfoldStarted&&(r.subMeshUnfoldStarted=!0,r.subMeshUnfoldStartTime=i),r.enableSubMesh&&r.subMeshUnfoldStarted&&r.subMeshUnfoldProgress<1&&!r.isPaused){let e=(n=r.config.range)==null?this._config.range:n,t=i-r.subMeshUnfoldStartTime;r.subMeshUnfoldProgress=Math.min(1,t*u/(c-2*e)),r.subMeshMaterial.uniforms.unfoldProgress.value=r.subMeshUnfoldProgress}d<r.lastAnimationProgress&&(r.isPathlineInitialAnimation=!1,(!r.enableSubMesh||r.subMeshUnfoldProgress>=1)&&(r.isInitialAnimation=!1))}else r.enableSubMesh&&(r.subMeshMaterial.uniforms.unfoldProgress.value=1);if(r.lastAnimationProgress=d,r.lastUpdateTime=i,r.isPathlineInitialAnimation&&r.lines.forEach(e=>{e.material.uniforms.time.value=i,e.material.uniforms.animationProgress.value=d}),r.isPathlineInitialAnimation){let e=null,t=1/0;if(r.lines.forEach(n=>{let r=n.geometry,i=r.attributes.instanceDistanceStart,a=r.attributes.instanceDistanceEnd,o=i.count;for(let s=0;s<o;s++){let o=i.getX(s)/n.material.uniforms.totalLength.value,c=a.getX(s)/n.material.uniforms.totalLength.value;if(d>=o&&d<=c){let n=(d-o)/(c-o),i=new l.Vector3().fromBufferAttribute(r.attributes.instanceStart,s),a=new l.Vector3().fromBufferAttribute(r.attributes.instanceEnd,s),u=new l.Vector3().lerpVectors(i,a,n),f=Math.abs(d-(o+c)/2);f<t&&(t=f,e=u)}}}),e)for(let t=0;t<a;t++){let n=r.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),r.particlePositions[t*3]=e.x,r.particlePositions[t*3+1]=e.y,r.particlePositions[t*3+2]=e.z,n.startPos.copy(e),n.alpha=0)}for(let e=0;e<a;e++){let t=r.particleInfos[e];if(t.active){t.age+=.016;let n=r.particlePositions[e*3]-t.startPos.x,i=r.particlePositions[e*3+1]-t.startPos.y,a=r.particlePositions[e*3+2]-t.startPos.z;(Math.sqrt(n*n+i*i+a*a)>=o||t.age>=t.life)&&(t.active=!1,r.particlePositions[e*3]=9999,r.particlePositions[e*3+1]=9999,r.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),r.particlePositions[e*3]+=t.velocity.x,r.particlePositions[e*3+1]+=t.velocity.y,r.particlePositions[e*3+2]+=t.velocity.z;let s=t.age/t.life;s<.2?t.alpha=s/.2:s>.8?t.alpha=(1-s)/.2:t.alpha=1}}r.particleGeometry.attributes.position.needsUpdate=!0,r.particleMaterial.opacity=.6}r.enableSubMesh&&(r.subMeshMaterial.uniforms.animationProgress.value=d),this.five.needsRender=!0}startPathAnimation(e,t){var n,r;let i=this.paths.get(e);if(!i)return console.warn(`DynamicPathLinePlugin: 路径 ${e} 不存在`),!1;if(i.animationId!==null)return!1;let a=(n=t==null?void 0:t.startPointIndex)==null?0:n,o=(r=t==null?void 0:t.fromStart)==null?!1:r;if(!i.isPaused||o){let e=0,t=a;if(t>0){let n=i.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])}i.startOffset=e,i.lines.forEach(t=>{t.material.uniforms.startOffset.value=e}),i.enableSubMesh&&(i.subMeshMaterial.uniforms.startOffset.value=e)}let s=performance.now()/1e3;if(!o&&i.isPaused&&i.pausedProgress>0){let e=i.curve.getLength(),t=Math.max(.01,e-i.startOffset-i.endOffset),n=i.speed;i.cycleStartTime=s-i.pausedProgress*t/n,i.subMeshUnfoldStarted&&i.subMeshUnfoldProgress<1&&(i.subMeshUnfoldStartTime=s-(i.pausedTime-i.subMeshUnfoldStartTime)),i.isPaused=!1}else i.cycleStartTime=s,i.isPaused=!1,i.pausedProgress=0;return i.lastUpdateTime=s,this.highlightPath(e,!0),i.animationId=c.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,t){let n=this.paths.get(e);if(!n)return;let r=n.lines,i=0,a=c.AnimationFrameLoop.shared.add((e,o)=>{i=Math.min(1,i+o/250),t?(r.forEach(e=>{e.material.uniforms.opacity.value=.3+i*.7}),n.particleMaterial.opacity=.3+i*.7,n.enableSubMesh&&(n.subMeshMaterial.uniforms.globalOpacity.value=.3+i*.7)):(r.forEach(e=>{e.material.uniforms.opacity.value=1-i*.7}),n.particleMaterial.opacity=.6*(1-i*.7),n.enableSubMesh&&(n.subMeshMaterial.uniforms.globalOpacity.value=1-i*.7)),this.five.needsRender=!0,i===1&&a()})}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);exports.BackgroundPlugin=U,Object.defineProperty(exports,`BasePlugin`,{enumerable:!0,get:function(){return p}}),exports.CSS3DRenderer=ne,exports.DynamicPathLinePlugin=be,exports.ItemMaskPlugin=k,exports.OrbitControls=j,exports.OrientationPlugin=ie,exports.PanoAnimePlugin=fe,exports.RoundedBoxGeometry=re,exports.TrajectoryPlugin=G;
811
+ `})}projectPointsToScreen(e,t){let n=[],r=0;for(let i=0;i<e.length;i++){let a=e[i];i>0&&(r+=a.distanceTo(e[i-1]));let o=a.clone().project(t),s=o.x<-1||o.x>1||o.y<-1||o.y>1||o.z<-1||o.z>1;n.push({point:a.clone(),screenPos:new l.Vector2(o.x,o.y),distanceFromStart:r,isOffscreen:s})}return n}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,n;let r=this.paths.get(e);if(!r||!r.enabled)return;let i=performance.now()/1e3,{particleCount:a,maxDistance:o}=this._config,s=((t=r.lines[0])==null?void 0:t.material.uniforms.totalLength.value)||1,c=Math.max(.01,s-r.startOffset-r.endOffset),u=r.speed,d=(i-r.cycleStartTime)*u/c%1;if(r.isInitialAnimation){let e=d*c;if(r.enableSubMesh&&e>=1&&!r.subMeshUnfoldStarted&&(r.subMeshUnfoldStarted=!0,r.subMeshUnfoldStartTime=i),r.enableSubMesh&&r.subMeshUnfoldStarted&&r.subMeshUnfoldProgress<1&&!r.isPaused){let e=(n=r.config.range)==null?this._config.range:n,t=i-r.subMeshUnfoldStartTime;r.subMeshUnfoldProgress=Math.min(1,t*u/(c-2*e)),r.subMeshMaterial.uniforms.unfoldProgress.value=r.subMeshUnfoldProgress}d<r.lastAnimationProgress&&(r.isPathlineInitialAnimation=!1,(!r.enableSubMesh||r.subMeshUnfoldProgress>=1)&&(r.isInitialAnimation=!1))}else r.enableSubMesh&&(r.subMeshMaterial.uniforms.unfoldProgress.value=1);if(r.lastAnimationProgress=d,r.lastUpdateTime=i,r.isPathlineInitialAnimation&&r.lines.forEach(e=>{e.material.uniforms.time.value=i,e.material.uniforms.animationProgress.value=d}),r.isPathlineInitialAnimation){let e=null,t=1/0;if(r.lines.forEach(n=>{let r=n.geometry,i=r.attributes.instanceDistanceStart,a=r.attributes.instanceDistanceEnd,o=i.count;for(let s=0;s<o;s++){let o=i.getX(s)/n.material.uniforms.totalLength.value,c=a.getX(s)/n.material.uniforms.totalLength.value;if(d>=o&&d<=c){let n=(d-o)/(c-o),i=new l.Vector3().fromBufferAttribute(r.attributes.instanceStart,s),a=new l.Vector3().fromBufferAttribute(r.attributes.instanceEnd,s),u=new l.Vector3().lerpVectors(i,a,n),f=Math.abs(d-(o+c)/2);f<t&&(t=f,e=u)}}}),e)for(let t=0;t<a;t++){let n=r.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),r.particlePositions[t*3]=e.x,r.particlePositions[t*3+1]=e.y,r.particlePositions[t*3+2]=e.z,n.startPos.copy(e),n.alpha=0)}for(let e=0;e<a;e++){let t=r.particleInfos[e];if(t.active){t.age+=.016;let n=r.particlePositions[e*3]-t.startPos.x,i=r.particlePositions[e*3+1]-t.startPos.y,a=r.particlePositions[e*3+2]-t.startPos.z;(Math.sqrt(n*n+i*i+a*a)>=o||t.age>=t.life)&&(t.active=!1,r.particlePositions[e*3]=9999,r.particlePositions[e*3+1]=9999,r.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),r.particlePositions[e*3]+=t.velocity.x,r.particlePositions[e*3+1]+=t.velocity.y,r.particlePositions[e*3+2]+=t.velocity.z;let s=t.age/t.life;s<.2?t.alpha=s/.2:s>.8?t.alpha=(1-s)/.2:t.alpha=1}}r.particleGeometry.attributes.position.needsUpdate=!0,r.particleMaterial.opacity=.6}r.enableSubMesh&&(r.subMeshMaterial.uniforms.animationProgress.value=d),this.five.needsRender=!0}startPathAnimation(e,t){var n,r;let i=this.paths.get(e);if(!i)return console.warn(`DynamicPathLinePlugin: 路径 ${e} 不存在`),!1;if(i.animationId!==null)return!1;let a=(n=t==null?void 0:t.startPointIndex)==null?0:n,o=(r=t==null?void 0:t.fromStart)==null?!1:r;if(!i.isPaused||o){let e=0,t=a;if(t>0){let n=i.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])}i.startOffset=e,i.lines.forEach(t=>{t.material.uniforms.startOffset.value=e}),i.enableSubMesh&&(i.subMeshMaterial.uniforms.startOffset.value=e)}let s=performance.now()/1e3;if(!o&&i.isPaused&&i.pausedProgress>0){let e=i.curve.getLength(),t=Math.max(.01,e-i.startOffset-i.endOffset),n=i.speed;i.cycleStartTime=s-i.pausedProgress*t/n,i.subMeshUnfoldStarted&&i.subMeshUnfoldProgress<1&&(i.subMeshUnfoldStartTime=s-(i.pausedTime-i.subMeshUnfoldStartTime)),i.isPaused=!1}else i.cycleStartTime=s,i.isPaused=!1,i.pausedProgress=0;return i.lastUpdateTime=s,this.highlightPath(e,!0),i.animationId=c.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,t){let n=this.paths.get(e);if(!n)return;let r=n.lines,i=0,a=c.AnimationFrameLoop.shared.add((e,o)=>{i=Math.min(1,i+o/250),t?(r.forEach(e=>{e.material.uniforms.opacity.value=.3+i*.7}),n.particleMaterial.opacity=.3+i*.7,n.enableSubMesh&&(n.subMeshMaterial.uniforms.globalOpacity.value=.3+i*.7)):(r.forEach(e=>{e.material.uniforms.opacity.value=1-i*.7}),n.particleMaterial.opacity=.6*(1-i*.7),n.enableSubMesh&&(n.subMeshMaterial.uniforms.globalOpacity.value=1-i*.7)),this.five.needsRender=!0,i===1&&a()})}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 n=e.content.data.positionArray,r=n.length/3,i=.01,a=.1,o=new xe(i,a,1,0,1),s=new xe(i,a,1,0,1),c=new xe(i,a,1,0,1),u=new Float32Array(r);for(let e=0;e<r;e++)if(e===0)u[e]=0;else{let t=new l.Vector3(n[(e-1)*3],n[(e-1)*3+1],n[(e-1)*3+2]);u[e]=new l.Vector3(n[e*3],n[e*3+1],n[e*3+2]).distanceTo(t)+u[e-1]}for(let i=0;i<r;i++){let a=new l.Vector3(0,0,0),d=0;for(let e=i-5;e<i+6;e++)e>=0&&e<r&&(a.add(new l.Vector3(n[e*3],n[e*3+1],n[e*3+2])),d++);a.divideScalar(d).applyMatrix4(e.transform);let f=o.filter(a.x),p=s.filter(a.y),m=c.filter(a.z);t.push({position:new l.Vector3(f,p,m),location:u[i]})}return t}computeAABB2D(e){let t=1/0,n=-1/0,r=1/0,i=-1/0;for(let a of e)a.position.x<t&&(t=a.position.x),a.position.x>n&&(n=a.position.x),a.position.z<r&&(r=a.position.z),a.position.z>i&&(i=a.position.z);return{min:new l.Vector2(t,r),max:new l.Vector2(n,i)}}findClosestKeyframeToRay(e,t){let n=1/0,r=t[0].position.clone(),i=new l.Vector3;for(let a of t){e.closestPointToPoint(a.position,i);let t=i.distanceTo(a.position);t<n&&(n=t,r=a.position.clone())}return r}getCameraCurve(){return m(this,void 0,void 0,function*(){var e,t,n;let r=(n=(t=(e=this.five.model.viewLayers[0])==null?void 0:e.scene)==null?void 0:t.trajectories)==null?void 0:n[0];if(!r)throw Error(`未找到轨迹数据`);r.visible=!0,yield new Promise(e=>{let t=c.AnimationFrameLoop.shared.add(()=>{r.content.loadState===`READY`&&(t(),e(),r.visible=!1)})});let i=this.extractKeyframes(r);if(i.length<2)throw Error(`轨迹关键帧不足,至少需要2个关键帧`);this.keyframes=i;let a=this.computeAABB2D(i);this.boundingAABB=a;let o=this.curveHeight,s=new l.Vector3((a.min.x+a.max.x)/2,o,(a.min.y+a.max.y)/2),u=(a.max.x-a.min.x)/2,d=(a.max.y-a.min.y)/2,f=Math.sqrt(u*u+d*d),p=e=>{let t=new l.Vector3().subVectors(e,s);return t.length()<.001&&t.set(1,0,0),s.clone().add(t.normalize().multiplyScalar(f))},m=new l.Vector3(i[0].position.x,o,i[0].position.z),h=p(m),g=new l.Vector3().subVectors(s,m).normalize(),_=new l.Ray(m,g),v=new l.Vector3(-g.z,0,g.x).normalize(),y=new l.Ray(s,v),b=this.findClosestKeyframeToRay(y,i),x=p(new l.Vector3(b.x,o,b.z)),S=this.findClosestKeyframeToRay(_,i),C=p(new l.Vector3(S.x,o,S.z));return new l.CatmullRomCurve3([h,x,C],!1,`centripetal`,.5)})}findRenderMesh(){let e=null;if(this.five.scene.traverse(t=>{e||t instanceof l.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(),n=new l.Vector3(e.min.x,0,e.min.y),r=new l.Vector3(e.max.x,3,e.max.y);t.material.uniforms.u_aggregationBoundsMin.value.copy(n),t.material.uniforms.u_aggregationBoundsMax.value.copy(r),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 t=performance.now(),n=this.duration;this.cancelAnimation=c.AnimationFrameLoop.shared.add(()=>{let r=performance.now()-t,i=Math.min(r/n,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(),t=this.boundingAABB,n=new l.Vector3((t.min.x+t.max.x)/2,this.curveHeight,(t.min.y+t.max.y)/2),r=e.getPointAt(0),i=new c.Camera(90).copy(this.five.camera);i.position.copy(r),i.lookAt(n),i.computePose(0),this.five.setState(Object.assign({},i.pose)),this.setBounds();let a=this.findRenderMesh().material.uniforms;a.u_aggregationEnabled.value=!0,a.u_aggregationProgress.value=0,a.u_aggregationPointDuration.value=Math.min(this.pointDuration/this.duration,1),this.five.needsRender=!0;let o=this.duration,s=performance.now();return new Promise(t=>{this.cancelAnimation=c.AnimationFrameLoop.shared.add(()=>{let r=performance.now()-s,c=Math.min(r/o,1),l=c*c*(3-2*c);a.u_aggregationProgress.value=l,this.five.modelSceneNeedsRender=!0;let u=e.getPointAt(l);i.position.copy(u),i.lookAt(n),i.computePose(0),this.five.setState(Object.assign({},i.pose)),this.five.needsRender=!0,c>=1&&(a.u_aggregationEnabled.value=!1,a.u_aggregationProgress.value=1,this.cancelAnimation&&(this.cancelAnimation(),this.cancelAnimation=null),t())})})})}},Ce=(e,t)=>new Se(e,t);exports.BackgroundPlugin=V,Object.defineProperty(exports,`BasePlugin`,{enumerable:!0,get:function(){return p}}),exports.CSS3DRenderer=ie,exports.DynamicPathLinePlugin=be,exports.GaussianSplattingEntranceAnimationPlugin=Ce,exports.ItemMaskPlugin=k,exports.OrbitControls=A,exports.OrientationPlugin=z,exports.PanoAnimePlugin=fe,exports.RoundedBoxGeometry=ae,exports.TrajectoryPlugin=W;