@shopware-ag/dive 3.0.11 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (200) hide show
  1. package/README.md +31 -5
  2. package/build/chunks/{AssetCache-MtISiPD2.cjs → AssetCache-DdxevusY.cjs} +1 -1
  3. package/build/chunks/{AssetCache-DOB996Vk.mjs → AssetCache-MXFCGzZU.mjs} +1 -1
  4. package/build/chunks/AssetExporter-CD2iuQce.mjs +108 -0
  5. package/build/chunks/AssetExporter-CoL-QXkB.cjs +1 -0
  6. package/build/chunks/{AssetLoader-B1n3KGOu.cjs → AssetLoader-BDDJG9JL.cjs} +2 -2
  7. package/build/chunks/{AssetLoader-BY5D3Cvc.mjs → AssetLoader-kRhuVN4p.mjs} +12 -21
  8. package/build/chunks/FileTypes-DGSsi-AX.mjs +2294 -0
  9. package/build/chunks/FileTypes-gD_1MonW.cjs +29 -0
  10. package/build/chunks/ModelComponent-Cj3ff6nL.cjs +1 -0
  11. package/build/chunks/ModelComponent-DkfAgTL0.mjs +87 -0
  12. package/build/chunks/OrbitController-DFPcXvlO.cjs +1 -0
  13. package/build/chunks/OrbitController-DLEyTvUt.mjs +612 -0
  14. package/build/chunks/SpriteTextComponent-ByefJLeU.cjs +1 -0
  15. package/build/chunks/SpriteTextComponent-CG5vfiFy.mjs +83 -0
  16. package/build/chunks/collectAnimations-BgYCN1le.mjs +35 -0
  17. package/build/chunks/collectAnimations-C3HfZHte.cjs +1 -0
  18. package/build/chunks/contributesToBounds-C1mva__U.cjs +1 -0
  19. package/build/chunks/contributesToBounds-DYmHYES4.mjs +14 -0
  20. package/build/chunks/detachTransformControls-2XQrpLN-.cjs +1 -0
  21. package/build/chunks/detachTransformControls-Dr3TIdVy.mjs +209 -0
  22. package/build/chunks/{isFileTypeSupported-C-hfGk-7.mjs → isFileExtensionSupported-CgcqpgqN.mjs} +1 -1
  23. package/build/chunks/{isFileTypeSupported-xoGjHFuz.cjs → isFileExtensionSupported-RvlnH2dr.cjs} +1 -1
  24. package/build/chunks/isVisibleInHierarchy-D9JcLqR5.cjs +1 -0
  25. package/build/chunks/isVisibleInHierarchy-KzVGvDEw.mjs +21 -0
  26. package/build/components/boundingbox/BoundingBoxComponent.d.ts +100 -0
  27. package/build/components/boundingbox/index.d.ts +1 -0
  28. package/build/components/camera/CameraComponent.d.ts +75 -0
  29. package/build/components/camera/index.d.ts +2 -0
  30. package/build/components/camera/perspective/PerspectiveCameraComponent.d.ts +39 -0
  31. package/build/components/grid/GridComponent.d.ts +50 -0
  32. package/build/components/index.d.ts +6 -9
  33. package/build/components/light/LightComponent.d.ts +65 -0
  34. package/build/components/light/ambient/AmbientLightComponent.d.ts +10 -0
  35. package/build/components/light/directional/DirectionalLightComponent.d.ts +23 -0
  36. package/build/components/light/hemi/HemisphereLightComponent.d.ts +21 -0
  37. package/build/components/light/index.d.ts +5 -3
  38. package/build/components/light/point/PointLightComponent.d.ts +26 -0
  39. package/build/components/line/MultiLineComponent.d.ts +133 -0
  40. package/build/components/line/index.d.ts +1 -0
  41. package/build/components/mesh/MeshComponent.d.ts +74 -0
  42. package/build/components/mesh/floor/FloorComponent.d.ts +36 -0
  43. package/build/components/mesh/index.d.ts +4 -0
  44. package/build/components/mesh/model/ModelComponent.d.ts +67 -0
  45. package/build/components/mesh/primitive/PrimitiveComponent.d.ts +43 -0
  46. package/build/components/spritetext/SpriteTextComponent.d.ts +58 -0
  47. package/build/constants/VisibilityLayerMask.d.ts +23 -0
  48. package/build/dive.cjs +1 -1
  49. package/build/dive.mjs +252 -774
  50. package/build/engine/Dive.d.ts +17 -13
  51. package/build/engine/boundingbox/BoundingBox.d.ts +76 -0
  52. package/build/engine/component/Component.d.ts +236 -0
  53. package/build/engine/environment/Environment.d.ts +8 -18
  54. package/build/engine/index.d.ts +4 -1
  55. package/build/engine/node/Node.d.ts +189 -0
  56. package/build/engine/promise/abortable/AbortablePromise.d.ts +8 -0
  57. package/build/engine/renderer/Renderer.d.ts +43 -7
  58. package/build/engine/scene/Scene.d.ts +88 -4
  59. package/build/engine/scene/root/Root.d.ts +29 -0
  60. package/build/engine/scene/xrroot/XRRoot.d.ts +1 -1
  61. package/build/engine/view/View.d.ts +15 -4
  62. package/build/helpers/collectAnimations/collectAnimations.d.ts +23 -0
  63. package/build/helpers/computeProductBounds/computeProductBounds.d.ts +18 -0
  64. package/build/helpers/contributesToBounds/contributesToBounds.d.ts +17 -0
  65. package/build/helpers/detachTransformControls/detachTransformControls.d.ts +15 -0
  66. package/build/helpers/disposeComponents/disposeComponents.d.ts +20 -0
  67. package/build/helpers/findSceneRecursive/findSceneRecursive.d.ts +7 -3
  68. package/build/helpers/implementsInterface/implementsInterface.d.ts +11 -0
  69. package/build/helpers/index.d.ts +6 -1
  70. package/build/helpers/isVisibleInHierarchy/isVisibleInHierarchy.d.ts +12 -0
  71. package/build/index.d.ts +0 -1
  72. package/build/plugins/animation/index.mjs +3 -2
  73. package/build/plugins/animation/src/system/AnimationSystem.d.ts +3 -2
  74. package/build/plugins/ar/index.cjs +1 -1
  75. package/build/plugins/ar/index.mjs +2 -2
  76. package/build/plugins/ar/src/webxr/WebXR.d.ts +7 -0
  77. package/build/plugins/assetcache/index.cjs +1 -1
  78. package/build/plugins/assetcache/index.mjs +1 -1
  79. package/build/plugins/assetexporter/index.cjs +1 -1
  80. package/build/plugins/assetexporter/index.mjs +1 -1
  81. package/build/plugins/assetexporter/src/AssetExporter.d.ts +12 -0
  82. package/build/plugins/assetloader/index.cjs +1 -1
  83. package/build/plugins/assetloader/index.mjs +2 -2
  84. package/build/plugins/mediacreator/index.cjs +1 -1
  85. package/build/plugins/mediacreator/index.mjs +32 -30
  86. package/build/plugins/mediacreator/src/MediaCreator.d.ts +1 -2
  87. package/build/plugins/orbitcontroller/index.cjs +1 -1
  88. package/build/plugins/orbitcontroller/index.d.ts +1 -0
  89. package/build/plugins/orbitcontroller/index.mjs +1 -1
  90. package/build/plugins/orbitcontroller/src/OrbitController.d.ts +39 -6
  91. package/build/plugins/orientationdisplay/index.cjs +1 -1
  92. package/build/plugins/orientationdisplay/index.mjs +41 -33
  93. package/build/plugins/orientationdisplay/src/OrientationDisplay.d.ts +3 -3
  94. package/build/plugins/quickview/index.cjs +1 -1
  95. package/build/plugins/quickview/index.mjs +71 -19
  96. package/build/plugins/quickview/src/QuickView.d.ts +40 -8
  97. package/build/plugins/quickview/types/QuickViewSettings.d.ts +14 -0
  98. package/build/plugins/state/index.cjs +1 -27
  99. package/build/plugins/state/index.mjs +2031 -4135
  100. package/build/plugins/state/src/EngineGateway.d.ts +98 -0
  101. package/build/plugins/state/src/EntityRegistry.d.ts +51 -0
  102. package/build/plugins/state/src/State.d.ts +20 -9
  103. package/build/plugins/state/src/actions/camera/computeencompassingview.d.ts +1 -1
  104. package/build/plugins/state/src/actions/camera/movecamera.d.ts +2 -2
  105. package/build/plugins/state/src/actions/index.d.ts +1 -0
  106. package/build/plugins/state/src/actions/media/generatemedia.d.ts +1 -1
  107. package/build/plugins/state/src/actions/object/addobject.d.ts +2 -3
  108. package/build/plugins/state/src/actions/object/deleteobject.d.ts +3 -4
  109. package/build/plugins/state/src/actions/object/deselectobject.d.ts +3 -4
  110. package/build/plugins/state/src/actions/object/dropit.d.ts +2 -2
  111. package/build/plugins/state/src/actions/object/getallobjects.d.ts +2 -3
  112. package/build/plugins/state/src/actions/object/getobjects.d.ts +3 -4
  113. package/build/plugins/state/src/actions/object/index.d.ts +0 -1
  114. package/build/plugins/state/src/actions/object/modelloaded.d.ts +2 -2
  115. package/build/plugins/state/src/actions/object/selectobject.d.ts +3 -4
  116. package/build/plugins/state/src/actions/object/setparent.d.ts +3 -4
  117. package/build/plugins/state/src/actions/object/updateobject.d.ts +3 -4
  118. package/build/plugins/state/src/actions/renderer/startrender.d.ts +1 -1
  119. package/build/plugins/state/src/actions/scene/exportscene.d.ts +2 -2
  120. package/build/plugins/state/src/actions/scene/index.d.ts +0 -1
  121. package/build/plugins/state/src/actions/scene/setbackground.d.ts +2 -2
  122. package/build/plugins/state/src/actions/scene/updatescene.d.ts +2 -2
  123. package/build/plugins/state/src/actions/state/getstate.d.ts +8 -0
  124. package/build/plugins/state/src/actions/state/index.d.ts +2 -0
  125. package/build/plugins/state/src/actions/state/setstate.d.ts +8 -0
  126. package/build/plugins/state/src/helpers/copyVectors/copyVectors.d.ts +17 -0
  127. package/build/plugins/state/src/helpers/updateParentLink/updateParentLink.d.ts +29 -0
  128. package/build/plugins/state/src/helpers/watchEntity/watchEntity.d.ts +30 -0
  129. package/build/plugins/state/types/ActionTypes.d.ts +18 -3
  130. package/build/plugins/state/types/RegisteredEntity.d.ts +27 -0
  131. package/build/plugins/state/types/{StateSceneData.d.ts → StateData.d.ts} +7 -8
  132. package/build/plugins/state/types/index.d.ts +3 -1
  133. package/build/plugins/state/types/schema/BaseEntitySchema.d.ts +25 -0
  134. package/build/plugins/state/types/schema/CameraSchema.d.ts +18 -0
  135. package/build/plugins/state/types/schema/EntitySchema.d.ts +21 -0
  136. package/build/plugins/state/types/schema/EntityTypeSchema.d.ts +9 -0
  137. package/build/{types → plugins/state/types}/schema/GroupSchema.d.ts +8 -1
  138. package/build/{types → plugins/state/types}/schema/LightSchema.d.ts +16 -0
  139. package/build/plugins/state/types/schema/ModelSchema.d.ts +33 -0
  140. package/build/{types → plugins/state/types}/schema/PrimitiveSchema.d.ts +8 -4
  141. package/build/{types → plugins/state/types}/schema/index.d.ts +1 -4
  142. package/build/plugins/toolbox/index.cjs +1 -1
  143. package/build/plugins/toolbox/index.mjs +194 -150
  144. package/build/plugins/toolbox/src/PointerContext.d.ts +7 -0
  145. package/build/plugins/toolbox/src/SelectionState.d.ts +21 -0
  146. package/build/plugins/toolbox/src/Toolbox.d.ts +9 -2
  147. package/build/{components → plugins/toolbox/src}/gizmo/Gizmo.d.ts +16 -2
  148. package/build/{components → plugins/toolbox/src}/gizmo/handles/AxisHandle.d.ts +2 -3
  149. package/build/{components → plugins/toolbox/src}/gizmo/handles/RadialHandle.d.ts +2 -3
  150. package/build/{components → plugins/toolbox/src}/gizmo/handles/ScaleHandle.d.ts +2 -3
  151. package/build/{components → plugins/toolbox/src}/gizmo/rotate/RotateGizmo.d.ts +2 -2
  152. package/build/{components → plugins/toolbox/src}/gizmo/scale/ScaleGizmo.d.ts +3 -3
  153. package/build/{components → plugins/toolbox/src}/gizmo/translate/TranslateGizmo.d.ts +2 -2
  154. package/build/types/components/DIVESceneObject.d.ts +13 -6
  155. package/build/types/components/index.d.ts +0 -1
  156. package/build/types/events/DIVEComponentEventMap.d.ts +14 -0
  157. package/build/types/events/DIVEEntityEventMap.d.ts +47 -0
  158. package/build/types/events/index.d.ts +2 -0
  159. package/build/types/geometry/DIVEGeometry.d.ts +16 -0
  160. package/build/types/geometry/DIVEGeometryType.d.ts +7 -0
  161. package/build/types/geometry/index.d.ts +2 -0
  162. package/build/types/index.d.ts +3 -1
  163. package/build/types/material/DIVEMaterial.d.ts +21 -0
  164. package/build/types/material/index.d.ts +1 -0
  165. package/package.json +8 -9
  166. package/build/chunks/AssetExporter-Cdxb04b3.cjs +0 -1
  167. package/build/chunks/AssetExporter-DLL_vJae.mjs +0 -67
  168. package/build/chunks/FileTypes-DMTSUCcK.cjs +0 -29
  169. package/build/chunks/FileTypes-DYtXCJQV.mjs +0 -2141
  170. package/build/chunks/PerspectiveCamera-B5TvUzTa.mjs +0 -39
  171. package/build/chunks/PerspectiveCamera-DwQUmkDv.cjs +0 -1
  172. package/build/chunks/PovSchema-Co9FznEz.cjs +0 -1
  173. package/build/chunks/PovSchema-DWWvr_ED.mjs +0 -10
  174. package/build/chunks/findInterface-C6mrvf_t.cjs +0 -1
  175. package/build/chunks/findInterface-DbJ5qzbc.mjs +0 -11
  176. package/build/components/boundingbox/BoundingBox.d.ts +0 -136
  177. package/build/components/floor/Floor.d.ts +0 -14
  178. package/build/components/grid/Grid.d.ts +0 -23
  179. package/build/components/group/Group.d.ts +0 -28
  180. package/build/components/light/AmbientLight.d.ts +0 -19
  181. package/build/components/light/PointLight.d.ts +0 -29
  182. package/build/components/light/SceneLight.d.ts +0 -20
  183. package/build/components/model/Model.d.ts +0 -26
  184. package/build/components/node/Node.d.ts +0 -24
  185. package/build/components/primitive/Primitive.d.ts +0 -27
  186. package/build/components/root/Root.d.ts +0 -34
  187. package/build/engine/camera/PerspectiveCamera.d.ts +0 -24
  188. package/build/helpers/isFileTypeSupported/isFileTypeSupported.d.ts +0 -9
  189. package/build/plugins/state/src/actions/object/placeonfloor.d.ts +0 -12
  190. package/build/plugins/state/src/actions/scene/getallscenedata.d.ts +0 -9
  191. package/build/types/components/DIVELight.d.ts +0 -4
  192. package/build/types/schema/BaseEntitySchema.d.ts +0 -8
  193. package/build/types/schema/EntitySchema.d.ts +0 -11
  194. package/build/types/schema/EntityTypeSchema.d.ts +0 -1
  195. package/build/types/schema/GeometrySchema.d.ts +0 -7
  196. package/build/types/schema/GeometryTypeSchema.d.ts +0 -1
  197. package/build/types/schema/MaterialSchema.d.ts +0 -11
  198. package/build/types/schema/ModelSchema.d.ts +0 -14
  199. package/build/types/schema/PovSchema.d.ts +0 -10
  200. /package/build/{components → plugins/toolbox/src}/gizmo/plane/GizmoPlane.d.ts +0 -0
