@shopware-ag/dive 2.0.1-beta.1 → 2.0.1-beta.11

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 (280) hide show
  1. package/build/chunks/AssetCache-CsfCIl9J.mjs +79 -0
  2. package/build/chunks/AssetCache-DGLqbo2B.cjs +1 -0
  3. package/build/chunks/AssetExporter-DsbC2rqv.cjs +164 -0
  4. package/build/{src/modules/asset/exporter/AssetExporter.mjs → chunks/AssetExporter-brT7ogoM.mjs} +22 -21
  5. package/build/chunks/AssetLoader-DvF8gL8a.mjs +2341 -0
  6. package/build/chunks/AssetLoader-H_GSIMop.cjs +4 -0
  7. package/build/chunks/FileTypes-CHutqD19.cjs +30 -0
  8. package/build/chunks/FileTypes-IBuu9ohV.mjs +1057 -0
  9. package/build/chunks/MathUtils-CBW56ZuG.cjs +1 -0
  10. package/build/chunks/MathUtils-CFGjHuVF.mjs +159 -0
  11. package/build/chunks/OrbitController-BQ6SV1O_.mjs +1159 -0
  12. package/build/chunks/OrbitController-CpFQ3A1H.cjs +1 -0
  13. package/build/chunks/{PerspectiveCamera-sm4_81KJ.mjs → PerspectiveCamera-PMJPzAn3.mjs} +2 -2
  14. package/build/chunks/PovSchema-Co9FznEz.cjs +1 -0
  15. package/build/chunks/PovSchema-DWWvr_ED.mjs +10 -0
  16. package/build/chunks/{SelectTool-Bd8cC9nb.mjs → SelectTool-BU0vTDXg.mjs} +44 -39
  17. package/build/chunks/SelectTool-CAqDMcoM.cjs +1 -0
  18. package/build/chunks/draco_decoder-Bh9flJPu.cjs +1 -0
  19. package/build/chunks/draco_decoder-CEzwqP9o.mjs +38 -0
  20. package/build/chunks/draco_decoder-DtHHc5d0.mjs +4 -0
  21. package/build/chunks/draco_decoder-DvYjcLz_.cjs +35 -0
  22. package/build/chunks/draco_wasm_wrapper-FoEVV9af.cjs +118 -0
  23. package/build/chunks/draco_wasm_wrapper-yQy2VLhb.mjs +121 -0
  24. package/build/chunks/fflate.module-DHdJvhNh.cjs +6 -0
  25. package/build/chunks/fflate.module-xyO_T3Zm.mjs +602 -0
  26. package/build/chunks/findInterface-C6mrvf_t.cjs +1 -0
  27. package/build/chunks/findInterface-DbJ5qzbc.mjs +11 -0
  28. package/build/chunks/isFileTypeSupported-BSpswPHU.mjs +12 -0
  29. package/build/chunks/isFileTypeSupported-CrEqYiv9.cjs +1 -0
  30. package/build/chunks/network-error-BONfHWQq.mjs +14 -0
  31. package/build/chunks/network-error-CdDXil5g.cjs +1 -0
  32. package/build/chunks/package-CmvmIjT5.cjs +1 -0
  33. package/build/chunks/package-DSKqbNMb.mjs +39 -0
  34. package/build/chunks/parse-error-DfOPyLWM.mjs +14 -0
  35. package/build/chunks/parse-error-Dy_EE4rL.cjs +1 -0
  36. package/build/dive.cjs +1 -30
  37. package/build/dive.mjs +674 -1535
  38. package/build/plugins/animation/index.cjs +1 -0
  39. package/build/plugins/animation/index.d.ts +2 -0
  40. package/build/plugins/animation/index.mjs +126 -0
  41. package/build/plugins/ar/index.cjs +1 -0
  42. package/build/plugins/ar/index.d.ts +2 -0
  43. package/build/plugins/ar/index.mjs +207 -0
  44. package/build/plugins/assetcache/index.cjs +1 -0
  45. package/build/plugins/assetcache/index.d.ts +2 -0
  46. package/build/plugins/assetcache/index.mjs +5 -0
  47. package/build/plugins/assetconverter/index.d.ts +2 -0
  48. package/build/plugins/assetexporter/index.cjs +1 -0
  49. package/build/plugins/assetexporter/index.d.ts +2 -0
  50. package/build/plugins/assetexporter/index.mjs +4 -0
  51. package/build/plugins/assetloader/index.cjs +1 -0
  52. package/build/plugins/assetloader/index.d.ts +2 -0
  53. package/build/plugins/assetloader/index.mjs +6 -0
  54. package/build/plugins/mediacreator/index.cjs +1 -0
  55. package/build/plugins/mediacreator/index.d.ts +2 -0
  56. package/build/{src/modules/mediacreator/MediaCreator.mjs → plugins/mediacreator/index.mjs} +4 -4
  57. package/build/plugins/orbitcontroller/index.cjs +1 -0
  58. package/build/plugins/orbitcontroller/index.d.ts +2 -0
  59. package/build/plugins/orbitcontroller/index.mjs +5 -0
  60. package/build/plugins/orientationdisplay/index.cjs +1 -0
  61. package/build/plugins/orientationdisplay/index.d.ts +2 -0
  62. package/build/plugins/orientationdisplay/index.mjs +5 -0
  63. package/build/plugins/state/index.cjs +27 -0
  64. package/build/plugins/state/index.d.ts +2 -0
  65. package/build/plugins/state/index.mjs +4266 -0
  66. package/build/plugins/systeminfo/index.cjs +1 -0
  67. package/build/plugins/systeminfo/index.d.ts +2 -0
  68. package/build/{chunks/SystemInfo-DPAQG-S5.mjs → plugins/systeminfo/index.mjs} +48 -51
  69. package/build/plugins/toolbox/index.cjs +1 -0
  70. package/build/plugins/toolbox/index.d.ts +2 -0
  71. package/build/{src/modules/toolbox/Toolbox.mjs → plugins/toolbox/index.mjs} +29 -23
  72. package/build/src/components/boundingbox/BoundingBox.d.ts +136 -0
  73. package/build/src/components/gizmo/Gizmo.d.ts +1 -1
  74. package/build/src/components/gizmo/handles/AxisHandle.d.ts +1 -1
  75. package/build/src/components/gizmo/handles/RadialHandle.d.ts +1 -1
  76. package/build/src/components/gizmo/handles/ScaleHandle.d.ts +1 -1
  77. package/build/src/components/gizmo/rotate/RotateGizmo.d.ts +2 -2
  78. package/build/src/components/gizmo/scale/ScaleGizmo.d.ts +2 -2
  79. package/build/src/components/gizmo/translate/TranslateGizmo.d.ts +2 -2
  80. package/build/src/components/group/Group.d.ts +4 -4
  81. package/build/src/components/model/Model.d.ts +2 -2
  82. package/build/src/components/node/Node.d.ts +7 -7
  83. package/build/src/components/primitive/Primitive.d.ts +3 -3
  84. package/build/src/components/root/Root.d.ts +5 -7
  85. package/build/src/core/Dive.d.ts +5 -4
  86. package/build/src/engine/clock/Clock.d.ts +1 -0
  87. package/build/src/engine/index.d.ts +6 -0
  88. package/build/src/engine/renderer/Renderer.d.ts +47 -7
  89. package/build/src/engine/scene/xrroot/XRRoot.d.ts +2 -2
  90. package/build/src/engine/scene/xrroot/xrlightroot/XRLightRoot.d.ts +2 -2
  91. package/build/src/error/file-content/file-content-error.d.ts +4 -0
  92. package/build/src/error/index.d.ts +4 -0
  93. package/build/src/error/network/network-error.d.ts +1 -1
  94. package/build/src/error/parse/parse-error.d.ts +2 -1
  95. package/build/src/events/dispatcher/EventDispatcher.d.ts +6 -0
  96. package/build/src/events/index.d.ts +1 -0
  97. package/build/src/helpers/deepClone/deepClone.d.ts +34 -0
  98. package/build/src/helpers/index.d.ts +5 -4
  99. package/build/src/index.d.ts +5 -5
  100. package/build/src/interfaces/Draggable.d.ts +1 -1
  101. package/build/src/plugins/animation/index.d.ts +2 -0
  102. package/build/src/{modules/animation → plugins/animation/src}/animator/Animator.d.ts +2 -3
  103. package/build/src/plugins/animation/src/index.d.ts +3 -0
  104. package/build/src/plugins/animation/src/system/AnimationSystem.d.ts +23 -0
  105. package/build/src/plugins/ar/index.d.ts +4 -0
  106. package/build/src/plugins/ar/src/ARSystem.d.ts +24 -0
  107. package/build/src/plugins/ar/src/arquicklook/ARQuickLook.d.ts +15 -0
  108. package/build/src/plugins/ar/src/error/ar-errors.d.ts +24 -0
  109. package/build/src/{modules/ar → plugins/ar/src}/sceneviewer/SceneViewer.d.ts +10 -0
  110. package/build/src/{modules/ar → plugins/ar/src}/webxr/WebXR.d.ts +4 -4
  111. package/build/src/{modules/ar → plugins/ar/src}/webxr/controller/WebXRController.d.ts +5 -5
  112. package/build/src/{modules/ar → plugins/ar/src}/webxr/crosshair/WebXRCrosshair.d.ts +2 -2
  113. package/build/src/{modules/ar → plugins/ar/src}/webxr/origin/WebXROrigin.d.ts +4 -4
  114. package/build/src/{modules/ar → plugins/ar/src}/webxr/overlay/Overlay.d.ts +2 -2
  115. package/build/src/{modules/ar → plugins/ar/src}/webxr/raycaster/WebXRRaycaster.d.ts +8 -8
  116. package/build/src/{modules/ar → plugins/ar/src}/webxr/raycaster/ar/WebXRRaycasterAR.d.ts +4 -4
  117. package/build/src/{modules/ar → plugins/ar/src}/webxr/raycaster/three/WebXRRaycasterTHREE.d.ts +4 -4
  118. package/build/src/{modules/ar → plugins/ar/src}/webxr/touchscreencontrols/WebXRTouchscreenControls.d.ts +3 -3
  119. package/build/src/plugins/assetcache/index.d.ts +1 -0
  120. package/build/src/plugins/assetcache/src/cache/AssetCache.d.ts +12 -0
  121. package/build/src/plugins/assetcache/src/chunk/Chunk.d.ts +16 -0
  122. package/build/src/plugins/assetcache/src/index.d.ts +2 -0
  123. package/build/src/plugins/assetconverter/index.d.ts +1 -0
  124. package/build/src/plugins/assetconverter/src/AssetConverter.d.ts +13 -0
  125. package/build/src/plugins/assetexporter/index.d.ts +1 -0
  126. package/build/src/{modules/asset/exporter → plugins/assetexporter/src}/AssetExporter.d.ts +0 -17
  127. package/build/src/plugins/assetloader/index.d.ts +3 -0
  128. package/build/src/plugins/assetloader/src/draco/DracoLoader.d.ts +10 -0
  129. package/build/src/plugins/assetloader/src/loader/AssetLoader.d.ts +14 -0
  130. package/build/src/plugins/mediacreator/index.d.ts +1 -0
  131. package/build/src/plugins/mediacreator/src/MediaCreator.d.ts +15 -0
  132. package/build/src/plugins/orbitcontroller/index.d.ts +1 -0
  133. package/build/src/plugins/orbitcontroller/src/OrbitController.d.ts +45 -0
  134. package/build/src/plugins/orientationdisplay/index.d.ts +2 -0
  135. package/build/src/plugins/orientationdisplay/src/OrientationDisplay.d.ts +18 -0
  136. package/build/src/plugins/orientationdisplay/src/axes/Axes.d.ts +6 -0
  137. package/build/src/plugins/state/index.d.ts +4 -0
  138. package/build/src/{modules/state → plugins/state/src}/State.d.ts +4 -27
  139. package/build/src/{modules/state → plugins/state/src}/actions/action.d.ts +1 -1
  140. package/build/src/{modules/state → plugins/state/src}/actions/ar/launchar.d.ts +2 -2
  141. package/build/src/{modules/state → plugins/state/src}/actions/camera/computeencompassingview.d.ts +1 -1
  142. package/build/src/{modules/state → plugins/state/src}/actions/camera/getcameratransform.d.ts +1 -1
  143. package/build/src/{modules/state → plugins/state/src}/actions/camera/lockcamera.d.ts +1 -1
  144. package/build/src/{modules/state → plugins/state/src}/actions/camera/movecamera.d.ts +3 -3
  145. package/build/src/{modules/state → plugins/state/src}/actions/camera/setcameralayer.d.ts +1 -1
  146. package/build/src/{modules/state → plugins/state/src}/actions/camera/setcameratransform.d.ts +1 -1
  147. package/build/src/{modules/state → plugins/state/src}/actions/camera/zoomcamera.d.ts +1 -1
  148. package/build/src/{modules/state → plugins/state/src}/actions/media/generatemedia.d.ts +1 -1
  149. package/build/src/plugins/state/src/actions/object/addobject.d.ts +9 -0
  150. package/build/src/plugins/state/src/actions/object/deleteobject.d.ts +13 -0
  151. package/build/src/plugins/state/src/actions/object/deselectobject.d.ts +13 -0
  152. package/build/src/{modules/state → plugins/state/src}/actions/object/dropit.d.ts +3 -3
  153. package/build/src/{modules/state → plugins/state/src}/actions/object/getallobjects.d.ts +3 -2
  154. package/build/src/plugins/state/src/actions/object/getobjects.d.ts +13 -0
  155. package/build/src/{modules/state → plugins/state/src}/actions/object/modelloaded.d.ts +1 -1
  156. package/build/src/{modules/state → plugins/state/src}/actions/object/placeonfloor.d.ts +3 -3
  157. package/build/src/plugins/state/src/actions/object/selectobject.d.ts +13 -0
  158. package/build/src/plugins/state/src/actions/object/setparent.d.ts +23 -0
  159. package/build/src/plugins/state/src/actions/object/updateobject.d.ts +13 -0
  160. package/build/src/{modules/state → plugins/state/src}/actions/renderer/startrender.d.ts +1 -1
  161. package/build/src/{modules/state → plugins/state/src}/actions/scene/exportscene.d.ts +4 -4
  162. package/build/src/plugins/state/src/actions/scene/getallscenedata.d.ts +9 -0
  163. package/build/src/{modules/state → plugins/state/src}/actions/scene/setbackground.d.ts +1 -1
  164. package/build/src/{modules/state → plugins/state/src}/actions/scene/updatescene.d.ts +1 -1
  165. package/build/src/{modules/state → plugins/state/src}/actions/toolbox/setgizmomode.d.ts +1 -1
  166. package/build/src/{modules/state → plugins/state/src}/actions/toolbox/setgizmoscalelinked.d.ts +1 -1
  167. package/build/src/plugins/state/src/actions/toolbox/setgizmovisible.d.ts +8 -0
  168. package/build/src/{modules/state → plugins/state/src}/actions/toolbox/usetool.d.ts +2 -2
  169. package/build/src/plugins/state/types/ActionTypes.d.ts +17 -0
  170. package/build/src/{types/SceneType.d.ts → plugins/state/types/StateExportFileType.d.ts} +1 -1
  171. package/build/src/plugins/state/types/StateSceneData.d.ts +19 -0
  172. package/build/src/plugins/state/types/index.d.ts +1 -0
  173. package/build/src/plugins/systeminfo/index.d.ts +2 -0
  174. package/build/src/{modules/systeminfo → plugins/systeminfo/src}/SystemInfo.d.ts +22 -32
  175. package/build/src/plugins/toolbox/index.d.ts +4 -0
  176. package/build/src/{modules/toolbox → plugins/toolbox/src}/BaseTool.d.ts +4 -6
  177. package/build/src/{modules/toolbox → plugins/toolbox/src}/Toolbox.d.ts +8 -17
  178. package/build/src/{modules/toolbox → plugins/toolbox/src}/select/SelectTool.d.ts +7 -11
  179. package/build/src/{modules/toolbox → plugins/toolbox/src}/transform/TransformTool.d.ts +6 -10
  180. package/build/src/types/components/DIVELight.d.ts +4 -0
  181. package/build/src/types/components/DIVESceneObject.d.ts +6 -0
  182. package/build/src/types/components/index.d.ts +2 -0
  183. package/build/src/types/index.d.ts +2 -5
  184. package/build/src/types/schema/BaseEntitySchema.d.ts +8 -0
  185. package/build/src/types/schema/EntitySchema.d.ts +11 -0
  186. package/build/src/types/schema/EntityTypeSchema.d.ts +1 -0
  187. package/build/src/types/schema/GeometrySchema.d.ts +7 -0
  188. package/build/src/types/schema/GeometryTypeSchema.d.ts +1 -0
  189. package/build/src/types/schema/GroupSchema.d.ts +11 -0
  190. package/build/src/types/schema/LightSchema.d.ts +28 -0
  191. package/build/src/{modules/state/types/COMMaterial.d.ts → types/schema/MaterialSchema.d.ts} +1 -1
  192. package/build/src/types/schema/ModelSchema.d.ts +14 -0
  193. package/build/src/types/schema/PovSchema.d.ts +10 -0
  194. package/build/src/types/schema/PrimitiveSchema.d.ts +14 -0
  195. package/build/src/types/schema/index.d.ts +11 -0
  196. package/package.json +59 -41
  197. package/build/chunks/FileTypes-BjZ0rrIV.cjs +0 -1
  198. package/build/chunks/FileTypes-qgYnI0Jg.mjs +0 -30
  199. package/build/chunks/ModuleRegistry-NyNtjHb2.cjs +0 -1
  200. package/build/chunks/ModuleRegistry-RSub8W0G.mjs +0 -13
  201. package/build/chunks/SelectTool-BAXTVyWs.cjs +0 -1
  202. package/build/chunks/SystemInfo-oX-NNneO.cjs +0 -1
  203. package/build/chunks/findInterface-BEdL2iUQ.cjs +0 -1
  204. package/build/chunks/findInterface-OrXgmwxj.mjs +0 -18
  205. package/build/chunks/index-C_uFFwT2.mjs +0 -5
  206. package/build/chunks/index-DAwIH9xh.cjs +0 -1
  207. package/build/chunks/package-BHjZWYD6.mjs +0 -39
  208. package/build/chunks/package-JHvTSNgQ.cjs +0 -1
  209. package/build/chunks/parse-error-2f5qpXP5.cjs +0 -6
  210. package/build/chunks/parse-error-DRBVHL9E.mjs +0 -614
  211. package/build/src/error/ar-compatibility/ar-compatibility-error.d.ts +0 -12
  212. package/build/src/modules/ModuleRegistry.d.ts +0 -19
  213. package/build/src/modules/animation/AnimationSystem.cjs +0 -1
  214. package/build/src/modules/animation/AnimationSystem.d.ts +0 -36
  215. package/build/src/modules/animation/AnimationSystem.mjs +0 -95
  216. package/build/src/modules/ar/ARSystem.cjs +0 -1
  217. package/build/src/modules/ar/ARSystem.d.ts +0 -71
  218. package/build/src/modules/ar/ARSystem.mjs +0 -163
  219. package/build/src/modules/ar/arquicklook/ARQuickLook.d.ts +0 -7
  220. package/build/src/modules/asset/converter/AssetConverter.d.ts +0 -30
  221. package/build/src/modules/asset/draco/README.md +0 -32
  222. package/build/src/modules/asset/draco/draco_decoder.js +0 -33
  223. package/build/src/modules/asset/draco/draco_decoder.wasm +0 -0
  224. package/build/src/modules/asset/draco/draco_encoder.js +0 -33
  225. package/build/src/modules/asset/draco/draco_wasm_wrapper.js +0 -116
  226. package/build/src/modules/asset/draco/gltf/draco_decoder.js +0 -33
  227. package/build/src/modules/asset/draco/gltf/draco_decoder.wasm +0 -0
  228. package/build/src/modules/asset/draco/gltf/draco_encoder.js +0 -33
  229. package/build/src/modules/asset/draco/gltf/draco_wasm_wrapper.js +0 -116
  230. package/build/src/modules/asset/exporter/AssetExporter.cjs +0 -164
  231. package/build/src/modules/asset/loader/AssetLoader.cjs +0 -3
  232. package/build/src/modules/asset/loader/AssetLoader.d.ts +0 -29
  233. package/build/src/modules/asset/loader/AssetLoader.mjs +0 -2154
  234. package/build/src/modules/axiscamera/AxisCamera.d.ts +0 -21
  235. package/build/src/modules/controller/orbit/OrbitController.d.ts +0 -30
  236. package/build/src/modules/events/EventExecutor.d.ts +0 -5
  237. package/build/src/modules/mediacreator/MediaCreator.cjs +0 -1
  238. package/build/src/modules/mediacreator/MediaCreator.d.ts +0 -44
  239. package/build/src/modules/state/State.cjs +0 -27
  240. package/build/src/modules/state/State.mjs +0 -4296
  241. package/build/src/modules/state/actions/object/addobject.d.ts +0 -8
  242. package/build/src/modules/state/actions/object/deleteobject.d.ts +0 -12
  243. package/build/src/modules/state/actions/object/deselectobject.d.ts +0 -12
  244. package/build/src/modules/state/actions/object/getobjects.d.ts +0 -12
  245. package/build/src/modules/state/actions/object/selectobject.d.ts +0 -12
  246. package/build/src/modules/state/actions/object/setparent.d.ts +0 -22
  247. package/build/src/modules/state/actions/object/updateobject.d.ts +0 -12
  248. package/build/src/modules/state/actions/scene/getallscenedata.d.ts +0 -9
  249. package/build/src/modules/state/actions/toolbox/setgizmovisible.d.ts +0 -8
  250. package/build/src/modules/state/types/ActionTypes.d.ts +0 -18
  251. package/build/src/modules/state/types/COMBaseEntity.d.ts +0 -8
  252. package/build/src/modules/state/types/COMEntity.d.ts +0 -11
  253. package/build/src/modules/state/types/COMEntityType.d.ts +0 -1
  254. package/build/src/modules/state/types/COMGeometry.d.ts +0 -7
  255. package/build/src/modules/state/types/COMGeometryType.d.ts +0 -1
  256. package/build/src/modules/state/types/COMGroup.d.ts +0 -11
  257. package/build/src/modules/state/types/COMLight.d.ts +0 -28
  258. package/build/src/modules/state/types/COMModel.d.ts +0 -14
  259. package/build/src/modules/state/types/COMPov.d.ts +0 -10
  260. package/build/src/modules/state/types/COMPrimitive.d.ts +0 -14
  261. package/build/src/modules/state/types/index.d.ts +0 -11
  262. package/build/src/modules/systeminfo/SystemInfo.cjs +0 -1
  263. package/build/src/modules/systeminfo/SystemInfo.mjs +0 -5
  264. package/build/src/modules/toolbox/Toolbox.cjs +0 -1
  265. package/build/src/types/SceneData.d.ts +0 -19
  266. package/build/src/types/SceneObjects.d.ts +0 -9
  267. package/build/src/types/UUID.d.ts +0 -1
  268. /package/build/{src/modules/asset/converter/AssetConverter.cjs → plugins/assetconverter/index.cjs} +0 -0
  269. /package/build/{src/modules/asset/converter/AssetConverter.mjs → plugins/assetconverter/index.mjs} +0 -0
  270. /package/build/src/{modules/animation → plugins/animation/src}/types/AnimatorParameters.d.ts +0 -0
  271. /package/build/src/{modules/state → plugins/state/src}/ActionRegistry.d.ts +0 -0
  272. /package/build/src/{modules/state → plugins/state/src}/actions/ar/index.d.ts +0 -0
  273. /package/build/src/{modules/state → plugins/state/src}/actions/camera/index.d.ts +0 -0
  274. /package/build/src/{modules/state → plugins/state/src}/actions/index.d.ts +0 -0
  275. /package/build/src/{modules/state → plugins/state/src}/actions/media/index.d.ts +0 -0
  276. /package/build/src/{modules/state → plugins/state/src}/actions/object/index.d.ts +0 -0
  277. /package/build/src/{modules/state → plugins/state/src}/actions/renderer/index.d.ts +0 -0
  278. /package/build/src/{modules/state → plugins/state/src}/actions/scene/index.d.ts +0 -0
  279. /package/build/src/{modules/state → plugins/state/src}/actions/toolbox/index.d.ts +0 -0
  280. /package/build/src/{types/info → plugins/systeminfo/types}/index.d.ts +0 -0
