@shopware-ag/dive 1.19.1-beta.9 → 2.0.1-beta.1

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 (234) hide show
  1. package/build/chunks/FileTypes-BjZ0rrIV.cjs +1 -0
  2. package/build/chunks/FileTypes-qgYnI0Jg.mjs +30 -0
  3. package/build/chunks/ModuleRegistry-NyNtjHb2.cjs +1 -0
  4. package/build/chunks/ModuleRegistry-RSub8W0G.mjs +13 -0
  5. package/build/chunks/PerspectiveCamera-BByyG5R4.cjs +1 -0
  6. package/build/chunks/PerspectiveCamera-sm4_81KJ.mjs +34 -0
  7. package/build/chunks/SelectTool-BAXTVyWs.cjs +1 -0
  8. package/build/chunks/SelectTool-Bd8cC9nb.mjs +712 -0
  9. package/build/chunks/{SystemInfo-DYq9x4Ch.mjs → SystemInfo-DPAQG-S5.mjs} +37 -40
  10. package/build/chunks/SystemInfo-oX-NNneO.cjs +1 -0
  11. package/build/chunks/VisibilityLayerMask-BI7jPKdx.cjs +1 -0
  12. package/build/chunks/VisibilityLayerMask-CXgt1fJc.mjs +8 -0
  13. package/build/chunks/findInterface-BEdL2iUQ.cjs +1 -0
  14. package/build/chunks/findInterface-OrXgmwxj.mjs +18 -0
  15. package/build/chunks/index-C_uFFwT2.mjs +5 -0
  16. package/build/chunks/index-DAwIH9xh.cjs +1 -0
  17. package/build/chunks/package-BHjZWYD6.mjs +39 -0
  18. package/build/chunks/package-JHvTSNgQ.cjs +1 -0
  19. package/build/chunks/{fflate.module-Chbb_O8w.cjs → parse-error-2f5qpXP5.cjs} +2 -3
  20. package/build/chunks/{fflate.module-BQhIETD7.mjs → parse-error-DRBVHL9E.mjs} +16 -17
  21. package/build/dive.cjs +30 -0
  22. package/build/dive.mjs +1663 -0
  23. package/build/src/components/floor/Floor.d.ts +2 -2
  24. package/build/src/components/gizmo/Gizmo.d.ts +4 -4
  25. package/build/src/components/gizmo/handles/AxisHandle.d.ts +4 -4
  26. package/build/src/components/gizmo/handles/RadialHandle.d.ts +4 -4
  27. package/build/src/components/gizmo/handles/ScaleHandle.d.ts +4 -4
  28. package/build/src/components/gizmo/plane/GizmoPlane.d.ts +1 -1
  29. package/build/src/components/gizmo/rotate/RotateGizmo.d.ts +4 -4
  30. package/build/src/components/gizmo/scale/ScaleGizmo.d.ts +5 -5
  31. package/build/src/components/gizmo/translate/TranslateGizmo.d.ts +4 -4
  32. package/build/src/components/grid/Grid.d.ts +1 -1
  33. package/build/src/components/light/AmbientLight.d.ts +3 -3
  34. package/build/src/components/light/PointLight.d.ts +6 -6
  35. package/build/src/components/light/SceneLight.d.ts +3 -3
  36. package/build/src/components/model/Model.d.ts +9 -6
  37. package/build/src/components/node/Node.d.ts +4 -4
  38. package/build/src/components/primitive/Primitive.d.ts +4 -4
  39. package/build/src/components/root/Root.d.ts +20 -29
  40. package/build/src/core/Dive.d.ts +26 -14
  41. package/build/src/engine/Engine.d.ts +7 -11
  42. package/build/src/engine/clock/Clock.d.ts +4 -0
  43. package/build/src/engine/renderer/Renderer.d.ts +12 -8
  44. package/build/src/engine/resize/ResizeManager.d.ts +4 -2
  45. package/build/src/engine/scene/Scene.d.ts +6 -24
  46. package/build/src/engine/scene/xrroot/XRRoot.d.ts +5 -5
  47. package/build/src/engine/scene/xrroot/xrlightroot/XRLightRoot.d.ts +3 -3
  48. package/build/src/helpers/findSceneRecursive/findSceneRecursive.d.ts +1 -1
  49. package/build/src/helpers/isFileTypeSupported/isFileTypeSupported.d.ts +1 -1
  50. package/build/src/index.d.ts +6 -9
  51. package/build/src/interfaces/Draggable.d.ts +1 -1
  52. package/build/src/modules/ModuleRegistry.d.ts +19 -0
  53. package/build/src/modules/animation/AnimationSystem.cjs +1 -0
  54. package/build/src/modules/animation/AnimationSystem.d.ts +28 -4
  55. package/build/src/modules/animation/AnimationSystem.mjs +95 -0
  56. package/build/src/modules/animation/animator/Animator.d.ts +26 -0
  57. package/build/src/modules/animation/types/AnimatorParameters.d.ts +7 -0
  58. package/build/src/modules/ar/ARSystem.cjs +1 -2
  59. package/build/src/modules/ar/ARSystem.mjs +5 -5
  60. package/build/src/modules/ar/arquicklook/ARQuickLook.d.ts +1 -1
  61. package/build/src/modules/ar/sceneviewer/SceneViewer.d.ts +1 -1
  62. package/build/src/modules/ar/webxr/WebXR.d.ts +3 -3
  63. package/build/src/modules/ar/webxr/controller/WebXRController.d.ts +3 -3
  64. package/build/src/modules/ar/webxr/origin/WebXROrigin.d.ts +2 -2
  65. package/build/src/modules/ar/webxr/raycaster/WebXRRaycaster.d.ts +4 -4
  66. package/build/src/modules/ar/webxr/raycaster/ar/WebXRRaycasterAR.d.ts +3 -3
  67. package/build/src/modules/ar/webxr/raycaster/three/WebXRRaycasterTHREE.d.ts +4 -4
  68. package/build/src/modules/ar/webxr/touchscreencontrols/WebXRTouchscreenControls.d.ts +1 -1
  69. package/build/src/modules/asset/converter/AssetConverter.cjs +0 -1
  70. package/build/src/modules/asset/converter/AssetConverter.d.ts +3 -3
  71. package/build/src/modules/asset/converter/AssetConverter.mjs +0 -1
  72. package/build/src/modules/asset/draco/README.md +32 -0
  73. package/build/src/modules/asset/draco/draco_decoder.js +33 -0
  74. package/build/src/modules/asset/draco/draco_decoder.wasm +0 -0
  75. package/build/src/modules/asset/draco/draco_encoder.js +33 -0
  76. package/build/src/modules/asset/draco/draco_wasm_wrapper.js +116 -0
  77. package/build/src/modules/asset/draco/gltf/draco_decoder.js +33 -0
  78. package/build/src/modules/asset/draco/gltf/draco_decoder.wasm +0 -0
  79. package/build/src/modules/asset/draco/gltf/draco_encoder.js +33 -0
  80. package/build/src/modules/asset/draco/gltf/draco_wasm_wrapper.js +116 -0
  81. package/build/src/modules/asset/exporter/AssetExporter.cjs +1 -2
  82. package/build/src/modules/asset/exporter/AssetExporter.d.ts +3 -3
  83. package/build/src/modules/asset/exporter/AssetExporter.mjs +1 -2
  84. package/build/src/modules/asset/loader/AssetLoader.cjs +3 -2
  85. package/build/src/modules/asset/loader/AssetLoader.mjs +2152 -5
  86. package/build/src/modules/axiscamera/AxisCamera.d.ts +8 -9
  87. package/build/src/modules/controller/orbit/OrbitController.d.ts +13 -24
  88. package/build/src/modules/mediacreator/MediaCreator.cjs +1 -2
  89. package/build/src/modules/mediacreator/MediaCreator.d.ts +4 -4
  90. package/build/src/modules/mediacreator/MediaCreator.mjs +28 -3
  91. package/build/src/modules/state/ActionRegistry.d.ts +26 -0
  92. package/build/src/modules/state/State.cjs +27 -0
  93. package/build/src/modules/state/State.d.ts +58 -0
  94. package/build/src/modules/state/State.mjs +4296 -0
  95. package/build/src/modules/state/actions/action.d.ts +36 -0
  96. package/build/src/modules/state/actions/ar/index.d.ts +1 -0
  97. package/build/src/modules/state/actions/ar/launchar.d.ts +15 -0
  98. package/build/src/modules/state/actions/camera/computeencompassingview.d.ts +12 -0
  99. package/build/src/modules/state/actions/camera/getcameratransform.d.ts +12 -0
  100. package/build/src/modules/state/actions/camera/index.d.ts +6 -0
  101. package/build/src/modules/state/actions/camera/lockcamera.d.ts +8 -0
  102. package/build/src/modules/state/actions/camera/movecamera.d.ts +29 -0
  103. package/build/src/modules/state/actions/camera/setcameralayer.d.ts +12 -0
  104. package/build/src/modules/state/actions/camera/setcameratransform.d.ts +15 -0
  105. package/build/src/modules/state/actions/camera/zoomcamera.d.ts +14 -0
  106. package/build/src/modules/state/actions/index.d.ts +7 -0
  107. package/build/src/modules/state/actions/media/generatemedia.d.ts +25 -0
  108. package/build/src/modules/state/actions/media/index.d.ts +1 -0
  109. package/build/src/modules/state/actions/object/addobject.d.ts +8 -0
  110. package/build/src/modules/state/actions/object/deleteobject.d.ts +12 -0
  111. package/build/src/modules/state/actions/object/deselectobject.d.ts +12 -0
  112. package/build/src/modules/state/actions/object/dropit.d.ts +12 -0
  113. package/build/src/modules/state/actions/object/getallobjects.d.ts +8 -0
  114. package/build/src/modules/state/actions/object/getobjects.d.ts +12 -0
  115. package/build/src/modules/state/actions/object/index.d.ts +11 -0
  116. package/build/src/modules/state/actions/object/modelloaded.d.ts +12 -0
  117. package/build/src/modules/state/actions/object/placeonfloor.d.ts +12 -0
  118. package/build/src/modules/state/actions/object/selectobject.d.ts +12 -0
  119. package/build/src/modules/state/actions/object/setparent.d.ts +22 -0
  120. package/build/src/modules/state/actions/object/updateobject.d.ts +12 -0
  121. package/build/src/modules/state/actions/renderer/index.d.ts +1 -0
  122. package/build/src/modules/state/actions/renderer/startrender.d.ts +8 -0
  123. package/build/src/modules/state/actions/scene/exportscene.d.ts +13 -0
  124. package/build/src/modules/state/actions/scene/getallscenedata.d.ts +9 -0
  125. package/build/src/modules/state/actions/scene/index.d.ts +4 -0
  126. package/build/src/modules/state/actions/scene/setbackground.d.ts +12 -0
  127. package/build/src/modules/state/actions/scene/updatescene.d.ts +20 -0
  128. package/build/src/modules/state/actions/toolbox/index.d.ts +4 -0
  129. package/build/src/modules/state/actions/toolbox/setgizmomode.d.ts +12 -0
  130. package/build/src/modules/state/actions/toolbox/setgizmoscalelinked.d.ts +8 -0
  131. package/build/src/modules/state/actions/toolbox/setgizmovisible.d.ts +8 -0
  132. package/build/src/modules/state/actions/toolbox/usetool.d.ts +13 -0
  133. package/build/src/modules/state/types/ActionTypes.d.ts +18 -0
  134. package/build/src/modules/{com → state}/types/COMBaseEntity.d.ts +1 -1
  135. package/build/src/modules/state/types/COMEntity.d.ts +11 -0
  136. package/build/src/modules/{com → state}/types/COMGeometry.d.ts +1 -1
  137. package/build/src/modules/state/types/COMGroup.d.ts +11 -0
  138. package/build/src/modules/state/types/COMLight.d.ts +28 -0
  139. package/build/src/modules/state/types/COMModel.d.ts +14 -0
  140. package/build/src/modules/state/types/COMPov.d.ts +10 -0
  141. package/build/src/modules/state/types/COMPrimitive.d.ts +14 -0
  142. package/build/src/modules/state/types/index.d.ts +11 -0
  143. package/build/src/modules/systeminfo/SystemInfo.cjs +1 -2
  144. package/build/src/modules/systeminfo/SystemInfo.d.ts +1 -1
  145. package/build/src/modules/systeminfo/SystemInfo.mjs +3 -3
  146. package/build/src/modules/toolbox/BaseTool.d.ts +6 -6
  147. package/build/src/modules/toolbox/Toolbox.cjs +1 -0
  148. package/build/src/modules/toolbox/Toolbox.d.ts +12 -8
  149. package/build/src/modules/toolbox/Toolbox.mjs +99 -0
  150. package/build/src/modules/toolbox/select/SelectTool.d.ts +6 -6
  151. package/build/src/modules/toolbox/transform/TransformTool.d.ts +6 -6
  152. package/build/src/types/SceneData.d.ts +1 -1
  153. package/build/src/types/SceneObjects.d.ts +9 -7
  154. package/build/src/types/SceneType.d.ts +1 -1
  155. package/build/src/types/UUID.d.ts +1 -0
  156. package/build/src/types/file/index.d.ts +1 -1
  157. package/build/src/types/index.d.ts +6 -6
  158. package/package.json +34 -23
  159. package/build/chunks/AssetLoader-BYhwzCxs.cjs +0 -3
  160. package/build/chunks/AssetLoader-BYhwzCxs.cjs.map +0 -1
  161. package/build/chunks/AssetLoader-Bmcx40wo.mjs +0 -1948
  162. package/build/chunks/AssetLoader-Bmcx40wo.mjs.map +0 -1
  163. package/build/chunks/MediaCreator-CAXBbn15.mjs +0 -59
  164. package/build/chunks/MediaCreator-CAXBbn15.mjs.map +0 -1
  165. package/build/chunks/MediaCreator-DDXQIlRv.cjs +0 -2
  166. package/build/chunks/MediaCreator-DDXQIlRv.cjs.map +0 -1
  167. package/build/chunks/SystemInfo--669uW1p.cjs +0 -2
  168. package/build/chunks/SystemInfo--669uW1p.cjs.map +0 -1
  169. package/build/chunks/SystemInfo-DYq9x4Ch.mjs.map +0 -1
  170. package/build/chunks/fflate.module-BQhIETD7.mjs.map +0 -1
  171. package/build/chunks/fflate.module-Chbb_O8w.cjs.map +0 -1
  172. package/build/index.cjs +0 -57
  173. package/build/index.cjs.map +0 -1
  174. package/build/index.mjs +0 -6793
  175. package/build/index.mjs.map +0 -1
  176. package/build/src/engine/index.d.ts +0 -1
  177. package/build/src/engine/pipeline/RenderPipeline.d.ts +0 -26
  178. package/build/src/error/index.d.ts +0 -4
  179. package/build/src/modules/_system/ModuleImporter.d.ts +0 -43
  180. package/build/src/modules/ar/ARSystem.cjs.map +0 -1
  181. package/build/src/modules/ar/ARSystem.mjs.map +0 -1
  182. package/build/src/modules/asset/converter/AssetConverter.cjs.map +0 -1
  183. package/build/src/modules/asset/converter/AssetConverter.mjs.map +0 -1
  184. package/build/src/modules/asset/exporter/AssetExporter.cjs.map +0 -1
  185. package/build/src/modules/asset/exporter/AssetExporter.mjs.map +0 -1
  186. package/build/src/modules/asset/loader/AssetLoader.cjs.map +0 -1
  187. package/build/src/modules/asset/loader/AssetLoader.mjs.map +0 -1
  188. package/build/src/modules/com/Communication.d.ts +0 -72
  189. package/build/src/modules/com/actions/camera/computeencompassingview.d.ts +0 -9
  190. package/build/src/modules/com/actions/camera/getcameratransform.d.ts +0 -9
  191. package/build/src/modules/com/actions/camera/movecamera.d.ts +0 -15
  192. package/build/src/modules/com/actions/camera/resetcamera.d.ts +0 -7
  193. package/build/src/modules/com/actions/camera/setcameralayer.d.ts +0 -7
  194. package/build/src/modules/com/actions/camera/setcameratransform.d.ts +0 -9
  195. package/build/src/modules/com/actions/camera/zoomcamera.d.ts +0 -8
  196. package/build/src/modules/com/actions/index.d.ts +0 -60
  197. package/build/src/modules/com/actions/media/generatemedia.d.ts +0 -14
  198. package/build/src/modules/com/actions/object/addobject.d.ts +0 -6
  199. package/build/src/modules/com/actions/object/deleteobject.d.ts +0 -8
  200. package/build/src/modules/com/actions/object/deselectobject.d.ts +0 -8
  201. package/build/src/modules/com/actions/object/getallobjects.d.ts +0 -6
  202. package/build/src/modules/com/actions/object/getobjects.d.ts +0 -8
  203. package/build/src/modules/com/actions/object/model/dropit.d.ts +0 -7
  204. package/build/src/modules/com/actions/object/model/modelloaded.d.ts +0 -7
  205. package/build/src/modules/com/actions/object/model/placeonfloor.d.ts +0 -7
  206. package/build/src/modules/com/actions/object/selectobject.d.ts +0 -8
  207. package/build/src/modules/com/actions/object/setparent.d.ts +0 -13
  208. package/build/src/modules/com/actions/object/updateobject.d.ts +0 -8
  209. package/build/src/modules/com/actions/renderer/startrender.d.ts +0 -5
  210. package/build/src/modules/com/actions/scene/exportscene.d.ts +0 -8
  211. package/build/src/modules/com/actions/scene/getallscenedata.d.ts +0 -6
  212. package/build/src/modules/com/actions/scene/launchar.d.ts +0 -9
  213. package/build/src/modules/com/actions/scene/setbackground.d.ts +0 -7
  214. package/build/src/modules/com/actions/scene/updatescene.d.ts +0 -11
  215. package/build/src/modules/com/actions/toolbox/select/setgizmomode.d.ts +0 -7
  216. package/build/src/modules/com/actions/toolbox/transform/setgizmoscalelinked.d.ts +0 -5
  217. package/build/src/modules/com/actions/toolbox/transform/setgizmovisible.d.ts +0 -5
  218. package/build/src/modules/com/actions/toolbox/usetool.d.ts +0 -8
  219. package/build/src/modules/com/types/COMEntity.d.ts +0 -6
  220. package/build/src/modules/com/types/COMGroup.d.ts +0 -8
  221. package/build/src/modules/com/types/COMLight.d.ts +0 -10
  222. package/build/src/modules/com/types/COMModel.d.ts +0 -11
  223. package/build/src/modules/com/types/COMPov.d.ts +0 -7
  224. package/build/src/modules/com/types/COMPrimitive.d.ts +0 -11
  225. package/build/src/modules/com/types/index.d.ts +0 -11
  226. package/build/src/modules/index.d.ts +0 -2
  227. package/build/src/modules/mediacreator/MediaCreator.cjs.map +0 -1
  228. package/build/src/modules/mediacreator/MediaCreator.mjs.map +0 -1
  229. package/build/src/modules/systeminfo/SystemInfo.cjs.map +0 -1
  230. package/build/src/modules/systeminfo/SystemInfo.mjs.map +0 -1
  231. /package/build/{index.d.ts → dive.d.ts} +0 -0
  232. /package/build/src/modules/{com → state}/types/COMEntityType.d.ts +0 -0
  233. /package/build/src/modules/{com → state}/types/COMGeometryType.d.ts +0 -0
  234. /package/build/src/modules/{com → state}/types/COMMaterial.d.ts +0 -0