@@ -0,0 +1,87 @@
1
+ var m = Object.defineProperty;
2
+ var l = (a, e, t) => e in a ? m(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
3
+ var r = (a, e, t) => l(a, typeof e != "symbol" ? e + "" : e, t);
4
+ import { P as u } from "./contributesToBounds-DYmHYES4.mjs";
5
+ import { M as _ } from "./FileTypes-DGSsi-AX.mjs";
6
+ class c extends _ {
7
+ constructor() {
8
+ super();
9
+ r(this, "isModelComponent", !0);
10
+ /**
11
+ * The clips the asset came with.
12
+ *
13
+ * Its own field, not `Object3D.animations`: they belong to the asset, and the
14
+ * mixer takes a root and its clips separately, so nothing needs them to sit
15
+ * on a graph object.
16
+ */
17
+ r(this, "animations", []);
18
+ /** What {@link setFromURL} last loaded, so a clone can load it again. */
19
+ r(this, "_url", null);
20
+ r(this, "_assetLoader", null);
21
+ this.name = "ModelComponent";
22
+ }
23
+ async _getAssetLoader() {
24
+ return this._assetLoader || (this._assetLoader = new (await import("../plugins/assetloader/index.mjs")).AssetLoader()), this._assetLoader;
25
+ }
26
+ /**
27
+ * Loads an asset and takes its content as this component's geometry.
28
+ *
29
+ * Reports the load on itself. Whoever wants to hear about an entity being
30
+ * loaded listens to the component that loads it -- the node has nothing to
31
+ * do with fetching, and a component with no owner yet had nowhere to report
32
+ * before, which silently dropped the event.
33
+ *
34
+ * @param url - The asset to load.
35
+ */
36
+ async setFromURL(t) {
37
+ const o = await (await this._getAssetLoader()).load(t);
38
+ return this.setFromGLTF(o), this._url = t, this.dispatchEvent({ type: "object-load" }), this;
39
+ }
40
+ /**
41
+ * Replaces the content with a loaded glTF hierarchy.
42
+ *
43
+ * @param gltf - What the loader returned: a glTF *scene*, whose children are
44
+ * the file's root nodes.
45
+ */
46
+ setFromGLTF(t) {
47
+ const i = [...this.contributions];
48
+ this.withdraw(...i), i.forEach(
49
+ (s) => s.traverse((h) => {
50
+ var n;
51
+ (n = h.geometry) == null || n.dispose();
52
+ })
53
+ ), this._mesh = null;
54
+ const o = this.isAttached ? this.owner.layers.mask : u;
55
+ return t.traverse((s) => {
56
+ s.castShadow = !0, s.receiveShadow = !0, s.layers.mask = o, !this._mesh && "isMesh" in s && (this._mesh = s, this._materialIsOwn ? s.material = this._material : Array.isArray(s.material) || (this._material = s.material));
57
+ }), this.animations = t.animations, this.contribute(...t.children), this;
58
+ }
59
+ /** The asset {@link setFromURL} last loaded, if any. */
60
+ get url() {
61
+ return this._url;
62
+ }
63
+ /**
64
+ * Carries over what identifies the content, not the content itself.
65
+ *
66
+ * The one component whose state a copy cannot reproduce on its own: a load is
67
+ * asynchronous, and `copy` is not. So the clone comes back with the same
68
+ * {@link url} and clips but no geometry, and the caller finishes it:
69
+ *
70
+ * ```ts
71
+ * const clone = source.clone();
72
+ * if (clone.url) await clone.setFromURL(clone.url);
73
+ * ```
74
+ *
75
+ * Spelled out because the alternative is worse: cloning the loaded hierarchy
76
+ * would share every geometry and material with the source, and either
77
+ * component's `dispose` would then free what the other still draws.
78
+ *
79
+ * @param source - The component to copy from.
80
+ */
81
+ copy(t) {
82
+ return super.copy(t), this._url = t.url, this.animations = t.animations, this;
83
+ }
84
+ }
85
+ export {
86
+ c as M
87
+ };
@@ -0,0 +1 @@
1
+ "use strict";var D=Object.defineProperty;var E=(r,h,t)=>h in r?D(r,h,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[h]=t;var s=(r,h,t)=>E(r,typeof h!="symbol"?h+"":h,t);const i=require("three/webgpu"),S=require("./FileTypes-gD_1MonW.cjs");require("three/examples/jsm/loaders/HDRLoader.js");require("three/tsl");const w={enableDamping:!0,dampingFactor:.05,enabled:!0,target:new i.Vector3,minDistance:0,maxDistance:1/0,minZoom:0,maxZoom:1/0,minPolarAngle:0,maxPolarAngle:Math.PI,minAzimuthAngle:-1/0,maxAzimuthAngle:1/0,enableZoom:!0,zoomSpeed:1,enableRotate:!0,rotateSpeed:1,enablePan:!0,panSpeed:1,screenSpacePanning:!0,keyPanSpeed:7,autoRotate:!1,autoRotateSpeed:2,keys:{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},mouseButtons:{LEFT:i.MOUSE.ROTATE,MIDDLE:i.MOUSE.DOLLY,RIGHT:i.MOUSE.PAN},touches:{ONE:i.TOUCH.ROTATE,TWO:i.TOUCH.DOLLY_PAN}},c=class c extends i.EventDispatcher{constructor(t,e,a){super();s(this,"object");s(this,"domElements");s(this,"enabled",!0);s(this,"target",new i.Vector3);s(this,"minDistance",0);s(this,"maxDistance",1/0);s(this,"minZoom",0);s(this,"maxZoom",1/0);s(this,"minPolarAngle",0);s(this,"maxPolarAngle",Math.PI);s(this,"minAzimuthAngle",-1/0);s(this,"maxAzimuthAngle",1/0);s(this,"enableDamping",!0);s(this,"dampingFactor",.05);s(this,"enableZoom",!0);s(this,"zoomSpeed",1);s(this,"enableRotate",!0);s(this,"rotateSpeed",1);s(this,"enablePan",!0);s(this,"panSpeed",1);s(this,"screenSpacePanning",!0);s(this,"keyPanSpeed",7);s(this,"autoRotate",!1);s(this,"autoRotateSpeed",2);s(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"});s(this,"mouseButtons",{LEFT:i.MOUSE.ROTATE,MIDDLE:i.MOUSE.DOLLY,RIGHT:i.MOUSE.PAN});s(this,"touches",{ONE:i.TOUCH.ROTATE,TWO:i.TOUCH.DOLLY_PAN});s(this,"target0");s(this,"position0");s(this,"zoom0");s(this,"uuid",i.MathUtils.generateUUID());s(this,"state",-1);s(this,"EPS",1e-6);s(this,"spherical",new i.Spherical);s(this,"sphericalDelta",new i.Spherical);s(this,"scale",1);s(this,"panOffset",new i.Vector3);s(this,"zoomChanged",!1);s(this,"rotateStart",new i.Vector2);s(this,"rotateEnd",new i.Vector2);s(this,"rotateDelta",new i.Vector2);s(this,"panStart",new i.Vector2);s(this,"panEnd",new i.Vector2);s(this,"panDelta",new i.Vector2);s(this,"dollyStart",new i.Vector2);s(this,"dollyEnd",new i.Vector2);s(this,"dollyDelta",new i.Vector2);s(this,"pointers",[]);s(this,"pointerPositions",{});s(this,"offset",new i.Vector3);s(this,"quat");s(this,"quatInverse");s(this,"lastPosition",new i.Vector3);s(this,"lastQuaternion",new i.Quaternion);s(this,"lastTarget",new i.Vector3);s(this,"panLeft",(()=>{const t=new i.Vector3;return(e,a)=>{t.setFromMatrixColumn(a,0),t.multiplyScalar(-e),this.panOffset.add(t)}})());s(this,"panUp",(()=>{const t=new i.Vector3;return(e,a)=>{this.screenSpacePanning===!0?t.setFromMatrixColumn(a,1):(t.setFromMatrixColumn(a,0),t.crossVectors(this.object.camera.up,t)),t.multiplyScalar(e),this.panOffset.add(t)}})());s(this,"onMouseDown",t=>{let e;switch(t.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case i.MOUSE.DOLLY:if(this.enableZoom===!1)return;this.handleMouseDownDolly(t),this.state=1;break;case i.MOUSE.ROTATE:if(t.ctrlKey||t.metaKey||t.shiftKey){if(this.enablePan===!1)return;this.handleMouseDownPan(t),this.state=2}else{if(this.enableRotate===!1)return;this.handleMouseDownRotate(t),this.state=0}break;case i.MOUSE.PAN:if(t.ctrlKey||t.metaKey||t.shiftKey){if(this.enableRotate===!1)return;this.handleMouseDownRotate(t),this.state=0}else{if(this.enablePan===!1)return;this.handleMouseDownPan(t),this.state=2}break;default:this.state=-1}this.state!==-1&&this.dispatchEvent({type:"start"})});s(this,"onMouseMove",t=>{if(this.enabled!==!1)switch(this.state){case 0:if(this.enableRotate===!1)return;this.handleMouseMoveRotate(t);break;case 1:if(this.enableZoom===!1)return;this.handleMouseMoveDolly(t);break;case 2:if(this.enablePan===!1)return;this.handleMouseMovePan(t);break}});s(this,"onMouseWheel",t=>{this.enabled===!1||this.enableZoom===!1||this.state!==-1||(t.preventDefault(),this.dispatchEvent({type:"start"}),this.handleMouseWheel(t),this.dispatchEvent({type:"end"}))});s(this,"onKeyDown",t=>{this.enabled===!1||this.enablePan===!1||this.handleKeyDown(t)});s(this,"onTouchStart",t=>{switch(this.trackPointer(t),this.pointers.length){case 1:switch(this.touches.ONE){case i.TOUCH.ROTATE:if(this.enableRotate===!1)return;this.handleTouchStartRotate(t),this.state=3;break;case i.TOUCH.PAN:if(this.enablePan===!1)return;this.handleTouchStartPan(t),this.state=4;break;default:this.state=-1}break;case 2:switch(this.touches.TWO){case i.TOUCH.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this.handleTouchStartDollyPan(t),this.state=5;break;case i.TOUCH.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this.handleTouchStartDollyRotate(t),this.state=6;break;default:this.state=-1}break;default:this.state=-1}this.state!==-1&&this.dispatchEvent({type:"start"})});s(this,"onTouchMove",t=>{switch(this.trackPointer(t),this.state){case 3:if(this.enableRotate===!1)return;this.handleTouchMoveRotate(t),this.update();break;case 4:if(this.enablePan===!1)return;this.handleTouchMovePan(t),this.update();break;case 5:if(this.enableZoom===!1&&this.enablePan===!1)return;this.handleTouchMoveDollyPan(t),this.update();break;case 6:if(this.enableZoom===!1&&this.enableRotate===!1)return;this.handleTouchMoveDollyRotate(t),this.update();break;default:this.state=-1}});s(this,"onPointerDown",t=>{if(this.enabled!==!1){if(this.pointers.length===0){const e=t.currentTarget;e.setPointerCapture(t.pointerId),e.addEventListener("pointermove",this.onPointerMove),e.addEventListener("pointerup",this.onPointerUp)}this.isTrackingPointer(t)||(this.addPointer(t),t.pointerType==="touch"?this.onTouchStart(t):this.onMouseDown(t))}});s(this,"onPointerMove",t=>{this.enabled!==!1&&(t.pointerType==="touch"?this.onTouchMove(t):this.onMouseMove(t))});s(this,"onPointerUp",t=>{if(this.removePointer(t),this.pointers.length===0){const e=t.currentTarget;e.releasePointerCapture(t.pointerId),e.removeEventListener("pointermove",this.onPointerMove),e.removeEventListener("pointerup",this.onPointerUp),this.dispatchEvent({type:"end"}),this.state=-1}});s(this,"onPointerCancel",t=>{this.removePointer(t)});s(this,"onContextMenu",t=>{this.enabled!==!1&&t.preventDefault()});if(this.object=t,!t.isAttached)throw new Error("OrbitController: the camera component must be attached to a node, because that is what gets moved.");this.domElements=Array.isArray(e)?e:[e],Object.assign(this,a),this.target0=this.target.clone(),this.position0=this.object.owner.position.clone(),this.zoom0=this._camera.zoom,this.quat=new i.Quaternion().setFromUnitVectors(this.object.camera.up,new i.Vector3(0,1,0)),this.quatInverse=this.quat.clone().invert(),this.domElements.forEach(o=>this.addEventListeners(o)),this.update()}get _camera(){return this.object.camera}get domElement(){return this.domElements[0]}tick(){this.enabled&&this.update()}getPolarAngle(){return this.spherical.phi}getAzimuthalAngle(){return this.spherical.theta}getDistance(){return this.object.owner.position.distanceTo(this.target)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.owner.position),this.zoom0=this._camera.zoom}reset(){this.target.copy(this.target0),this.object.owner.position.copy(this.position0),this._camera.zoom=this.zoom0,this._camera.updateProjectionMatrix(),this.dispatchEvent({type:"change"}),this.update(),this.state=-1}update(){return this.offset.copy(this.object.owner.position).sub(this.target),this.offset.applyQuaternion(this.quat),this.spherical.setFromVector3(this.offset),this.autoRotate&&this.state===-1&&this.rotateLeft(this.getAutoRotationAngle()),this.enableDamping?(this.spherical.theta+=this.sphericalDelta.theta*this.dampingFactor,this.spherical.phi+=this.sphericalDelta.phi*this.dampingFactor):(this.spherical.theta+=this.sphericalDelta.theta,this.spherical.phi+=this.sphericalDelta.phi),this.spherical.theta=Math.max(this.minAzimuthAngle,Math.min(this.maxAzimuthAngle,this.spherical.theta)),this.spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this.spherical.phi)),this.spherical.makeSafe(),this.spherical.radius*=this.scale,this.spherical.radius=Math.max(this.minDistance,Math.min(this.maxDistance,this.spherical.radius)),this.enableDamping===!0?this.target.addScaledVector(this.panOffset,this.dampingFactor):this.target.add(this.panOffset),this.offset.setFromSpherical(this.spherical),this.offset.applyQuaternion(this.quatInverse),this.object.owner.position.copy(this.target).add(this.offset),this.object.lookAt(this.target),this.enableDamping===!0?(this.sphericalDelta.theta*=1-this.dampingFactor,this.sphericalDelta.phi*=1-this.dampingFactor,this.panOffset.multiplyScalar(1-this.dampingFactor)):(this.sphericalDelta.set(0,0,0),this.panOffset.set(0,0,0)),this.scale=1,this.zoomChanged||this.lastPosition.distanceToSquared(this.object.owner.position)>this.EPS||8*(1-this.lastQuaternion.dot(this.object.owner.quaternion))>this.EPS||this.lastTarget.distanceToSquared(this.target)>this.EPS?(this.dispatchEvent({type:"change"}),this.lastPosition.copy(this.object.owner.position),this.lastQuaternion.copy(this.object.owner.quaternion),this.lastTarget.copy(this.target),this.zoomChanged=!1,!0):!1}dispose(){this.domElements.forEach(t=>this.removeEventListeners(t)),this.dispatchEvent({type:"dispose"})}addDomElements(...t){t.forEach(e=>{this.domElements.includes(e)||(this.domElements.push(e),this.addEventListeners(e))})}removeDomElements(...t){t.forEach(e=>{const a=this.domElements.indexOf(e);a>-1&&(this.removeEventListeners(e),this.domElements.splice(a,1))})}setDomElements(...t){this.removeDomElements(...this.domElements),this.domElements=[],this.addDomElements(...t)}computeEncompassingView(t,e=0){const a=t.center,o=t.radius,n=this._camera,l=n.fov*(Math.PI/180),m=n.aspect,d=l/2,f=Math.atan(Math.tan(d)*m),g=o/Math.sin(d),y=o/Math.sin(f),b=Math.max(g,y)*(1+e),u=this.object.owner.position.clone().sub(this.target).normalize(),P=u.length()>.001?u:new i.Vector3(0,0,1);return{position:a.clone().add(P.multiplyScalar(b)),target:a}}focusObject(t,e=0){const a=this.computeEncompassingView(new S.BoundingBox().enclose(t).sphere,e);this.object.owner.position.copy(a.position),this.target.copy(a.target),this.update()}zoomIn(t){this.dollyIn(Math.pow(.95,t??c.DEFAULT_ZOOM_FACTOR)),this.update()}zoomOut(t){this.dollyOut(Math.pow(.95,t??c.DEFAULT_ZOOM_FACTOR)),this.update()}getState(){return{target:this.target.clone(),azimuthalAngle:this.getAzimuthalAngle(),polarAngle:this.getPolarAngle(),distance:this.getDistance(),position:this.object.owner.position.clone(),quaternion:this.object.owner.quaternion.clone()}}setState(t){this.target.copy(t.target),this.object.owner.position.copy(t.position),this.object.owner.quaternion.copy(t.quaternion),this.update()}addEventListeners(t){t.style.touchAction="none",t.addEventListener("contextmenu",this.onContextMenu),t.addEventListener("pointerdown",this.onPointerDown),t.addEventListener("pointercancel",this.onPointerCancel),t.addEventListener("wheel",this.onMouseWheel,{passive:!1}),t.addEventListener("keydown",this.onKeyDown)}removeEventListeners(t){t.removeEventListener("contextmenu",this.onContextMenu),t.removeEventListener("pointerdown",this.onPointerDown),t.removeEventListener("pointercancel",this.onPointerCancel),t.removeEventListener("wheel",this.onMouseWheel),t.removeEventListener("keydown",this.onKeyDown),t.removeEventListener("pointermove",this.onPointerMove),t.removeEventListener("pointerup",this.onPointerUp)}getAutoRotationAngle(){return 2*Math.PI/60/60*this.autoRotateSpeed}getZoomScale(){return Math.pow(.95,this.zoomSpeed)}rotateLeft(t){this.sphericalDelta.theta-=t}rotateUp(t){this.sphericalDelta.phi-=t}pan(t,e,a){const o=new i.Vector3;if("isPerspectiveCamera"in this._camera){const n=this.object.owner.position;o.copy(n).sub(this.target);let l=o.length();l*=Math.tan(this._camera.fov/2*Math.PI/180),this.panLeft(2*t*l/a.clientHeight,this.object.owner.matrix),this.panUp(2*e*l/a.clientHeight,this.object.owner.matrix)}else"isOrthographicCamera"in this._camera?(this.panLeft(t*(this._camera.right-this._camera.left)/this._camera.zoom/a.clientWidth,this.object.owner.matrix),this.panUp(e*(this._camera.top-this._camera.bottom)/this._camera.zoom/a.clientHeight,this.object.owner.matrix)):(console.warn("WARNING: OrbitController encountered an unknown camera type - pan disabled."),this.enablePan=!1)}dollyIn(t){"isPerspectiveCamera"in this._camera||"isOrthographicCamera"in this._camera?this.scale*=t:(console.warn("WARNING: OrbitController encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}dollyOut(t){"isPerspectiveCamera"in this._camera||"isOrthographicCamera"in this._camera?this.scale/=t:(console.warn("WARNING: OrbitController encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}handleMouseDownRotate(t){this.rotateStart.set(t.clientX,t.clientY)}handleMouseDownDolly(t){this.dollyStart.set(t.clientX,t.clientY)}handleMouseDownPan(t){this.panStart.set(t.clientX,t.clientY)}handleMouseMoveRotate(t){this.rotateEnd.set(t.clientX,t.clientY),this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart).multiplyScalar(this.rotateSpeed);const e=t.currentTarget;this.rotateLeft(2*Math.PI*this.rotateDelta.x/e.clientHeight),this.rotateUp(2*Math.PI*this.rotateDelta.y/e.clientHeight),this.rotateStart.copy(this.rotateEnd),this.update()}handleMouseMoveDolly(t){this.dollyEnd.set(t.clientX,t.clientY),this.dollyDelta.subVectors(this.dollyEnd,this.dollyStart),this.dollyDelta.y>0?this.dollyIn(this.getZoomScale()):this.dollyDelta.y<0&&this.dollyOut(this.getZoomScale()),this.dollyStart.copy(this.dollyEnd),this.update()}handleMouseMovePan(t){const e=t.currentTarget;this.panEnd.set(t.clientX,t.clientY),this.panDelta.subVectors(this.panEnd,this.panStart).multiplyScalar(this.panSpeed),this.pan(this.panDelta.x,this.panDelta.y,e),this.panStart.copy(this.panEnd),this.update()}handleMouseWheel(t){t.deltaY<0?this.dollyIn(this.getZoomScale()):t.deltaY>0&&this.dollyOut(this.getZoomScale()),this.update()}handleKeyDown(t){let e=!1;const a=t.currentTarget;switch(t.code){case this.keys.UP:this.pan(0,this.keyPanSpeed,a),e=!0;break;case this.keys.BOTTOM:this.pan(0,-this.keyPanSpeed,a),e=!0;break;case this.keys.LEFT:this.pan(this.keyPanSpeed,0,a),e=!0;break;case this.keys.RIGHT:this.pan(-this.keyPanSpeed,0,a),e=!0;break}e&&(t.preventDefault(),this.update())}handleTouchStartRotate(t){if(this.pointers.length===1)this.rotateStart.set(t.pageX,t.pageY);else{const e=this.getSecondPointer(t),a=.5*(t.pageX+e.pageX),o=.5*(t.pageY+e.pageY);this.rotateStart.set(a,o)}}handleTouchStartPan(t){if(this.pointers.length===1)this.panStart.set(t.pageX,t.pageY);else{const e=this.getSecondPointer(t),a=.5*(t.pageX+e.pageX),o=.5*(t.pageY+e.pageY);this.panStart.set(a,o)}}handleTouchStartDolly(t){const e=this.getSecondPointer(t),a=t.pageX-e.pageX,o=t.pageY-e.pageY,n=Math.sqrt(a*a+o*o);this.dollyStart.set(0,n)}handleTouchStartDollyPan(t){this.enableZoom&&this.handleTouchStartDolly(t),this.enablePan&&this.handleTouchStartPan(t)}handleTouchStartDollyRotate(t){this.enableZoom&&this.handleTouchStartDolly(t),this.enableRotate&&this.handleTouchStartRotate(t)}handleTouchMoveRotate(t){if(this.pointers.length===1)this.rotateEnd.set(t.pageX,t.pageY);else{const a=this.getSecondPointer(t),o=.5*(t.pageX+a.pageX),n=.5*(t.pageY+a.pageY);this.rotateEnd.set(o,n)}const e=t.currentTarget;this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart).multiplyScalar(this.rotateSpeed),this.rotateLeft(2*Math.PI*this.rotateDelta.x/e.clientHeight),this.rotateUp(2*Math.PI*this.rotateDelta.y/e.clientHeight),this.rotateStart.copy(this.rotateEnd)}handleTouchMovePan(t){if(this.pointers.length===1)this.panEnd.set(t.pageX,t.pageY);else{const a=this.getSecondPointer(t),o=.5*(t.pageX+a.pageX),n=.5*(t.pageY+a.pageY);this.panEnd.set(o,n)}const e=t.currentTarget;this.panDelta.subVectors(this.panEnd,this.panStart).multiplyScalar(this.panSpeed),this.pan(this.panDelta.x,this.panDelta.y,e),this.panStart.copy(this.panEnd)}handleTouchMoveDolly(t){const e=this.getSecondPointer(t),a=t.pageX-e.pageX,o=t.pageY-e.pageY,n=Math.sqrt(a*a+o*o);this.dollyEnd.set(0,n),this.dollyDelta.set(0,Math.pow(this.dollyEnd.y/this.dollyStart.y,this.zoomSpeed)),this.dollyOut(this.dollyDelta.y),this.dollyStart.copy(this.dollyEnd)}handleTouchMoveDollyPan(t){this.enableZoom&&this.handleTouchMoveDolly(t),this.enablePan&&this.handleTouchMovePan(t)}handleTouchMoveDollyRotate(t){this.enableZoom&&this.handleTouchMoveDolly(t),this.enableRotate&&this.handleTouchMoveRotate(t)}addPointer(t){this.pointers.push(t)}removePointer(t){delete this.pointerPositions[t.pointerId];for(let e=0;e<this.pointers.length;e++)if(this.pointers[e].pointerId==t.pointerId){this.pointers.splice(e,1);return}}trackPointer(t){let e=this.pointerPositions[t.pointerId];e===void 0&&(e=new i.Vector2,this.pointerPositions[t.pointerId]=e),e.set(t.pageX,t.pageY)}getSecondPointer(t){return this.pointers[0].pointerId===t.pointerId?this.pointers[1]:this.pointers[0]}isTrackingPointer(t){return this.pointers.some(e=>e.pointerId===t.pointerId)}};s(c,"DEFAULT_ZOOM_FACTOR",1);let p=c;exports.OrbitController=p;exports.OrbitControllerDefaultSettings=w;