@@ -0,0 +1,2341 @@
1
+ var ve = Object.defineProperty;
2
+ var Be = (d, e, t) => e in d ? ve(d, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[e] = t;
3
+ var v = (d, e, t) => Be(d, typeof e != "symbol" ? e + "" : e, t);
4
+ import { TrianglesDrawMode as je, TriangleFanDrawMode as re, TriangleStripDrawMode as be, Loader as ae, LoaderUtils as X, FileLoader as K, MeshPhysicalMaterial as O, Vector2 as q, Color as U, LinearSRGBColorSpace as D, SRGBColorSpace as N, SpotLight as Ke, PointLight as Ve, DirectionalLight as We, Matrix4 as Y, Vector3 as B, Quaternion as Le, InstancedMesh as Xe, InstancedBufferAttribute as ze, Object3D as ce, TextureLoader as Me, ImageBitmapLoader as qe, BufferAttribute as P, InterleavedBuffer as Ye, InterleavedBufferAttribute as Je, LinearMipmapLinearFilter as Ie, NearestMipmapLinearFilter as Qe, LinearMipmapNearestFilter as Ze, NearestMipmapNearestFilter as $e, LinearFilter as Ce, NearestFilter as et, RepeatWrapping as J, MirroredRepeatWrapping as Ne, ClampToEdgeWrapping as De, PointsMaterial as tt, Material as Z, LineBasicMaterial as nt, MeshStandardMaterial as Oe, DoubleSide as st, MeshBasicMaterial as W, PropertyBinding as rt, BufferGeometry as ue, SkinnedMesh as ot, Mesh as Pe, LineSegments as it, Line as at, LineLoop as ct, Points as ut, Group as z, PerspectiveCamera as lt, MathUtils as ft, OrthographicCamera as dt, Skeleton as ht, AnimationClip as pt, Bone as mt, InterpolateDiscrete as gt, InterpolateLinear as ke, Texture as de, VectorKeyframeTrack as he, NumberKeyframeTrack as pe, QuaternionKeyframeTrack as me, ColorManagement as ge, FrontSide as At, Interpolant as Tt, Box3 as yt, Sphere as xt, NoColorSpace as H } from "three";
5
+ import { u as Rt, a as Ae } from "./fflate.module-xyO_T3Zm.mjs";
6
+ import { S as _t } from "./FileTypes-IBuu9ohV.mjs";
7
+ import { g as wt, i as Et } from "./isFileTypeSupported-BSpswPHU.mjs";
8
+ import { F as Te, P as ye } from "./parse-error-DfOPyLWM.mjs";
9
+ import { A as xe } from "./AssetCache-CsfCIl9J.mjs";
10
+ function Re(d, e) {
11
+ if (e === je)
12
+ return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), d;
13
+ if (e === re || e === be) {
14
+ let t = d.getIndex();
15
+ if (t === null) {
16
+ const n = [], a = d.getAttribute("position");
17
+ if (a !== void 0) {
18
+ for (let i = 0; i < a.count; i++)
19
+ n.push(i);
20
+ d.setIndex(n), t = d.getIndex();
21
+ } else
22
+ return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), d;
23
+ }
24
+ const o = t.count - 2, s = [];
25
+ if (e === re)
26
+ for (let n = 1; n <= o; n++)
27
+ s.push(t.getX(0)), s.push(t.getX(n)), s.push(t.getX(n + 1));
28
+ else
29
+ for (let n = 0; n < o; n++)
30
+ n % 2 === 0 ? (s.push(t.getX(n)), s.push(t.getX(n + 1)), s.push(t.getX(n + 2))) : (s.push(t.getX(n + 2)), s.push(t.getX(n + 1)), s.push(t.getX(n)));
31
+ s.length / 3 !== o && console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");
32
+ const r = d.clone();
33
+ return r.setIndex(s), r.clearGroups(), r;
34
+ } else
35
+ return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", e), d;
36
+ }
37
+ class St extends ae {
38
+ constructor(e) {
39
+ super(e), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(t) {
40
+ return new Ct(t);
41
+ }), this.register(function(t) {
42
+ return new Gt(t);
43
+ }), this.register(function(t) {
44
+ return new vt(t);
45
+ }), this.register(function(t) {
46
+ return new Bt(t);
47
+ }), this.register(function(t) {
48
+ return new Dt(t);
49
+ }), this.register(function(t) {
50
+ return new Ot(t);
51
+ }), this.register(function(t) {
52
+ return new Pt(t);
53
+ }), this.register(function(t) {
54
+ return new kt(t);
55
+ }), this.register(function(t) {
56
+ return new It(t);
57
+ }), this.register(function(t) {
58
+ return new Ft(t);
59
+ }), this.register(function(t) {
60
+ return new Nt(t);
61
+ }), this.register(function(t) {
62
+ return new Ht(t);
63
+ }), this.register(function(t) {
64
+ return new Ut(t);
65
+ }), this.register(function(t) {
66
+ return new Lt(t);
67
+ }), this.register(function(t) {
68
+ return new jt(t);
69
+ }), this.register(function(t) {
70
+ return new Kt(t);
71
+ });
72
+ }
73
+ load(e, t, o, s) {
74
+ const r = this;
75
+ let n;
76
+ if (this.resourcePath !== "")
77
+ n = this.resourcePath;
78
+ else if (this.path !== "") {
79
+ const c = X.extractUrlBase(e);
80
+ n = X.resolveURL(c, this.path);
81
+ } else
82
+ n = X.extractUrlBase(e);
83
+ this.manager.itemStart(e);
84
+ const a = function(c) {
85
+ s ? s(c) : console.error(c), r.manager.itemError(e), r.manager.itemEnd(e);
86
+ }, i = new K(this.manager);
87
+ i.setPath(this.path), i.setResponseType("arraybuffer"), i.setRequestHeader(this.requestHeader), i.setWithCredentials(this.withCredentials), i.load(e, function(c) {
88
+ try {
89
+ r.parse(c, n, function(u) {
90
+ t(u), r.manager.itemEnd(e);
91
+ }, a);
92
+ } catch (u) {
93
+ a(u);
94
+ }
95
+ }, o, a);
96
+ }
97
+ setDRACOLoader(e) {
98
+ return this.dracoLoader = e, this;
99
+ }
100
+ setDDSLoader() {
101
+ throw new Error(
102
+ 'THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".'
103
+ );
104
+ }
105
+ setKTX2Loader(e) {
106
+ return this.ktx2Loader = e, this;
107
+ }
108
+ setMeshoptDecoder(e) {
109
+ return this.meshoptDecoder = e, this;
110
+ }
111
+ register(e) {
112
+ return this.pluginCallbacks.indexOf(e) === -1 && this.pluginCallbacks.push(e), this;
113
+ }
114
+ unregister(e) {
115
+ return this.pluginCallbacks.indexOf(e) !== -1 && this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e), 1), this;
116
+ }
117
+ parse(e, t, o, s) {
118
+ let r;
119
+ const n = {}, a = {}, i = new TextDecoder();
120
+ if (typeof e == "string")
121
+ r = JSON.parse(e);
122
+ else if (e instanceof ArrayBuffer)
123
+ if (i.decode(new Uint8Array(e, 0, 4)) === Fe) {
124
+ try {
125
+ n[b.KHR_BINARY_GLTF] = new Vt(e);
126
+ } catch (l) {
127
+ s && s(l);
128
+ return;
129
+ }
130
+ r = JSON.parse(n[b.KHR_BINARY_GLTF].content);
131
+ } else
132
+ r = JSON.parse(i.decode(e));
133
+ else
134
+ r = e;
135
+ if (r.asset === void 0 || r.asset.version[0] < 2) {
136
+ s && s(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
137
+ return;
138
+ }
139
+ const c = new sn(r, {
140
+ path: t || this.resourcePath || "",
141
+ crossOrigin: this.crossOrigin,
142
+ requestHeader: this.requestHeader,
143
+ manager: this.manager,
144
+ ktx2Loader: this.ktx2Loader,
145
+ meshoptDecoder: this.meshoptDecoder
146
+ });
147
+ c.fileLoader.setRequestHeader(this.requestHeader);
148
+ for (let u = 0; u < this.pluginCallbacks.length; u++) {
149
+ const l = this.pluginCallbacks[u](c);
150
+ l.name || console.error("THREE.GLTFLoader: Invalid plugin found: missing name"), a[l.name] = l, n[l.name] = !0;
151
+ }
152
+ if (r.extensionsUsed)
153
+ for (let u = 0; u < r.extensionsUsed.length; ++u) {
154
+ const l = r.extensionsUsed[u], f = r.extensionsRequired || [];
155
+ switch (l) {
156
+ case b.KHR_MATERIALS_UNLIT:
157
+ n[l] = new Mt();
158
+ break;
159
+ case b.KHR_DRACO_MESH_COMPRESSION:
160
+ n[l] = new Wt(r, this.dracoLoader);
161
+ break;
162
+ case b.KHR_TEXTURE_TRANSFORM:
163
+ n[l] = new Xt();
164
+ break;
165
+ case b.KHR_MESH_QUANTIZATION:
166
+ n[l] = new zt();
167
+ break;
168
+ default:
169
+ f.indexOf(l) >= 0 && a[l] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + l + '".');
170
+ }
171
+ }
172
+ c.setExtensions(n), c.setPlugins(a), c.parse(o, s);
173
+ }
174
+ parseAsync(e, t) {
175
+ const o = this;
176
+ return new Promise(function(s, r) {
177
+ o.parse(e, t, s, r);
178
+ });
179
+ }
180
+ }
181
+ function bt() {
182
+ let d = {};
183
+ return {
184
+ get: function(e) {
185
+ return d[e];
186
+ },
187
+ add: function(e, t) {
188
+ d[e] = t;
189
+ },
190
+ remove: function(e) {
191
+ delete d[e];
192
+ },
193
+ removeAll: function() {
194
+ d = {};
195
+ }
196
+ };
197
+ }
198
+ const b = {
199
+ KHR_BINARY_GLTF: "KHR_binary_glTF",
200
+ KHR_DRACO_MESH_COMPRESSION: "KHR_draco_mesh_compression",
201
+ KHR_LIGHTS_PUNCTUAL: "KHR_lights_punctual",
202
+ KHR_MATERIALS_CLEARCOAT: "KHR_materials_clearcoat",
203
+ KHR_MATERIALS_IOR: "KHR_materials_ior",
204
+ KHR_MATERIALS_SHEEN: "KHR_materials_sheen",
205
+ KHR_MATERIALS_SPECULAR: "KHR_materials_specular",
206
+ KHR_MATERIALS_TRANSMISSION: "KHR_materials_transmission",
207
+ KHR_MATERIALS_IRIDESCENCE: "KHR_materials_iridescence",
208
+ KHR_MATERIALS_ANISOTROPY: "KHR_materials_anisotropy",
209
+ KHR_MATERIALS_UNLIT: "KHR_materials_unlit",
210
+ KHR_MATERIALS_VOLUME: "KHR_materials_volume",
211
+ KHR_TEXTURE_BASISU: "KHR_texture_basisu",
212
+ KHR_TEXTURE_TRANSFORM: "KHR_texture_transform",
213
+ KHR_MESH_QUANTIZATION: "KHR_mesh_quantization",
214
+ KHR_MATERIALS_EMISSIVE_STRENGTH: "KHR_materials_emissive_strength",
215
+ EXT_MATERIALS_BUMP: "EXT_materials_bump",
216
+ EXT_TEXTURE_WEBP: "EXT_texture_webp",
217
+ EXT_TEXTURE_AVIF: "EXT_texture_avif",
218
+ EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression",
219
+ EXT_MESH_GPU_INSTANCING: "EXT_mesh_gpu_instancing"
220
+ };
221
+ class Lt {
222
+ constructor(e) {
223
+ this.parser = e, this.name = b.KHR_LIGHTS_PUNCTUAL, this.cache = { refs: {}, uses: {} };
224
+ }
225
+ _markDefs() {
226
+ const e = this.parser, t = this.parser.json.nodes || [];
227
+ for (let o = 0, s = t.length; o < s; o++) {
228
+ const r = t[o];
229
+ r.extensions && r.extensions[this.name] && r.extensions[this.name].light !== void 0 && e._addNodeRef(this.cache, r.extensions[this.name].light);
230
+ }
231
+ }
232
+ _loadLight(e) {
233
+ const t = this.parser, o = "light:" + e;
234
+ let s = t.cache.get(o);
235
+ if (s) return s;
236
+ const r = t.json, i = ((r.extensions && r.extensions[this.name] || {}).lights || [])[e];
237
+ let c;
238
+ const u = new U(16777215);
239
+ i.color !== void 0 && u.setRGB(i.color[0], i.color[1], i.color[2], D);
240
+ const l = i.range !== void 0 ? i.range : 0;
241
+ switch (i.type) {
242
+ case "directional":
243
+ c = new We(u), c.target.position.set(0, 0, -1), c.add(c.target);
244
+ break;
245
+ case "point":
246
+ c = new Ve(u), c.distance = l;
247
+ break;
248
+ case "spot":
249
+ c = new Ke(u), c.distance = l, 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);
250
+ break;
251
+ default:
252
+ throw new Error("THREE.GLTFLoader: Unexpected light type: " + i.type);
253
+ }
254
+ return c.position.set(0, 0, 0), c.decay = 2, F(c, i), i.intensity !== void 0 && (c.intensity = i.intensity), c.name = t.createUniqueName(i.name || "light_" + e), s = Promise.resolve(c), t.cache.add(o, s), s;
255
+ }
256
+ getDependency(e, t) {
257
+ if (e === "light")
258
+ return this._loadLight(t);
259
+ }
260
+ createNodeAttachment(e) {
261
+ const t = this, o = this.parser, r = o.json.nodes[e], a = (r.extensions && r.extensions[this.name] || {}).light;
262
+ return a === void 0 ? null : this._loadLight(a).then(function(i) {
263
+ return o._getNodeRef(t.cache, a, i);
264
+ });
265
+ }
266
+ }
267
+ class Mt {
268
+ constructor() {
269
+ this.name = b.KHR_MATERIALS_UNLIT;
270
+ }
271
+ getMaterialType() {
272
+ return W;
273
+ }
274
+ extendParams(e, t, o) {
275
+ const s = [];
276
+ e.color = new U(1, 1, 1), e.opacity = 1;
277
+ const r = t.pbrMetallicRoughness;
278
+ if (r) {
279
+ if (Array.isArray(r.baseColorFactor)) {
280
+ const n = r.baseColorFactor;
281
+ e.color.setRGB(n[0], n[1], n[2], D), e.opacity = n[3];
282
+ }
283
+ r.baseColorTexture !== void 0 && s.push(o.assignTexture(e, "map", r.baseColorTexture, N));
284
+ }
285
+ return Promise.all(s);
286
+ }
287
+ }
288
+ class It {
289
+ constructor(e) {
290
+ this.parser = e, this.name = b.KHR_MATERIALS_EMISSIVE_STRENGTH;
291
+ }
292
+ extendMaterialParams(e, t) {
293
+ const s = this.parser.json.materials[e];
294
+ if (!s.extensions || !s.extensions[this.name])
295
+ return Promise.resolve();
296
+ const r = s.extensions[this.name].emissiveStrength;
297
+ return r !== void 0 && (t.emissiveIntensity = r), Promise.resolve();
298
+ }
299
+ }
300
+ class Ct {
301
+ constructor(e) {
302
+ this.parser = e, this.name = b.KHR_MATERIALS_CLEARCOAT;
303
+ }
304
+ getMaterialType(e) {
305
+ const o = this.parser.json.materials[e];
306
+ return !o.extensions || !o.extensions[this.name] ? null : O;
307
+ }
308
+ extendMaterialParams(e, t) {
309
+ const o = this.parser, s = o.json.materials[e];
310
+ if (!s.extensions || !s.extensions[this.name])
311
+ return Promise.resolve();
312
+ const r = [], n = s.extensions[this.name];
313
+ if (n.clearcoatFactor !== void 0 && (t.clearcoat = n.clearcoatFactor), n.clearcoatTexture !== void 0 && r.push(o.assignTexture(t, "clearcoatMap", n.clearcoatTexture)), n.clearcoatRoughnessFactor !== void 0 && (t.clearcoatRoughness = n.clearcoatRoughnessFactor), n.clearcoatRoughnessTexture !== void 0 && r.push(o.assignTexture(t, "clearcoatRoughnessMap", n.clearcoatRoughnessTexture)), n.clearcoatNormalTexture !== void 0 && (r.push(o.assignTexture(t, "clearcoatNormalMap", n.clearcoatNormalTexture)), n.clearcoatNormalTexture.scale !== void 0)) {
314
+ const a = n.clearcoatNormalTexture.scale;
315
+ t.clearcoatNormalScale = new q(a, a);
316
+ }
317
+ return Promise.all(r);
318
+ }
319
+ }
320
+ class Nt {
321
+ constructor(e) {
322
+ this.parser = e, this.name = b.KHR_MATERIALS_IRIDESCENCE;
323
+ }
324
+ getMaterialType(e) {
325
+ const o = this.parser.json.materials[e];
326
+ return !o.extensions || !o.extensions[this.name] ? null : O;
327
+ }
328
+ extendMaterialParams(e, t) {
329
+ const o = this.parser, s = o.json.materials[e];
330
+ if (!s.extensions || !s.extensions[this.name])
331
+ return Promise.resolve();
332
+ const r = [], n = s.extensions[this.name];
333
+ return n.iridescenceFactor !== void 0 && (t.iridescence = n.iridescenceFactor), n.iridescenceTexture !== void 0 && r.push(o.assignTexture(t, "iridescenceMap", n.iridescenceTexture)), n.iridescenceIor !== void 0 && (t.iridescenceIOR = n.iridescenceIor), t.iridescenceThicknessRange === void 0 && (t.iridescenceThicknessRange = [100, 400]), n.iridescenceThicknessMinimum !== void 0 && (t.iridescenceThicknessRange[0] = n.iridescenceThicknessMinimum), n.iridescenceThicknessMaximum !== void 0 && (t.iridescenceThicknessRange[1] = n.iridescenceThicknessMaximum), n.iridescenceThicknessTexture !== void 0 && r.push(o.assignTexture(t, "iridescenceThicknessMap", n.iridescenceThicknessTexture)), Promise.all(r);
334
+ }
335
+ }
336
+ class Dt {
337
+ constructor(e) {
338
+ this.parser = e, this.name = b.KHR_MATERIALS_SHEEN;
339
+ }
340
+ getMaterialType(e) {
341
+ const o = this.parser.json.materials[e];
342
+ return !o.extensions || !o.extensions[this.name] ? null : O;
343
+ }
344
+ extendMaterialParams(e, t) {
345
+ const o = this.parser, s = o.json.materials[e];
346
+ if (!s.extensions || !s.extensions[this.name])
347
+ return Promise.resolve();
348
+ const r = [];
349
+ t.sheenColor = new U(0, 0, 0), t.sheenRoughness = 0, t.sheen = 1;
350
+ const n = s.extensions[this.name];
351
+ if (n.sheenColorFactor !== void 0) {
352
+ const a = n.sheenColorFactor;
353
+ t.sheenColor.setRGB(a[0], a[1], a[2], D);
354
+ }
355
+ return n.sheenRoughnessFactor !== void 0 && (t.sheenRoughness = n.sheenRoughnessFactor), n.sheenColorTexture !== void 0 && r.push(o.assignTexture(t, "sheenColorMap", n.sheenColorTexture, N)), n.sheenRoughnessTexture !== void 0 && r.push(o.assignTexture(t, "sheenRoughnessMap", n.sheenRoughnessTexture)), Promise.all(r);
356
+ }
357
+ }
358
+ class Ot {
359
+ constructor(e) {
360
+ this.parser = e, this.name = b.KHR_MATERIALS_TRANSMISSION;
361
+ }
362
+ getMaterialType(e) {
363
+ const o = this.parser.json.materials[e];
364
+ return !o.extensions || !o.extensions[this.name] ? null : O;
365
+ }
366
+ extendMaterialParams(e, t) {
367
+ const o = this.parser, s = o.json.materials[e];
368
+ if (!s.extensions || !s.extensions[this.name])
369
+ return Promise.resolve();
370
+ const r = [], n = s.extensions[this.name];
371
+ return n.transmissionFactor !== void 0 && (t.transmission = n.transmissionFactor), n.transmissionTexture !== void 0 && r.push(o.assignTexture(t, "transmissionMap", n.transmissionTexture)), Promise.all(r);
372
+ }
373
+ }
374
+ class Pt {
375
+ constructor(e) {
376
+ this.parser = e, this.name = b.KHR_MATERIALS_VOLUME;
377
+ }
378
+ getMaterialType(e) {
379
+ const o = this.parser.json.materials[e];
380
+ return !o.extensions || !o.extensions[this.name] ? null : O;
381
+ }
382
+ extendMaterialParams(e, t) {
383
+ const o = this.parser, s = o.json.materials[e];
384
+ if (!s.extensions || !s.extensions[this.name])
385
+ return Promise.resolve();
386
+ const r = [], n = s.extensions[this.name];
387
+ t.thickness = n.thicknessFactor !== void 0 ? n.thicknessFactor : 0, n.thicknessTexture !== void 0 && r.push(o.assignTexture(t, "thicknessMap", n.thicknessTexture)), t.attenuationDistance = n.attenuationDistance || 1 / 0;
388
+ const a = n.attenuationColor || [1, 1, 1];
389
+ return t.attenuationColor = new U().setRGB(a[0], a[1], a[2], D), Promise.all(r);
390
+ }
391
+ }
392
+ class kt {
393
+ constructor(e) {
394
+ this.parser = e, this.name = b.KHR_MATERIALS_IOR;
395
+ }
396
+ getMaterialType(e) {
397
+ const o = this.parser.json.materials[e];
398
+ return !o.extensions || !o.extensions[this.name] ? null : O;
399
+ }
400
+ extendMaterialParams(e, t) {
401
+ const s = this.parser.json.materials[e];
402
+ if (!s.extensions || !s.extensions[this.name])
403
+ return Promise.resolve();
404
+ const r = s.extensions[this.name];
405
+ return t.ior = r.ior !== void 0 ? r.ior : 1.5, Promise.resolve();
406
+ }
407
+ }
408
+ class Ft {
409
+ constructor(e) {
410
+ this.parser = e, this.name = b.KHR_MATERIALS_SPECULAR;
411
+ }
412
+ getMaterialType(e) {
413
+ const o = this.parser.json.materials[e];
414
+ return !o.extensions || !o.extensions[this.name] ? null : O;
415
+ }
416
+ extendMaterialParams(e, t) {
417
+ const o = this.parser, s = o.json.materials[e];
418
+ if (!s.extensions || !s.extensions[this.name])
419
+ return Promise.resolve();
420
+ const r = [], n = s.extensions[this.name];
421
+ t.specularIntensity = n.specularFactor !== void 0 ? n.specularFactor : 1, n.specularTexture !== void 0 && r.push(o.assignTexture(t, "specularIntensityMap", n.specularTexture));
422
+ const a = n.specularColorFactor || [1, 1, 1];
423
+ return t.specularColor = new U().setRGB(a[0], a[1], a[2], D), n.specularColorTexture !== void 0 && r.push(o.assignTexture(t, "specularColorMap", n.specularColorTexture, N)), Promise.all(r);
424
+ }
425
+ }
426
+ class Ut {
427
+ constructor(e) {
428
+ this.parser = e, this.name = b.EXT_MATERIALS_BUMP;
429
+ }
430
+ getMaterialType(e) {
431
+ const o = this.parser.json.materials[e];
432
+ return !o.extensions || !o.extensions[this.name] ? null : O;
433
+ }
434
+ extendMaterialParams(e, t) {
435
+ const o = this.parser, s = o.json.materials[e];
436
+ if (!s.extensions || !s.extensions[this.name])
437
+ return Promise.resolve();
438
+ const r = [], n = s.extensions[this.name];
439
+ return t.bumpScale = n.bumpFactor !== void 0 ? n.bumpFactor : 1, n.bumpTexture !== void 0 && r.push(o.assignTexture(t, "bumpMap", n.bumpTexture)), Promise.all(r);
440
+ }
441
+ }
442
+ class Ht {
443
+ constructor(e) {
444
+ this.parser = e, this.name = b.KHR_MATERIALS_ANISOTROPY;
445
+ }
446
+ getMaterialType(e) {
447
+ const o = this.parser.json.materials[e];
448
+ return !o.extensions || !o.extensions[this.name] ? null : O;
449
+ }
450
+ extendMaterialParams(e, t) {
451
+ const o = this.parser, s = o.json.materials[e];
452
+ if (!s.extensions || !s.extensions[this.name])
453
+ return Promise.resolve();
454
+ const r = [], n = s.extensions[this.name];
455
+ return n.anisotropyStrength !== void 0 && (t.anisotropy = n.anisotropyStrength), n.anisotropyRotation !== void 0 && (t.anisotropyRotation = n.anisotropyRotation), n.anisotropyTexture !== void 0 && r.push(o.assignTexture(t, "anisotropyMap", n.anisotropyTexture)), Promise.all(r);
456
+ }
457
+ }
458
+ class Gt {
459
+ constructor(e) {
460
+ this.parser = e, this.name = b.KHR_TEXTURE_BASISU;
461
+ }
462
+ loadTexture(e) {
463
+ const t = this.parser, o = t.json, s = o.textures[e];
464
+ if (!s.extensions || !s.extensions[this.name])
465
+ return null;
466
+ const r = s.extensions[this.name], n = t.options.ktx2Loader;
467
+ if (!n) {
468
+ if (o.extensionsRequired && o.extensionsRequired.indexOf(this.name) >= 0)
469
+ throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");
470
+ return null;
471
+ }
472
+ return t.loadTextureImage(e, r.source, n);
473
+ }
474
+ }
475
+ class vt {
476
+ constructor(e) {
477
+ this.parser = e, this.name = b.EXT_TEXTURE_WEBP, this.isSupported = null;
478
+ }
479
+ loadTexture(e) {
480
+ const t = this.name, o = this.parser, s = o.json, r = s.textures[e];
481
+ if (!r.extensions || !r.extensions[t])
482
+ return null;
483
+ const n = r.extensions[t], a = s.images[n.source];
484
+ let i = o.textureLoader;
485
+ if (a.uri) {
486
+ const c = o.options.manager.getHandler(a.uri);
487
+ c !== null && (i = c);
488
+ }
489
+ return this.detectSupport().then(function(c) {
490
+ if (c) return o.loadTextureImage(e, n.source, i);
491
+ if (s.extensionsRequired && s.extensionsRequired.indexOf(t) >= 0)
492
+ throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");
493
+ return o.loadTexture(e);
494
+ });
495
+ }
496
+ detectSupport() {
497
+ return this.isSupported || (this.isSupported = new Promise(function(e) {
498
+ const t = new Image();
499
+ t.src = "data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA", t.onload = t.onerror = function() {
500
+ e(t.height === 1);
501
+ };
502
+ })), this.isSupported;
503
+ }
504
+ }
505
+ class Bt {
506
+ constructor(e) {
507
+ this.parser = e, this.name = b.EXT_TEXTURE_AVIF, this.isSupported = null;
508
+ }
509
+ loadTexture(e) {
510
+ const t = this.name, o = this.parser, s = o.json, r = s.textures[e];
511
+ if (!r.extensions || !r.extensions[t])
512
+ return null;
513
+ const n = r.extensions[t], a = s.images[n.source];
514
+ let i = o.textureLoader;
515
+ if (a.uri) {
516
+ const c = o.options.manager.getHandler(a.uri);
517
+ c !== null && (i = c);
518
+ }
519
+ return this.detectSupport().then(function(c) {
520
+ if (c) return o.loadTextureImage(e, n.source, i);
521
+ if (s.extensionsRequired && s.extensionsRequired.indexOf(t) >= 0)
522
+ throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");
523
+ return o.loadTexture(e);
524
+ });
525
+ }
526
+ detectSupport() {
527
+ return this.isSupported || (this.isSupported = new Promise(function(e) {
528
+ const t = new Image();
529
+ t.src = "data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=", t.onload = t.onerror = function() {
530
+ e(t.height === 1);
531
+ };
532
+ })), this.isSupported;
533
+ }
534
+ }
535
+ class jt {
536
+ constructor(e) {
537
+ this.name = b.EXT_MESHOPT_COMPRESSION, this.parser = e;
538
+ }
539
+ loadBufferView(e) {
540
+ const t = this.parser.json, o = t.bufferViews[e];
541
+ if (o.extensions && o.extensions[this.name]) {
542
+ const s = o.extensions[this.name], r = this.parser.getDependency("buffer", s.buffer), n = this.parser.options.meshoptDecoder;
543
+ if (!n || !n.supported) {
544
+ if (t.extensionsRequired && t.extensionsRequired.indexOf(this.name) >= 0)
545
+ throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");
546
+ return null;
547
+ }
548
+ return r.then(function(a) {
549
+ const i = s.byteOffset || 0, c = s.byteLength || 0, u = s.count, l = s.byteStride, f = new Uint8Array(a, i, c);
550
+ return n.decodeGltfBufferAsync ? n.decodeGltfBufferAsync(u, l, f, s.mode, s.filter).then(function(m) {
551
+ return m.buffer;
552
+ }) : n.ready.then(function() {
553
+ const m = new ArrayBuffer(u * l);
554
+ return n.decodeGltfBuffer(new Uint8Array(m), u, l, f, s.mode, s.filter), m;
555
+ });
556
+ });
557
+ } else
558
+ return null;
559
+ }
560
+ }
561
+ class Kt {
562
+ constructor(e) {
563
+ this.name = b.EXT_MESH_GPU_INSTANCING, this.parser = e;
564
+ }
565
+ createNodeMesh(e) {
566
+ const t = this.parser.json, o = t.nodes[e];
567
+ if (!o.extensions || !o.extensions[this.name] || o.mesh === void 0)
568
+ return null;
569
+ const s = t.meshes[o.mesh];
570
+ for (const c of s.primitives)
571
+ if (c.mode !== C.TRIANGLES && c.mode !== C.TRIANGLE_STRIP && c.mode !== C.TRIANGLE_FAN && c.mode !== void 0)
572
+ return null;
573
+ const n = o.extensions[this.name].attributes, a = [], i = {};
574
+ for (const c in n)
575
+ a.push(this.parser.getDependency("accessor", n[c]).then((u) => (i[c] = u, i[c])));
576
+ return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(e)), Promise.all(a).then((c) => {
577
+ const u = c.pop(), l = u.isGroup ? u.children : [u], f = c[0].count, m = [];
578
+ for (const T of l) {
579
+ const R = new Y(), y = new B(), x = new Le(), E = new B(1, 1, 1), S = new Xe(T.geometry, T.material, f);
580
+ for (let _ = 0; _ < f; _++)
581
+ i.TRANSLATION && y.fromBufferAttribute(i.TRANSLATION, _), i.ROTATION && x.fromBufferAttribute(i.ROTATION, _), i.SCALE && E.fromBufferAttribute(i.SCALE, _), S.setMatrixAt(_, R.compose(y, x, E));
582
+ for (const _ in i)
583
+ if (_ === "_COLOR_0") {
584
+ const M = i[_];
585
+ S.instanceColor = new ze(M.array, M.itemSize, M.normalized);
586
+ } else _ !== "TRANSLATION" && _ !== "ROTATION" && _ !== "SCALE" && T.geometry.setAttribute(_, i[_]);
587
+ ce.prototype.copy.call(S, T), this.parser.assignFinalMaterial(S), m.push(S);
588
+ }
589
+ return u.isGroup ? (u.clear(), u.add(...m), u) : m[0];
590
+ }));
591
+ }
592
+ }
593
+ const Fe = "glTF", V = 12, _e = { JSON: 1313821514, BIN: 5130562 };
594
+ class Vt {
595
+ constructor(e) {
596
+ this.name = b.KHR_BINARY_GLTF, this.content = null, this.body = null;
597
+ const t = new DataView(e, 0, V), o = new TextDecoder();
598
+ if (this.header = {
599
+ magic: o.decode(new Uint8Array(e.slice(0, 4))),
600
+ version: t.getUint32(4, !0),
601
+ length: t.getUint32(8, !0)
602
+ }, this.header.magic !== Fe)
603
+ throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
604
+ if (this.header.version < 2)
605
+ throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
606
+ const s = this.header.length - V, r = new DataView(e, V);
607
+ let n = 0;
608
+ for (; n < s; ) {
609
+ const a = r.getUint32(n, !0);
610
+ n += 4;
611
+ const i = r.getUint32(n, !0);
612
+ if (n += 4, i === _e.JSON) {
613
+ const c = new Uint8Array(e, V + n, a);
614
+ this.content = o.decode(c);
615
+ } else if (i === _e.BIN) {
616
+ const c = V + n;
617
+ this.body = e.slice(c, c + a);
618
+ }
619
+ n += a;
620
+ }
621
+ if (this.content === null)
622
+ throw new Error("THREE.GLTFLoader: JSON content not found.");
623
+ }
624
+ }
625
+ class Wt {
626
+ constructor(e, t) {
627
+ if (!t)
628
+ throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
629
+ this.name = b.KHR_DRACO_MESH_COMPRESSION, this.json = e, this.dracoLoader = t, this.dracoLoader.preload();
630
+ }
631
+ decodePrimitive(e, t) {
632
+ const o = this.json, s = this.dracoLoader, r = e.extensions[this.name].bufferView, n = e.extensions[this.name].attributes, a = {}, i = {}, c = {};
633
+ for (const u in n) {
634
+ const l = oe[u] || u.toLowerCase();
635
+ a[l] = n[u];
636
+ }
637
+ for (const u in e.attributes) {
638
+ const l = oe[u] || u.toLowerCase();
639
+ if (n[u] !== void 0) {
640
+ const f = o.accessors[e.attributes[u]], m = j[f.componentType];
641
+ c[l] = m.name, i[l] = f.normalized === !0;
642
+ }
643
+ }
644
+ return t.getDependency("bufferView", r).then(function(u) {
645
+ return new Promise(function(l, f) {
646
+ s.decodeDracoFile(u, function(m) {
647
+ for (const T in m.attributes) {
648
+ const R = m.attributes[T], y = i[T];
649
+ y !== void 0 && (R.normalized = y);
650
+ }
651
+ l(m);
652
+ }, a, c, D, f);
653
+ });
654
+ });
655
+ }
656
+ }
657
+ class Xt {
658
+ constructor() {
659
+ this.name = b.KHR_TEXTURE_TRANSFORM;
660
+ }
661
+ extendTexture(e, t) {
662
+ return (t.texCoord === void 0 || t.texCoord === e.channel) && t.offset === void 0 && t.rotation === void 0 && t.scale === void 0 || (e = e.clone(), t.texCoord !== void 0 && (e.channel = t.texCoord), t.offset !== void 0 && e.offset.fromArray(t.offset), t.rotation !== void 0 && (e.rotation = t.rotation), t.scale !== void 0 && e.repeat.fromArray(t.scale), e.needsUpdate = !0), e;
663
+ }
664
+ }
665
+ class zt {
666
+ constructor() {
667
+ this.name = b.KHR_MESH_QUANTIZATION;
668
+ }
669
+ }
670
+ class Ue extends Tt {
671
+ constructor(e, t, o, s) {
672
+ super(e, t, o, s);
673
+ }
674
+ copySampleValue_(e) {
675
+ const t = this.resultBuffer, o = this.sampleValues, s = this.valueSize, r = e * s * 3 + s;
676
+ for (let n = 0; n !== s; n++)
677
+ t[n] = o[r + n];
678
+ return t;
679
+ }
680
+ interpolate_(e, t, o, s) {
681
+ const r = this.resultBuffer, n = this.sampleValues, a = this.valueSize, i = a * 2, c = a * 3, u = s - t, l = (o - t) / u, f = l * l, m = f * l, T = e * c, R = T - c, y = -2 * m + 3 * f, x = m - f, E = 1 - y, S = x - f + l;
682
+ for (let _ = 0; _ !== a; _++) {
683
+ const M = n[R + _ + a], I = n[R + _ + i] * u, L = n[T + _ + a], h = n[T + _] * u;
684
+ r[_] = E * M + S * I + y * L + x * h;
685
+ }
686
+ return r;
687
+ }
688
+ }
689
+ const qt = new Le();
690
+ class Yt extends Ue {
691
+ interpolate_(e, t, o, s) {
692
+ const r = super.interpolate_(e, t, o, s);
693
+ return qt.fromArray(r).normalize().toArray(r), r;
694
+ }
695
+ }
696
+ const C = {
697
+ POINTS: 0,
698
+ LINES: 1,
699
+ LINE_LOOP: 2,
700
+ LINE_STRIP: 3,
701
+ TRIANGLES: 4,
702
+ TRIANGLE_STRIP: 5,
703
+ TRIANGLE_FAN: 6
704
+ }, j = {
705
+ 5120: Int8Array,
706
+ 5121: Uint8Array,
707
+ 5122: Int16Array,
708
+ 5123: Uint16Array,
709
+ 5125: Uint32Array,
710
+ 5126: Float32Array
711
+ }, we = {
712
+ 9728: et,
713
+ 9729: Ce,
714
+ 9984: $e,
715
+ 9985: Ze,
716
+ 9986: Qe,
717
+ 9987: Ie
718
+ }, Ee = {
719
+ 33071: De,
720
+ 33648: Ne,
721
+ 10497: J
722
+ }, $ = {
723
+ SCALAR: 1,
724
+ VEC2: 2,
725
+ VEC3: 3,
726
+ VEC4: 4,
727
+ MAT2: 4,
728
+ MAT3: 9,
729
+ MAT4: 16
730
+ }, oe = {
731
+ POSITION: "position",
732
+ NORMAL: "normal",
733
+ TANGENT: "tangent",
734
+ TEXCOORD_0: "uv",
735
+ TEXCOORD_1: "uv1",
736
+ TEXCOORD_2: "uv2",
737
+ TEXCOORD_3: "uv3",
738
+ COLOR_0: "color",
739
+ WEIGHTS_0: "skinWeight",
740
+ JOINTS_0: "skinIndex"
741
+ }, k = {
742
+ scale: "scale",
743
+ translation: "position",
744
+ rotation: "quaternion",
745
+ weights: "morphTargetInfluences"
746
+ }, Jt = {
747
+ CUBICSPLINE: void 0,
748
+ // We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
749
+ // keyframe track will be initialized with a default interpolation type, then modified.
750
+ LINEAR: ke,
751
+ STEP: gt
752
+ }, ee = {
753
+ OPAQUE: "OPAQUE",
754
+ MASK: "MASK",
755
+ BLEND: "BLEND"
756
+ };
757
+ function Qt(d) {
758
+ return d.DefaultMaterial === void 0 && (d.DefaultMaterial = new Oe({
759
+ color: 16777215,
760
+ emissive: 0,
761
+ metalness: 1,
762
+ roughness: 1,
763
+ transparent: !1,
764
+ depthTest: !0,
765
+ side: At
766
+ })), d.DefaultMaterial;
767
+ }
768
+ function G(d, e, t) {
769
+ for (const o in t.extensions)
770
+ d[o] === void 0 && (e.userData.gltfExtensions = e.userData.gltfExtensions || {}, e.userData.gltfExtensions[o] = t.extensions[o]);
771
+ }
772
+ function F(d, e) {
773
+ e.extras !== void 0 && (typeof e.extras == "object" ? Object.assign(d.userData, e.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + e.extras));
774
+ }
775
+ function Zt(d, e, t) {
776
+ let o = !1, s = !1, r = !1;
777
+ for (let c = 0, u = e.length; c < u; c++) {
778
+ const l = e[c];
779
+ if (l.POSITION !== void 0 && (o = !0), l.NORMAL !== void 0 && (s = !0), l.COLOR_0 !== void 0 && (r = !0), o && s && r) break;
780
+ }
781
+ if (!o && !s && !r) return Promise.resolve(d);
782
+ const n = [], a = [], i = [];
783
+ for (let c = 0, u = e.length; c < u; c++) {
784
+ const l = e[c];
785
+ if (o) {
786
+ const f = l.POSITION !== void 0 ? t.getDependency("accessor", l.POSITION) : d.attributes.position;
787
+ n.push(f);
788
+ }
789
+ if (s) {
790
+ const f = l.NORMAL !== void 0 ? t.getDependency("accessor", l.NORMAL) : d.attributes.normal;
791
+ a.push(f);
792
+ }
793
+ if (r) {
794
+ const f = l.COLOR_0 !== void 0 ? t.getDependency("accessor", l.COLOR_0) : d.attributes.color;
795
+ i.push(f);
796
+ }
797
+ }
798
+ return Promise.all([
799
+ Promise.all(n),
800
+ Promise.all(a),
801
+ Promise.all(i)
802
+ ]).then(function(c) {
803
+ const u = c[0], l = c[1], f = c[2];
804
+ return o && (d.morphAttributes.position = u), s && (d.morphAttributes.normal = l), r && (d.morphAttributes.color = f), d.morphTargetsRelative = !0, d;
805
+ });
806
+ }
807
+ function $t(d, e) {
808
+ if (d.updateMorphTargets(), e.weights !== void 0)
809
+ for (let t = 0, o = e.weights.length; t < o; t++)
810
+ d.morphTargetInfluences[t] = e.weights[t];
811
+ if (e.extras && Array.isArray(e.extras.targetNames)) {
812
+ const t = e.extras.targetNames;
813
+ if (d.morphTargetInfluences.length === t.length) {
814
+ d.morphTargetDictionary = {};
815
+ for (let o = 0, s = t.length; o < s; o++)
816
+ d.morphTargetDictionary[t[o]] = o;
817
+ } else
818
+ console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
819
+ }
820
+ }
821
+ function en(d) {
822
+ let e;
823
+ const t = d.extensions && d.extensions[b.KHR_DRACO_MESH_COMPRESSION];
824
+ if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" + te(t.attributes) : e = d.indices + ":" + te(d.attributes) + ":" + d.mode, d.targets !== void 0)
825
+ for (let o = 0, s = d.targets.length; o < s; o++)
826
+ e += ":" + te(d.targets[o]);
827
+ return e;
828
+ }
829
+ function te(d) {
830
+ let e = "";
831
+ const t = Object.keys(d).sort();
832
+ for (let o = 0, s = t.length; o < s; o++)
833
+ e += t[o] + ":" + d[t[o]] + ";";
834
+ return e;
835
+ }
836
+ function ie(d) {
837
+ switch (d) {
838
+ case Int8Array:
839
+ return 1 / 127;
840
+ case Uint8Array:
841
+ return 1 / 255;
842
+ case Int16Array:
843
+ return 1 / 32767;
844
+ case Uint16Array:
845
+ return 1 / 65535;
846
+ default:
847
+ throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");
848
+ }
849
+ }
850
+ function tn(d) {
851
+ 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";
852
+ }
853
+ const nn = new Y();
854
+ class sn {
855
+ constructor(e = {}, t = {}) {
856
+ this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new bt(), this.associations = /* @__PURE__ */ new Map(), this.primitiveCache = {}, this.nodeCache = {}, this.meshCache = { refs: {}, uses: {} }, this.cameraCache = { refs: {}, uses: {} }, this.lightCache = { refs: {}, uses: {} }, this.sourceCache = {}, this.textureCache = {}, this.nodeNamesUsed = {};
857
+ let o = !1, s = !1, r = -1;
858
+ typeof navigator < "u" && (o = /^((?!chrome|android).)*safari/i.test(navigator.userAgent) === !0, s = navigator.userAgent.indexOf("Firefox") > -1, r = s ? navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1] : -1), typeof createImageBitmap > "u" || o || s && r < 98 ? this.textureLoader = new Me(this.options.manager) : this.textureLoader = new qe(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new K(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
859
+ }
860
+ setExtensions(e) {
861
+ this.extensions = e;
862
+ }
863
+ setPlugins(e) {
864
+ this.plugins = e;
865
+ }
866
+ parse(e, t) {
867
+ const o = this, s = this.json, r = this.extensions;
868
+ this.cache.removeAll(), this.nodeCache = {}, this._invokeAll(function(n) {
869
+ return n._markDefs && n._markDefs();
870
+ }), Promise.all(this._invokeAll(function(n) {
871
+ return n.beforeRoot && n.beforeRoot();
872
+ })).then(function() {
873
+ return Promise.all([
874
+ o.getDependencies("scene"),
875
+ o.getDependencies("animation"),
876
+ o.getDependencies("camera")
877
+ ]);
878
+ }).then(function(n) {
879
+ const a = {
880
+ scene: n[0][s.scene || 0],
881
+ scenes: n[0],
882
+ animations: n[1],
883
+ cameras: n[2],
884
+ asset: s.asset,
885
+ parser: o,
886
+ userData: {}
887
+ };
888
+ return G(r, a, s), F(a, s), Promise.all(o._invokeAll(function(i) {
889
+ return i.afterRoot && i.afterRoot(a);
890
+ })).then(function() {
891
+ for (const i of a.scenes)
892
+ i.updateMatrixWorld();
893
+ e(a);
894
+ });
895
+ }).catch(t);
896
+ }
897
+ /**
898
+ * Marks the special nodes/meshes in json for efficient parse.
899
+ */
900
+ _markDefs() {
901
+ const e = this.json.nodes || [], t = this.json.skins || [], o = this.json.meshes || [];
902
+ for (let s = 0, r = t.length; s < r; s++) {
903
+ const n = t[s].joints;
904
+ for (let a = 0, i = n.length; a < i; a++)
905
+ e[n[a]].isBone = !0;
906
+ }
907
+ for (let s = 0, r = e.length; s < r; s++) {
908
+ const n = e[s];
909
+ n.mesh !== void 0 && (this._addNodeRef(this.meshCache, n.mesh), n.skin !== void 0 && (o[n.mesh].isSkinnedMesh = !0)), n.camera !== void 0 && this._addNodeRef(this.cameraCache, n.camera);
910
+ }
911
+ }
912
+ /**
913
+ * Counts references to shared node / Object3D resources. These resources
914
+ * can be reused, or "instantiated", at multiple nodes in the scene
915
+ * hierarchy. Mesh, Camera, and Light instances are instantiated and must
916
+ * be marked. Non-scenegraph resources (like Materials, Geometries, and
917
+ * Textures) can be reused directly and are not marked here.
918
+ *
919
+ * Example: CesiumMilkTruck sample model reuses "Wheel" meshes.
920
+ */
921
+ _addNodeRef(e, t) {
922
+ t !== void 0 && (e.refs[t] === void 0 && (e.refs[t] = e.uses[t] = 0), e.refs[t]++);
923
+ }
924
+ /** Returns a reference to a shared resource, cloning it if necessary. */
925
+ _getNodeRef(e, t, o) {
926
+ if (e.refs[t] <= 1) return o;
927
+ const s = o.clone(), r = (n, a) => {
928
+ const i = this.associations.get(n);
929
+ i != null && this.associations.set(a, i);
930
+ for (const [c, u] of n.children.entries())
931
+ r(u, a.children[c]);
932
+ };
933
+ return r(o, s), s.name += "_instance_" + e.uses[t]++, s;
934
+ }
935
+ _invokeOne(e) {
936
+ const t = Object.values(this.plugins);
937
+ t.push(this);
938
+ for (let o = 0; o < t.length; o++) {
939
+ const s = e(t[o]);
940
+ if (s) return s;
941
+ }
942
+ return null;
943
+ }
944
+ _invokeAll(e) {
945
+ const t = Object.values(this.plugins);
946
+ t.unshift(this);
947
+ const o = [];
948
+ for (let s = 0; s < t.length; s++) {
949
+ const r = e(t[s]);
950
+ r && o.push(r);
951
+ }
952
+ return o;
953
+ }
954
+ /**
955
+ * Requests the specified dependency asynchronously, with caching.
956
+ * @param {string} type
957
+ * @param {number} index
958
+ * @return {Promise<Object3D|Material|THREE.Texture|AnimationClip|ArrayBuffer|Object>}
959
+ */
960
+ getDependency(e, t) {
961
+ const o = e + ":" + t;
962
+ let s = this.cache.get(o);
963
+ if (!s) {
964
+ switch (e) {
965
+ case "scene":
966
+ s = this.loadScene(t);
967
+ break;
968
+ case "node":
969
+ s = this._invokeOne(function(r) {
970
+ return r.loadNode && r.loadNode(t);
971
+ });
972
+ break;
973
+ case "mesh":
974
+ s = this._invokeOne(function(r) {
975
+ return r.loadMesh && r.loadMesh(t);
976
+ });
977
+ break;
978
+ case "accessor":
979
+ s = this.loadAccessor(t);
980
+ break;
981
+ case "bufferView":
982
+ s = this._invokeOne(function(r) {
983
+ return r.loadBufferView && r.loadBufferView(t);
984
+ });
985
+ break;
986
+ case "buffer":
987
+ s = this.loadBuffer(t);
988
+ break;
989
+ case "material":
990
+ s = this._invokeOne(function(r) {
991
+ return r.loadMaterial && r.loadMaterial(t);
992
+ });
993
+ break;
994
+ case "texture":
995
+ s = this._invokeOne(function(r) {
996
+ return r.loadTexture && r.loadTexture(t);
997
+ });
998
+ break;
999
+ case "skin":
1000
+ s = this.loadSkin(t);
1001
+ break;
1002
+ case "animation":
1003
+ s = this._invokeOne(function(r) {
1004
+ return r.loadAnimation && r.loadAnimation(t);
1005
+ });
1006
+ break;
1007
+ case "camera":
1008
+ s = this.loadCamera(t);
1009
+ break;
1010
+ default:
1011
+ if (s = this._invokeOne(function(r) {
1012
+ return r != this && r.getDependency && r.getDependency(e, t);
1013
+ }), !s)
1014
+ throw new Error("Unknown type: " + e);
1015
+ break;
1016
+ }
1017
+ this.cache.add(o, s);
1018
+ }
1019
+ return s;
1020
+ }
1021
+ /**
1022
+ * Requests all dependencies of the specified type asynchronously, with caching.
1023
+ * @param {string} type
1024
+ * @return {Promise<Array<Object>>}
1025
+ */
1026
+ getDependencies(e) {
1027
+ let t = this.cache.get(e);
1028
+ if (!t) {
1029
+ const o = this, s = this.json[e + (e === "mesh" ? "es" : "s")] || [];
1030
+ t = Promise.all(s.map(function(r, n) {
1031
+ return o.getDependency(e, n);
1032
+ })), this.cache.add(e, t);
1033
+ }
1034
+ return t;
1035
+ }
1036
+ /**
1037
+ * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
1038
+ * @param {number} bufferIndex
1039
+ * @return {Promise<ArrayBuffer>}
1040
+ */
1041
+ loadBuffer(e) {
1042
+ const t = this.json.buffers[e], o = this.fileLoader;
1043
+ if (t.type && t.type !== "arraybuffer")
1044
+ throw new Error("THREE.GLTFLoader: " + t.type + " buffer type is not supported.");
1045
+ if (t.uri === void 0 && e === 0)
1046
+ return Promise.resolve(this.extensions[b.KHR_BINARY_GLTF].body);
1047
+ const s = this.options;
1048
+ return new Promise(function(r, n) {
1049
+ o.load(X.resolveURL(t.uri, s.path), r, void 0, function() {
1050
+ n(new Error('THREE.GLTFLoader: Failed to load buffer "' + t.uri + '".'));
1051
+ });
1052
+ });
1053
+ }
1054
+ /**
1055
+ * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
1056
+ * @param {number} bufferViewIndex
1057
+ * @return {Promise<ArrayBuffer>}
1058
+ */
1059
+ loadBufferView(e) {
1060
+ const t = this.json.bufferViews[e];
1061
+ return this.getDependency("buffer", t.buffer).then(function(o) {
1062
+ const s = t.byteLength || 0, r = t.byteOffset || 0;
1063
+ return o.slice(r, r + s);
1064
+ });
1065
+ }
1066
+ /**
1067
+ * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#accessors
1068
+ * @param {number} accessorIndex
1069
+ * @return {Promise<BufferAttribute|InterleavedBufferAttribute>}
1070
+ */
1071
+ loadAccessor(e) {
1072
+ const t = this, o = this.json, s = this.json.accessors[e];
1073
+ if (s.bufferView === void 0 && s.sparse === void 0) {
1074
+ const n = $[s.type], a = j[s.componentType], i = s.normalized === !0, c = new a(s.count * n);
1075
+ return Promise.resolve(new P(c, n, i));
1076
+ }
1077
+ const r = [];
1078
+ return s.bufferView !== void 0 ? r.push(this.getDependency("bufferView", s.bufferView)) : r.push(null), s.sparse !== void 0 && (r.push(this.getDependency("bufferView", s.sparse.indices.bufferView)), r.push(this.getDependency("bufferView", s.sparse.values.bufferView))), Promise.all(r).then(function(n) {
1079
+ const a = n[0], i = $[s.type], c = j[s.componentType], u = c.BYTES_PER_ELEMENT, l = u * i, f = s.byteOffset || 0, m = s.bufferView !== void 0 ? o.bufferViews[s.bufferView].byteStride : void 0, T = s.normalized === !0;
1080
+ let R, y;
1081
+ if (m && m !== l) {
1082
+ const x = Math.floor(f / m), E = "InterleavedBuffer:" + s.bufferView + ":" + s.componentType + ":" + x + ":" + s.count;
1083
+ let S = t.cache.get(E);
1084
+ S || (R = new c(a, x * m, s.count * m / u), S = new Ye(R, m / u), t.cache.add(E, S)), y = new Je(S, i, f % m / u, T);
1085
+ } else
1086
+ a === null ? R = new c(s.count * i) : R = new c(a, f, s.count * i), y = new P(R, i, T);
1087
+ if (s.sparse !== void 0) {
1088
+ const x = $.SCALAR, E = j[s.sparse.indices.componentType], S = s.sparse.indices.byteOffset || 0, _ = s.sparse.values.byteOffset || 0, M = new E(n[1], S, s.sparse.count * x), I = new c(n[2], _, s.sparse.count * i);
1089
+ a !== null && (y = new P(y.array.slice(), y.itemSize, y.normalized));
1090
+ for (let L = 0, h = M.length; L < h; L++) {
1091
+ const p = M[L];
1092
+ if (y.setX(p, I[L * i]), i >= 2 && y.setY(p, I[L * i + 1]), i >= 3 && y.setZ(p, I[L * i + 2]), i >= 4 && y.setW(p, I[L * i + 3]), i >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
1093
+ }
1094
+ }
1095
+ return y;
1096
+ });
1097
+ }
1098
+ /**
1099
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures
1100
+ * @param {number} textureIndex
1101
+ * @return {Promise<THREE.Texture|null>}
1102
+ */
1103
+ loadTexture(e) {
1104
+ const t = this.json, o = this.options, r = t.textures[e].source, n = t.images[r];
1105
+ let a = this.textureLoader;
1106
+ if (n.uri) {
1107
+ const i = o.manager.getHandler(n.uri);
1108
+ i !== null && (a = i);
1109
+ }
1110
+ return this.loadTextureImage(e, r, a);
1111
+ }
1112
+ loadTextureImage(e, t, o) {
1113
+ const s = this, r = this.json, n = r.textures[e], a = r.images[t], i = (a.uri || a.bufferView) + ":" + n.sampler;
1114
+ if (this.textureCache[i])
1115
+ return this.textureCache[i];
1116
+ const c = this.loadImageSource(t, o).then(function(u) {
1117
+ u.flipY = !1, u.name = n.name || a.name || "", u.name === "" && typeof a.uri == "string" && a.uri.startsWith("data:image/") === !1 && (u.name = a.uri);
1118
+ const f = (r.samplers || {})[n.sampler] || {};
1119
+ return u.magFilter = we[f.magFilter] || Ce, u.minFilter = we[f.minFilter] || Ie, u.wrapS = Ee[f.wrapS] || J, u.wrapT = Ee[f.wrapT] || J, s.associations.set(u, { textures: e }), u;
1120
+ }).catch(function() {
1121
+ return null;
1122
+ });
1123
+ return this.textureCache[i] = c, c;
1124
+ }
1125
+ loadImageSource(e, t) {
1126
+ const o = this, s = this.json, r = this.options;
1127
+ if (this.sourceCache[e] !== void 0)
1128
+ return this.sourceCache[e].then((l) => l.clone());
1129
+ const n = s.images[e], a = self.URL || self.webkitURL;
1130
+ let i = n.uri || "", c = !1;
1131
+ if (n.bufferView !== void 0)
1132
+ i = o.getDependency("bufferView", n.bufferView).then(function(l) {
1133
+ c = !0;
1134
+ const f = new Blob([l], { type: n.mimeType });
1135
+ return i = a.createObjectURL(f), i;
1136
+ });
1137
+ else if (n.uri === void 0)
1138
+ throw new Error("THREE.GLTFLoader: Image " + e + " is missing URI and bufferView");
1139
+ const u = Promise.resolve(i).then(function(l) {
1140
+ return new Promise(function(f, m) {
1141
+ let T = f;
1142
+ t.isImageBitmapLoader === !0 && (T = function(R) {
1143
+ const y = new de(R);
1144
+ y.needsUpdate = !0, f(y);
1145
+ }), t.load(X.resolveURL(l, r.path), T, void 0, m);
1146
+ });
1147
+ }).then(function(l) {
1148
+ return c === !0 && a.revokeObjectURL(i), l.userData.mimeType = n.mimeType || tn(n.uri), l;
1149
+ }).catch(function(l) {
1150
+ throw console.error("THREE.GLTFLoader: Couldn't load texture", i), l;
1151
+ });
1152
+ return this.sourceCache[e] = u, u;
1153
+ }
1154
+ /**
1155
+ * Asynchronously assigns a texture to the given material parameters.
1156
+ * @param {Object} materialParams
1157
+ * @param {string} mapName
1158
+ * @param {Object} mapDef
1159
+ * @return {Promise<Texture>}
1160
+ */
1161
+ assignTexture(e, t, o, s) {
1162
+ const r = this;
1163
+ return this.getDependency("texture", o.index).then(function(n) {
1164
+ if (!n) return null;
1165
+ if (o.texCoord !== void 0 && o.texCoord > 0 && (n = n.clone(), n.channel = o.texCoord), r.extensions[b.KHR_TEXTURE_TRANSFORM]) {
1166
+ const a = o.extensions !== void 0 ? o.extensions[b.KHR_TEXTURE_TRANSFORM] : void 0;
1167
+ if (a) {
1168
+ const i = r.associations.get(n);
1169
+ n = r.extensions[b.KHR_TEXTURE_TRANSFORM].extendTexture(n, a), r.associations.set(n, i);
1170
+ }
1171
+ }
1172
+ return s !== void 0 && (n.colorSpace = s), e[t] = n, n;
1173
+ });
1174
+ }
1175
+ /**
1176
+ * Assigns final material to a Mesh, Line, or Points instance. The instance
1177
+ * already has a material (generated from the glTF material options alone)
1178
+ * but reuse of the same glTF material may require multiple threejs materials
1179
+ * to accommodate different primitive types, defines, etc. New materials will
1180
+ * be created if necessary, and reused from a cache.
1181
+ * @param {Object3D} mesh Mesh, Line, or Points instance.
1182
+ */
1183
+ assignFinalMaterial(e) {
1184
+ const t = e.geometry;
1185
+ let o = e.material;
1186
+ const s = t.attributes.tangent === void 0, r = t.attributes.color !== void 0, n = t.attributes.normal === void 0;
1187
+ if (e.isPoints) {
1188
+ const a = "PointsMaterial:" + o.uuid;
1189
+ let i = this.cache.get(a);
1190
+ i || (i = new tt(), Z.prototype.copy.call(i, o), i.color.copy(o.color), i.map = o.map, i.sizeAttenuation = !1, this.cache.add(a, i)), o = i;
1191
+ } else if (e.isLine) {
1192
+ const a = "LineBasicMaterial:" + o.uuid;
1193
+ let i = this.cache.get(a);
1194
+ i || (i = new nt(), Z.prototype.copy.call(i, o), i.color.copy(o.color), i.map = o.map, this.cache.add(a, i)), o = i;
1195
+ }
1196
+ if (s || r || n) {
1197
+ let a = "ClonedMaterial:" + o.uuid + ":";
1198
+ s && (a += "derivative-tangents:"), r && (a += "vertex-colors:"), n && (a += "flat-shading:");
1199
+ let i = this.cache.get(a);
1200
+ i || (i = o.clone(), r && (i.vertexColors = !0), n && (i.flatShading = !0), s && (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;
1201
+ }
1202
+ e.material = o;
1203
+ }
1204
+ getMaterialType() {
1205
+ return Oe;
1206
+ }
1207
+ /**
1208
+ * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
1209
+ * @param {number} materialIndex
1210
+ * @return {Promise<Material>}
1211
+ */
1212
+ loadMaterial(e) {
1213
+ const t = this, o = this.json, s = this.extensions, r = o.materials[e];
1214
+ let n;
1215
+ const a = {}, i = r.extensions || {}, c = [];
1216
+ if (i[b.KHR_MATERIALS_UNLIT]) {
1217
+ const l = s[b.KHR_MATERIALS_UNLIT];
1218
+ n = l.getMaterialType(), c.push(l.extendParams(a, r, t));
1219
+ } else {
1220
+ const l = r.pbrMetallicRoughness || {};
1221
+ if (a.color = new U(1, 1, 1), a.opacity = 1, Array.isArray(l.baseColorFactor)) {
1222
+ const f = l.baseColorFactor;
1223
+ a.color.setRGB(f[0], f[1], f[2], D), a.opacity = f[3];
1224
+ }
1225
+ l.baseColorTexture !== void 0 && c.push(t.assignTexture(a, "map", l.baseColorTexture, N)), a.metalness = l.metallicFactor !== void 0 ? l.metallicFactor : 1, a.roughness = l.roughnessFactor !== void 0 ? l.roughnessFactor : 1, l.metallicRoughnessTexture !== void 0 && (c.push(t.assignTexture(a, "metalnessMap", l.metallicRoughnessTexture)), c.push(t.assignTexture(a, "roughnessMap", l.metallicRoughnessTexture))), n = this._invokeOne(function(f) {
1226
+ return f.getMaterialType && f.getMaterialType(e);
1227
+ }), c.push(Promise.all(this._invokeAll(function(f) {
1228
+ return f.extendMaterialParams && f.extendMaterialParams(e, a);
1229
+ })));
1230
+ }
1231
+ r.doubleSided === !0 && (a.side = st);
1232
+ const u = r.alphaMode || ee.OPAQUE;
1233
+ if (u === ee.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, u === ee.MASK && (a.alphaTest = r.alphaCutoff !== void 0 ? r.alphaCutoff : 0.5)), r.normalTexture !== void 0 && n !== W && (c.push(t.assignTexture(a, "normalMap", r.normalTexture)), a.normalScale = new q(1, 1), r.normalTexture.scale !== void 0)) {
1234
+ const l = r.normalTexture.scale;
1235
+ a.normalScale.set(l, l);
1236
+ }
1237
+ if (r.occlusionTexture !== void 0 && n !== W && (c.push(t.assignTexture(a, "aoMap", r.occlusionTexture)), r.occlusionTexture.strength !== void 0 && (a.aoMapIntensity = r.occlusionTexture.strength)), r.emissiveFactor !== void 0 && n !== W) {
1238
+ const l = r.emissiveFactor;
1239
+ a.emissive = new U().setRGB(l[0], l[1], l[2], D);
1240
+ }
1241
+ return r.emissiveTexture !== void 0 && n !== W && c.push(t.assignTexture(a, "emissiveMap", r.emissiveTexture, N)), Promise.all(c).then(function() {
1242
+ const l = new n(a);
1243
+ return r.name && (l.name = r.name), F(l, r), t.associations.set(l, { materials: e }), r.extensions && G(s, l, r), l;
1244
+ });
1245
+ }
1246
+ /** When Object3D instances are targeted by animation, they need unique names. */
1247
+ createUniqueName(e) {
1248
+ const t = rt.sanitizeNodeName(e || "");
1249
+ return t in this.nodeNamesUsed ? t + "_" + ++this.nodeNamesUsed[t] : (this.nodeNamesUsed[t] = 0, t);
1250
+ }
1251
+ /**
1252
+ * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#geometry
1253
+ *
1254
+ * Creates BufferGeometries from primitives.
1255
+ *
1256
+ * @param {Array<GLTF.Primitive>} primitives
1257
+ * @return {Promise<Array<BufferGeometry>>}
1258
+ */
1259
+ loadGeometries(e) {
1260
+ const t = this, o = this.extensions, s = this.primitiveCache;
1261
+ function r(a) {
1262
+ return o[b.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a, t).then(function(i) {
1263
+ return Se(i, a, t);
1264
+ });
1265
+ }
1266
+ const n = [];
1267
+ for (let a = 0, i = e.length; a < i; a++) {
1268
+ const c = e[a], u = en(c), l = s[u];
1269
+ if (l)
1270
+ n.push(l.promise);
1271
+ else {
1272
+ let f;
1273
+ c.extensions && c.extensions[b.KHR_DRACO_MESH_COMPRESSION] ? f = r(c) : f = Se(new ue(), c, t), s[u] = { primitive: c, promise: f }, n.push(f);
1274
+ }
1275
+ }
1276
+ return Promise.all(n);
1277
+ }
1278
+ /**
1279
+ * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes
1280
+ * @param {number} meshIndex
1281
+ * @return {Promise<Group|Mesh|SkinnedMesh>}
1282
+ */
1283
+ loadMesh(e) {
1284
+ const t = this, o = this.json, s = this.extensions, r = o.meshes[e], n = r.primitives, a = [];
1285
+ for (let i = 0, c = n.length; i < c; i++) {
1286
+ const u = n[i].material === void 0 ? Qt(this.cache) : this.getDependency("material", n[i].material);
1287
+ a.push(u);
1288
+ }
1289
+ return a.push(t.loadGeometries(n)), Promise.all(a).then(function(i) {
1290
+ const c = i.slice(0, i.length - 1), u = i[i.length - 1], l = [];
1291
+ for (let m = 0, T = u.length; m < T; m++) {
1292
+ const R = u[m], y = n[m];
1293
+ let x;
1294
+ const E = c[m];
1295
+ if (y.mode === C.TRIANGLES || y.mode === C.TRIANGLE_STRIP || y.mode === C.TRIANGLE_FAN || y.mode === void 0)
1296
+ x = r.isSkinnedMesh === !0 ? new ot(R, E) : new Pe(R, E), x.isSkinnedMesh === !0 && x.normalizeSkinWeights(), y.mode === C.TRIANGLE_STRIP ? x.geometry = Re(x.geometry, be) : y.mode === C.TRIANGLE_FAN && (x.geometry = Re(x.geometry, re));
1297
+ else if (y.mode === C.LINES)
1298
+ x = new it(R, E);
1299
+ else if (y.mode === C.LINE_STRIP)
1300
+ x = new at(R, E);
1301
+ else if (y.mode === C.LINE_LOOP)
1302
+ x = new ct(R, E);
1303
+ else if (y.mode === C.POINTS)
1304
+ x = new ut(R, E);
1305
+ else
1306
+ throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + y.mode);
1307
+ Object.keys(x.geometry.morphAttributes).length > 0 && $t(x, r), x.name = t.createUniqueName(r.name || "mesh_" + e), F(x, r), y.extensions && G(s, x, y), t.assignFinalMaterial(x), l.push(x);
1308
+ }
1309
+ for (let m = 0, T = l.length; m < T; m++)
1310
+ t.associations.set(l[m], {
1311
+ meshes: e,
1312
+ primitives: m
1313
+ });
1314
+ if (l.length === 1)
1315
+ return r.extensions && G(s, l[0], r), l[0];
1316
+ const f = new z();
1317
+ r.extensions && G(s, f, r), t.associations.set(f, { meshes: e });
1318
+ for (let m = 0, T = l.length; m < T; m++)
1319
+ f.add(l[m]);
1320
+ return f;
1321
+ });
1322
+ }
1323
+ /**
1324
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras
1325
+ * @param {number} cameraIndex
1326
+ * @return {Promise<THREE.Camera>}
1327
+ */
1328
+ loadCamera(e) {
1329
+ let t;
1330
+ const o = this.json.cameras[e], s = o[o.type];
1331
+ if (!s) {
1332
+ console.warn("THREE.GLTFLoader: Missing camera parameters.");
1333
+ return;
1334
+ }
1335
+ return o.type === "perspective" ? t = new lt(ft.radToDeg(s.yfov), s.aspectRatio || 1, s.znear || 1, s.zfar || 2e6) : o.type === "orthographic" && (t = new dt(-s.xmag, s.xmag, s.ymag, -s.ymag, s.znear, s.zfar)), o.name && (t.name = this.createUniqueName(o.name)), F(t, o), Promise.resolve(t);
1336
+ }
1337
+ /**
1338
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
1339
+ * @param {number} skinIndex
1340
+ * @return {Promise<Skeleton>}
1341
+ */
1342
+ loadSkin(e) {
1343
+ const t = this.json.skins[e], o = [];
1344
+ for (let s = 0, r = t.joints.length; s < r; s++)
1345
+ o.push(this._loadNodeShallow(t.joints[s]));
1346
+ return t.inverseBindMatrices !== void 0 ? o.push(this.getDependency("accessor", t.inverseBindMatrices)) : o.push(null), Promise.all(o).then(function(s) {
1347
+ const r = s.pop(), n = s, a = [], i = [];
1348
+ for (let c = 0, u = n.length; c < u; c++) {
1349
+ const l = n[c];
1350
+ if (l) {
1351
+ a.push(l);
1352
+ const f = new Y();
1353
+ r !== null && f.fromArray(r.array, c * 16), i.push(f);
1354
+ } else
1355
+ console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', t.joints[c]);
1356
+ }
1357
+ return new ht(a, i);
1358
+ });
1359
+ }
1360
+ /**
1361
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations
1362
+ * @param {number} animationIndex
1363
+ * @return {Promise<AnimationClip>}
1364
+ */
1365
+ loadAnimation(e) {
1366
+ const t = this.json, o = this, s = t.animations[e], r = s.name ? s.name : "animation_" + e, n = [], a = [], i = [], c = [], u = [];
1367
+ for (let l = 0, f = s.channels.length; l < f; l++) {
1368
+ const m = s.channels[l], T = s.samplers[m.sampler], R = m.target, y = R.node, x = s.parameters !== void 0 ? s.parameters[T.input] : T.input, E = s.parameters !== void 0 ? s.parameters[T.output] : T.output;
1369
+ R.node !== void 0 && (n.push(this.getDependency("node", y)), a.push(this.getDependency("accessor", x)), i.push(this.getDependency("accessor", E)), c.push(T), u.push(R));
1370
+ }
1371
+ return Promise.all([
1372
+ Promise.all(n),
1373
+ Promise.all(a),
1374
+ Promise.all(i),
1375
+ Promise.all(c),
1376
+ Promise.all(u)
1377
+ ]).then(function(l) {
1378
+ const f = l[0], m = l[1], T = l[2], R = l[3], y = l[4], x = [];
1379
+ for (let E = 0, S = f.length; E < S; E++) {
1380
+ const _ = f[E], M = m[E], I = T[E], L = R[E], h = y[E];
1381
+ if (_ === void 0) continue;
1382
+ _.updateMatrix && _.updateMatrix();
1383
+ const p = o._createAnimationTracks(_, M, I, L, h);
1384
+ if (p)
1385
+ for (let g = 0; g < p.length; g++)
1386
+ x.push(p[g]);
1387
+ }
1388
+ return new pt(r, void 0, x);
1389
+ });
1390
+ }
1391
+ createNodeMesh(e) {
1392
+ const t = this.json, o = this, s = t.nodes[e];
1393
+ return s.mesh === void 0 ? null : o.getDependency("mesh", s.mesh).then(function(r) {
1394
+ const n = o._getNodeRef(o.meshCache, s.mesh, r);
1395
+ return s.weights !== void 0 && n.traverse(function(a) {
1396
+ if (a.isMesh)
1397
+ for (let i = 0, c = s.weights.length; i < c; i++)
1398
+ a.morphTargetInfluences[i] = s.weights[i];
1399
+ }), n;
1400
+ });
1401
+ }
1402
+ /**
1403
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#nodes-and-hierarchy
1404
+ * @param {number} nodeIndex
1405
+ * @return {Promise<Object3D>}
1406
+ */
1407
+ loadNode(e) {
1408
+ const t = this.json, o = this, s = t.nodes[e], r = o._loadNodeShallow(e), n = [], a = s.children || [];
1409
+ for (let c = 0, u = a.length; c < u; c++)
1410
+ n.push(o.getDependency("node", a[c]));
1411
+ const i = s.skin === void 0 ? Promise.resolve(null) : o.getDependency("skin", s.skin);
1412
+ return Promise.all([
1413
+ r,
1414
+ Promise.all(n),
1415
+ i
1416
+ ]).then(function(c) {
1417
+ const u = c[0], l = c[1], f = c[2];
1418
+ f !== null && u.traverse(function(m) {
1419
+ m.isSkinnedMesh && m.bind(f, nn);
1420
+ });
1421
+ for (let m = 0, T = l.length; m < T; m++)
1422
+ u.add(l[m]);
1423
+ return u;
1424
+ });
1425
+ }
1426
+ // ._loadNodeShallow() parses a single node.
1427
+ // skin and child nodes are created and added in .loadNode() (no '_' prefix).
1428
+ _loadNodeShallow(e) {
1429
+ const t = this.json, o = this.extensions, s = this;
1430
+ if (this.nodeCache[e] !== void 0)
1431
+ return this.nodeCache[e];
1432
+ const r = t.nodes[e], n = r.name ? s.createUniqueName(r.name) : "", a = [], i = s._invokeOne(function(c) {
1433
+ return c.createNodeMesh && c.createNodeMesh(e);
1434
+ });
1435
+ return i && a.push(i), r.camera !== void 0 && a.push(s.getDependency("camera", r.camera).then(function(c) {
1436
+ return s._getNodeRef(s.cameraCache, r.camera, c);
1437
+ })), s._invokeAll(function(c) {
1438
+ return c.createNodeAttachment && c.createNodeAttachment(e);
1439
+ }).forEach(function(c) {
1440
+ a.push(c);
1441
+ }), this.nodeCache[e] = Promise.all(a).then(function(c) {
1442
+ let u;
1443
+ if (r.isBone === !0 ? u = new mt() : c.length > 1 ? u = new z() : c.length === 1 ? u = c[0] : u = new ce(), u !== c[0])
1444
+ for (let l = 0, f = c.length; l < f; l++)
1445
+ u.add(c[l]);
1446
+ if (r.name && (u.userData.name = r.name, u.name = n), F(u, r), r.extensions && G(o, u, r), r.matrix !== void 0) {
1447
+ const l = new Y();
1448
+ l.fromArray(r.matrix), u.applyMatrix4(l);
1449
+ } else
1450
+ r.translation !== void 0 && u.position.fromArray(r.translation), r.rotation !== void 0 && u.quaternion.fromArray(r.rotation), r.scale !== void 0 && u.scale.fromArray(r.scale);
1451
+ return s.associations.has(u) || s.associations.set(u, {}), s.associations.get(u).nodes = e, u;
1452
+ }), this.nodeCache[e];
1453
+ }
1454
+ /**
1455
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes
1456
+ * @param {number} sceneIndex
1457
+ * @return {Promise<Group>}
1458
+ */
1459
+ loadScene(e) {
1460
+ const t = this.extensions, o = this.json.scenes[e], s = this, r = new z();
1461
+ o.name && (r.name = s.createUniqueName(o.name)), F(r, o), o.extensions && G(t, r, o);
1462
+ const n = o.nodes || [], a = [];
1463
+ for (let i = 0, c = n.length; i < c; i++)
1464
+ a.push(s.getDependency("node", n[i]));
1465
+ return Promise.all(a).then(function(i) {
1466
+ for (let u = 0, l = i.length; u < l; u++)
1467
+ r.add(i[u]);
1468
+ const c = (u) => {
1469
+ const l = /* @__PURE__ */ new Map();
1470
+ for (const [f, m] of s.associations)
1471
+ (f instanceof Z || f instanceof de) && l.set(f, m);
1472
+ return u.traverse((f) => {
1473
+ const m = s.associations.get(f);
1474
+ m != null && l.set(f, m);
1475
+ }), l;
1476
+ };
1477
+ return s.associations = c(r), r;
1478
+ });
1479
+ }
1480
+ _createAnimationTracks(e, t, o, s, r) {
1481
+ const n = [], a = e.name ? e.name : e.uuid, i = [];
1482
+ k[r.path] === k.weights ? e.traverse(function(f) {
1483
+ f.morphTargetInfluences && i.push(f.name ? f.name : f.uuid);
1484
+ }) : i.push(a);
1485
+ let c;
1486
+ switch (k[r.path]) {
1487
+ case k.weights:
1488
+ c = pe;
1489
+ break;
1490
+ case k.rotation:
1491
+ c = me;
1492
+ break;
1493
+ case k.position:
1494
+ case k.scale:
1495
+ c = he;
1496
+ break;
1497
+ default:
1498
+ switch (o.itemSize) {
1499
+ case 1:
1500
+ c = pe;
1501
+ break;
1502
+ case 2:
1503
+ case 3:
1504
+ default:
1505
+ c = he;
1506
+ break;
1507
+ }
1508
+ break;
1509
+ }
1510
+ const u = s.interpolation !== void 0 ? Jt[s.interpolation] : ke, l = this._getArrayFromAccessor(o);
1511
+ for (let f = 0, m = i.length; f < m; f++) {
1512
+ const T = new c(
1513
+ i[f] + "." + k[r.path],
1514
+ t.array,
1515
+ l,
1516
+ u
1517
+ );
1518
+ s.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(T), n.push(T);
1519
+ }
1520
+ return n;
1521
+ }
1522
+ _getArrayFromAccessor(e) {
1523
+ let t = e.array;
1524
+ if (e.normalized) {
1525
+ const o = ie(t.constructor), s = new Float32Array(t.length);
1526
+ for (let r = 0, n = t.length; r < n; r++)
1527
+ s[r] = t[r] * o;
1528
+ t = s;
1529
+ }
1530
+ return t;
1531
+ }
1532
+ _createCubicSplineTrackInterpolant(e) {
1533
+ e.createInterpolant = function(o) {
1534
+ const s = this instanceof me ? Yt : Ue;
1535
+ return new s(this.times, this.values, this.getValueSize() / 3, o);
1536
+ }, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
1537
+ }
1538
+ }
1539
+ function rn(d, e, t) {
1540
+ const o = e.attributes, s = new yt();
1541
+ if (o.POSITION !== void 0) {
1542
+ const a = t.json.accessors[o.POSITION], i = a.min, c = a.max;
1543
+ if (i !== void 0 && c !== void 0) {
1544
+ if (s.set(
1545
+ new B(i[0], i[1], i[2]),
1546
+ new B(c[0], c[1], c[2])
1547
+ ), a.normalized) {
1548
+ const u = ie(j[a.componentType]);
1549
+ s.min.multiplyScalar(u), s.max.multiplyScalar(u);
1550
+ }
1551
+ } else {
1552
+ console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
1553
+ return;
1554
+ }
1555
+ } else
1556
+ return;
1557
+ const r = e.targets;
1558
+ if (r !== void 0) {
1559
+ const a = new B(), i = new B();
1560
+ for (let c = 0, u = r.length; c < u; c++) {
1561
+ const l = r[c];
1562
+ if (l.POSITION !== void 0) {
1563
+ const f = t.json.accessors[l.POSITION], m = f.min, T = f.max;
1564
+ if (m !== void 0 && T !== void 0) {
1565
+ if (i.setX(Math.max(Math.abs(m[0]), Math.abs(T[0]))), i.setY(Math.max(Math.abs(m[1]), Math.abs(T[1]))), i.setZ(Math.max(Math.abs(m[2]), Math.abs(T[2]))), f.normalized) {
1566
+ const R = ie(j[f.componentType]);
1567
+ i.multiplyScalar(R);
1568
+ }
1569
+ a.max(i);
1570
+ } else
1571
+ console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
1572
+ }
1573
+ }
1574
+ s.expandByVector(a);
1575
+ }
1576
+ d.boundingBox = s;
1577
+ const n = new xt();
1578
+ s.getCenter(n.center), n.radius = s.min.distanceTo(s.max) / 2, d.boundingSphere = n;
1579
+ }
1580
+ function Se(d, e, t) {
1581
+ const o = e.attributes, s = [];
1582
+ function r(n, a) {
1583
+ return t.getDependency("accessor", n).then(function(i) {
1584
+ d.setAttribute(a, i);
1585
+ });
1586
+ }
1587
+ for (const n in o) {
1588
+ const a = oe[n] || n.toLowerCase();
1589
+ a in d.attributes || s.push(r(o[n], a));
1590
+ }
1591
+ if (e.indices !== void 0 && !d.index) {
1592
+ const n = t.getDependency("accessor", e.indices).then(function(a) {
1593
+ d.setIndex(a);
1594
+ });
1595
+ s.push(n);
1596
+ }
1597
+ return ge.workingColorSpace !== D && "COLOR_0" in o && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${ge.workingColorSpace}" not supported.`), F(d, e), rn(d, e, t), Promise.all(s).then(function() {
1598
+ return e.targets !== void 0 ? Zt(d, e.targets, t) : d;
1599
+ });
1600
+ }
1601
+ class on {
1602
+ parse(e) {
1603
+ const t = {}, o = e.split(`
1604
+ `);
1605
+ let s = null, r = t;
1606
+ const n = [t];
1607
+ for (const a of o)
1608
+ if (a.includes("=")) {
1609
+ const i = a.split("="), c = i[0].trim(), u = i[1].trim();
1610
+ if (u.endsWith("{")) {
1611
+ const l = {};
1612
+ n.push(l), r[c] = l, r = l;
1613
+ } else
1614
+ r[c] = u;
1615
+ } else if (a.endsWith("{")) {
1616
+ const i = r[s] || {};
1617
+ n.push(i), r[s] = i, r = i;
1618
+ } else if (a.endsWith("}")) {
1619
+ if (n.pop(), n.length === 0) continue;
1620
+ r = n[n.length - 1];
1621
+ } else if (a.endsWith("(")) {
1622
+ const i = {};
1623
+ n.push(i), s = a.split("(")[0].trim() || s, r[s] = i, r = i;
1624
+ } else a.endsWith(")") ? (n.pop(), r = n[n.length - 1]) : s = a.trim();
1625
+ return t;
1626
+ }
1627
+ }
1628
+ class an extends ae {
1629
+ constructor(e) {
1630
+ super(e);
1631
+ }
1632
+ load(e, t, o, s) {
1633
+ const r = this, n = new K(r.manager);
1634
+ n.setPath(r.path), n.setResponseType("arraybuffer"), n.setRequestHeader(r.requestHeader), n.setWithCredentials(r.withCredentials), n.load(e, function(a) {
1635
+ try {
1636
+ t(r.parse(a));
1637
+ } catch (i) {
1638
+ s ? s(i) : console.error(i), r.manager.itemError(e);
1639
+ }
1640
+ }, o, s);
1641
+ }
1642
+ parse(e) {
1643
+ const t = new on();
1644
+ function o(h) {
1645
+ const p = {};
1646
+ new K().setResponseType("arraybuffer");
1647
+ for (const A in h) {
1648
+ if (A.endsWith("png")) {
1649
+ const w = new Blob([h[A]], { type: { type: "image/png" } });
1650
+ p[A] = URL.createObjectURL(w);
1651
+ }
1652
+ if (A.endsWith("usd") || A.endsWith("usda")) {
1653
+ if (s(h[A])) {
1654
+ console.warn("THREE.USDZLoader: Crate files (.usdc or binary .usd) are not supported.");
1655
+ continue;
1656
+ }
1657
+ const w = Ae(h[A]);
1658
+ p[A] = t.parse(w);
1659
+ }
1660
+ }
1661
+ return p;
1662
+ }
1663
+ function s(h) {
1664
+ const p = h.slice(0, 7), g = new Uint8Array([80, 88, 82, 45, 85, 83, 68, 67]);
1665
+ return p.every((A, w) => A === g[w]);
1666
+ }
1667
+ function r(h) {
1668
+ if (h.length < 1) return;
1669
+ const p = Object.keys(h)[0];
1670
+ let g = !1;
1671
+ if (p.endsWith("usda")) return h[p];
1672
+ if (p.endsWith("usdc"))
1673
+ g = !0;
1674
+ else if (p.endsWith("usd"))
1675
+ if (s(h[p]))
1676
+ g = !0;
1677
+ else
1678
+ return h[p];
1679
+ g && console.warn("THREE.USDZLoader: Crate files (.usdc or binary .usd) are not supported.");
1680
+ }
1681
+ const n = Rt(new Uint8Array(e)), a = o(n), i = r(n);
1682
+ if (i === void 0)
1683
+ return console.warn("THREE.USDZLoader: No usda file found."), new z();
1684
+ const c = Ae(i), u = t.parse(c);
1685
+ function l(h) {
1686
+ if (h) {
1687
+ if ("prepend references" in h) {
1688
+ const g = h["prepend references"].split("@"), A = g[1].replace(/^.\//, ""), w = g[2].replace(/^<\//, "").replace(/>$/, "");
1689
+ return f(a[A], w);
1690
+ }
1691
+ return f(h);
1692
+ }
1693
+ }
1694
+ function f(h, p) {
1695
+ if (h) {
1696
+ if (p !== void 0) {
1697
+ const g = `def Mesh "${p}"`;
1698
+ if (g in h)
1699
+ return h[g];
1700
+ }
1701
+ for (const g in h) {
1702
+ const A = h[g];
1703
+ if (g.startsWith("def Mesh"))
1704
+ 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;
1705
+ if (typeof A == "object") {
1706
+ const w = f(A);
1707
+ if (w) return w;
1708
+ }
1709
+ }
1710
+ }
1711
+ }
1712
+ function m(h) {
1713
+ if (!h) return;
1714
+ let p = new ue();
1715
+ if ("int[] faceVertexIndices" in h) {
1716
+ const g = JSON.parse(h["int[] faceVertexIndices"]);
1717
+ p.setIndex(g);
1718
+ }
1719
+ if ("point3f[] points" in h) {
1720
+ const g = JSON.parse(h["point3f[] points"].replace(/[()]*/g, "")), A = new P(new Float32Array(g), 3);
1721
+ p.setAttribute("position", A);
1722
+ }
1723
+ if ("normal3f[] normals" in h) {
1724
+ const g = JSON.parse(h["normal3f[] normals"].replace(/[()]*/g, "")), A = new P(new Float32Array(g), 3);
1725
+ p.setAttribute("normal", A);
1726
+ } else
1727
+ p.computeVertexNormals();
1728
+ if ("float2[] primvars:st" in h && (h["texCoord2f[] primvars:st"] = h["float2[] primvars:st"]), "texCoord2f[] primvars:st" in h) {
1729
+ const g = JSON.parse(h["texCoord2f[] primvars:st"].replace(/[()]*/g, "")), A = new P(new Float32Array(g), 2);
1730
+ if ("int[] primvars:st:indices" in h) {
1731
+ p = p.toNonIndexed();
1732
+ const w = JSON.parse(h["int[] primvars:st:indices"]);
1733
+ p.setAttribute("uv", T(A, w));
1734
+ } else
1735
+ p.setAttribute("uv", A);
1736
+ }
1737
+ return p;
1738
+ }
1739
+ function T(h, p) {
1740
+ const g = h.array, A = h.itemSize, w = new g.constructor(p.length * A);
1741
+ let le = 0, He = 0;
1742
+ for (let Q = 0, Ge = p.length; Q < Ge; Q++) {
1743
+ le = p[Q] * A;
1744
+ for (let fe = 0; fe < A; fe++)
1745
+ w[He++] = g[le++];
1746
+ }
1747
+ return new P(w, A);
1748
+ }
1749
+ function R(h) {
1750
+ if (h) {
1751
+ if ("rel material:binding" in h) {
1752
+ const A = h["rel material:binding"].replace(/^<\//, "").replace(/>$/, "").split("/");
1753
+ return y(u, ` "${A[1]}"`);
1754
+ }
1755
+ return y(h);
1756
+ }
1757
+ }
1758
+ function y(h, p = "") {
1759
+ for (const g in h) {
1760
+ const A = h[g];
1761
+ if (g.startsWith("def Material" + p))
1762
+ return A;
1763
+ if (typeof A == "object") {
1764
+ const w = y(A, p);
1765
+ if (w) return w;
1766
+ }
1767
+ }
1768
+ }
1769
+ function x(h, p) {
1770
+ p["float inputs:rotation"] && (h.rotation = parseFloat(p["float inputs:rotation"])), p["float2 inputs:scale"] && (h.repeat = new q().fromArray(JSON.parse("[" + p["float2 inputs:scale"].replace(/[()]*/g, "") + "]"))), p["float2 inputs:translation"] && (h.offset = new q().fromArray(JSON.parse("[" + p["float2 inputs:translation"].replace(/[()]*/g, "") + "]")));
1771
+ }
1772
+ function E(h) {
1773
+ const p = new O();
1774
+ if (h !== void 0) {
1775
+ if ('def Shader "PreviewSurface"' in h) {
1776
+ const g = h['def Shader "PreviewSurface"'];
1777
+ if ("color3f inputs:diffuseColor.connect" in g) {
1778
+ const A = g["color3f inputs:diffuseColor.connect"], w = S(u, /(\w+).output/.exec(A)[1]);
1779
+ p.map = _(w), p.map.colorSpace = N, 'def Shader "Transform2d_diffuse"' in h && x(p.map, h['def Shader "Transform2d_diffuse"']);
1780
+ } else if ("color3f inputs:diffuseColor" in g) {
1781
+ const A = g["color3f inputs:diffuseColor"].replace(/[()]*/g, "");
1782
+ p.color.fromArray(JSON.parse("[" + A + "]"));
1783
+ }
1784
+ if ("color3f inputs:emissiveColor.connect" in g) {
1785
+ const A = g["color3f inputs:emissiveColor.connect"], w = S(u, /(\w+).output/.exec(A)[1]);
1786
+ p.emissiveMap = _(w), p.emissiveMap.colorSpace = N, p.emissive.set(16777215), 'def Shader "Transform2d_emissive"' in h && x(p.emissiveMap, h['def Shader "Transform2d_emissive"']);
1787
+ } else if ("color3f inputs:emissiveColor" in g) {
1788
+ const A = g["color3f inputs:emissiveColor"].replace(/[()]*/g, "");
1789
+ p.emissive.fromArray(JSON.parse("[" + A + "]"));
1790
+ }
1791
+ if ("normal3f inputs:normal.connect" in g) {
1792
+ const A = g["normal3f inputs:normal.connect"], w = S(u, /(\w+).output/.exec(A)[1]);
1793
+ p.normalMap = _(w), p.normalMap.colorSpace = H, 'def Shader "Transform2d_normal"' in h && x(p.normalMap, h['def Shader "Transform2d_normal"']);
1794
+ }
1795
+ if ("float inputs:roughness.connect" in g) {
1796
+ const A = g["float inputs:roughness.connect"], w = S(u, /(\w+).output/.exec(A)[1]);
1797
+ p.roughness = 1, p.roughnessMap = _(w), p.roughnessMap.colorSpace = H, 'def Shader "Transform2d_roughness"' in h && x(p.roughnessMap, h['def Shader "Transform2d_roughness"']);
1798
+ } else "float inputs:roughness" in g && (p.roughness = parseFloat(g["float inputs:roughness"]));
1799
+ if ("float inputs:metallic.connect" in g) {
1800
+ const A = g["float inputs:metallic.connect"], w = S(u, /(\w+).output/.exec(A)[1]);
1801
+ p.metalness = 1, p.metalnessMap = _(w), p.metalnessMap.colorSpace = H, 'def Shader "Transform2d_metallic"' in h && x(p.metalnessMap, h['def Shader "Transform2d_metallic"']);
1802
+ } else "float inputs:metallic" in g && (p.metalness = parseFloat(g["float inputs:metallic"]));
1803
+ if ("float inputs:clearcoat.connect" in g) {
1804
+ const A = g["float inputs:clearcoat.connect"], w = S(u, /(\w+).output/.exec(A)[1]);
1805
+ p.clearcoat = 1, p.clearcoatMap = _(w), p.clearcoatMap.colorSpace = H, 'def Shader "Transform2d_clearcoat"' in h && x(p.clearcoatMap, h['def Shader "Transform2d_clearcoat"']);
1806
+ } else "float inputs:clearcoat" in g && (p.clearcoat = parseFloat(g["float inputs:clearcoat"]));
1807
+ if ("float inputs:clearcoatRoughness.connect" in g) {
1808
+ const A = g["float inputs:clearcoatRoughness.connect"], w = S(u, /(\w+).output/.exec(A)[1]);
1809
+ p.clearcoatRoughness = 1, p.clearcoatRoughnessMap = _(w), p.clearcoatRoughnessMap.colorSpace = H, 'def Shader "Transform2d_clearcoatRoughness"' in h && x(p.clearcoatRoughnessMap, h['def Shader "Transform2d_clearcoatRoughness"']);
1810
+ } else "float inputs:clearcoatRoughness" in g && (p.clearcoatRoughness = parseFloat(g["float inputs:clearcoatRoughness"]));
1811
+ if ("float inputs:ior" in g && (p.ior = parseFloat(g["float inputs:ior"])), "float inputs:occlusion.connect" in g) {
1812
+ const A = g["float inputs:occlusion.connect"], w = S(u, /(\w+).output/.exec(A)[1]);
1813
+ p.aoMap = _(w), p.aoMap.colorSpace = H, 'def Shader "Transform2d_occlusion"' in h && x(p.aoMap, h['def Shader "Transform2d_occlusion"']);
1814
+ }
1815
+ }
1816
+ if ('def Shader "diffuseColor_texture"' in h) {
1817
+ const g = h['def Shader "diffuseColor_texture"'];
1818
+ p.map = _(g), p.map.colorSpace = N;
1819
+ }
1820
+ if ('def Shader "normal_texture"' in h) {
1821
+ const g = h['def Shader "normal_texture"'];
1822
+ p.normalMap = _(g), p.normalMap.colorSpace = H;
1823
+ }
1824
+ }
1825
+ return p;
1826
+ }
1827
+ function S(h, p) {
1828
+ for (const g in h) {
1829
+ const A = h[g];
1830
+ if (g.startsWith(`def Shader "${p}"`))
1831
+ return A;
1832
+ if (typeof A == "object") {
1833
+ const w = S(A, p);
1834
+ if (w) return w;
1835
+ }
1836
+ }
1837
+ }
1838
+ function _(h) {
1839
+ if ("asset inputs:file" in h) {
1840
+ const p = h["asset inputs:file"].replace(/@*/g, ""), A = new Me().load(a[p]), w = {
1841
+ '"clamp"': De,
1842
+ '"mirror"': Ne,
1843
+ '"repeat"': J
1844
+ };
1845
+ return "token inputs:wrapS" in h && (A.wrapS = w[h["token inputs:wrapS"]]), "token inputs:wrapT" in h && (A.wrapT = w[h["token inputs:wrapT"]]), A;
1846
+ }
1847
+ return null;
1848
+ }
1849
+ function M(h) {
1850
+ const p = m(l(h)), g = E(R(h)), A = p ? new Pe(p, g) : new ce();
1851
+ if ("matrix4d xformOp:transform" in h) {
1852
+ const w = JSON.parse("[" + h["matrix4d xformOp:transform"].replace(/[()]*/g, "") + "]");
1853
+ A.matrix.fromArray(w), A.matrix.decompose(A.position, A.quaternion, A.scale);
1854
+ }
1855
+ return A;
1856
+ }
1857
+ function I(h, p) {
1858
+ for (const g in h)
1859
+ if (g.startsWith("def Scope"))
1860
+ I(h[g], p);
1861
+ else if (g.startsWith("def Xform")) {
1862
+ const A = M(h[g]);
1863
+ /def Xform "(\w+)"/.test(g) && (A.name = /def Xform "(\w+)"/.exec(g)[1]), p.add(A), I(h[g], A);
1864
+ }
1865
+ }
1866
+ const L = new z();
1867
+ return I(u, L), L;
1868
+ }
1869
+ }
1870
+ const ne = /* @__PURE__ */ new WeakMap();
1871
+ class cn extends ae {
1872
+ constructor(e) {
1873
+ super(e), this.decoderPath = "", this.decoderConfig = {}, this.decoderBinary = null, this.decoderPending = null, this.workerLimit = 4, this.workerPool = [], this.workerNextTaskID = 1, this.workerSourceURL = "", this.defaultAttributeIDs = {
1874
+ position: "POSITION",
1875
+ normal: "NORMAL",
1876
+ color: "COLOR",
1877
+ uv: "TEX_COORD"
1878
+ }, this.defaultAttributeTypes = {
1879
+ position: "Float32Array",
1880
+ normal: "Float32Array",
1881
+ color: "Float32Array",
1882
+ uv: "Float32Array"
1883
+ };
1884
+ }
1885
+ setDecoderPath(e) {
1886
+ return this.decoderPath = e, this;
1887
+ }
1888
+ setDecoderConfig(e) {
1889
+ return this.decoderConfig = e, this;
1890
+ }
1891
+ setWorkerLimit(e) {
1892
+ return this.workerLimit = e, this;
1893
+ }
1894
+ load(e, t, o, s) {
1895
+ const r = new K(this.manager);
1896
+ r.setPath(this.path), r.setResponseType("arraybuffer"), r.setRequestHeader(this.requestHeader), r.setWithCredentials(this.withCredentials), r.load(e, (n) => {
1897
+ this.parse(n, t, s);
1898
+ }, o, s);
1899
+ }
1900
+ parse(e, t, o = () => {
1901
+ }) {
1902
+ this.decodeDracoFile(e, t, null, null, N).catch(o);
1903
+ }
1904
+ decodeDracoFile(e, t, o, s, r = D, n = () => {
1905
+ }) {
1906
+ const a = {
1907
+ attributeIDs: o || this.defaultAttributeIDs,
1908
+ attributeTypes: s || this.defaultAttributeTypes,
1909
+ useUniqueIDs: !!o,
1910
+ vertexColorSpace: r
1911
+ };
1912
+ return this.decodeGeometry(e, a).then(t).catch(n);
1913
+ }
1914
+ decodeGeometry(e, t) {
1915
+ const o = JSON.stringify(t);
1916
+ if (ne.has(e)) {
1917
+ const i = ne.get(e);
1918
+ if (i.key === o)
1919
+ return i.promise;
1920
+ if (e.byteLength === 0)
1921
+ throw new Error(
1922
+ "THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred."
1923
+ );
1924
+ }
1925
+ let s;
1926
+ const r = this.workerNextTaskID++, n = e.byteLength, a = this._getWorker(r, n).then((i) => (s = i, new Promise((c, u) => {
1927
+ s._callbacks[r] = { resolve: c, reject: u }, s.postMessage({ type: "decode", id: r, taskConfig: t, buffer: e }, [e]);
1928
+ }))).then((i) => this._createGeometry(i.geometry));
1929
+ return a.catch(() => !0).then(() => {
1930
+ s && r && this._releaseTask(s, r);
1931
+ }), ne.set(e, {
1932
+ key: o,
1933
+ promise: a
1934
+ }), a;
1935
+ }
1936
+ _createGeometry(e) {
1937
+ const t = new ue();
1938
+ e.index && t.setIndex(new P(e.index.array, 1));
1939
+ for (let o = 0; o < e.attributes.length; o++) {
1940
+ const s = e.attributes[o], r = s.name, n = s.array, a = s.itemSize, i = new P(n, a);
1941
+ r === "color" && (this._assignVertexColorSpace(i, s.vertexColorSpace), i.normalized = !(n instanceof Float32Array)), t.setAttribute(r, i);
1942
+ }
1943
+ return t;
1944
+ }
1945
+ _assignVertexColorSpace(e, t) {
1946
+ if (t !== N) return;
1947
+ const o = new U();
1948
+ for (let s = 0, r = e.count; s < r; s++)
1949
+ o.fromBufferAttribute(e, s).convertSRGBToLinear(), e.setXYZ(s, o.r, o.g, o.b);
1950
+ }
1951
+ _loadLibrary(e, t) {
1952
+ const o = new K(this.manager);
1953
+ return o.setPath(this.decoderPath), o.setResponseType(t), o.setWithCredentials(this.withCredentials), new Promise((s, r) => {
1954
+ o.load(e, s, void 0, r);
1955
+ });
1956
+ }
1957
+ preload() {
1958
+ return this._initDecoder(), this;
1959
+ }
1960
+ _initDecoder() {
1961
+ if (this.decoderPending) return this.decoderPending;
1962
+ const e = typeof WebAssembly != "object" || this.decoderConfig.type === "js", t = [];
1963
+ return e ? t.push(this._loadLibrary("draco_decoder.js", "text")) : (t.push(this._loadLibrary("draco_wasm_wrapper.js", "text")), t.push(this._loadLibrary("draco_decoder.wasm", "arraybuffer"))), this.decoderPending = Promise.all(t).then((o) => {
1964
+ const s = o[0];
1965
+ e || (this.decoderConfig.wasmBinary = o[1]);
1966
+ const r = un.toString(), n = [
1967
+ "/* draco decoder */",
1968
+ s,
1969
+ "",
1970
+ "/* worker */",
1971
+ r.substring(r.indexOf("{") + 1, r.lastIndexOf("}"))
1972
+ ].join(`
1973
+ `);
1974
+ this.workerSourceURL = URL.createObjectURL(new Blob([n]));
1975
+ }), this.decoderPending;
1976
+ }
1977
+ _getWorker(e, t) {
1978
+ return this._initDecoder().then(() => {
1979
+ if (this.workerPool.length < this.workerLimit) {
1980
+ const s = new Worker(this.workerSourceURL);
1981
+ s._callbacks = {}, s._taskCosts = {}, s._taskLoad = 0, s.postMessage({ type: "init", decoderConfig: this.decoderConfig }), s.onmessage = function(r) {
1982
+ const n = r.data;
1983
+ switch (n.type) {
1984
+ case "decode":
1985
+ s._callbacks[n.id].resolve(n);
1986
+ break;
1987
+ case "error":
1988
+ s._callbacks[n.id].reject(n);
1989
+ break;
1990
+ default:
1991
+ console.error('THREE.DRACOLoader: Unexpected message, "' + n.type + '"');
1992
+ }
1993
+ }, this.workerPool.push(s);
1994
+ } else
1995
+ this.workerPool.sort(function(s, r) {
1996
+ return s._taskLoad > r._taskLoad ? -1 : 1;
1997
+ });
1998
+ const o = this.workerPool[this.workerPool.length - 1];
1999
+ return o._taskCosts[e] = t, o._taskLoad += t, o;
2000
+ });
2001
+ }
2002
+ _releaseTask(e, t) {
2003
+ e._taskLoad -= e._taskCosts[t], delete e._callbacks[t], delete e._taskCosts[t];
2004
+ }
2005
+ debug() {
2006
+ console.log("Task load: ", this.workerPool.map((e) => e._taskLoad));
2007
+ }
2008
+ dispose() {
2009
+ for (let e = 0; e < this.workerPool.length; ++e)
2010
+ this.workerPool[e].terminate();
2011
+ return this.workerPool.length = 0, this.workerSourceURL !== "" && URL.revokeObjectURL(this.workerSourceURL), this;
2012
+ }
2013
+ }
2014
+ function un() {
2015
+ let d, e;
2016
+ onmessage = function(n) {
2017
+ const a = n.data;
2018
+ switch (a.type) {
2019
+ case "init":
2020
+ d = a.decoderConfig, e = new Promise(function(u) {
2021
+ d.onModuleLoaded = function(l) {
2022
+ u({ draco: l });
2023
+ }, DracoDecoderModule(d);
2024
+ });
2025
+ break;
2026
+ case "decode":
2027
+ const i = a.buffer, c = a.taskConfig;
2028
+ e.then((u) => {
2029
+ const l = u.draco, f = new l.Decoder();
2030
+ try {
2031
+ const m = t(l, f, new Int8Array(i), c), T = m.attributes.map((R) => R.array.buffer);
2032
+ m.index && T.push(m.index.array.buffer), self.postMessage({ type: "decode", id: a.id, geometry: m }, T);
2033
+ } catch (m) {
2034
+ console.error(m), self.postMessage({ type: "error", id: a.id, error: m.message });
2035
+ } finally {
2036
+ l.destroy(f);
2037
+ }
2038
+ });
2039
+ break;
2040
+ }
2041
+ };
2042
+ function t(n, a, i, c) {
2043
+ const u = c.attributeIDs, l = c.attributeTypes;
2044
+ let f, m;
2045
+ const T = a.GetEncodedGeometryType(i);
2046
+ if (T === n.TRIANGULAR_MESH)
2047
+ f = new n.Mesh(), m = a.DecodeArrayToMesh(i, i.byteLength, f);
2048
+ else if (T === n.POINT_CLOUD)
2049
+ f = new n.PointCloud(), m = a.DecodeArrayToPointCloud(i, i.byteLength, f);
2050
+ else
2051
+ throw new Error("THREE.DRACOLoader: Unexpected geometry type.");
2052
+ if (!m.ok() || f.ptr === 0)
2053
+ throw new Error("THREE.DRACOLoader: Decoding failed: " + m.error_msg());
2054
+ const R = { index: null, attributes: [] };
2055
+ for (const y in u) {
2056
+ const x = self[l[y]];
2057
+ let E, S;
2058
+ if (c.useUniqueIDs)
2059
+ S = u[y], E = a.GetAttributeByUniqueId(f, S);
2060
+ else {
2061
+ if (S = a.GetAttributeId(f, n[u[y]]), S === -1) continue;
2062
+ E = a.GetAttribute(f, S);
2063
+ }
2064
+ const _ = s(n, a, f, y, x, E);
2065
+ y === "color" && (_.vertexColorSpace = c.vertexColorSpace), R.attributes.push(_);
2066
+ }
2067
+ return T === n.TRIANGULAR_MESH && (R.index = o(n, a, f)), n.destroy(f), R;
2068
+ }
2069
+ function o(n, a, i) {
2070
+ const u = i.num_faces() * 3, l = u * 4, f = n._malloc(l);
2071
+ a.GetTrianglesUInt32Array(i, l, f);
2072
+ const m = new Uint32Array(n.HEAPF32.buffer, f, u).slice();
2073
+ return n._free(f), { array: m, itemSize: 1 };
2074
+ }
2075
+ function s(n, a, i, c, u, l) {
2076
+ const f = l.num_components(), T = i.num_points() * f, R = T * u.BYTES_PER_ELEMENT, y = r(n, u), x = n._malloc(R);
2077
+ a.GetAttributeDataArrayForAllPoints(i, l, y, R, x);
2078
+ const E = new u(n.HEAPF32.buffer, x, T).slice();
2079
+ return n._free(x), {
2080
+ name: c,
2081
+ array: E,
2082
+ itemSize: f
2083
+ };
2084
+ }
2085
+ function r(n, a) {
2086
+ switch (a) {
2087
+ case Float32Array:
2088
+ return n.DT_FLOAT32;
2089
+ case Int8Array:
2090
+ return n.DT_INT8;
2091
+ case Int16Array:
2092
+ return n.DT_INT16;
2093
+ case Int32Array:
2094
+ return n.DT_INT32;
2095
+ case Uint8Array:
2096
+ return n.DT_UINT8;
2097
+ case Uint16Array:
2098
+ return n.DT_UINT16;
2099
+ case Uint32Array:
2100
+ return n.DT_UINT32;
2101
+ }
2102
+ }
2103
+ }
2104
+ function ln() {
2105
+ let d, e;
2106
+ onmessage = function(n) {
2107
+ const a = n.data;
2108
+ switch (a.type) {
2109
+ case "init":
2110
+ d = a.decoderConfig, e = new Promise(function(u) {
2111
+ d.onModuleLoaded = function(l) {
2112
+ u({ draco: l });
2113
+ }, DracoDecoderModule(d);
2114
+ });
2115
+ break;
2116
+ case "decode":
2117
+ const i = a.buffer, c = a.taskConfig;
2118
+ e.then((u) => {
2119
+ const l = u.draco, f = new l.Decoder();
2120
+ try {
2121
+ const m = t(
2122
+ l,
2123
+ f,
2124
+ new Int8Array(i),
2125
+ c
2126
+ ), T = m.attributes.map(
2127
+ (R) => R.array.buffer
2128
+ );
2129
+ m.index && T.push(m.index.array.buffer), self.postMessage(
2130
+ { type: "decode", id: a.id, geometry: m },
2131
+ T
2132
+ );
2133
+ } catch (m) {
2134
+ console.error(m), self.postMessage({
2135
+ type: "error",
2136
+ id: a.id,
2137
+ error: m.message
2138
+ });
2139
+ } finally {
2140
+ l.destroy(f);
2141
+ }
2142
+ });
2143
+ break;
2144
+ }
2145
+ };
2146
+ function t(n, a, i, c) {
2147
+ const u = c.attributeIDs, l = c.attributeTypes;
2148
+ let f, m;
2149
+ const T = a.GetEncodedGeometryType(i);
2150
+ if (T === n.TRIANGULAR_MESH)
2151
+ f = new n.Mesh(), m = a.DecodeArrayToMesh(
2152
+ i,
2153
+ i.byteLength,
2154
+ f
2155
+ );
2156
+ else if (T === n.POINT_CLOUD)
2157
+ f = new n.PointCloud(), m = a.DecodeArrayToPointCloud(
2158
+ i,
2159
+ i.byteLength,
2160
+ f
2161
+ );
2162
+ else
2163
+ throw new Error("THREE.DRACOLoader: Unexpected geometry type.");
2164
+ if (!m.ok() || f.ptr === 0)
2165
+ throw new Error(
2166
+ "THREE.DRACOLoader: Decoding failed: " + m.error_msg()
2167
+ );
2168
+ const R = { index: null, attributes: [] };
2169
+ for (const y in u) {
2170
+ const x = self[l[y]];
2171
+ let E, S;
2172
+ if (c.useUniqueIDs)
2173
+ S = u[y], E = a.GetAttributeByUniqueId(
2174
+ f,
2175
+ S
2176
+ );
2177
+ else {
2178
+ if (S = a.GetAttributeId(
2179
+ f,
2180
+ n[u[y]]
2181
+ ), S === -1) continue;
2182
+ E = a.GetAttribute(f, S);
2183
+ }
2184
+ const _ = s(
2185
+ n,
2186
+ a,
2187
+ f,
2188
+ y,
2189
+ x,
2190
+ E
2191
+ );
2192
+ y === "color" && (_.vertexColorSpace = c.vertexColorSpace), R.attributes.push(_);
2193
+ }
2194
+ return T === n.TRIANGULAR_MESH && (R.index = o(n, a, f)), n.destroy(f), R;
2195
+ }
2196
+ function o(n, a, i) {
2197
+ const u = i.num_faces() * 3, l = u * 4, f = n._malloc(l);
2198
+ a.GetTrianglesUInt32Array(i, l, f);
2199
+ const m = new Uint32Array(
2200
+ n.HEAPF32.buffer,
2201
+ f,
2202
+ u
2203
+ ).slice();
2204
+ return n._free(f), { array: m, itemSize: 1 };
2205
+ }
2206
+ function s(n, a, i, c, u, l) {
2207
+ const f = l.num_components(), T = i.num_points() * f, R = T * u.BYTES_PER_ELEMENT, y = r(n, u), x = n._malloc(R);
2208
+ a.GetAttributeDataArrayForAllPoints(
2209
+ i,
2210
+ l,
2211
+ y,
2212
+ R,
2213
+ x
2214
+ );
2215
+ const E = new u(
2216
+ n.HEAPF32.buffer,
2217
+ x,
2218
+ T
2219
+ ).slice();
2220
+ return n._free(x), {
2221
+ name: c,
2222
+ array: E,
2223
+ itemSize: f
2224
+ };
2225
+ }
2226
+ function r(n, a) {
2227
+ switch (a) {
2228
+ case Float32Array:
2229
+ return n.DT_FLOAT32;
2230
+ case Int8Array:
2231
+ return n.DT_INT8;
2232
+ case Int16Array:
2233
+ return n.DT_INT16;
2234
+ case Int32Array:
2235
+ return n.DT_INT32;
2236
+ case Uint8Array:
2237
+ return n.DT_UINT8;
2238
+ case Uint16Array:
2239
+ return n.DT_UINT16;
2240
+ case Uint32Array:
2241
+ return n.DT_UINT32;
2242
+ }
2243
+ }
2244
+ }
2245
+ const se = {
2246
+ LOAD_DRACO_JS_DECODER: async () => (await import("./draco_decoder-CEzwqP9o.mjs")).default,
2247
+ LOAD_DRACO_WASM_WRAPPER: async () => (await import("./draco_wasm_wrapper-yQy2VLhb.mjs")).default,
2248
+ LOAD_DRACO_WASM_DECODER: async () => {
2249
+ const d = (await import("./draco_decoder-DtHHc5d0.mjs")).default;
2250
+ return await (await fetch(d)).arrayBuffer();
2251
+ }
2252
+ };
2253
+ class fn extends cn {
2254
+ constructor() {
2255
+ super(...arguments);
2256
+ v(this, "decoderPending", null);
2257
+ v(this, "decoderConfig", {
2258
+ type: "js",
2259
+ wasmBinary: null
2260
+ });
2261
+ v(this, "workerSourceURL", "");
2262
+ }
2263
+ async _initDecoder() {
2264
+ if (this.decoderPending) return this.decoderPending;
2265
+ const t = typeof WebAssembly != "object" || this.decoderConfig.type === "js", o = [];
2266
+ return t ? o.push(
2267
+ se.LOAD_DRACO_JS_DECODER()
2268
+ ) : (o.push(
2269
+ se.LOAD_DRACO_WASM_WRAPPER()
2270
+ ), o.push(
2271
+ se.LOAD_DRACO_WASM_DECODER()
2272
+ )), this.decoderPending = Promise.all(o).then(
2273
+ (s) => {
2274
+ const r = s[0];
2275
+ t || (this.decoderConfig.wasmBinary = s[1]);
2276
+ const n = ln.toString(), a = [
2277
+ "/* draco decoder */",
2278
+ r,
2279
+ "",
2280
+ "/* worker */",
2281
+ n.substring(n.indexOf("{") + 1, n.lastIndexOf("}"))
2282
+ ].join(`
2283
+ `);
2284
+ this.workerSourceURL = URL.createObjectURL(new Blob([a]));
2285
+ }
2286
+ ), this.decoderPending;
2287
+ }
2288
+ }
2289
+ class yn {
2290
+ constructor() {
2291
+ v(this, "_gltfLoader");
2292
+ v(this, "_usdzLoader");
2293
+ const e = new fn();
2294
+ e.setDecoderConfig({ type: "wasm" }), this._gltfLoader = new St(), this._gltfLoader.setDRACOLoader(e), this._usdzLoader = new an();
2295
+ }
2296
+ async load(e) {
2297
+ const t = wt(e);
2298
+ if (t.length === 0)
2299
+ throw new Te("No file extension found in URI", "");
2300
+ if (!Et(t))
2301
+ throw new Te(
2302
+ `Unsupported file type: ${t}. Supported types: ${_t.join(", ")}`,
2303
+ t
2304
+ );
2305
+ const o = xe.read(e);
2306
+ if (o)
2307
+ return o.arrayBuffer ? this._parse(o.arrayBuffer, t) : o.promise.then((n) => this._parse(n, t));
2308
+ const r = await xe.create(e).load();
2309
+ return this._parse(r, t);
2310
+ }
2311
+ /**
2312
+ * parse function for the chunk
2313
+ * @param arrayBuffer - the array buffer to parse, will be provided within the chunk
2314
+ * @param type - the file type of the array buffer
2315
+ * @returns the parsed object, will be stored within the chunk
2316
+ */
2317
+ async _parse(e, t) {
2318
+ try {
2319
+ switch (t) {
2320
+ case "glb":
2321
+ case "gltf":
2322
+ return (await this._gltfLoader.parseAsync(
2323
+ e,
2324
+ ""
2325
+ )).scene;
2326
+ case "usdz":
2327
+ return await this._usdzLoader.parse(e);
2328
+ }
2329
+ } catch (o) {
2330
+ throw o instanceof Error ? new ye(
2331
+ `Failed to parse ${t} file: ${o.message}`,
2332
+ o
2333
+ ) : new ye(`Failed to parse ${t} file`);
2334
+ }
2335
+ }
2336
+ }
2337
+ export {
2338
+ yn as A,
2339
+ fn as D,
2340
+ ln as a
2341
+ };