@@ -0,0 +1,14 @@
1
+ import { Vector3Like } from 'three';
2
+ import { COMBaseEntity } from './COMBaseEntity.ts';
3
+ import { COMGeometry } from './COMGeometry.ts';
4
+ import { COMMaterial } from './COMMaterial.ts';
5
+ import { COMEntity } from './COMEntity.ts';
6
+ export declare function isCOMPrimitive(entity: COMEntity): entity is COMPrimitive;
7
+ export type COMPrimitive = COMBaseEntity & {
8
+ entityType: 'primitive';
9
+ position: Vector3Like;
10
+ rotation: Vector3Like;
11
+ scale: Vector3Like;
12
+ geometry: COMGeometry;
13
+ material?: Partial<COMMaterial>;
14
+ };
@@ -0,0 +1,11 @@
1
+ export * from './COMEntity.ts';
2
+ export * from './COMPrimitive.ts';
3
+ export * from './COMModel.ts';
4
+ export * from './COMLight.ts';
5
+ export * from './COMPov.ts';
6
+ export * from './COMGeometry.ts';
7
+ export * from './COMMaterial.ts';
8
+ export * from './COMGroup.ts';
9
+ export * from './COMEntityType.ts';
10
+ export * from './COMGeometryType.ts';
11
+ export * from './ActionTypes.ts';
@@ -1,2 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../chunks/SystemInfo--669uW1p.cjs");exports.SystemInfo=e.SystemInfo;
2
- //# sourceMappingURL=SystemInfo.cjs.map
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../../chunks/index-DAwIH9xh.cjs");const e=require("../../../chunks/SystemInfo-oX-NNneO.cjs");exports.SystemInfo=e.SystemInfo;
@@ -1,4 +1,4 @@
1
- import { ESystem, EWebXRUnsupportedReason } from '../../types/info';
1
+ import { ESystem, EWebXRUnsupportedReason } from '../../types/info/index.ts';
2
2
  declare global {
3
3
  interface ModuleClasses {
4
4
  SystemInfo: typeof SystemInfo;
@@ -1,5 +1,5 @@
1
- import { S as f } from "../../../chunks/SystemInfo-DYq9x4Ch.mjs";
1
+ import "../../../chunks/index-C_uFFwT2.mjs";
2
+ import { S as t } from "../../../chunks/SystemInfo-DPAQG-S5.mjs";
2
3
  export {
3
- f as SystemInfo
4
+ t as SystemInfo
4
5
  };
5
- //# sourceMappingURL=SystemInfo.mjs.map
@@ -1,8 +1,8 @@
1
1
  import { Intersection, Object3D, Raycaster, Vector2, Vector3 } from 'three';
2
- import { DIVEScene } from '../../engine/scene/Scene';
3
- import { DIVEOrbitController } from '../controller/orbit/OrbitController';
4
- import { DIVEDraggable } from '../../interfaces/Draggable';
5
- import { DIVEHoverable } from '../../interfaces/Hoverable';
2
+ import { DIVEScene } from '../../engine/scene/Scene.ts';
3
+ import { OrbitController } from '../controller/orbit/OrbitController.ts';
4
+ import { DIVEDraggable } from '../../interfaces/Draggable.ts';
5
+ import { DIVEHoverable } from '../../interfaces/Hoverable.ts';
6
6
  export type DraggableEvent = {
7
7
  dragStart: Vector3;
8
8
  dragCurrent: Vector3;
@@ -14,7 +14,7 @@ export declare abstract class DIVEBaseTool {
14
14
  name: string;
15
15
  protected _canvas: HTMLElement;
16
16
  protected _scene: DIVEScene;
17
- protected _controller: DIVEOrbitController;
17
+ protected _controller: OrbitController;
18
18
  protected _pointer: Vector2;
19
19
  protected get _pointerAnyDown(): boolean;
20
20
  protected _pointerPrimaryDown: boolean;
@@ -32,7 +32,7 @@ export declare abstract class DIVEBaseTool {
32
32
  protected _dragDelta: Vector3;
33
33
  protected _draggable: DIVEDraggable | null;
34
34
  protected _dragRaycastOnObjects: Object3D[] | null;
35
- protected constructor(scene: DIVEScene, controller: DIVEOrbitController);
35
+ protected constructor(scene: DIVEScene, controller: OrbitController);
36
36
  Activate(): void;
37
37
  Deactivate(): void;
38
38
  onPointerDown(e: PointerEvent): void;
@@ -0,0 +1 @@
1
+ "use strict";var l=Object.defineProperty;var s=(t,e,o)=>e in t?l(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var i=(t,e,o)=>s(t,typeof e!="symbol"?e+"":e,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../chunks/SelectTool-BAXTVyWs.cjs");class n{constructor(e,o){i(this,"_scene");i(this,"_controller");i(this,"_activeTool");i(this,"_selectTool");this._scene=e,this._controller=o,this._selectTool=null,this._activeTool=null}get selectTool(){return this._selectTool||(this._selectTool=new r.DIVESelectTool(this._scene,this._controller)),this._selectTool}Dispose(){this.removeEventListeners()}GetActiveTool(){return this._activeTool}UseTool(e){var o;switch((o=this._activeTool)==null||o.Deactivate(),e){case"select":{this.addEventListeners(),this.selectTool.Activate(),this._activeTool=this.selectTool;break}case"none":{this.removeEventListeners(),this._activeTool=null;break}default:console.warn(`DIVEToolBox.UseTool: Unknown tool: ${e}`)}}SetGizmoMode(e){this.selectTool.SetGizmoMode(e)}SetGizmoVisibility(e){this.selectTool.SetGizmoVisibility(e)}SetGizmoScaleLinked(e){this.selectTool.SetGizmoScaleLinked(e)}onPointerMove(e){var o;(o=this._activeTool)==null||o.onPointerMove(e)}onPointerDown(e){var o;(o=this._activeTool)==null||o.onPointerDown(e)}onPointerUp(e){var o;(o=this._activeTool)==null||o.onPointerUp(e)}onWheel(e){var o;(o=this._activeTool)==null||o.onWheel(e)}addEventListeners(){this._controller.domElement.addEventListener("pointermove",e=>this.onPointerMove(e)),this._controller.domElement.addEventListener("pointerdown",e=>this.onPointerDown(e)),this._controller.domElement.addEventListener("pointerup",e=>this.onPointerUp(e)),this._controller.domElement.addEventListener("wheel",e=>this.onWheel(e))}removeEventListeners(){this._controller.domElement.removeEventListener("pointermove",e=>this.onPointerMove(e)),this._controller.domElement.removeEventListener("pointerdown",e=>this.onPointerDown(e)),this._controller.domElement.removeEventListener("pointerup",e=>this.onPointerUp(e)),this._controller.domElement.removeEventListener("wheel",e=>this.onWheel(e))}}i(n,"DefaultTool","select");exports.Toolbox=n;
@@ -1,21 +1,25 @@
1
- import { DIVEScene } from '../../engine/scene/Scene';
2
- import { DIVEBaseTool } from './BaseTool';
3
- import { DIVESelectTool } from './select/SelectTool';
4
- import { DIVEOrbitController } from '../controller/orbit/OrbitController';
1
+ import { DIVEScene } from '../../engine/scene/Scene.ts';
2
+ import { DIVEBaseTool } from './BaseTool.ts';
3
+ import { DIVESelectTool } from './select/SelectTool.ts';
4
+ import { OrbitController } from '../controller/orbit/OrbitController.ts';
5
5
  export type ToolType = 'select' | 'none';
6
+ declare global {
7
+ interface ModuleClasses {
8
+ Toolbox: typeof Toolbox;
9
+ }
10
+ }
6
11
  /**
12
+ * @module Toolbox
7
13
  * A Toolbox to activate and deactivate tools to use with the pointer.
8
- *
9
- * @module
10
14
  */
11
- export declare class DIVEToolbox {
15
+ export declare class Toolbox {
12
16
  static readonly DefaultTool = "select";
13
17
  private _scene;
14
18
  private _controller;
15
19
  private _activeTool;
16
20
  private _selectTool;
17
21
  get selectTool(): DIVESelectTool;
18
- constructor(scene: DIVEScene, controller: DIVEOrbitController);
22
+ constructor(scene: DIVEScene, controller: OrbitController);
19
23
  Dispose(): void;
20
24
  GetActiveTool(): DIVEBaseTool | null;
21
25
  UseTool(tool: ToolType): void;
@@ -0,0 +1,99 @@
1
+ var n = Object.defineProperty;
2
+ var l = (t, e, o) => e in t ? n(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
3
+ var i = (t, e, o) => l(t, typeof e != "symbol" ? e + "" : e, o);
4
+ import { D as s } from "../../../chunks/SelectTool-Bd8cC9nb.mjs";
5
+ class r {
6
+ constructor(e, o) {
7
+ i(this, "_scene");
8
+ i(this, "_controller");
9
+ i(this, "_activeTool");
10
+ i(this, "_selectTool");
11
+ this._scene = e, this._controller = o, this._selectTool = null, this._activeTool = null;
12
+ }
13
+ get selectTool() {
14
+ return this._selectTool || (this._selectTool = new s(
15
+ this._scene,
16
+ this._controller
17
+ )), this._selectTool;
18
+ }
19
+ Dispose() {
20
+ this.removeEventListeners();
21
+ }
22
+ GetActiveTool() {
23
+ return this._activeTool;
24
+ }
25
+ UseTool(e) {
26
+ var o;
27
+ switch ((o = this._activeTool) == null || o.Deactivate(), e) {
28
+ case "select": {
29
+ this.addEventListeners(), this.selectTool.Activate(), this._activeTool = this.selectTool;
30
+ break;
31
+ }
32
+ case "none": {
33
+ this.removeEventListeners(), this._activeTool = null;
34
+ break;
35
+ }
36
+ default:
37
+ console.warn(`DIVEToolBox.UseTool: Unknown tool: ${e}`);
38
+ }
39
+ }
40
+ SetGizmoMode(e) {
41
+ this.selectTool.SetGizmoMode(e);
42
+ }
43
+ SetGizmoVisibility(e) {
44
+ this.selectTool.SetGizmoVisibility(e);
45
+ }
46
+ SetGizmoScaleLinked(e) {
47
+ this.selectTool.SetGizmoScaleLinked(e);
48
+ }
49
+ onPointerMove(e) {
50
+ var o;
51
+ (o = this._activeTool) == null || o.onPointerMove(e);
52
+ }
53
+ onPointerDown(e) {
54
+ var o;
55
+ (o = this._activeTool) == null || o.onPointerDown(e);
56
+ }
57
+ onPointerUp(e) {
58
+ var o;
59
+ (o = this._activeTool) == null || o.onPointerUp(e);
60
+ }
61
+ onWheel(e) {
62
+ var o;
63
+ (o = this._activeTool) == null || o.onWheel(e);
64
+ }
65
+ addEventListeners() {
66
+ this._controller.domElement.addEventListener(
67
+ "pointermove",
68
+ (e) => this.onPointerMove(e)
69
+ ), this._controller.domElement.addEventListener(
70
+ "pointerdown",
71
+ (e) => this.onPointerDown(e)
72
+ ), this._controller.domElement.addEventListener(
73
+ "pointerup",
74
+ (e) => this.onPointerUp(e)
75
+ ), this._controller.domElement.addEventListener(
76
+ "wheel",
77
+ (e) => this.onWheel(e)
78
+ );
79
+ }
80
+ removeEventListeners() {
81
+ this._controller.domElement.removeEventListener(
82
+ "pointermove",
83
+ (e) => this.onPointerMove(e)
84
+ ), this._controller.domElement.removeEventListener(
85
+ "pointerdown",
86
+ (e) => this.onPointerDown(e)
87
+ ), this._controller.domElement.removeEventListener(
88
+ "pointerup",
89
+ (e) => this.onPointerUp(e)
90
+ ), this._controller.domElement.removeEventListener(
91
+ "wheel",
92
+ (e) => this.onWheel(e)
93
+ );
94
+ }
95
+ }
96
+ i(r, "DefaultTool", "select");
97
+ export {
98
+ r as Toolbox
99
+ };
@@ -1,8 +1,8 @@
1
- import { DIVEScene } from '../../../engine/scene/Scene';
2
- import { DIVETransformTool } from '../transform/TransformTool';
3
- import { DIVEOrbitController } from '../../controller/orbit/OrbitController';
4
- import { DIVESelectable } from '../../../interfaces/Selectable';
5
- import { DIVEBaseTool } from '../BaseTool';
1
+ import { DIVEScene } from '../../../engine/scene/Scene.ts';
2
+ import { DIVETransformTool } from '../transform/TransformTool.ts';
3
+ import { OrbitController } from '../../controller/orbit/OrbitController.ts';
4
+ import { DIVESelectable } from '../../../interfaces/Selectable.ts';
5
+ import { DIVEBaseTool } from '../BaseTool.ts';
6
6
  export declare const isSelectTool: (tool: DIVEBaseTool) => tool is DIVESelectTool;
7
7
  export interface DIVEObjectEventMap {
8
8
  select: object;
@@ -16,7 +16,7 @@ export interface DIVEObjectEventMap {
16
16
  */
17
17
  export declare class DIVESelectTool extends DIVETransformTool {
18
18
  readonly isSelectTool: boolean;
19
- constructor(scene: DIVEScene, controller: DIVEOrbitController);
19
+ constructor(scene: DIVEScene, controller: OrbitController);
20
20
  Activate(): void;
21
21
  Select(selectable: DIVESelectable): void;
22
22
  Deselect(selectable: DIVESelectable): void;
@@ -1,8 +1,8 @@
1
- import { DIVEBaseTool } from '../BaseTool';
2
- import { DIVEScene } from '../../../engine/scene/Scene';
3
- import { DIVEOrbitController } from '../../controller/orbit/OrbitController';
4
- import { TransformControls } from 'three/examples/jsm/controls/TransformControls';
5
- import { DIVEGizmo } from '../../../components/gizmo/Gizmo';
1
+ import { TransformControls } from 'three/examples/jsm/controls/TransformControls.js';
2
+ import { DIVEBaseTool } from '../BaseTool.ts';
3
+ import { DIVEScene } from '../../../engine/scene/Scene.ts';
4
+ import { OrbitController } from '../../controller/orbit/OrbitController.ts';
5
+ import { DIVEGizmo } from '../../../components/gizmo/Gizmo.ts';
6
6
  export declare const isTransformTool: (tool: DIVEBaseTool) => tool is DIVETransformTool;
7
7
  export interface DIVEObjectEventMap {
8
8
  select: object;
@@ -18,7 +18,7 @@ export declare class DIVETransformTool extends DIVEBaseTool {
18
18
  readonly isTransformTool: boolean;
19
19
  private _scaleLinked;
20
20
  protected _gizmo: TransformControls | DIVEGizmo;
21
- constructor(scene: DIVEScene, controller: DIVEOrbitController);
21
+ constructor(scene: DIVEScene, controller: OrbitController);
22
22
  Activate(): void;
23
23
  SetGizmoMode(mode: 'translate' | 'rotate' | 'scale'): void;
24
24
  SetGizmoVisibility(active: boolean): void;
@@ -1,5 +1,5 @@
1
1
  import { Vector3Like } from 'three';
2
- import { COMGroup, COMLight, COMModel, COMPov, COMPrimitive } from '../modules/com/types/index.ts';
2
+ import { COMGroup, COMLight, COMModel, COMPov, COMPrimitive } from '../modules/state/types/index.ts';
3
3
  export type DIVESceneData = {
4
4
  name: string;
5
5
  mediaItem: null;
@@ -1,7 +1,9 @@
1
- import { DIVEGroup } from '../components/group/Group';
2
- import { DIVEAmbientLight } from '../components/light/AmbientLight';
3
- import { DIVEPointLight } from '../components/light/PointLight';
4
- import { DIVESceneLight } from '../components/light/SceneLight';
5
- import { DIVEModel } from '../components/model/Model';
6
- import { DIVEPrimitive } from '../components/primitive/Primitive';
7
- export type DIVESceneObject = DIVEModel | DIVEGroup | DIVEPrimitive | DIVEAmbientLight | DIVEPointLight | DIVESceneLight;
1
+ import { DIVEGroup } from '../components/group/Group.ts';
2
+ import { DIVEAmbientLight } from '../components/light/AmbientLight.ts';
3
+ import { DIVEPointLight } from '../components/light/PointLight.ts';
4
+ import { DIVESceneLight } from '../components/light/SceneLight.ts';
5
+ import { DIVEModel } from '../components/model/Model.ts';
6
+ import { DIVEPrimitive } from '../components/primitive/Primitive.ts';
7
+ import { COMEntityType } from '../modules/state/types/index.ts';
8
+ export type DIVESceneObject<T extends COMEntityType | void = void> = T extends 'model' ? DIVEModel : T extends 'group' ? DIVEGroup : T extends 'primitive' ? DIVEPrimitive : T extends 'light' ? DIVELight : DIVEModel | DIVEGroup | DIVEPrimitive | DIVELight;
9
+ export type DIVELight = DIVEAmbientLight | DIVEPointLight | DIVESceneLight;
@@ -1,4 +1,4 @@
1
- import { GLTF } from 'three/examples/jsm/loaders/GLTFLoader';
1
+ import { GLTF } from 'three/examples/jsm/loaders/GLTFLoader.ts';
2
2
  export type DIVESceneFileType = {
3
3
  glb: GLTF;
4
4
  };
@@ -0,0 +1 @@
1
+ export type UUID = string;
@@ -1 +1 @@
1
- export * from './FileTypes';
1
+ export * from './FileTypes.ts';
@@ -1,6 +1,6 @@
1
- export * from './SceneData';
2
- export * from './SceneObjects';
3
- export * from './SceneType';
4
- export * from './file';
5
- export * from '../error';
6
- export * from './info';
1
+ export * from './SceneData.ts';
2
+ export * from './SceneObjects.ts';
3
+ export * from './SceneType.ts';
4
+ export * from './UUID.ts';
5
+ export * from './file/index.ts';
6
+ export * from './info/index.ts';
package/package.json CHANGED
@@ -1,16 +1,21 @@
1
1
  {
2
2
  "name": "@shopware-ag/dive",
3
- "version": "1.19.1-beta.9",
3
+ "version": "2.0.1-beta.1",
4
4
  "description": "Shopware Spatial Framework",
5
5
  "type": "module",
6
- "main": "build/index.cjs",
7
- "module": "build/index.mjs",
8
- "types": "build/index.d.ts",
6
+ "main": "build/dive.cjs",
7
+ "module": "build/dive.mjs",
8
+ "types": "build/dive.d.ts",
9
9
  "exports": {
10
10
  ".": {
11
- "types": "./build/index.d.ts",
12
- "import": "./build/index.mjs",
13
- "require": "./build/index.cjs"
11
+ "types": "./build/dive.d.ts",
12
+ "import": "./build/dive.mjs",
13
+ "require": "./build/dive.cjs"
14
+ },
15
+ "./modules/AnimationSystem": {
16
+ "types": "./build/src/modules/animation/AnimationSystem.d.ts",
17
+ "import": "./build/src/modules/animation/AnimationSystem.mjs",
18
+ "require": "./build/src/modules/animation/AnimationSystem.cjs"
14
19
  },
15
20
  "./modules/ARSystem": {
16
21
  "types": "./build/src/modules/ar/ARSystem.d.ts",
@@ -37,10 +42,20 @@
37
42
  "import": "./build/src/modules/mediacreator/MediaCreator.mjs",
38
43
  "require": "./build/src/modules/mediacreator/MediaCreator.cjs"
39
44
  },
45
+ "./modules/State": {
46
+ "types": "./build/src/modules/state/State.d.ts",
47
+ "import": "./build/src/modules/state/State.mjs",
48
+ "require": "./build/src/modules/state/State.cjs"
49
+ },
40
50
  "./modules/SystemInfo": {
41
51
  "types": "./build/src/modules/systeminfo/SystemInfo.d.ts",
42
52
  "import": "./build/src/modules/systeminfo/SystemInfo.mjs",
43
53
  "require": "./build/src/modules/systeminfo/SystemInfo.cjs"
54
+ },
55
+ "./modules/Toolbox": {
56
+ "types": "./build/src/modules/toolbox/Toolbox.d.ts",
57
+ "import": "./build/src/modules/toolbox/Toolbox.mjs",
58
+ "require": "./build/src/modules/toolbox/Toolbox.cjs"
44
59
  }
45
60
  },
46
61
  "files": [
@@ -71,49 +86,45 @@
71
86
  },
72
87
  "devDependencies": {
73
88
  "@eslint/js": "^9.1.1",
89
+ "@testing-library/jest-dom": "^6.6.3",
74
90
  "@types/jest": "^29.5.12",
75
91
  "@types/lodash": "^4.17.12",
76
92
  "@types/node": "^20.12.7",
77
93
  "@types/three": "^0.163.0",
94
+ "@vitest/coverage-v8": "3.1.2",
78
95
  "acorn": "^8.14.1",
79
96
  "acorn-walk": "^8.3.4",
80
97
  "eslint": "^9.1.1",
81
98
  "glob": "^11.0.1",
82
99
  "globals": "^15.0.0",
83
- "jest": "^29.7.0",
84
- "jest-environment-jsdom": "^29.7.0",
85
- "jest-junit": "^16.0.0",
86
- "jsdom": "^24.0.0",
100
+ "jsdom": "^26.1.0",
87
101
  "magic-string": "^0.30.17",
88
102
  "prettier": "^3.3.3",
89
103
  "prettier-plugin-multiline-arrays": "^3.0.6",
104
+ "rollup-plugin-copy": "^3.5.0",
90
105
  "ts-jest": "^29.1.2",
91
106
  "ts-morph": "^25.0.1",
92
107
  "ts-node": "^10.9.2",
93
108
  "tsc": "^2.0.4",
109
+ "tsx": "^4.19.4",
94
110
  "typescript": "^5.8.2",
95
111
  "typescript-eslint": "^7.7.1",
96
112
  "vite": "^6.2.1",
97
- "vite-plugin-dts": "^4.5.3"
113
+ "vite-plugin-dts": "^4.5.3",
114
+ "vitest": "^3.1.2"
98
115
  },
99
116
  "scripts": {
100
117
  "validate-build-paths": "NODE_OPTIONS='--loader ts-node/esm' ts-node ci/build/validate-build-paths.ts",
101
- "validate-import-paths": "NODE_OPTIONS='--loader ts-node/esm' ts-node ci/build/validate-import-paths.ts",
102
118
  "build": "vite build",
103
- "postbuild": "yarn validate-import-paths && yarn validate-build-paths",
104
119
  "dev": "vite build --watch",
105
120
  "lint": "eslint",
106
- "lint:actions": "bash ci/lint/lint-actions.sh",
107
- "lint:actions:transpile": "yarn tsc --resolveJsonModule --esModuleInterop ci/lint/lint-actions.ts && mv ci/lint/lint-actions.js ci/lint/lint-actions.cjs",
108
- "lint:actions:check": "yarn node ci/lint/lint-actions.cjs",
109
- "lint:actions:cleanup": "node -e \"require('fs').unlinkSync('ci/lint/lint-actions.cjs')\"",
110
121
  "prettier:check": "prettier --check .",
111
122
  "prettier:fix": "prettier --write .",
112
- "unit": "jest",
113
- "coverage": "jest --coverage",
123
+ "unit": "vitest --run",
124
+ "coverage": "vitest --coverage --run",
114
125
  "docs": "yarn docs:actions && yarn docs:modules",
115
- "docs:actions": "NODE_OPTIONS='--loader ts-node/esm' ts-node docs/generators/generate-actions-docs.ts",
116
- "docs:modules": "NODE_OPTIONS='--loader ts-node/esm' ts-node docs/generators/generate-modules-docs.ts",
117
- "ci": "yarn lint && yarn lint:actions && yarn prettier:check && yarn docs && yarn coverage && yarn build"
126
+ "docs:actions": "tsx docs/generators/generate-actions-docs.ts",
127
+ "docs:modules": "tsx docs/generators/generate-modules-docs.ts",
128
+ "ci": "yarn lint && yarn prettier:check && yarn docs && yarn coverage && yarn build"
118
129
  }
119
130
  }
@@ -1,3 +0,0 @@
1
- "use strict";var ae=Object.defineProperty;var ce=(d,t,e)=>t in d?ae(d,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):d[t]=e;var H=(d,t,e)=>ce(d,typeof t!="symbol"?t+"":t,e);const l=require("three"),D=require("./fflate.module-Chbb_O8w.cjs");function $(d){var o;const t=d.split("/").pop()||"";return!t.includes(".")||t.endsWith(".")?"":((o=t.split(".").pop())==null?void 0:o.toLowerCase().split("?")[0])||""}function ee(d){return d.toLowerCase()in{glb:!0,gltf:!0,usdz:!0}}class K extends Error{constructor(t,e,o){super(e),this.url=t,this.cause=o,this.name="NetworkError"}}const te={glb:{key:"glb",extension:"glb"},gltf:{key:"gltf",extension:"gltf"},usdz:{key:"usdz",extension:"usdz"}},ne=Object.values(te).map(d=>d.extension);function q(d,t){if(t===l.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),d;if(t===l.TriangleFanDrawMode||t===l.TriangleStripDrawMode){let e=d.getIndex();if(e===null){const s=[],a=d.getAttribute("position");if(a!==void 0){for(let i=0;i<a.count;i++)s.push(i);d.setIndex(s),e=d.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),d}const o=e.count-2,n=[];if(t===l.TriangleFanDrawMode)for(let s=1;s<=o;s++)n.push(e.getX(0)),n.push(e.getX(s)),n.push(e.getX(s+1));else for(let s=0;s<o;s++)s%2===0?(n.push(e.getX(s)),n.push(e.getX(s+1)),n.push(e.getX(s+2))):(n.push(e.getX(s+2)),n.push(e.getX(s+1)),n.push(e.getX(s)));n.length/3!==o&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const r=d.clone();return r.setIndex(n),r.clearGroups(),r}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),d}class le extends l.Loader{constructor(t){super(t),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new pe(e)}),this.register(function(e){return new we(e)}),this.register(function(e){return new Me(e)}),this.register(function(e){return new ye(e)}),this.register(function(e){return new ge(e)}),this.register(function(e){return new Ae(e)}),this.register(function(e){return new Te(e)}),this.register(function(e){return new xe(e)}),this.register(function(e){return new he(e)}),this.register(function(e){return new Re(e)}),this.register(function(e){return new me(e)}),this.register(function(e){return new Ee(e)}),this.register(function(e){return new Se(e)}),this.register(function(e){return new fe(e)}),this.register(function(e){return new Le(e)}),this.register(function(e){return new _e(e)})}load(t,e,o,n){const r=this;let s;if(this.resourcePath!=="")s=this.resourcePath;else if(this.path!==""){const c=l.LoaderUtils.extractUrlBase(t);s=l.LoaderUtils.resolveURL(c,this.path)}else s=l.LoaderUtils.extractUrlBase(t);this.manager.itemStart(t);const a=function(c){n?n(c):console.error(c),r.manager.itemError(t),r.manager.itemEnd(t)},i=new l.FileLoader(this.manager);i.setPath(this.path),i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),i.load(t,function(c){try{r.parse(c,s,function(f){e(f),r.manager.itemEnd(t)},a)}catch(f){a(f)}},o,a)}setDRACOLoader(t){return this.dracoLoader=t,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(t){return this.ktx2Loader=t,this}setMeshoptDecoder(t){return this.meshoptDecoder=t,this}register(t){return this.pluginCallbacks.indexOf(t)===-1&&this.pluginCallbacks.push(t),this}unregister(t){return this.pluginCallbacks.indexOf(t)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}parse(t,e,o,n){let r;const s={},a={},i=new TextDecoder;if(typeof t=="string")r=JSON.parse(t);else if(t instanceof ArrayBuffer)if(i.decode(new Uint8Array(t,0,4))===se){try{s[M.KHR_BINARY_GLTF]=new be(t)}catch(u){n&&n(u);return}r=JSON.parse(s[M.KHR_BINARY_GLTF].content)}else r=JSON.parse(i.decode(t));else r=t;if(r.asset===void 0||r.asset.version[0]<2){n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const c=new Ue(r,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let f=0;f<this.pluginCallbacks.length;f++){const u=this.pluginCallbacks[f](c);u.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[u.name]=u,s[u.name]=!0}if(r.extensionsUsed)for(let f=0;f<r.extensionsUsed.length;++f){const u=r.extensionsUsed[f],m=r.extensionsRequired||[];switch(u){case M.KHR_MATERIALS_UNLIT:s[u]=new de;break;case M.KHR_DRACO_MESH_COMPRESSION:s[u]=new Ne(r,this.dracoLoader);break;case M.KHR_TEXTURE_TRANSFORM:s[u]=new Ce;break;case M.KHR_MESH_QUANTIZATION:s[u]=new Ie;break;default:m.indexOf(u)>=0&&a[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}c.setExtensions(s),c.setPlugins(a),c.parse(o,n)}parseAsync(t,e){const o=this;return new Promise(function(n,r){o.parse(t,e,n,r)})}}function ue(){let d={};return{get:function(t){return d[t]},add:function(t,e){d[t]=e},remove:function(t){delete d[t]},removeAll:function(){d={}}}}const M={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class fe{constructor(t){this.parser=t,this.name=M.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const t=this.parser,e=this.parser.json.nodes||[];for(let o=0,n=e.length;o<n;o++){const r=e[o];r.extensions&&r.extensions[this.name]&&r.extensions[this.name].light!==void 0&&t._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(t){const e=this.parser,o="light:"+t;let n=e.cache.get(o);if(n)return n;const r=e.json,i=((r.extensions&&r.extensions[this.name]||{}).lights||[])[t];let c;const f=new l.Color(16777215);i.color!==void 0&&f.setRGB(i.color[0],i.color[1],i.color[2],l.LinearSRGBColorSpace);const u=i.range!==void 0?i.range:0;switch(i.type){case"directional":c=new l.DirectionalLight(f),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new l.PointLight(f),c.distance=u;break;case"spot":c=new l.SpotLight(f),c.distance=u,i.spot=i.spot||{},i.spot.innerConeAngle=i.spot.innerConeAngle!==void 0?i.spot.innerConeAngle:0,i.spot.outerConeAngle=i.spot.outerConeAngle!==void 0?i.spot.outerConeAngle:Math.PI/4,c.angle=i.spot.outerConeAngle,c.penumbra=1-i.spot.innerConeAngle/i.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+i.type)}return c.position.set(0,0,0),c.decay=2,F(c,i),i.intensity!==void 0&&(c.intensity=i.intensity),c.name=e.createUniqueName(i.name||"light_"+t),n=Promise.resolve(c),e.cache.add(o,n),n}getDependency(t,e){if(t==="light")return this._loadLight(e)}createNodeAttachment(t){const e=this,o=this.parser,r=o.json.nodes[t],a=(r.extensions&&r.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(i){return o._getNodeRef(e.cache,a,i)})}}class de{constructor(){this.name=M.KHR_MATERIALS_UNLIT}getMaterialType(){return l.MeshBasicMaterial}extendParams(t,e,o){const n=[];t.color=new l.Color(1,1,1),t.opacity=1;const r=e.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){const s=r.baseColorFactor;t.color.setRGB(s[0],s[1],s[2],l.LinearSRGBColorSpace),t.opacity=s[3]}r.baseColorTexture!==void 0&&n.push(o.assignTexture(t,"map",r.baseColorTexture,l.SRGBColorSpace))}return Promise.all(n)}}class he{constructor(t){this.parser=t,this.name=M.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(t,e){const n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=n.extensions[this.name].emissiveStrength;return r!==void 0&&(e.emissiveIntensity=r),Promise.resolve()}}class pe{constructor(t){this.parser=t,this.name=M.KHR_MATERIALS_CLEARCOAT}getMaterialType(t){const o=this.parser.json.materials[t];return!o.extensions||!o.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(t,e){const o=this.parser,n=o.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],s=n.extensions[this.name];if(s.clearcoatFactor!==void 0&&(e.clearcoat=s.clearcoatFactor),s.clearcoatTexture!==void 0&&r.push(o.assignTexture(e,"clearcoatMap",s.clearcoatTexture)),s.clearcoatRoughnessFactor!==void 0&&(e.clearcoatRoughness=s.clearcoatRoughnessFactor),s.clearcoatRoughnessTexture!==void 0&&r.push(o.assignTexture(e,"clearcoatRoughnessMap",s.clearcoatRoughnessTexture)),s.clearcoatNormalTexture!==void 0&&(r.push(o.assignTexture(e,"clearcoatNormalMap",s.clearcoatNormalTexture)),s.clearcoatNormalTexture.scale!==void 0)){const a=s.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new l.Vector2(a,a)}return Promise.all(r)}}class me{constructor(t){this.parser=t,this.name=M.KHR_MATERIALS_IRIDESCENCE}getMaterialType(t){const o=this.parser.json.materials[t];return!o.extensions||!o.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(t,e){const o=this.parser,n=o.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],s=n.extensions[this.name];return s.iridescenceFactor!==void 0&&(e.iridescence=s.iridescenceFactor),s.iridescenceTexture!==void 0&&r.push(o.assignTexture(e,"iridescenceMap",s.iridescenceTexture)),s.iridescenceIor!==void 0&&(e.iridescenceIOR=s.iridescenceIor),e.iridescenceThicknessRange===void 0&&(e.iridescenceThicknessRange=[100,400]),s.iridescenceThicknessMinimum!==void 0&&(e.iridescenceThicknessRange[0]=s.iridescenceThicknessMinimum),s.iridescenceThicknessMaximum!==void 0&&(e.iridescenceThicknessRange[1]=s.iridescenceThicknessMaximum),s.iridescenceThicknessTexture!==void 0&&r.push(o.assignTexture(e,"iridescenceThicknessMap",s.iridescenceThicknessTexture)),Promise.all(r)}}class ge{constructor(t){this.parser=t,this.name=M.KHR_MATERIALS_SHEEN}getMaterialType(t){const o=this.parser.json.materials[t];return!o.extensions||!o.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(t,e){const o=this.parser,n=o.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[];e.sheenColor=new l.Color(0,0,0),e.sheenRoughness=0,e.sheen=1;const s=n.extensions[this.name];if(s.sheenColorFactor!==void 0){const a=s.sheenColorFactor;e.sheenColor.setRGB(a[0],a[1],a[2],l.LinearSRGBColorSpace)}return s.sheenRoughnessFactor!==void 0&&(e.sheenRoughness=s.sheenRoughnessFactor),s.sheenColorTexture!==void 0&&r.push(o.assignTexture(e,"sheenColorMap",s.sheenColorTexture,l.SRGBColorSpace)),s.sheenRoughnessTexture!==void 0&&r.push(o.assignTexture(e,"sheenRoughnessMap",s.sheenRoughnessTexture)),Promise.all(r)}}class Ae{constructor(t){this.parser=t,this.name=M.KHR_MATERIALS_TRANSMISSION}getMaterialType(t){const o=this.parser.json.materials[t];return!o.extensions||!o.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(t,e){const o=this.parser,n=o.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],s=n.extensions[this.name];return s.transmissionFactor!==void 0&&(e.transmission=s.transmissionFactor),s.transmissionTexture!==void 0&&r.push(o.assignTexture(e,"transmissionMap",s.transmissionTexture)),Promise.all(r)}}class Te{constructor(t){this.parser=t,this.name=M.KHR_MATERIALS_VOLUME}getMaterialType(t){const o=this.parser.json.materials[t];return!o.extensions||!o.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(t,e){const o=this.parser,n=o.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],s=n.extensions[this.name];e.thickness=s.thicknessFactor!==void 0?s.thicknessFactor:0,s.thicknessTexture!==void 0&&r.push(o.assignTexture(e,"thicknessMap",s.thicknessTexture)),e.attenuationDistance=s.attenuationDistance||1/0;const a=s.attenuationColor||[1,1,1];return e.attenuationColor=new l.Color().setRGB(a[0],a[1],a[2],l.LinearSRGBColorSpace),Promise.all(r)}}class xe{constructor(t){this.parser=t,this.name=M.KHR_MATERIALS_IOR}getMaterialType(t){const o=this.parser.json.materials[t];return!o.extensions||!o.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=n.extensions[this.name];return e.ior=r.ior!==void 0?r.ior:1.5,Promise.resolve()}}class Re{constructor(t){this.parser=t,this.name=M.KHR_MATERIALS_SPECULAR}getMaterialType(t){const o=this.parser.json.materials[t];return!o.extensions||!o.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(t,e){const o=this.parser,n=o.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],s=n.extensions[this.name];e.specularIntensity=s.specularFactor!==void 0?s.specularFactor:1,s.specularTexture!==void 0&&r.push(o.assignTexture(e,"specularIntensityMap",s.specularTexture));const a=s.specularColorFactor||[1,1,1];return e.specularColor=new l.Color().setRGB(a[0],a[1],a[2],l.LinearSRGBColorSpace),s.specularColorTexture!==void 0&&r.push(o.assignTexture(e,"specularColorMap",s.specularColorTexture,l.SRGBColorSpace)),Promise.all(r)}}class Se{constructor(t){this.parser=t,this.name=M.EXT_MATERIALS_BUMP}getMaterialType(t){const o=this.parser.json.materials[t];return!o.extensions||!o.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(t,e){const o=this.parser,n=o.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],s=n.extensions[this.name];return e.bumpScale=s.bumpFactor!==void 0?s.bumpFactor:1,s.bumpTexture!==void 0&&r.push(o.assignTexture(e,"bumpMap",s.bumpTexture)),Promise.all(r)}}class Ee{constructor(t){this.parser=t,this.name=M.KHR_MATERIALS_ANISOTROPY}getMaterialType(t){const o=this.parser.json.materials[t];return!o.extensions||!o.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(t,e){const o=this.parser,n=o.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],s=n.extensions[this.name];return s.anisotropyStrength!==void 0&&(e.anisotropy=s.anisotropyStrength),s.anisotropyRotation!==void 0&&(e.anisotropyRotation=s.anisotropyRotation),s.anisotropyTexture!==void 0&&r.push(o.assignTexture(e,"anisotropyMap",s.anisotropyTexture)),Promise.all(r)}}class we{constructor(t){this.parser=t,this.name=M.KHR_TEXTURE_BASISU}loadTexture(t){const e=this.parser,o=e.json,n=o.textures[t];if(!n.extensions||!n.extensions[this.name])return null;const r=n.extensions[this.name],s=e.options.ktx2Loader;if(!s){if(o.extensionsRequired&&o.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(t,r.source,s)}}class Me{constructor(t){this.parser=t,this.name=M.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(t){const e=this.name,o=this.parser,n=o.json,r=n.textures[t];if(!r.extensions||!r.extensions[e])return null;const s=r.extensions[e],a=n.images[s.source];let i=o.textureLoader;if(a.uri){const c=o.options.manager.getHandler(a.uri);c!==null&&(i=c)}return this.detectSupport().then(function(c){if(c)return o.loadTextureImage(t,s.source,i);if(n.extensionsRequired&&n.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return o.loadTexture(t)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(t){const e=new Image;e.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",e.onload=e.onerror=function(){t(e.height===1)}})),this.isSupported}}class ye{constructor(t){this.parser=t,this.name=M.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(t){const e=this.name,o=this.parser,n=o.json,r=n.textures[t];if(!r.extensions||!r.extensions[e])return null;const s=r.extensions[e],a=n.images[s.source];let i=o.textureLoader;if(a.uri){const c=o.options.manager.getHandler(a.uri);c!==null&&(i=c)}return this.detectSupport().then(function(c){if(c)return o.loadTextureImage(t,s.source,i);if(n.extensionsRequired&&n.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return o.loadTexture(t)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(t){const e=new Image;e.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",e.onload=e.onerror=function(){t(e.height===1)}})),this.isSupported}}class Le{constructor(t){this.name=M.EXT_MESHOPT_COMPRESSION,this.parser=t}loadBufferView(t){const e=this.parser.json,o=e.bufferViews[t];if(o.extensions&&o.extensions[this.name]){const n=o.extensions[this.name],r=this.parser.getDependency("buffer",n.buffer),s=this.parser.options.meshoptDecoder;if(!s||!s.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return r.then(function(a){const i=n.byteOffset||0,c=n.byteLength||0,f=n.count,u=n.byteStride,m=new Uint8Array(a,i,c);return s.decodeGltfBufferAsync?s.decodeGltfBufferAsync(f,u,m,n.mode,n.filter).then(function(T){return T.buffer}):s.ready.then(function(){const T=new ArrayBuffer(f*u);return s.decodeGltfBuffer(new Uint8Array(T),f,u,m,n.mode,n.filter),T})})}else return null}}class _e{constructor(t){this.name=M.EXT_MESH_GPU_INSTANCING,this.parser=t}createNodeMesh(t){const e=this.parser.json,o=e.nodes[t];if(!o.extensions||!o.extensions[this.name]||o.mesh===void 0)return null;const n=e.meshes[o.mesh];for(const c of n.primitives)if(c.mode!==I.TRIANGLES&&c.mode!==I.TRIANGLE_STRIP&&c.mode!==I.TRIANGLE_FAN&&c.mode!==void 0)return null;const s=o.extensions[this.name].attributes,a=[],i={};for(const c in s)a.push(this.parser.getDependency("accessor",s[c]).then(f=>(i[c]=f,i[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(t)),Promise.all(a).then(c=>{const f=c.pop(),u=f.isGroup?f.children:[f],m=c[0].count,T=[];for(const R of u){const y=new l.Matrix4,x=new l.Vector3,S=new l.Quaternion,L=new l.Vector3(1,1,1),_=new l.InstancedMesh(R.geometry,R.material,m);for(let w=0;w<m;w++)i.TRANSLATION&&x.fromBufferAttribute(i.TRANSLATION,w),i.ROTATION&&S.fromBufferAttribute(i.ROTATION,w),i.SCALE&&L.fromBufferAttribute(i.SCALE,w),_.setMatrixAt(w,y.compose(x,S,L));for(const w in i)if(w==="_COLOR_0"){const N=i[w];_.instanceColor=new l.InstancedBufferAttribute(N.array,N.itemSize,N.normalized)}else w!=="TRANSLATION"&&w!=="ROTATION"&&w!=="SCALE"&&R.geometry.setAttribute(w,i[w]);l.Object3D.prototype.copy.call(_,R),this.parser.assignFinalMaterial(_),T.push(_)}return f.isGroup?(f.clear(),f.add(...T),f):T[0]}))}}const se="glTF",k=12,Y={JSON:1313821514,BIN:5130562};class be{constructor(t){this.name=M.KHR_BINARY_GLTF,this.content=null,this.body=null;const e=new DataView(t,0,k),o=new TextDecoder;if(this.header={magic:o.decode(new Uint8Array(t.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==se)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const n=this.header.length-k,r=new DataView(t,k);let s=0;for(;s<n;){const a=r.getUint32(s,!0);s+=4;const i=r.getUint32(s,!0);if(s+=4,i===Y.JSON){const c=new Uint8Array(t,k+s,a);this.content=o.decode(c)}else if(i===Y.BIN){const c=k+s;this.body=t.slice(c,c+a)}s+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class Ne{constructor(t,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=M.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=e,this.dracoLoader.preload()}decodePrimitive(t,e){const o=this.json,n=this.dracoLoader,r=t.extensions[this.name].bufferView,s=t.extensions[this.name].attributes,a={},i={},c={};for(const f in s){const u=V[f]||f.toLowerCase();a[u]=s[f]}for(const f in t.attributes){const u=V[f]||f.toLowerCase();if(s[f]!==void 0){const m=o.accessors[t.attributes[f]],T=B[m.componentType];c[u]=T.name,i[u]=m.normalized===!0}}return e.getDependency("bufferView",r).then(function(f){return new Promise(function(u,m){n.decodeDracoFile(f,function(T){for(const R in T.attributes){const y=T.attributes[R],x=i[R];x!==void 0&&(y.normalized=x)}u(T)},a,c,l.LinearSRGBColorSpace,m)})})}}class Ce{constructor(){this.name=M.KHR_TEXTURE_TRANSFORM}extendTexture(t,e){return(e.texCoord===void 0||e.texCoord===t.channel)&&e.offset===void 0&&e.rotation===void 0&&e.scale===void 0||(t=t.clone(),e.texCoord!==void 0&&(t.channel=e.texCoord),e.offset!==void 0&&t.offset.fromArray(e.offset),e.rotation!==void 0&&(t.rotation=e.rotation),e.scale!==void 0&&t.repeat.fromArray(e.scale),t.needsUpdate=!0),t}}class Ie{constructor(){this.name=M.KHR_MESH_QUANTIZATION}}class re extends l.Interpolant{constructor(t,e,o,n){super(t,e,o,n)}copySampleValue_(t){const e=this.resultBuffer,o=this.sampleValues,n=this.valueSize,r=t*n*3+n;for(let s=0;s!==n;s++)e[s]=o[r+s];return e}interpolate_(t,e,o,n){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,i=a*2,c=a*3,f=n-e,u=(o-e)/f,m=u*u,T=m*u,R=t*c,y=R-c,x=-2*T+3*m,S=T-m,L=1-x,_=S-m+u;for(let w=0;w!==a;w++){const N=s[y+w+a],C=s[y+w+i]*f,b=s[R+w+a],h=s[R+w]*f;r[w]=L*N+_*C+x*b+S*h}return r}}const Oe=new l.Quaternion;class Fe extends re{interpolate_(t,e,o,n){const r=super.interpolate_(t,e,o,n);return Oe.fromArray(r).normalize().toArray(r),r}}const I={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},B={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Q={9728:l.NearestFilter,9729:l.LinearFilter,9984:l.NearestMipmapNearestFilter,9985:l.LinearMipmapNearestFilter,9986:l.NearestMipmapLinearFilter,9987:l.LinearMipmapLinearFilter},J={33071:l.ClampToEdgeWrapping,33648:l.MirroredRepeatWrapping,10497:l.RepeatWrapping},v={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},V={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},O={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Pe={CUBICSPLINE:void 0,LINEAR:l.InterpolateLinear,STEP:l.InterpolateDiscrete},U={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function De(d){return d.DefaultMaterial===void 0&&(d.DefaultMaterial=new l.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:l.FrontSide})),d.DefaultMaterial}function P(d,t,e){for(const o in e.extensions)d[o]===void 0&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[o]=e.extensions[o])}function F(d,t){t.extras!==void 0&&(typeof t.extras=="object"?Object.assign(d.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function Be(d,t,e){let o=!1,n=!1,r=!1;for(let c=0,f=t.length;c<f;c++){const u=t[c];if(u.POSITION!==void 0&&(o=!0),u.NORMAL!==void 0&&(n=!0),u.COLOR_0!==void 0&&(r=!0),o&&n&&r)break}if(!o&&!n&&!r)return Promise.resolve(d);const s=[],a=[],i=[];for(let c=0,f=t.length;c<f;c++){const u=t[c];if(o){const m=u.POSITION!==void 0?e.getDependency("accessor",u.POSITION):d.attributes.position;s.push(m)}if(n){const m=u.NORMAL!==void 0?e.getDependency("accessor",u.NORMAL):d.attributes.normal;a.push(m)}if(r){const m=u.COLOR_0!==void 0?e.getDependency("accessor",u.COLOR_0):d.attributes.color;i.push(m)}}return Promise.all([Promise.all(s),Promise.all(a),Promise.all(i)]).then(function(c){const f=c[0],u=c[1],m=c[2];return o&&(d.morphAttributes.position=f),n&&(d.morphAttributes.normal=u),r&&(d.morphAttributes.color=m),d.morphTargetsRelative=!0,d})}function ke(d,t){if(d.updateMorphTargets(),t.weights!==void 0)for(let e=0,o=t.weights.length;e<o;e++)d.morphTargetInfluences[e]=t.weights[e];if(t.extras&&Array.isArray(t.extras.targetNames)){const e=t.extras.targetNames;if(d.morphTargetInfluences.length===e.length){d.morphTargetDictionary={};for(let o=0,n=e.length;o<n;o++)d.morphTargetDictionary[e[o]]=o}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Ge(d){let t;const e=d.extensions&&d.extensions[M.KHR_DRACO_MESH_COMPRESSION];if(e?t="draco:"+e.bufferView+":"+e.indices+":"+j(e.attributes):t=d.indices+":"+j(d.attributes)+":"+d.mode,d.targets!==void 0)for(let o=0,n=d.targets.length;o<n;o++)t+=":"+j(d.targets[o]);return t}function j(d){let t="";const e=Object.keys(d).sort();for(let o=0,n=e.length;o<n;o++)t+=e[o]+":"+d[e[o]]+";";return t}function X(d){switch(d){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function He(d){return d.search(/\.jpe?g($|\?)/i)>0||d.search(/^data\:image\/jpeg/)===0?"image/jpeg":d.search(/\.webp($|\?)/i)>0||d.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const ve=new l.Matrix4;class Ue{constructor(t={},e={}){this.json=t,this.extensions={},this.plugins={},this.options=e,this.cache=new ue,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let o=!1,n=!1,r=-1;typeof navigator<"u"&&(o=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,n=navigator.userAgent.indexOf("Firefox")>-1,r=n?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||o||n&&r<98?this.textureLoader=new l.TextureLoader(this.options.manager):this.textureLoader=new l.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new l.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(t){this.extensions=t}setPlugins(t){this.plugins=t}parse(t,e){const o=this,n=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(s){return s._markDefs&&s._markDefs()}),Promise.all(this._invokeAll(function(s){return s.beforeRoot&&s.beforeRoot()})).then(function(){return Promise.all([o.getDependencies("scene"),o.getDependencies("animation"),o.getDependencies("camera")])}).then(function(s){const a={scene:s[0][n.scene||0],scenes:s[0],animations:s[1],cameras:s[2],asset:n.asset,parser:o,userData:{}};return P(r,a,n),F(a,n),Promise.all(o._invokeAll(function(i){return i.afterRoot&&i.afterRoot(a)})).then(function(){for(const i of a.scenes)i.updateMatrixWorld();t(a)})}).catch(e)}_markDefs(){const t=this.json.nodes||[],e=this.json.skins||[],o=this.json.meshes||[];for(let n=0,r=e.length;n<r;n++){const s=e[n].joints;for(let a=0,i=s.length;a<i;a++)t[s[a]].isBone=!0}for(let n=0,r=t.length;n<r;n++){const s=t[n];s.mesh!==void 0&&(this._addNodeRef(this.meshCache,s.mesh),s.skin!==void 0&&(o[s.mesh].isSkinnedMesh=!0)),s.camera!==void 0&&this._addNodeRef(this.cameraCache,s.camera)}}_addNodeRef(t,e){e!==void 0&&(t.refs[e]===void 0&&(t.refs[e]=t.uses[e]=0),t.refs[e]++)}_getNodeRef(t,e,o){if(t.refs[e]<=1)return o;const n=o.clone(),r=(s,a)=>{const i=this.associations.get(s);i!=null&&this.associations.set(a,i);for(const[c,f]of s.children.entries())r(f,a.children[c])};return r(o,n),n.name+="_instance_"+t.uses[e]++,n}_invokeOne(t){const e=Object.values(this.plugins);e.push(this);for(let o=0;o<e.length;o++){const n=t(e[o]);if(n)return n}return null}_invokeAll(t){const e=Object.values(this.plugins);e.unshift(this);const o=[];for(let n=0;n<e.length;n++){const r=t(e[n]);r&&o.push(r)}return o}getDependency(t,e){const o=t+":"+e;let n=this.cache.get(o);if(!n){switch(t){case"scene":n=this.loadScene(e);break;case"node":n=this._invokeOne(function(r){return r.loadNode&&r.loadNode(e)});break;case"mesh":n=this._invokeOne(function(r){return r.loadMesh&&r.loadMesh(e)});break;case"accessor":n=this.loadAccessor(e);break;case"bufferView":n=this._invokeOne(function(r){return r.loadBufferView&&r.loadBufferView(e)});break;case"buffer":n=this.loadBuffer(e);break;case"material":n=this._invokeOne(function(r){return r.loadMaterial&&r.loadMaterial(e)});break;case"texture":n=this._invokeOne(function(r){return r.loadTexture&&r.loadTexture(e)});break;case"skin":n=this.loadSkin(e);break;case"animation":n=this._invokeOne(function(r){return r.loadAnimation&&r.loadAnimation(e)});break;case"camera":n=this.loadCamera(e);break;default:if(n=this._invokeOne(function(r){return r!=this&&r.getDependency&&r.getDependency(t,e)}),!n)throw new Error("Unknown type: "+t);break}this.cache.add(o,n)}return n}getDependencies(t){let e=this.cache.get(t);if(!e){const o=this,n=this.json[t+(t==="mesh"?"es":"s")]||[];e=Promise.all(n.map(function(r,s){return o.getDependency(t,s)})),this.cache.add(t,e)}return e}loadBuffer(t){const e=this.json.buffers[t],o=this.fileLoader;if(e.type&&e.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(e.uri===void 0&&t===0)return Promise.resolve(this.extensions[M.KHR_BINARY_GLTF].body);const n=this.options;return new Promise(function(r,s){o.load(l.LoaderUtils.resolveURL(e.uri,n.path),r,void 0,function(){s(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))})})}loadBufferView(t){const e=this.json.bufferViews[t];return this.getDependency("buffer",e.buffer).then(function(o){const n=e.byteLength||0,r=e.byteOffset||0;return o.slice(r,r+n)})}loadAccessor(t){const e=this,o=this.json,n=this.json.accessors[t];if(n.bufferView===void 0&&n.sparse===void 0){const s=v[n.type],a=B[n.componentType],i=n.normalized===!0,c=new a(n.count*s);return Promise.resolve(new l.BufferAttribute(c,s,i))}const r=[];return n.bufferView!==void 0?r.push(this.getDependency("bufferView",n.bufferView)):r.push(null),n.sparse!==void 0&&(r.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(r).then(function(s){const a=s[0],i=v[n.type],c=B[n.componentType],f=c.BYTES_PER_ELEMENT,u=f*i,m=n.byteOffset||0,T=n.bufferView!==void 0?o.bufferViews[n.bufferView].byteStride:void 0,R=n.normalized===!0;let y,x;if(T&&T!==u){const S=Math.floor(m/T),L="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+S+":"+n.count;let _=e.cache.get(L);_||(y=new c(a,S*T,n.count*T/f),_=new l.InterleavedBuffer(y,T/f),e.cache.add(L,_)),x=new l.InterleavedBufferAttribute(_,i,m%T/f,R)}else a===null?y=new c(n.count*i):y=new c(a,m,n.count*i),x=new l.BufferAttribute(y,i,R);if(n.sparse!==void 0){const S=v.SCALAR,L=B[n.sparse.indices.componentType],_=n.sparse.indices.byteOffset||0,w=n.sparse.values.byteOffset||0,N=new L(s[1],_,n.sparse.count*S),C=new c(s[2],w,n.sparse.count*i);a!==null&&(x=new l.BufferAttribute(x.array.slice(),x.itemSize,x.normalized));for(let b=0,h=N.length;b<h;b++){const p=N[b];if(x.setX(p,C[b*i]),i>=2&&x.setY(p,C[b*i+1]),i>=3&&x.setZ(p,C[b*i+2]),i>=4&&x.setW(p,C[b*i+3]),i>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return x})}loadTexture(t){const e=this.json,o=this.options,r=e.textures[t].source,s=e.images[r];let a=this.textureLoader;if(s.uri){const i=o.manager.getHandler(s.uri);i!==null&&(a=i)}return this.loadTextureImage(t,r,a)}loadTextureImage(t,e,o){const n=this,r=this.json,s=r.textures[t],a=r.images[e],i=(a.uri||a.bufferView)+":"+s.sampler;if(this.textureCache[i])return this.textureCache[i];const c=this.loadImageSource(e,o).then(function(f){f.flipY=!1,f.name=s.name||a.name||"",f.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(f.name=a.uri);const m=(r.samplers||{})[s.sampler]||{};return f.magFilter=Q[m.magFilter]||l.LinearFilter,f.minFilter=Q[m.minFilter]||l.LinearMipmapLinearFilter,f.wrapS=J[m.wrapS]||l.RepeatWrapping,f.wrapT=J[m.wrapT]||l.RepeatWrapping,n.associations.set(f,{textures:t}),f}).catch(function(){return null});return this.textureCache[i]=c,c}loadImageSource(t,e){const o=this,n=this.json,r=this.options;if(this.sourceCache[t]!==void 0)return this.sourceCache[t].then(u=>u.clone());const s=n.images[t],a=self.URL||self.webkitURL;let i=s.uri||"",c=!1;if(s.bufferView!==void 0)i=o.getDependency("bufferView",s.bufferView).then(function(u){c=!0;const m=new Blob([u],{type:s.mimeType});return i=a.createObjectURL(m),i});else if(s.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");const f=Promise.resolve(i).then(function(u){return new Promise(function(m,T){let R=m;e.isImageBitmapLoader===!0&&(R=function(y){const x=new l.Texture(y);x.needsUpdate=!0,m(x)}),e.load(l.LoaderUtils.resolveURL(u,r.path),R,void 0,T)})}).then(function(u){return c===!0&&a.revokeObjectURL(i),u.userData.mimeType=s.mimeType||He(s.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",i),u});return this.sourceCache[t]=f,f}assignTexture(t,e,o,n){const r=this;return this.getDependency("texture",o.index).then(function(s){if(!s)return null;if(o.texCoord!==void 0&&o.texCoord>0&&(s=s.clone(),s.channel=o.texCoord),r.extensions[M.KHR_TEXTURE_TRANSFORM]){const a=o.extensions!==void 0?o.extensions[M.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const i=r.associations.get(s);s=r.extensions[M.KHR_TEXTURE_TRANSFORM].extendTexture(s,a),r.associations.set(s,i)}}return n!==void 0&&(s.colorSpace=n),t[e]=s,s})}assignFinalMaterial(t){const e=t.geometry;let o=t.material;const n=e.attributes.tangent===void 0,r=e.attributes.color!==void 0,s=e.attributes.normal===void 0;if(t.isPoints){const a="PointsMaterial:"+o.uuid;let i=this.cache.get(a);i||(i=new l.PointsMaterial,l.Material.prototype.copy.call(i,o),i.color.copy(o.color),i.map=o.map,i.sizeAttenuation=!1,this.cache.add(a,i)),o=i}else if(t.isLine){const a="LineBasicMaterial:"+o.uuid;let i=this.cache.get(a);i||(i=new l.LineBasicMaterial,l.Material.prototype.copy.call(i,o),i.color.copy(o.color),i.map=o.map,this.cache.add(a,i)),o=i}if(n||r||s){let a="ClonedMaterial:"+o.uuid+":";n&&(a+="derivative-tangents:"),r&&(a+="vertex-colors:"),s&&(a+="flat-shading:");let i=this.cache.get(a);i||(i=o.clone(),r&&(i.vertexColors=!0),s&&(i.flatShading=!0),n&&(i.normalScale&&(i.normalScale.y*=-1),i.clearcoatNormalScale&&(i.clearcoatNormalScale.y*=-1)),this.cache.add(a,i),this.associations.set(i,this.associations.get(o))),o=i}t.material=o}getMaterialType(){return l.MeshStandardMaterial}loadMaterial(t){const e=this,o=this.json,n=this.extensions,r=o.materials[t];let s;const a={},i=r.extensions||{},c=[];if(i[M.KHR_MATERIALS_UNLIT]){const u=n[M.KHR_MATERIALS_UNLIT];s=u.getMaterialType(),c.push(u.extendParams(a,r,e))}else{const u=r.pbrMetallicRoughness||{};if(a.color=new l.Color(1,1,1),a.opacity=1,Array.isArray(u.baseColorFactor)){const m=u.baseColorFactor;a.color.setRGB(m[0],m[1],m[2],l.LinearSRGBColorSpace),a.opacity=m[3]}u.baseColorTexture!==void 0&&c.push(e.assignTexture(a,"map",u.baseColorTexture,l.SRGBColorSpace)),a.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,a.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(c.push(e.assignTexture(a,"metalnessMap",u.metallicRoughnessTexture)),c.push(e.assignTexture(a,"roughnessMap",u.metallicRoughnessTexture))),s=this._invokeOne(function(m){return m.getMaterialType&&m.getMaterialType(t)}),c.push(Promise.all(this._invokeAll(function(m){return m.extendMaterialParams&&m.extendMaterialParams(t,a)})))}r.doubleSided===!0&&(a.side=l.DoubleSide);const f=r.alphaMode||U.OPAQUE;if(f===U.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,f===U.MASK&&(a.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:.5)),r.normalTexture!==void 0&&s!==l.MeshBasicMaterial&&(c.push(e.assignTexture(a,"normalMap",r.normalTexture)),a.normalScale=new l.Vector2(1,1),r.normalTexture.scale!==void 0)){const u=r.normalTexture.scale;a.normalScale.set(u,u)}if(r.occlusionTexture!==void 0&&s!==l.MeshBasicMaterial&&(c.push(e.assignTexture(a,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&s!==l.MeshBasicMaterial){const u=r.emissiveFactor;a.emissive=new l.Color().setRGB(u[0],u[1],u[2],l.LinearSRGBColorSpace)}return r.emissiveTexture!==void 0&&s!==l.MeshBasicMaterial&&c.push(e.assignTexture(a,"emissiveMap",r.emissiveTexture,l.SRGBColorSpace)),Promise.all(c).then(function(){const u=new s(a);return r.name&&(u.name=r.name),F(u,r),e.associations.set(u,{materials:t}),r.extensions&&P(n,u,r),u})}createUniqueName(t){const e=l.PropertyBinding.sanitizeNodeName(t||"");return e in this.nodeNamesUsed?e+"_"+ ++this.nodeNamesUsed[e]:(this.nodeNamesUsed[e]=0,e)}loadGeometries(t){const e=this,o=this.extensions,n=this.primitiveCache;function r(a){return o[M.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,e).then(function(i){return Z(i,a,e)})}const s=[];for(let a=0,i=t.length;a<i;a++){const c=t[a],f=Ge(c),u=n[f];if(u)s.push(u.promise);else{let m;c.extensions&&c.extensions[M.KHR_DRACO_MESH_COMPRESSION]?m=r(c):m=Z(new l.BufferGeometry,c,e),n[f]={primitive:c,promise:m},s.push(m)}}return Promise.all(s)}loadMesh(t){const e=this,o=this.json,n=this.extensions,r=o.meshes[t],s=r.primitives,a=[];for(let i=0,c=s.length;i<c;i++){const f=s[i].material===void 0?De(this.cache):this.getDependency("material",s[i].material);a.push(f)}return a.push(e.loadGeometries(s)),Promise.all(a).then(function(i){const c=i.slice(0,i.length-1),f=i[i.length-1],u=[];for(let T=0,R=f.length;T<R;T++){const y=f[T],x=s[T];let S;const L=c[T];if(x.mode===I.TRIANGLES||x.mode===I.TRIANGLE_STRIP||x.mode===I.TRIANGLE_FAN||x.mode===void 0)S=r.isSkinnedMesh===!0?new l.SkinnedMesh(y,L):new l.Mesh(y,L),S.isSkinnedMesh===!0&&S.normalizeSkinWeights(),x.mode===I.TRIANGLE_STRIP?S.geometry=q(S.geometry,l.TriangleStripDrawMode):x.mode===I.TRIANGLE_FAN&&(S.geometry=q(S.geometry,l.TriangleFanDrawMode));else if(x.mode===I.LINES)S=new l.LineSegments(y,L);else if(x.mode===I.LINE_STRIP)S=new l.Line(y,L);else if(x.mode===I.LINE_LOOP)S=new l.LineLoop(y,L);else if(x.mode===I.POINTS)S=new l.Points(y,L);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+x.mode);Object.keys(S.geometry.morphAttributes).length>0&&ke(S,r),S.name=e.createUniqueName(r.name||"mesh_"+t),F(S,r),x.extensions&&P(n,S,x),e.assignFinalMaterial(S),u.push(S)}for(let T=0,R=u.length;T<R;T++)e.associations.set(u[T],{meshes:t,primitives:T});if(u.length===1)return r.extensions&&P(n,u[0],r),u[0];const m=new l.Group;r.extensions&&P(n,m,r),e.associations.set(m,{meshes:t});for(let T=0,R=u.length;T<R;T++)m.add(u[T]);return m})}loadCamera(t){let e;const o=this.json.cameras[t],n=o[o.type];if(!n){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return o.type==="perspective"?e=new l.PerspectiveCamera(l.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):o.type==="orthographic"&&(e=new l.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),o.name&&(e.name=this.createUniqueName(o.name)),F(e,o),Promise.resolve(e)}loadSkin(t){const e=this.json.skins[t],o=[];for(let n=0,r=e.joints.length;n<r;n++)o.push(this._loadNodeShallow(e.joints[n]));return e.inverseBindMatrices!==void 0?o.push(this.getDependency("accessor",e.inverseBindMatrices)):o.push(null),Promise.all(o).then(function(n){const r=n.pop(),s=n,a=[],i=[];for(let c=0,f=s.length;c<f;c++){const u=s[c];if(u){a.push(u);const m=new l.Matrix4;r!==null&&m.fromArray(r.array,c*16),i.push(m)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[c])}return new l.Skeleton(a,i)})}loadAnimation(t){const e=this.json,o=this,n=e.animations[t],r=n.name?n.name:"animation_"+t,s=[],a=[],i=[],c=[],f=[];for(let u=0,m=n.channels.length;u<m;u++){const T=n.channels[u],R=n.samplers[T.sampler],y=T.target,x=y.node,S=n.parameters!==void 0?n.parameters[R.input]:R.input,L=n.parameters!==void 0?n.parameters[R.output]:R.output;y.node!==void 0&&(s.push(this.getDependency("node",x)),a.push(this.getDependency("accessor",S)),i.push(this.getDependency("accessor",L)),c.push(R),f.push(y))}return Promise.all([Promise.all(s),Promise.all(a),Promise.all(i),Promise.all(c),Promise.all(f)]).then(function(u){const m=u[0],T=u[1],R=u[2],y=u[3],x=u[4],S=[];for(let L=0,_=m.length;L<_;L++){const w=m[L],N=T[L],C=R[L],b=y[L],h=x[L];if(w===void 0)continue;w.updateMatrix&&w.updateMatrix();const p=o._createAnimationTracks(w,N,C,b,h);if(p)for(let g=0;g<p.length;g++)S.push(p[g])}return new l.AnimationClip(r,void 0,S)})}createNodeMesh(t){const e=this.json,o=this,n=e.nodes[t];return n.mesh===void 0?null:o.getDependency("mesh",n.mesh).then(function(r){const s=o._getNodeRef(o.meshCache,n.mesh,r);return n.weights!==void 0&&s.traverse(function(a){if(a.isMesh)for(let i=0,c=n.weights.length;i<c;i++)a.morphTargetInfluences[i]=n.weights[i]}),s})}loadNode(t){const e=this.json,o=this,n=e.nodes[t],r=o._loadNodeShallow(t),s=[],a=n.children||[];for(let c=0,f=a.length;c<f;c++)s.push(o.getDependency("node",a[c]));const i=n.skin===void 0?Promise.resolve(null):o.getDependency("skin",n.skin);return Promise.all([r,Promise.all(s),i]).then(function(c){const f=c[0],u=c[1],m=c[2];m!==null&&f.traverse(function(T){T.isSkinnedMesh&&T.bind(m,ve)});for(let T=0,R=u.length;T<R;T++)f.add(u[T]);return f})}_loadNodeShallow(t){const e=this.json,o=this.extensions,n=this;if(this.nodeCache[t]!==void 0)return this.nodeCache[t];const r=e.nodes[t],s=r.name?n.createUniqueName(r.name):"",a=[],i=n._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(t)});return i&&a.push(i),r.camera!==void 0&&a.push(n.getDependency("camera",r.camera).then(function(c){return n._getNodeRef(n.cameraCache,r.camera,c)})),n._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(t)}).forEach(function(c){a.push(c)}),this.nodeCache[t]=Promise.all(a).then(function(c){let f;if(r.isBone===!0?f=new l.Bone:c.length>1?f=new l.Group:c.length===1?f=c[0]:f=new l.Object3D,f!==c[0])for(let u=0,m=c.length;u<m;u++)f.add(c[u]);if(r.name&&(f.userData.name=r.name,f.name=s),F(f,r),r.extensions&&P(o,f,r),r.matrix!==void 0){const u=new l.Matrix4;u.fromArray(r.matrix),f.applyMatrix4(u)}else r.translation!==void 0&&f.position.fromArray(r.translation),r.rotation!==void 0&&f.quaternion.fromArray(r.rotation),r.scale!==void 0&&f.scale.fromArray(r.scale);return n.associations.has(f)||n.associations.set(f,{}),n.associations.get(f).nodes=t,f}),this.nodeCache[t]}loadScene(t){const e=this.extensions,o=this.json.scenes[t],n=this,r=new l.Group;o.name&&(r.name=n.createUniqueName(o.name)),F(r,o),o.extensions&&P(e,r,o);const s=o.nodes||[],a=[];for(let i=0,c=s.length;i<c;i++)a.push(n.getDependency("node",s[i]));return Promise.all(a).then(function(i){for(let f=0,u=i.length;f<u;f++)r.add(i[f]);const c=f=>{const u=new Map;for(const[m,T]of n.associations)(m instanceof l.Material||m instanceof l.Texture)&&u.set(m,T);return f.traverse(m=>{const T=n.associations.get(m);T!=null&&u.set(m,T)}),u};return n.associations=c(r),r})}_createAnimationTracks(t,e,o,n,r){const s=[],a=t.name?t.name:t.uuid,i=[];O[r.path]===O.weights?t.traverse(function(m){m.morphTargetInfluences&&i.push(m.name?m.name:m.uuid)}):i.push(a);let c;switch(O[r.path]){case O.weights:c=l.NumberKeyframeTrack;break;case O.rotation:c=l.QuaternionKeyframeTrack;break;case O.position:case O.scale:c=l.VectorKeyframeTrack;break;default:switch(o.itemSize){case 1:c=l.NumberKeyframeTrack;break;case 2:case 3:default:c=l.VectorKeyframeTrack;break}break}const f=n.interpolation!==void 0?Pe[n.interpolation]:l.InterpolateLinear,u=this._getArrayFromAccessor(o);for(let m=0,T=i.length;m<T;m++){const R=new c(i[m]+"."+O[r.path],e.array,u,f);n.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(R),s.push(R)}return s}_getArrayFromAccessor(t){let e=t.array;if(t.normalized){const o=X(e.constructor),n=new Float32Array(e.length);for(let r=0,s=e.length;r<s;r++)n[r]=e[r]*o;e=n}return e}_createCubicSplineTrackInterpolant(t){t.createInterpolant=function(o){const n=this instanceof l.QuaternionKeyframeTrack?Fe:re;return new n(this.times,this.values,this.getValueSize()/3,o)},t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function je(d,t,e){const o=t.attributes,n=new l.Box3;if(o.POSITION!==void 0){const a=e.json.accessors[o.POSITION],i=a.min,c=a.max;if(i!==void 0&&c!==void 0){if(n.set(new l.Vector3(i[0],i[1],i[2]),new l.Vector3(c[0],c[1],c[2])),a.normalized){const f=X(B[a.componentType]);n.min.multiplyScalar(f),n.max.multiplyScalar(f)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const r=t.targets;if(r!==void 0){const a=new l.Vector3,i=new l.Vector3;for(let c=0,f=r.length;c<f;c++){const u=r[c];if(u.POSITION!==void 0){const m=e.json.accessors[u.POSITION],T=m.min,R=m.max;if(T!==void 0&&R!==void 0){if(i.setX(Math.max(Math.abs(T[0]),Math.abs(R[0]))),i.setY(Math.max(Math.abs(T[1]),Math.abs(R[1]))),i.setZ(Math.max(Math.abs(T[2]),Math.abs(R[2]))),m.normalized){const y=X(B[m.componentType]);i.multiplyScalar(y)}a.max(i)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}n.expandByVector(a)}d.boundingBox=n;const s=new l.Sphere;n.getCenter(s.center),s.radius=n.min.distanceTo(n.max)/2,d.boundingSphere=s}function Z(d,t,e){const o=t.attributes,n=[];function r(s,a){return e.getDependency("accessor",s).then(function(i){d.setAttribute(a,i)})}for(const s in o){const a=V[s]||s.toLowerCase();a in d.attributes||n.push(r(o[s],a))}if(t.indices!==void 0&&!d.index){const s=e.getDependency("accessor",t.indices).then(function(a){d.setIndex(a)});n.push(s)}return l.ColorManagement.workingColorSpace!==l.LinearSRGBColorSpace&&"COLOR_0"in o&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${l.ColorManagement.workingColorSpace}" not supported.`),F(d,t),je(d,t,e),Promise.all(n).then(function(){return t.targets!==void 0?Be(d,t.targets,e):d})}class Ke{parse(t){const e={},o=t.split(`
2
- `);let n=null,r=e;const s=[e];for(const a of o)if(a.includes("=")){const i=a.split("="),c=i[0].trim(),f=i[1].trim();if(f.endsWith("{")){const u={};s.push(u),r[c]=u,r=u}else r[c]=f}else if(a.endsWith("{")){const i=r[n]||{};s.push(i),r[n]=i,r=i}else if(a.endsWith("}")){if(s.pop(),s.length===0)continue;r=s[s.length-1]}else if(a.endsWith("(")){const i={};s.push(i),n=a.split("(")[0].trim()||n,r[n]=i,r=i}else a.endsWith(")")?(s.pop(),r=s[s.length-1]):n=a.trim();return e}}class Ve extends l.Loader{constructor(t){super(t)}load(t,e,o,n){const r=this,s=new l.FileLoader(r.manager);s.setPath(r.path),s.setResponseType("arraybuffer"),s.setRequestHeader(r.requestHeader),s.setWithCredentials(r.withCredentials),s.load(t,function(a){try{e(r.parse(a))}catch(i){n?n(i):console.error(i),r.manager.itemError(t)}},o,n)}parse(t){const e=new Ke;function o(h){const p={};new l.FileLoader().setResponseType("arraybuffer");for(const A in h){if(A.endsWith("png")){const E=new Blob([h[A]],{type:{type:"image/png"}});p[A]=URL.createObjectURL(E)}if(A.endsWith("usd")||A.endsWith("usda")){if(n(h[A])){console.warn("THREE.USDZLoader: Crate files (.usdc or binary .usd) are not supported.");continue}const E=D.strFromU8(h[A]);p[A]=e.parse(E)}}return p}function n(h){const p=h.slice(0,7),g=new Uint8Array([80,88,82,45,85,83,68,67]);return p.every((A,E)=>A===g[E])}function r(h){if(h.length<1)return;const p=Object.keys(h)[0];let g=!1;if(p.endsWith("usda"))return h[p];if(p.endsWith("usdc"))g=!0;else if(p.endsWith("usd"))if(n(h[p]))g=!0;else return h[p];g&&console.warn("THREE.USDZLoader: Crate files (.usdc or binary .usd) are not supported.")}const s=D.unzipSync(new Uint8Array(t)),a=o(s),i=r(s);if(i===void 0)return console.warn("THREE.USDZLoader: No usda file found."),new l.Group;const c=D.strFromU8(i),f=e.parse(c);function u(h){if(h){if("prepend references"in h){const g=h["prepend references"].split("@"),A=g[1].replace(/^.\//,""),E=g[2].replace(/^<\//,"").replace(/>$/,"");return m(a[A],E)}return m(h)}}function m(h,p){if(h){if(p!==void 0){const g=`def Mesh "${p}"`;if(g in h)return h[g]}for(const g in h){const A=h[g];if(g.startsWith("def Mesh"))return"point3f[] points"in h&&(A["point3f[] points"]=h["point3f[] points"]),"texCoord2f[] primvars:st"in h&&(A["texCoord2f[] primvars:st"]=h["texCoord2f[] primvars:st"]),"int[] primvars:st:indices"in h&&(A["int[] primvars:st:indices"]=h["int[] primvars:st:indices"]),A;if(typeof A=="object"){const E=m(A);if(E)return E}}}}function T(h){if(!h)return;let p=new l.BufferGeometry;if("int[] faceVertexIndices"in h){const g=JSON.parse(h["int[] faceVertexIndices"]);p.setIndex(g)}if("point3f[] points"in h){const g=JSON.parse(h["point3f[] points"].replace(/[()]*/g,"")),A=new l.BufferAttribute(new Float32Array(g),3);p.setAttribute("position",A)}if("normal3f[] normals"in h){const g=JSON.parse(h["normal3f[] normals"].replace(/[()]*/g,"")),A=new l.BufferAttribute(new Float32Array(g),3);p.setAttribute("normal",A)}else p.computeVertexNormals();if("float2[] primvars:st"in h&&(h["texCoord2f[] primvars:st"]=h["float2[] primvars:st"]),"texCoord2f[] primvars:st"in h){const g=JSON.parse(h["texCoord2f[] primvars:st"].replace(/[()]*/g,"")),A=new l.BufferAttribute(new Float32Array(g),2);if("int[] primvars:st:indices"in h){p=p.toNonIndexed();const E=JSON.parse(h["int[] primvars:st:indices"]);p.setAttribute("uv",R(A,E))}else p.setAttribute("uv",A)}return p}function R(h,p){const g=h.array,A=h.itemSize,E=new g.constructor(p.length*A);let W=0,oe=0;for(let G=0,ie=p.length;G<ie;G++){W=p[G]*A;for(let z=0;z<A;z++)E[oe++]=g[W++]}return new l.BufferAttribute(E,A)}function y(h){if(h){if("rel material:binding"in h){const A=h["rel material:binding"].replace(/^<\//,"").replace(/>$/,"").split("/");return x(f,` "${A[1]}"`)}return x(h)}}function x(h,p=""){for(const g in h){const A=h[g];if(g.startsWith("def Material"+p))return A;if(typeof A=="object"){const E=x(A,p);if(E)return E}}}function S(h,p){p["float inputs:rotation"]&&(h.rotation=parseFloat(p["float inputs:rotation"])),p["float2 inputs:scale"]&&(h.repeat=new l.Vector2().fromArray(JSON.parse("["+p["float2 inputs:scale"].replace(/[()]*/g,"")+"]"))),p["float2 inputs:translation"]&&(h.offset=new l.Vector2().fromArray(JSON.parse("["+p["float2 inputs:translation"].replace(/[()]*/g,"")+"]")))}function L(h){const p=new l.MeshPhysicalMaterial;if(h!==void 0){if('def Shader "PreviewSurface"'in h){const g=h['def Shader "PreviewSurface"'];if("color3f inputs:diffuseColor.connect"in g){const A=g["color3f inputs:diffuseColor.connect"],E=_(f,/(\w+).output/.exec(A)[1]);p.map=w(E),p.map.colorSpace=l.SRGBColorSpace,'def Shader "Transform2d_diffuse"'in h&&S(p.map,h['def Shader "Transform2d_diffuse"'])}else if("color3f inputs:diffuseColor"in g){const A=g["color3f inputs:diffuseColor"].replace(/[()]*/g,"");p.color.fromArray(JSON.parse("["+A+"]"))}if("color3f inputs:emissiveColor.connect"in g){const A=g["color3f inputs:emissiveColor.connect"],E=_(f,/(\w+).output/.exec(A)[1]);p.emissiveMap=w(E),p.emissiveMap.colorSpace=l.SRGBColorSpace,p.emissive.set(16777215),'def Shader "Transform2d_emissive"'in h&&S(p.emissiveMap,h['def Shader "Transform2d_emissive"'])}else if("color3f inputs:emissiveColor"in g){const A=g["color3f inputs:emissiveColor"].replace(/[()]*/g,"");p.emissive.fromArray(JSON.parse("["+A+"]"))}if("normal3f inputs:normal.connect"in g){const A=g["normal3f inputs:normal.connect"],E=_(f,/(\w+).output/.exec(A)[1]);p.normalMap=w(E),p.normalMap.colorSpace=l.NoColorSpace,'def Shader "Transform2d_normal"'in h&&S(p.normalMap,h['def Shader "Transform2d_normal"'])}if("float inputs:roughness.connect"in g){const A=g["float inputs:roughness.connect"],E=_(f,/(\w+).output/.exec(A)[1]);p.roughness=1,p.roughnessMap=w(E),p.roughnessMap.colorSpace=l.NoColorSpace,'def Shader "Transform2d_roughness"'in h&&S(p.roughnessMap,h['def Shader "Transform2d_roughness"'])}else"float inputs:roughness"in g&&(p.roughness=parseFloat(g["float inputs:roughness"]));if("float inputs:metallic.connect"in g){const A=g["float inputs:metallic.connect"],E=_(f,/(\w+).output/.exec(A)[1]);p.metalness=1,p.metalnessMap=w(E),p.metalnessMap.colorSpace=l.NoColorSpace,'def Shader "Transform2d_metallic"'in h&&S(p.metalnessMap,h['def Shader "Transform2d_metallic"'])}else"float inputs:metallic"in g&&(p.metalness=parseFloat(g["float inputs:metallic"]));if("float inputs:clearcoat.connect"in g){const A=g["float inputs:clearcoat.connect"],E=_(f,/(\w+).output/.exec(A)[1]);p.clearcoat=1,p.clearcoatMap=w(E),p.clearcoatMap.colorSpace=l.NoColorSpace,'def Shader "Transform2d_clearcoat"'in h&&S(p.clearcoatMap,h['def Shader "Transform2d_clearcoat"'])}else"float inputs:clearcoat"in g&&(p.clearcoat=parseFloat(g["float inputs:clearcoat"]));if("float inputs:clearcoatRoughness.connect"in g){const A=g["float inputs:clearcoatRoughness.connect"],E=_(f,/(\w+).output/.exec(A)[1]);p.clearcoatRoughness=1,p.clearcoatRoughnessMap=w(E),p.clearcoatRoughnessMap.colorSpace=l.NoColorSpace,'def Shader "Transform2d_clearcoatRoughness"'in h&&S(p.clearcoatRoughnessMap,h['def Shader "Transform2d_clearcoatRoughness"'])}else"float inputs:clearcoatRoughness"in g&&(p.clearcoatRoughness=parseFloat(g["float inputs:clearcoatRoughness"]));if("float inputs:ior"in g&&(p.ior=parseFloat(g["float inputs:ior"])),"float inputs:occlusion.connect"in g){const A=g["float inputs:occlusion.connect"],E=_(f,/(\w+).output/.exec(A)[1]);p.aoMap=w(E),p.aoMap.colorSpace=l.NoColorSpace,'def Shader "Transform2d_occlusion"'in h&&S(p.aoMap,h['def Shader "Transform2d_occlusion"'])}}if('def Shader "diffuseColor_texture"'in h){const g=h['def Shader "diffuseColor_texture"'];p.map=w(g),p.map.colorSpace=l.SRGBColorSpace}if('def Shader "normal_texture"'in h){const g=h['def Shader "normal_texture"'];p.normalMap=w(g),p.normalMap.colorSpace=l.NoColorSpace}}return p}function _(h,p){for(const g in h){const A=h[g];if(g.startsWith(`def Shader "${p}"`))return A;if(typeof A=="object"){const E=_(A,p);if(E)return E}}}function w(h){if("asset inputs:file"in h){const p=h["asset inputs:file"].replace(/@*/g,""),A=new l.TextureLoader().load(a[p]),E={'"clamp"':l.ClampToEdgeWrapping,'"mirror"':l.MirroredRepeatWrapping,'"repeat"':l.RepeatWrapping};return"token inputs:wrapS"in h&&(A.wrapS=E[h["token inputs:wrapS"]]),"token inputs:wrapT"in h&&(A.wrapT=E[h["token inputs:wrapT"]]),A}return null}function N(h){const p=T(u(h)),g=L(y(h)),A=p?new l.Mesh(p,g):new l.Object3D;if("matrix4d xformOp:transform"in h){const E=JSON.parse("["+h["matrix4d xformOp:transform"].replace(/[()]*/g,"")+"]");A.matrix.fromArray(E),A.matrix.decompose(A.position,A.quaternion,A.scale)}return A}function C(h,p){for(const g in h)if(g.startsWith("def Scope"))C(h[g],p);else if(g.startsWith("def Xform")){const A=N(h[g]);/def Xform "(\w+)"/.test(g)&&(A.name=/def Xform "(\w+)"/.exec(g)[1]),p.add(A),C(h[g],A)}}const b=new l.Group;return C(f,b),b}}class Xe{constructor(){H(this,"_gltfLoader");H(this,"_usdzLoader");this._gltfLoader=new le,this._usdzLoader=new Ve}async _loadFile(t){const e=await fetch(t);if(!e.ok)throw new K(t,`Failed to fetch file from ${t}`);try{return await e.arrayBuffer()}catch{throw new K(t,`Failed to fetch file from ${t}`)}}async load(t){const e=$(t);if(e.length===0)throw new D.FileTypeError("No file extension found in URI","");if(!ee(e))throw new D.FileTypeError(`Unsupported file type: ${e}. Supported types: ${ne.join(", ")}`,e);const o=await this._loadFile(t);try{switch(e){case"glb":case"gltf":return(await this._gltfLoader.parseAsync(o,"")).scene;case"usdz":return await this._usdzLoader.parse(o)}}catch(n){throw n instanceof Error?new D.ParseError(`Failed to parse ${e} file: ${n.message}`,n):new D.ParseError(`Failed to parse ${e} file`)}}}exports.AssetLoader=Xe;exports.FILE_TYPES=te;exports.NetworkError=K;exports.SUPPORTED_FILE_TYPES=ne;exports.getFileTypeFromUri=$;exports.isFileTypeSupported=ee;
3
- //# sourceMappingURL=AssetLoader-BYhwzCxs.cjs.map