claude-dashboard-local 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1220) hide show
  1. package/.next/package.json +1 -0
  2. package/.next/standalone/.next/BUILD_ID +1 -0
  3. package/.next/standalone/.next/app-path-routes-manifest.json +11 -0
  4. package/.next/standalone/.next/build-manifest.json +20 -0
  5. package/.next/standalone/.next/package.json +1 -0
  6. package/.next/standalone/.next/prerender-manifest.json +114 -0
  7. package/.next/standalone/.next/required-server-files.json +336 -0
  8. package/.next/standalone/.next/routes-manifest.json +105 -0
  9. package/.next/standalone/.next/server/app/_global-error/page/app-paths-manifest.json +3 -0
  10. package/.next/standalone/.next/server/app/_global-error/page/build-manifest.json +16 -0
  11. package/.next/standalone/.next/server/app/_global-error/page/next-font-manifest.json +6 -0
  12. package/.next/standalone/.next/server/app/_global-error/page/react-loadable-manifest.json +1 -0
  13. package/.next/standalone/.next/server/app/_global-error/page/server-reference-manifest.json +4 -0
  14. package/.next/standalone/.next/server/app/_global-error/page.js +10 -0
  15. package/.next/standalone/.next/server/app/_global-error/page.js.map +5 -0
  16. package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -0
  17. package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +3 -0
  18. package/.next/standalone/.next/server/app/_global-error.html +1 -0
  19. package/.next/standalone/.next/server/app/_global-error.meta +15 -0
  20. package/.next/standalone/.next/server/app/_global-error.rsc +15 -0
  21. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +5 -0
  22. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +15 -0
  23. package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +6 -0
  24. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +5 -0
  25. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -0
  26. package/.next/standalone/.next/server/app/_not-found/page/app-paths-manifest.json +3 -0
  27. package/.next/standalone/.next/server/app/_not-found/page/build-manifest.json +16 -0
  28. package/.next/standalone/.next/server/app/_not-found/page/next-font-manifest.json +11 -0
  29. package/.next/standalone/.next/server/app/_not-found/page/react-loadable-manifest.json +1 -0
  30. package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +4 -0
  31. package/.next/standalone/.next/server/app/_not-found/page.js +13 -0
  32. package/.next/standalone/.next/server/app/_not-found/page.js.map +5 -0
  33. package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -0
  34. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +3 -0
  35. package/.next/standalone/.next/server/app/_not-found.html +1 -0
  36. package/.next/standalone/.next/server/app/_not-found.meta +16 -0
  37. package/.next/standalone/.next/server/app/_not-found.rsc +16 -0
  38. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +16 -0
  39. package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +6 -0
  40. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +5 -0
  41. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +5 -0
  42. package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +5 -0
  43. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -0
  44. package/.next/standalone/.next/server/app/api/license/validate/route/app-paths-manifest.json +3 -0
  45. package/.next/standalone/.next/server/app/api/license/validate/route/build-manifest.json +9 -0
  46. package/.next/standalone/.next/server/app/api/license/validate/route/server-reference-manifest.json +4 -0
  47. package/.next/standalone/.next/server/app/api/license/validate/route.js +6 -0
  48. package/.next/standalone/.next/server/app/api/license/validate/route.js.map +5 -0
  49. package/.next/standalone/.next/server/app/api/license/validate/route.js.nft.json +1 -0
  50. package/.next/standalone/.next/server/app/api/license/validate/route_client-reference-manifest.js +3 -0
  51. package/.next/standalone/.next/server/app/api/projects/[id]/route/app-paths-manifest.json +3 -0
  52. package/.next/standalone/.next/server/app/api/projects/[id]/route/build-manifest.json +9 -0
  53. package/.next/standalone/.next/server/app/api/projects/[id]/route/server-reference-manifest.json +4 -0
  54. package/.next/standalone/.next/server/app/api/projects/[id]/route.js +6 -0
  55. package/.next/standalone/.next/server/app/api/projects/[id]/route.js.map +5 -0
  56. package/.next/standalone/.next/server/app/api/projects/[id]/route.js.nft.json +1 -0
  57. package/.next/standalone/.next/server/app/api/projects/[id]/route_client-reference-manifest.js +3 -0
  58. package/.next/standalone/.next/server/app/api/projects/[id]/sessions/[sessionId]/route/app-paths-manifest.json +3 -0
  59. package/.next/standalone/.next/server/app/api/projects/[id]/sessions/[sessionId]/route/build-manifest.json +9 -0
  60. package/.next/standalone/.next/server/app/api/projects/[id]/sessions/[sessionId]/route/server-reference-manifest.json +4 -0
  61. package/.next/standalone/.next/server/app/api/projects/[id]/sessions/[sessionId]/route.js +6 -0
  62. package/.next/standalone/.next/server/app/api/projects/[id]/sessions/[sessionId]/route.js.map +5 -0
  63. package/.next/standalone/.next/server/app/api/projects/[id]/sessions/[sessionId]/route.js.nft.json +1 -0
  64. package/.next/standalone/.next/server/app/api/projects/[id]/sessions/[sessionId]/route_client-reference-manifest.js +3 -0
  65. package/.next/standalone/.next/server/app/api/projects/route/app-paths-manifest.json +3 -0
  66. package/.next/standalone/.next/server/app/api/projects/route/build-manifest.json +9 -0
  67. package/.next/standalone/.next/server/app/api/projects/route/server-reference-manifest.json +4 -0
  68. package/.next/standalone/.next/server/app/api/projects/route.js +6 -0
  69. package/.next/standalone/.next/server/app/api/projects/route.js.map +5 -0
  70. package/.next/standalone/.next/server/app/api/projects/route.js.nft.json +1 -0
  71. package/.next/standalone/.next/server/app/api/projects/route_client-reference-manifest.js +3 -0
  72. package/.next/standalone/.next/server/app/api/stats/route/app-paths-manifest.json +3 -0
  73. package/.next/standalone/.next/server/app/api/stats/route/build-manifest.json +9 -0
  74. package/.next/standalone/.next/server/app/api/stats/route/server-reference-manifest.json +4 -0
  75. package/.next/standalone/.next/server/app/api/stats/route.js +6 -0
  76. package/.next/standalone/.next/server/app/api/stats/route.js.map +5 -0
  77. package/.next/standalone/.next/server/app/api/stats/route.js.nft.json +1 -0
  78. package/.next/standalone/.next/server/app/api/stats/route_client-reference-manifest.js +3 -0
  79. package/.next/standalone/.next/server/app/favicon.ico/route/app-paths-manifest.json +3 -0
  80. package/.next/standalone/.next/server/app/favicon.ico/route/build-manifest.json +9 -0
  81. package/.next/standalone/.next/server/app/favicon.ico/route.js +7 -0
  82. package/.next/standalone/.next/server/app/favicon.ico/route.js.map +5 -0
  83. package/.next/standalone/.next/server/app/favicon.ico/route.js.nft.json +1 -0
  84. package/.next/standalone/.next/server/app/favicon.ico.body +0 -0
  85. package/.next/standalone/.next/server/app/favicon.ico.meta +1 -0
  86. package/.next/standalone/.next/server/app/index.html +1 -0
  87. package/.next/standalone/.next/server/app/index.meta +14 -0
  88. package/.next/standalone/.next/server/app/index.rsc +20 -0
  89. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +9 -0
  90. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +20 -0
  91. package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +6 -0
  92. package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +5 -0
  93. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +4 -0
  94. package/.next/standalone/.next/server/app/page/app-paths-manifest.json +3 -0
  95. package/.next/standalone/.next/server/app/page/build-manifest.json +16 -0
  96. package/.next/standalone/.next/server/app/page/next-font-manifest.json +11 -0
  97. package/.next/standalone/.next/server/app/page/react-loadable-manifest.json +1 -0
  98. package/.next/standalone/.next/server/app/page/server-reference-manifest.json +4 -0
  99. package/.next/standalone/.next/server/app/page.js +14 -0
  100. package/.next/standalone/.next/server/app/page.js.map +5 -0
  101. package/.next/standalone/.next/server/app/page.js.nft.json +1 -0
  102. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +3 -0
  103. package/.next/standalone/.next/server/app-paths-manifest.json +11 -0
  104. package/.next/standalone/.next/server/chunks/0zjb_server_app_api_projects_[id]_sessions_[sessionId]_route_actions_0dvk42y.js +3 -0
  105. package/.next/standalone/.next/server/chunks/[externals]_next_dist_0arv.vj._.js +3 -0
  106. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0-nqt9u._.js +3 -0
  107. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0gk2l.-._.js +3 -0
  108. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0hgzjhw._.js +3 -0
  109. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0j8-xkl._.js +13 -0
  110. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0p9ag9b._.js +3 -0
  111. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0pxyxtz._.js +3 -0
  112. package/.next/standalone/.next/server/chunks/[turbopack]_runtime.js +903 -0
  113. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_license_validate_route_actions_0lhsct4.js +3 -0
  114. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_projects_[id]_route_actions_0j8hzyq.js +3 -0
  115. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_projects_route_actions_09u5xm8.js +3 -0
  116. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_stats_route_actions_0dv_g.a.js +3 -0
  117. package/.next/standalone/.next/server/chunks/_next-internal_server_app_favicon_ico_route_actions_095lj93.js +3 -0
  118. package/.next/standalone/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_0m.429v.js +3 -0
  119. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0-_o0n5._.js +3 -0
  120. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0.xiv_y._.js +3 -0
  121. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__089dc4i._.js +33 -0
  122. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__09z7o2x._.js +19 -0
  123. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0hw~y-4._.js +3 -0
  124. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0v73tbn._.js +3 -0
  125. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0~bvmk0._.js +33 -0
  126. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0~y8ue.._.js +3 -0
  127. package/.next/standalone/.next/server/chunks/ssr/[turbopack]_runtime.js +903 -0
  128. package/.next/standalone/.next/server/chunks/ssr/_next-internal_server_app__global-error_page_actions_0k77kol.js +3 -0
  129. package/.next/standalone/.next/server/chunks/ssr/_next-internal_server_app__not-found_page_actions_0eq97pa.js +3 -0
  130. package/.next/standalone/.next/server/chunks/ssr/_next-internal_server_app_page_actions_09-gtaw.js +3 -0
  131. package/.next/standalone/.next/server/chunks/ssr/node_modules_09w7yel._.js +33 -0
  132. package/.next/standalone/.next/server/chunks/ssr/node_modules_0vtdjw7._.js +3 -0
  133. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_0.jrk~x._.js +6 -0
  134. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_client_components_0inhx6q._.js +3 -0
  135. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_forbidden_0ghu-f7.js +3 -0
  136. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_global-error_0lgvd_..js +3 -0
  137. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_unauthorized_0cjv-23.js +3 -0
  138. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_03-z2qq.js +4 -0
  139. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_07vh7rm.js +4 -0
  140. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0qp4u6g.js +4 -0
  141. package/.next/standalone/.next/server/chunks/ssr/src_app_page_tsx_0ss2.w7._.js +562 -0
  142. package/.next/standalone/.next/server/chunks/ssr/src_pro-loader_ts_06fh76g._.js +3 -0
  143. package/.next/standalone/.next/server/chunks/ssr/src_pro-loader_ts_0xhp.7l._.js +3 -0
  144. package/.next/standalone/.next/server/functions-config-manifest.json +4 -0
  145. package/.next/standalone/.next/server/middleware-build-manifest.js +20 -0
  146. package/.next/standalone/.next/server/middleware-manifest.json +6 -0
  147. package/.next/standalone/.next/server/next-font-manifest.js +1 -0
  148. package/.next/standalone/.next/server/next-font-manifest.json +15 -0
  149. package/.next/standalone/.next/server/pages/404.html +1 -0
  150. package/.next/standalone/.next/server/pages/500.html +1 -0
  151. package/.next/standalone/.next/server/pages-manifest.json +4 -0
  152. package/.next/standalone/.next/server/prefetch-hints.json +1 -0
  153. package/.next/standalone/.next/server/server-reference-manifest.js +1 -0
  154. package/.next/standalone/.next/server/server-reference-manifest.json +5 -0
  155. package/.next/standalone/node_modules/@img/colour/color.cjs +1596 -0
  156. package/.next/standalone/node_modules/@img/colour/index.cjs +1 -0
  157. package/.next/standalone/node_modules/@img/colour/package.json +58 -0
  158. package/.next/standalone/node_modules/@img/sharp-darwin-arm64/lib/sharp-darwin-arm64.node +0 -0
  159. package/.next/standalone/node_modules/@img/sharp-darwin-arm64/package.json +40 -0
  160. package/.next/standalone/node_modules/@img/sharp-libvips-darwin-arm64/README.md +46 -0
  161. package/.next/standalone/node_modules/@img/sharp-libvips-darwin-arm64/lib/glib-2.0/include/glibconfig.h +220 -0
  162. package/.next/standalone/node_modules/@img/sharp-libvips-darwin-arm64/lib/index.js +1 -0
  163. package/.next/standalone/node_modules/@img/sharp-libvips-darwin-arm64/lib/libvips-cpp.8.17.3.dylib +0 -0
  164. package/.next/standalone/node_modules/@img/sharp-libvips-darwin-arm64/package.json +36 -0
  165. package/.next/standalone/node_modules/@img/sharp-libvips-darwin-arm64/versions.json +30 -0
  166. package/.next/standalone/node_modules/@next/env/dist/index.js +1 -0
  167. package/.next/standalone/node_modules/@next/env/package.json +36 -0
  168. package/.next/standalone/node_modules/@swc/helpers/cjs/_interop_require_default.cjs +6 -0
  169. package/.next/standalone/node_modules/@swc/helpers/cjs/_interop_require_wildcard.cjs +38 -0
  170. package/.next/standalone/node_modules/@swc/helpers/package.json +471 -0
  171. package/.next/standalone/node_modules/client-only/index.js +0 -0
  172. package/.next/standalone/node_modules/client-only/package.json +19 -0
  173. package/.next/standalone/node_modules/detect-libc/lib/detect-libc.js +313 -0
  174. package/.next/standalone/node_modules/detect-libc/lib/elf.js +39 -0
  175. package/.next/standalone/node_modules/detect-libc/lib/filesystem.js +51 -0
  176. package/.next/standalone/node_modules/detect-libc/lib/process.js +24 -0
  177. package/.next/standalone/node_modules/detect-libc/package.json +44 -0
  178. package/.next/standalone/node_modules/next/dist/build/adapter/setup-node-env.external.js +15 -0
  179. package/.next/standalone/node_modules/next/dist/build/define-env.js +255 -0
  180. package/.next/standalone/node_modules/next/dist/build/duration-to-string.js +99 -0
  181. package/.next/standalone/node_modules/next/dist/build/get-supported-browsers.js +38 -0
  182. package/.next/standalone/node_modules/next/dist/build/next-config-ts/require-hook.js +85 -0
  183. package/.next/standalone/node_modules/next/dist/build/next-config-ts/transpile-config.js +251 -0
  184. package/.next/standalone/node_modules/next/dist/build/output/format.js +84 -0
  185. package/.next/standalone/node_modules/next/dist/build/output/log.js +135 -0
  186. package/.next/standalone/node_modules/next/dist/build/segment-config/app/app-segment-config.js +162 -0
  187. package/.next/standalone/node_modules/next/dist/build/segment-config/app/app-segments.js +137 -0
  188. package/.next/standalone/node_modules/next/dist/build/segment-config/app/collect-root-param-keys.js +52 -0
  189. package/.next/standalone/node_modules/next/dist/build/static-paths/app/extract-pathname-route-param-segments-from-loader-tree.js +137 -0
  190. package/.next/standalone/node_modules/next/dist/build/static-paths/app.js +735 -0
  191. package/.next/standalone/node_modules/next/dist/build/static-paths/pages.js +169 -0
  192. package/.next/standalone/node_modules/next/dist/build/static-paths/utils.js +119 -0
  193. package/.next/standalone/node_modules/next/dist/build/swc/helpers.js +15 -0
  194. package/.next/standalone/node_modules/next/dist/build/swc/index.js +1348 -0
  195. package/.next/standalone/node_modules/next/dist/build/swc/install-bindings.js +30 -0
  196. package/.next/standalone/node_modules/next/dist/build/swc/jest-transformer.js +76 -0
  197. package/.next/standalone/node_modules/next/dist/build/swc/loaderWorkerPool.js +40 -0
  198. package/.next/standalone/node_modules/next/dist/build/swc/options.js +403 -0
  199. package/.next/standalone/node_modules/next/dist/build/swc/types.js +6 -0
  200. package/.next/standalone/node_modules/next/dist/build/utils.js +1215 -0
  201. package/.next/standalone/node_modules/next/dist/cli/next-test.js +170 -0
  202. package/.next/standalone/node_modules/next/dist/client/add-base-path.js +24 -0
  203. package/.next/standalone/node_modules/next/dist/client/app-call-server.js +34 -0
  204. package/.next/standalone/node_modules/next/dist/client/app-find-source-map-url.js +39 -0
  205. package/.next/standalone/node_modules/next/dist/client/assign-location.js +29 -0
  206. package/.next/standalone/node_modules/next/dist/client/components/app-router-announcer.js +78 -0
  207. package/.next/standalone/node_modules/next/dist/client/components/app-router-headers.js +138 -0
  208. package/.next/standalone/node_modules/next/dist/client/components/app-router-instance.js +397 -0
  209. package/.next/standalone/node_modules/next/dist/client/components/app-router-utils.js +62 -0
  210. package/.next/standalone/node_modules/next/dist/client/components/app-router.js +514 -0
  211. package/.next/standalone/node_modules/next/dist/client/components/builtin/default.js +35 -0
  212. package/.next/standalone/node_modules/next/dist/client/components/builtin/error-styles.js +165 -0
  213. package/.next/standalone/node_modules/next/dist/client/components/builtin/global-error.js +100 -0
  214. package/.next/standalone/node_modules/next/dist/client/components/dev-root-http-access-fallback-boundary.js +52 -0
  215. package/.next/standalone/node_modules/next/dist/client/components/error-boundary.js +144 -0
  216. package/.next/standalone/node_modules/next/dist/client/components/errors/graceful-degrade-boundary.js +86 -0
  217. package/.next/standalone/node_modules/next/dist/client/components/errors/root-error-boundary.js +41 -0
  218. package/.next/standalone/node_modules/next/dist/client/components/forbidden.js +48 -0
  219. package/.next/standalone/node_modules/next/dist/client/components/handle-isr-error.js +30 -0
  220. package/.next/standalone/node_modules/next/dist/client/components/hooks-server-context.js +42 -0
  221. package/.next/standalone/node_modules/next/dist/client/components/http-access-fallback/error-boundary.js +125 -0
  222. package/.next/standalone/node_modules/next/dist/client/components/http-access-fallback/http-access-fallback.js +72 -0
  223. package/.next/standalone/node_modules/next/dist/client/components/is-next-router-error.js +23 -0
  224. package/.next/standalone/node_modules/next/dist/client/components/links.js +299 -0
  225. package/.next/standalone/node_modules/next/dist/client/components/match-segments.js +32 -0
  226. package/.next/standalone/node_modules/next/dist/client/components/nav-failure-handler.js +61 -0
  227. package/.next/standalone/node_modules/next/dist/client/components/navigation-devtools.js +126 -0
  228. package/.next/standalone/node_modules/next/dist/client/components/navigation-untracked.js +67 -0
  229. package/.next/standalone/node_modules/next/dist/client/components/navigation.js +225 -0
  230. package/.next/standalone/node_modules/next/dist/client/components/navigation.react-server.js +75 -0
  231. package/.next/standalone/node_modules/next/dist/client/components/not-found.js +42 -0
  232. package/.next/standalone/node_modules/next/dist/client/components/readonly-url-search-params.js +41 -0
  233. package/.next/standalone/node_modules/next/dist/client/components/redirect-boundary.js +107 -0
  234. package/.next/standalone/node_modules/next/dist/client/components/redirect-error.js +43 -0
  235. package/.next/standalone/node_modules/next/dist/client/components/redirect-status-code.js +24 -0
  236. package/.next/standalone/node_modules/next/dist/client/components/redirect.js +91 -0
  237. package/.next/standalone/node_modules/next/dist/client/components/router-reducer/compute-changed-path.js +201 -0
  238. package/.next/standalone/node_modules/next/dist/client/components/router-reducer/create-href-from-url.js +21 -0
  239. package/.next/standalone/node_modules/next/dist/client/components/router-reducer/create-initial-router-state.js +153 -0
  240. package/.next/standalone/node_modules/next/dist/client/components/router-reducer/create-router-cache-key.js +32 -0
  241. package/.next/standalone/node_modules/next/dist/client/components/router-reducer/fetch-server-response.js +457 -0
  242. package/.next/standalone/node_modules/next/dist/client/components/router-reducer/is-navigating-to-new-root-layout.js +59 -0
  243. package/.next/standalone/node_modules/next/dist/client/components/router-reducer/ppr-navigations.js +1341 -0
  244. package/.next/standalone/node_modules/next/dist/client/components/router-reducer/reducers/committed-state.js +49 -0
  245. package/.next/standalone/node_modules/next/dist/client/components/router-reducer/reducers/find-head-in-cache.js +63 -0
  246. package/.next/standalone/node_modules/next/dist/client/components/router-reducer/reducers/has-interception-route-in-current-tree.js +38 -0
  247. package/.next/standalone/node_modules/next/dist/client/components/router-reducer/reducers/hmr-refresh-reducer.js +23 -0
  248. package/.next/standalone/node_modules/next/dist/client/components/router-reducer/reducers/navigate-reducer.js +56 -0
  249. package/.next/standalone/node_modules/next/dist/client/components/router-reducer/reducers/refresh-reducer.js +83 -0
  250. package/.next/standalone/node_modules/next/dist/client/components/router-reducer/reducers/restore-reducer.js +62 -0
  251. package/.next/standalone/node_modules/next/dist/client/components/router-reducer/reducers/server-action-reducer.js +320 -0
  252. package/.next/standalone/node_modules/next/dist/client/components/router-reducer/reducers/server-patch-reducer.js +58 -0
  253. package/.next/standalone/node_modules/next/dist/client/components/router-reducer/router-reducer-types.js +70 -0
  254. package/.next/standalone/node_modules/next/dist/client/components/router-reducer/router-reducer.js +66 -0
  255. package/.next/standalone/node_modules/next/dist/client/components/router-reducer/set-cache-busting-search-param.js +60 -0
  256. package/.next/standalone/node_modules/next/dist/client/components/segment-cache/bfcache.js +128 -0
  257. package/.next/standalone/node_modules/next/dist/client/components/segment-cache/cache-key.js +28 -0
  258. package/.next/standalone/node_modules/next/dist/client/components/segment-cache/cache-map.js +305 -0
  259. package/.next/standalone/node_modules/next/dist/client/components/segment-cache/cache.js +1933 -0
  260. package/.next/standalone/node_modules/next/dist/client/components/segment-cache/lru.js +152 -0
  261. package/.next/standalone/node_modules/next/dist/client/components/segment-cache/navigation-testing-lock.js +194 -0
  262. package/.next/standalone/node_modules/next/dist/client/components/segment-cache/navigation.js +597 -0
  263. package/.next/standalone/node_modules/next/dist/client/components/segment-cache/optimistic-routes.js +543 -0
  264. package/.next/standalone/node_modules/next/dist/client/components/segment-cache/prefetch.js +31 -0
  265. package/.next/standalone/node_modules/next/dist/client/components/segment-cache/scheduler.js +1249 -0
  266. package/.next/standalone/node_modules/next/dist/client/components/segment-cache/types.js +69 -0
  267. package/.next/standalone/node_modules/next/dist/client/components/segment-cache/vary-path.js +278 -0
  268. package/.next/standalone/node_modules/next/dist/client/components/static-generation-bailout.js +42 -0
  269. package/.next/standalone/node_modules/next/dist/client/components/unauthorized.js +49 -0
  270. package/.next/standalone/node_modules/next/dist/client/components/unrecognized-action-error.js +39 -0
  271. package/.next/standalone/node_modules/next/dist/client/components/unresolved-thenable.js +23 -0
  272. package/.next/standalone/node_modules/next/dist/client/components/unstable-rethrow.browser.js +28 -0
  273. package/.next/standalone/node_modules/next/dist/client/components/unstable-rethrow.js +25 -0
  274. package/.next/standalone/node_modules/next/dist/client/components/unstable-rethrow.server.js +32 -0
  275. package/.next/standalone/node_modules/next/dist/client/components/use-action-queue.js +148 -0
  276. package/.next/standalone/node_modules/next/dist/client/dev/debug-channel.js +72 -0
  277. package/.next/standalone/node_modules/next/dist/client/flight-data-helpers.js +232 -0
  278. package/.next/standalone/node_modules/next/dist/client/has-base-path.js +23 -0
  279. package/.next/standalone/node_modules/next/dist/client/lib/console.js +177 -0
  280. package/.next/standalone/node_modules/next/dist/client/lib/javascript-url.js +32 -0
  281. package/.next/standalone/node_modules/next/dist/client/navigation-build-id.js +53 -0
  282. package/.next/standalone/node_modules/next/dist/client/normalize-trailing-slash.js +36 -0
  283. package/.next/standalone/node_modules/next/dist/client/remove-base-path.js +32 -0
  284. package/.next/standalone/node_modules/next/dist/client/route-params.js +230 -0
  285. package/.next/standalone/node_modules/next/dist/compiled/@edge-runtime/cookies/index.js +339 -0
  286. package/.next/standalone/node_modules/next/dist/compiled/@edge-runtime/cookies/package.json +1 -0
  287. package/.next/standalone/node_modules/next/dist/compiled/@edge-runtime/ponyfill/index.js +46 -0
  288. package/.next/standalone/node_modules/next/dist/compiled/@edge-runtime/ponyfill/package.json +1 -0
  289. package/.next/standalone/node_modules/next/dist/compiled/@edge-runtime/primitives/abort-controller.js.text.js +1 -0
  290. package/.next/standalone/node_modules/next/dist/compiled/@edge-runtime/primitives/console.js.text.js +1 -0
  291. package/.next/standalone/node_modules/next/dist/compiled/@edge-runtime/primitives/events.js.text.js +1 -0
  292. package/.next/standalone/node_modules/next/dist/compiled/@edge-runtime/primitives/index.js +5 -0
  293. package/.next/standalone/node_modules/next/dist/compiled/@edge-runtime/primitives/load.js +18713 -0
  294. package/.next/standalone/node_modules/next/dist/compiled/@edge-runtime/primitives/package.json +1 -0
  295. package/.next/standalone/node_modules/next/dist/compiled/@edge-runtime/primitives/stream.js +44 -0
  296. package/.next/standalone/node_modules/next/dist/compiled/@edge-runtime/primitives/timers.js.text.js +1 -0
  297. package/.next/standalone/node_modules/next/dist/compiled/@edge-runtime/primitives/url.js.text.js +1 -0
  298. package/.next/standalone/node_modules/next/dist/compiled/@hapi/accept/index.js +1 -0
  299. package/.next/standalone/node_modules/next/dist/compiled/@hapi/accept/package.json +1 -0
  300. package/.next/standalone/node_modules/next/dist/compiled/@mswjs/interceptors/ClientRequest/index.js +1 -0
  301. package/.next/standalone/node_modules/next/dist/compiled/@mswjs/interceptors/ClientRequest/package.json +1 -0
  302. package/.next/standalone/node_modules/next/dist/compiled/@napi-rs/triples/index.js +1 -0
  303. package/.next/standalone/node_modules/next/dist/compiled/@napi-rs/triples/package.json +1 -0
  304. package/.next/standalone/node_modules/next/dist/compiled/@opentelemetry/api/index.js +1 -0
  305. package/.next/standalone/node_modules/next/dist/compiled/@opentelemetry/api/package.json +1 -0
  306. package/.next/standalone/node_modules/next/dist/compiled/async-retry/index.js +1 -0
  307. package/.next/standalone/node_modules/next/dist/compiled/async-retry/package.json +1 -0
  308. package/.next/standalone/node_modules/next/dist/compiled/async-sema/index.js +1 -0
  309. package/.next/standalone/node_modules/next/dist/compiled/async-sema/package.json +1 -0
  310. package/.next/standalone/node_modules/next/dist/compiled/busboy/index.js +1 -0
  311. package/.next/standalone/node_modules/next/dist/compiled/busboy/package.json +1 -0
  312. package/.next/standalone/node_modules/next/dist/compiled/bytes/index.js +8 -0
  313. package/.next/standalone/node_modules/next/dist/compiled/bytes/package.json +1 -0
  314. package/.next/standalone/node_modules/next/dist/compiled/ci-info/index.js +1 -0
  315. package/.next/standalone/node_modules/next/dist/compiled/ci-info/package.json +1 -0
  316. package/.next/standalone/node_modules/next/dist/compiled/commander/index.js +1 -0
  317. package/.next/standalone/node_modules/next/dist/compiled/commander/package.json +1 -0
  318. package/.next/standalone/node_modules/next/dist/compiled/comment-json/index.js +7 -0
  319. package/.next/standalone/node_modules/next/dist/compiled/comment-json/package.json +1 -0
  320. package/.next/standalone/node_modules/next/dist/compiled/compression/index.js +58 -0
  321. package/.next/standalone/node_modules/next/dist/compiled/compression/package.json +1 -0
  322. package/.next/standalone/node_modules/next/dist/compiled/conf/index.js +15 -0
  323. package/.next/standalone/node_modules/next/dist/compiled/conf/package.json +1 -0
  324. package/.next/standalone/node_modules/next/dist/compiled/content-disposition/index.js +6 -0
  325. package/.next/standalone/node_modules/next/dist/compiled/content-disposition/package.json +1 -0
  326. package/.next/standalone/node_modules/next/dist/compiled/cookie/index.js +7 -0
  327. package/.next/standalone/node_modules/next/dist/compiled/cookie/package.json +1 -0
  328. package/.next/standalone/node_modules/next/dist/compiled/cross-spawn/index.js +1 -0
  329. package/.next/standalone/node_modules/next/dist/compiled/cross-spawn/package.json +1 -0
  330. package/.next/standalone/node_modules/next/dist/compiled/debug/index.js +1 -0
  331. package/.next/standalone/node_modules/next/dist/compiled/debug/package.json +1 -0
  332. package/.next/standalone/node_modules/next/dist/compiled/edge-runtime/index.js +1 -0
  333. package/.next/standalone/node_modules/next/dist/compiled/edge-runtime/package.json +1 -0
  334. package/.next/standalone/node_modules/next/dist/compiled/find-up/index.js +1 -0
  335. package/.next/standalone/node_modules/next/dist/compiled/find-up/package.json +1 -0
  336. package/.next/standalone/node_modules/next/dist/compiled/fresh/index.js +8 -0
  337. package/.next/standalone/node_modules/next/dist/compiled/fresh/package.json +1 -0
  338. package/.next/standalone/node_modules/next/dist/compiled/http-proxy/index.js +34 -0
  339. package/.next/standalone/node_modules/next/dist/compiled/http-proxy/package.json +1 -0
  340. package/.next/standalone/node_modules/next/dist/compiled/image-detector/detector.js +1 -0
  341. package/.next/standalone/node_modules/next/dist/compiled/image-size/index.js +1 -0
  342. package/.next/standalone/node_modules/next/dist/compiled/image-size/package.json +1 -0
  343. package/.next/standalone/node_modules/next/dist/compiled/ipaddr.js/ipaddr.js +1 -0
  344. package/.next/standalone/node_modules/next/dist/compiled/ipaddr.js/package.json +1 -0
  345. package/.next/standalone/node_modules/next/dist/compiled/is-animated/index.js +1 -0
  346. package/.next/standalone/node_modules/next/dist/compiled/is-animated/package.json +1 -0
  347. package/.next/standalone/node_modules/next/dist/compiled/is-docker/index.js +1 -0
  348. package/.next/standalone/node_modules/next/dist/compiled/is-docker/package.json +1 -0
  349. package/.next/standalone/node_modules/next/dist/compiled/is-wsl/index.js +1 -0
  350. package/.next/standalone/node_modules/next/dist/compiled/is-wsl/package.json +1 -0
  351. package/.next/standalone/node_modules/next/dist/compiled/jsonwebtoken/index.js +11 -0
  352. package/.next/standalone/node_modules/next/dist/compiled/jsonwebtoken/package.json +1 -0
  353. package/.next/standalone/node_modules/next/dist/compiled/nanoid/index.cjs +1 -0
  354. package/.next/standalone/node_modules/next/dist/compiled/nanoid/package.json +1 -0
  355. package/.next/standalone/node_modules/next/dist/compiled/next-server/app-page-turbo-experimental.runtime.prod.js +54 -0
  356. package/.next/standalone/node_modules/next/dist/compiled/next-server/app-page-turbo.runtime.prod.js +54 -0
  357. package/.next/standalone/node_modules/next/dist/compiled/next-server/app-route-turbo.runtime.prod.js +6 -0
  358. package/.next/standalone/node_modules/next/dist/compiled/next-server/pages-turbo.runtime.prod.js +20 -0
  359. package/.next/standalone/node_modules/next/dist/compiled/p-limit/index.js +1 -0
  360. package/.next/standalone/node_modules/next/dist/compiled/p-limit/package.json +1 -0
  361. package/.next/standalone/node_modules/next/dist/compiled/p-queue/index.js +1 -0
  362. package/.next/standalone/node_modules/next/dist/compiled/p-queue/package.json +1 -0
  363. package/.next/standalone/node_modules/next/dist/compiled/path-browserify/index.js +1 -0
  364. package/.next/standalone/node_modules/next/dist/compiled/path-browserify/package.json +1 -0
  365. package/.next/standalone/node_modules/next/dist/compiled/path-to-regexp/index.js +1 -0
  366. package/.next/standalone/node_modules/next/dist/compiled/path-to-regexp/package.json +1 -0
  367. package/.next/standalone/node_modules/next/dist/compiled/picomatch/index.js +1 -0
  368. package/.next/standalone/node_modules/next/dist/compiled/picomatch/package.json +1 -0
  369. package/.next/standalone/node_modules/next/dist/compiled/react-is/cjs/react-is.development.js +133 -0
  370. package/.next/standalone/node_modules/next/dist/compiled/react-is/cjs/react-is.production.js +130 -0
  371. package/.next/standalone/node_modules/next/dist/compiled/react-is/index.js +7 -0
  372. package/.next/standalone/node_modules/next/dist/compiled/react-is/package.json +26 -0
  373. package/.next/standalone/node_modules/next/dist/compiled/regenerator-runtime/package.json +19 -0
  374. package/.next/standalone/node_modules/next/dist/compiled/regenerator-runtime/runtime.js +729 -0
  375. package/.next/standalone/node_modules/next/dist/compiled/semver/index.js +1 -0
  376. package/.next/standalone/node_modules/next/dist/compiled/semver/package.json +1 -0
  377. package/.next/standalone/node_modules/next/dist/compiled/send/index.js +70 -0
  378. package/.next/standalone/node_modules/next/dist/compiled/send/package.json +1 -0
  379. package/.next/standalone/node_modules/next/dist/compiled/source-map/package.json +1 -0
  380. package/.next/standalone/node_modules/next/dist/compiled/source-map/source-map.js +1 -0
  381. package/.next/standalone/node_modules/next/dist/compiled/stacktrace-parser/package.json +1 -0
  382. package/.next/standalone/node_modules/next/dist/compiled/stacktrace-parser/stack-trace-parser.cjs.js +1 -0
  383. package/.next/standalone/node_modules/next/dist/compiled/string-hash/index.js +1 -0
  384. package/.next/standalone/node_modules/next/dist/compiled/string-hash/package.json +1 -0
  385. package/.next/standalone/node_modules/next/dist/compiled/strip-ansi/index.js +1 -0
  386. package/.next/standalone/node_modules/next/dist/compiled/strip-ansi/package.json +1 -0
  387. package/.next/standalone/node_modules/next/dist/compiled/superstruct/index.cjs +1 -0
  388. package/.next/standalone/node_modules/next/dist/compiled/superstruct/package.json +1 -0
  389. package/.next/standalone/node_modules/next/dist/compiled/tar/index.min.js +1 -0
  390. package/.next/standalone/node_modules/next/dist/compiled/tar/package.json +1 -0
  391. package/.next/standalone/node_modules/next/dist/compiled/text-table/index.js +1 -0
  392. package/.next/standalone/node_modules/next/dist/compiled/text-table/package.json +1 -0
  393. package/.next/standalone/node_modules/next/dist/compiled/watchpack/package.json +1 -0
  394. package/.next/standalone/node_modules/next/dist/compiled/watchpack/watchpack.js +1 -0
  395. package/.next/standalone/node_modules/next/dist/compiled/ws/index.js +1 -0
  396. package/.next/standalone/node_modules/next/dist/compiled/ws/package.json +1 -0
  397. package/.next/standalone/node_modules/next/dist/compiled/zod/index.cjs +1 -0
  398. package/.next/standalone/node_modules/next/dist/compiled/zod/package.json +1 -0
  399. package/.next/standalone/node_modules/next/dist/compiled/zod-validation-error/index.js +1 -0
  400. package/.next/standalone/node_modules/next/dist/compiled/zod-validation-error/package.json +1 -0
  401. package/.next/standalone/node_modules/next/dist/experimental/testmode/context.js +57 -0
  402. package/.next/standalone/node_modules/next/dist/experimental/testmode/fetch.js +142 -0
  403. package/.next/standalone/node_modules/next/dist/experimental/testmode/httpget.js +26 -0
  404. package/.next/standalone/node_modules/next/dist/experimental/testmode/server-edge.js +32 -0
  405. package/.next/standalone/node_modules/next/dist/experimental/testmode/server.js +62 -0
  406. package/.next/standalone/node_modules/next/dist/export/helpers/create-incremental-cache.js +61 -0
  407. package/.next/standalone/node_modules/next/dist/lib/batcher.js +65 -0
  408. package/.next/standalone/node_modules/next/dist/lib/build-custom-route.js +46 -0
  409. package/.next/standalone/node_modules/next/dist/lib/bundler.js +97 -0
  410. package/.next/standalone/node_modules/next/dist/lib/client-and-server-references.js +54 -0
  411. package/.next/standalone/node_modules/next/dist/lib/coalesced-function.js +39 -0
  412. package/.next/standalone/node_modules/next/dist/lib/compile-error.js +14 -0
  413. package/.next/standalone/node_modules/next/dist/lib/constants.js +420 -0
  414. package/.next/standalone/node_modules/next/dist/lib/create-client-router-filter.js +67 -0
  415. package/.next/standalone/node_modules/next/dist/lib/default-transpiled-packages.json +1 -0
  416. package/.next/standalone/node_modules/next/dist/lib/detached-promise.js +32 -0
  417. package/.next/standalone/node_modules/next/dist/lib/detect-typo.js +51 -0
  418. package/.next/standalone/node_modules/next/dist/lib/download-swc.js +183 -0
  419. package/.next/standalone/node_modules/next/dist/lib/error-telemetry-utils.js +42 -0
  420. package/.next/standalone/node_modules/next/dist/lib/fallback.js +100 -0
  421. package/.next/standalone/node_modules/next/dist/lib/fatal-error.js +14 -0
  422. package/.next/standalone/node_modules/next/dist/lib/file-exists.js +53 -0
  423. package/.next/standalone/node_modules/next/dist/lib/find-config.js +102 -0
  424. package/.next/standalone/node_modules/next/dist/lib/find-pages-dir.js +65 -0
  425. package/.next/standalone/node_modules/next/dist/lib/find-root.js +126 -0
  426. package/.next/standalone/node_modules/next/dist/lib/format-cli-help-output.js +84 -0
  427. package/.next/standalone/node_modules/next/dist/lib/format-dynamic-import-path.js +24 -0
  428. package/.next/standalone/node_modules/next/dist/lib/format-server-error.js +75 -0
  429. package/.next/standalone/node_modules/next/dist/lib/framework/boundary-components.js +62 -0
  430. package/.next/standalone/node_modules/next/dist/lib/framework/boundary-constants.js +36 -0
  431. package/.next/standalone/node_modules/next/dist/lib/fs/rename.js +87 -0
  432. package/.next/standalone/node_modules/next/dist/lib/fs/write-atomic.js +28 -0
  433. package/.next/standalone/node_modules/next/dist/lib/generate-interception-routes-rewrites.js +52 -0
  434. package/.next/standalone/node_modules/next/dist/lib/get-files-in-dir.js +33 -0
  435. package/.next/standalone/node_modules/next/dist/lib/get-network-host.js +44 -0
  436. package/.next/standalone/node_modules/next/dist/lib/get-package-version.js +118 -0
  437. package/.next/standalone/node_modules/next/dist/lib/get-project-dir.js +51 -0
  438. package/.next/standalone/node_modules/next/dist/lib/has-necessary-dependencies.js +49 -0
  439. package/.next/standalone/node_modules/next/dist/lib/helpers/get-cache-directory.js +66 -0
  440. package/.next/standalone/node_modules/next/dist/lib/helpers/get-npx-command.js +29 -0
  441. package/.next/standalone/node_modules/next/dist/lib/helpers/get-online.js +50 -0
  442. package/.next/standalone/node_modules/next/dist/lib/helpers/get-pkg-manager.js +63 -0
  443. package/.next/standalone/node_modules/next/dist/lib/helpers/get-registry.js +45 -0
  444. package/.next/standalone/node_modules/next/dist/lib/helpers/get-reserved-port.js +116 -0
  445. package/.next/standalone/node_modules/next/dist/lib/helpers/install.js +83 -0
  446. package/.next/standalone/node_modules/next/dist/lib/import-next-warning.js +50 -0
  447. package/.next/standalone/node_modules/next/dist/lib/inline-static-env.js +112 -0
  448. package/.next/standalone/node_modules/next/dist/lib/install-dependencies.js +40 -0
  449. package/.next/standalone/node_modules/next/dist/lib/interop-default.js +16 -0
  450. package/.next/standalone/node_modules/next/dist/lib/is-api-route.js +15 -0
  451. package/.next/standalone/node_modules/next/dist/lib/is-app-page-route.js +15 -0
  452. package/.next/standalone/node_modules/next/dist/lib/is-app-route-route.js +15 -0
  453. package/.next/standalone/node_modules/next/dist/lib/is-edge-runtime.js +16 -0
  454. package/.next/standalone/node_modules/next/dist/lib/is-error.js +78 -0
  455. package/.next/standalone/node_modules/next/dist/lib/is-interception-route-rewrite.js +18 -0
  456. package/.next/standalone/node_modules/next/dist/lib/is-internal-component.js +36 -0
  457. package/.next/standalone/node_modules/next/dist/lib/is-serializable-props.js +106 -0
  458. package/.next/standalone/node_modules/next/dist/lib/known-edge-safe-packages.json +1 -0
  459. package/.next/standalone/node_modules/next/dist/lib/load-custom-routes.js +594 -0
  460. package/.next/standalone/node_modules/next/dist/lib/memory/gc-observer.js +53 -0
  461. package/.next/standalone/node_modules/next/dist/lib/memory/shutdown.js +29 -0
  462. package/.next/standalone/node_modules/next/dist/lib/memory/startup.js +47 -0
  463. package/.next/standalone/node_modules/next/dist/lib/memory/trace.js +109 -0
  464. package/.next/standalone/node_modules/next/dist/lib/metadata/constants.js +40 -0
  465. package/.next/standalone/node_modules/next/dist/lib/metadata/default-metadata.js +82 -0
  466. package/.next/standalone/node_modules/next/dist/lib/metadata/generate/icon-mark.js +22 -0
  467. package/.next/standalone/node_modules/next/dist/lib/metadata/generate/utils.js +52 -0
  468. package/.next/standalone/node_modules/next/dist/lib/metadata/get-metadata-route.js +123 -0
  469. package/.next/standalone/node_modules/next/dist/lib/metadata/is-metadata-route.js +221 -0
  470. package/.next/standalone/node_modules/next/dist/lib/metadata/metadata-context.js +18 -0
  471. package/.next/standalone/node_modules/next/dist/lib/metadata/metadata.js +1686 -0
  472. package/.next/standalone/node_modules/next/dist/lib/metadata/resolve-metadata.js +884 -0
  473. package/.next/standalone/node_modules/next/dist/lib/metadata/resolvers/resolve-basics.js +232 -0
  474. package/.next/standalone/node_modules/next/dist/lib/metadata/resolvers/resolve-icons.js +56 -0
  475. package/.next/standalone/node_modules/next/dist/lib/metadata/resolvers/resolve-opengraph.js +199 -0
  476. package/.next/standalone/node_modules/next/dist/lib/metadata/resolvers/resolve-title.js +40 -0
  477. package/.next/standalone/node_modules/next/dist/lib/metadata/resolvers/resolve-url.js +135 -0
  478. package/.next/standalone/node_modules/next/dist/lib/metadata/types/alternative-urls-types.js +7 -0
  479. package/.next/standalone/node_modules/next/dist/lib/metadata/types/extra-types.js +9 -0
  480. package/.next/standalone/node_modules/next/dist/lib/metadata/types/icons.js +6 -0
  481. package/.next/standalone/node_modules/next/dist/lib/metadata/types/manifest-types.js +6 -0
  482. package/.next/standalone/node_modules/next/dist/lib/metadata/types/metadata-interface.js +18 -0
  483. package/.next/standalone/node_modules/next/dist/lib/metadata/types/metadata-types.js +10 -0
  484. package/.next/standalone/node_modules/next/dist/lib/metadata/types/opengraph-types.js +6 -0
  485. package/.next/standalone/node_modules/next/dist/lib/metadata/types/resolvers.js +6 -0
  486. package/.next/standalone/node_modules/next/dist/lib/metadata/types/twitter-types.js +7 -0
  487. package/.next/standalone/node_modules/next/dist/lib/mime-type.js +20 -0
  488. package/.next/standalone/node_modules/next/dist/lib/mkcert.js +204 -0
  489. package/.next/standalone/node_modules/next/dist/lib/multi-file-writer.js +75 -0
  490. package/.next/standalone/node_modules/next/dist/lib/needs-experimental-react.js +16 -0
  491. package/.next/standalone/node_modules/next/dist/lib/non-nullable.js +15 -0
  492. package/.next/standalone/node_modules/next/dist/lib/normalize-path.js +21 -0
  493. package/.next/standalone/node_modules/next/dist/lib/oxford-comma-list.js +15 -0
  494. package/.next/standalone/node_modules/next/dist/lib/page-types.js +18 -0
  495. package/.next/standalone/node_modules/next/dist/lib/patch-incorrect-lockfile.js +185 -0
  496. package/.next/standalone/node_modules/next/dist/lib/pick.js +19 -0
  497. package/.next/standalone/node_modules/next/dist/lib/picocolors.js +177 -0
  498. package/.next/standalone/node_modules/next/dist/lib/pretty-bytes.js +74 -0
  499. package/.next/standalone/node_modules/next/dist/lib/realpath.js +20 -0
  500. package/.next/standalone/node_modules/next/dist/lib/recursive-copy.js +76 -0
  501. package/.next/standalone/node_modules/next/dist/lib/recursive-delete.js +137 -0
  502. package/.next/standalone/node_modules/next/dist/lib/recursive-readdir.js +124 -0
  503. package/.next/standalone/node_modules/next/dist/lib/redirect-status.js +46 -0
  504. package/.next/standalone/node_modules/next/dist/lib/require-instrumentation-client.js +26 -0
  505. package/.next/standalone/node_modules/next/dist/lib/resolve-build-paths.js +154 -0
  506. package/.next/standalone/node_modules/next/dist/lib/resolve-from.js +65 -0
  507. package/.next/standalone/node_modules/next/dist/lib/route-pattern-normalizer.js +107 -0
  508. package/.next/standalone/node_modules/next/dist/lib/scheduler.js +64 -0
  509. package/.next/standalone/node_modules/next/dist/lib/semver-noop.js +18 -0
  510. package/.next/standalone/node_modules/next/dist/lib/server-external-packages.jsonc +103 -0
  511. package/.next/standalone/node_modules/next/dist/lib/setup-exception-listeners.js +11 -0
  512. package/.next/standalone/node_modules/next/dist/lib/static-env.js +92 -0
  513. package/.next/standalone/node_modules/next/dist/lib/try-to-parse-path.js +67 -0
  514. package/.next/standalone/node_modules/next/dist/lib/turbopack-warning.js +185 -0
  515. package/.next/standalone/node_modules/next/dist/lib/typescript/diagnosticFormatter.js +243 -0
  516. package/.next/standalone/node_modules/next/dist/lib/typescript/getTypeScriptConfiguration.js +73 -0
  517. package/.next/standalone/node_modules/next/dist/lib/typescript/getTypeScriptIntent.js +52 -0
  518. package/.next/standalone/node_modules/next/dist/lib/typescript/missingDependencyError.js +27 -0
  519. package/.next/standalone/node_modules/next/dist/lib/typescript/runTypeCheck.js +149 -0
  520. package/.next/standalone/node_modules/next/dist/lib/typescript/type-paths.js +51 -0
  521. package/.next/standalone/node_modules/next/dist/lib/typescript/writeAppTypeDeclarations.js +75 -0
  522. package/.next/standalone/node_modules/next/dist/lib/typescript/writeConfigurationDefaults.js +391 -0
  523. package/.next/standalone/node_modules/next/dist/lib/url.js +75 -0
  524. package/.next/standalone/node_modules/next/dist/lib/verify-partytown-setup.js +115 -0
  525. package/.next/standalone/node_modules/next/dist/lib/verify-root-layout.js +165 -0
  526. package/.next/standalone/node_modules/next/dist/lib/verify-typescript-setup.js +228 -0
  527. package/.next/standalone/node_modules/next/dist/lib/wait.js +19 -0
  528. package/.next/standalone/node_modules/next/dist/lib/with-promise-cache.js +24 -0
  529. package/.next/standalone/node_modules/next/dist/lib/worker.js +234 -0
  530. package/.next/standalone/node_modules/next/dist/server/ReactDOMServerPages.js +16 -0
  531. package/.next/standalone/node_modules/next/dist/server/accept-header.js +132 -0
  532. package/.next/standalone/node_modules/next/dist/server/after/after-context.js +140 -0
  533. package/.next/standalone/node_modules/next/dist/server/after/after.js +26 -0
  534. package/.next/standalone/node_modules/next/dist/server/after/awaiter.js +74 -0
  535. package/.next/standalone/node_modules/next/dist/server/after/builtin-request-context.js +38 -0
  536. package/.next/standalone/node_modules/next/dist/server/after/index.js +21 -0
  537. package/.next/standalone/node_modules/next/dist/server/after/run-with-after.js +35 -0
  538. package/.next/standalone/node_modules/next/dist/server/api-utils/get-cookie-parser.js +22 -0
  539. package/.next/standalone/node_modules/next/dist/server/api-utils/index.js +201 -0
  540. package/.next/standalone/node_modules/next/dist/server/api-utils/node/api-resolver.js +395 -0
  541. package/.next/standalone/node_modules/next/dist/server/api-utils/node/parse-body.js +79 -0
  542. package/.next/standalone/node_modules/next/dist/server/api-utils/node/try-get-preview-data.js +86 -0
  543. package/.next/standalone/node_modules/next/dist/server/api-utils/web.js +17 -0
  544. package/.next/standalone/node_modules/next/dist/server/app-render/action-async-storage-instance.js +14 -0
  545. package/.next/standalone/node_modules/next/dist/server/app-render/action-async-storage.external.js +13 -0
  546. package/.next/standalone/node_modules/next/dist/server/app-render/action-handler.js +1020 -0
  547. package/.next/standalone/node_modules/next/dist/server/app-render/after-task-async-storage-instance.js +14 -0
  548. package/.next/standalone/node_modules/next/dist/server/app-render/after-task-async-storage.external.js +13 -0
  549. package/.next/standalone/node_modules/next/dist/server/app-render/app-render-prerender-utils.js +167 -0
  550. package/.next/standalone/node_modules/next/dist/server/app-render/app-render-render-utils.js +76 -0
  551. package/.next/standalone/node_modules/next/dist/server/app-render/app-render-scheduling.js +188 -0
  552. package/.next/standalone/node_modules/next/dist/server/app-render/app-render.js +4469 -0
  553. package/.next/standalone/node_modules/next/dist/server/app-render/async-local-storage.js +76 -0
  554. package/.next/standalone/node_modules/next/dist/server/app-render/cache-signal.js +181 -0
  555. package/.next/standalone/node_modules/next/dist/server/app-render/collect-segment-data.js +600 -0
  556. package/.next/standalone/node_modules/next/dist/server/app-render/console-async-storage-instance.js +14 -0
  557. package/.next/standalone/node_modules/next/dist/server/app-render/console-async-storage.external.js +13 -0
  558. package/.next/standalone/node_modules/next/dist/server/app-render/create-component-styles-and-scripts.js +33 -0
  559. package/.next/standalone/node_modules/next/dist/server/app-render/create-component-tree.js +840 -0
  560. package/.next/standalone/node_modules/next/dist/server/app-render/create-error-handler.js +189 -0
  561. package/.next/standalone/node_modules/next/dist/server/app-render/create-flight-router-state-from-loader-tree.js +102 -0
  562. package/.next/standalone/node_modules/next/dist/server/app-render/csrf-protection.js +86 -0
  563. package/.next/standalone/node_modules/next/dist/server/app-render/debug-channel-server.js +30 -0
  564. package/.next/standalone/node_modules/next/dist/server/app-render/debug-channel-server.web.js +71 -0
  565. package/.next/standalone/node_modules/next/dist/server/app-render/dynamic-access-async-storage-instance.js +14 -0
  566. package/.next/standalone/node_modules/next/dist/server/app-render/dynamic-access-async-storage.external.js +13 -0
  567. package/.next/standalone/node_modules/next/dist/server/app-render/dynamic-rendering.js +1144 -0
  568. package/.next/standalone/node_modules/next/dist/server/app-render/encryption-utils-server.js +114 -0
  569. package/.next/standalone/node_modules/next/dist/server/app-render/encryption-utils.js +93 -0
  570. package/.next/standalone/node_modules/next/dist/server/app-render/encryption.js +259 -0
  571. package/.next/standalone/node_modules/next/dist/server/app-render/entry-base.js +256 -0
  572. package/.next/standalone/node_modules/next/dist/server/app-render/flight-render-result.js +28 -0
  573. package/.next/standalone/node_modules/next/dist/server/app-render/get-asset-query-string.js +29 -0
  574. package/.next/standalone/node_modules/next/dist/server/app-render/get-css-inlined-link-tags.js +49 -0
  575. package/.next/standalone/node_modules/next/dist/server/app-render/get-layer-assets.js +65 -0
  576. package/.next/standalone/node_modules/next/dist/server/app-render/get-preloadable-fonts.js +39 -0
  577. package/.next/standalone/node_modules/next/dist/server/app-render/get-script-nonce-from-header.js +44 -0
  578. package/.next/standalone/node_modules/next/dist/server/app-render/get-short-dynamic-param-type.js +25 -0
  579. package/.next/standalone/node_modules/next/dist/server/app-render/has-loading-component-in-tree.js +19 -0
  580. package/.next/standalone/node_modules/next/dist/server/app-render/instant-validation/boundary-constants.js +13 -0
  581. package/.next/standalone/node_modules/next/dist/server/app-render/instant-validation/boundary-impl.js +103 -0
  582. package/.next/standalone/node_modules/next/dist/server/app-render/instant-validation/boundary-tracking.js +18 -0
  583. package/.next/standalone/node_modules/next/dist/server/app-render/instant-validation/instant-config.js +181 -0
  584. package/.next/standalone/node_modules/next/dist/server/app-render/instant-validation/instant-samples-client.js +128 -0
  585. package/.next/standalone/node_modules/next/dist/server/app-render/instant-validation/instant-samples.js +432 -0
  586. package/.next/standalone/node_modules/next/dist/server/app-render/instant-validation/instant-validation-error.js +33 -0
  587. package/.next/standalone/node_modules/next/dist/server/app-render/instant-validation/instant-validation.js +713 -0
  588. package/.next/standalone/node_modules/next/dist/server/app-render/instant-validation/stream-utils.js +96 -0
  589. package/.next/standalone/node_modules/next/dist/server/app-render/interop-default.js +17 -0
  590. package/.next/standalone/node_modules/next/dist/server/app-render/make-get-server-inserted-html.js +92 -0
  591. package/.next/standalone/node_modules/next/dist/server/app-render/manifests-singleton.js +264 -0
  592. package/.next/standalone/node_modules/next/dist/server/app-render/metadata-insertion/create-server-inserted-metadata.js +28 -0
  593. package/.next/standalone/node_modules/next/dist/server/app-render/module-loading/track-dynamic-import.js +57 -0
  594. package/.next/standalone/node_modules/next/dist/server/app-render/module-loading/track-module-loading.external.js +32 -0
  595. package/.next/standalone/node_modules/next/dist/server/app-render/module-loading/track-module-loading.instance.js +66 -0
  596. package/.next/standalone/node_modules/next/dist/server/app-render/parse-and-validate-flight-router-state.js +49 -0
  597. package/.next/standalone/node_modules/next/dist/server/app-render/postponed-state.js +157 -0
  598. package/.next/standalone/node_modules/next/dist/server/app-render/prospective-render-utils.js +74 -0
  599. package/.next/standalone/node_modules/next/dist/server/app-render/react-large-shell-error.js +17 -0
  600. package/.next/standalone/node_modules/next/dist/server/app-render/react-server.node.js +39 -0
  601. package/.next/standalone/node_modules/next/dist/server/app-render/render-css-resource.js +52 -0
  602. package/.next/standalone/node_modules/next/dist/server/app-render/required-scripts.js +76 -0
  603. package/.next/standalone/node_modules/next/dist/server/app-render/rsc/postpone.js +18 -0
  604. package/.next/standalone/node_modules/next/dist/server/app-render/rsc/preloads.js +74 -0
  605. package/.next/standalone/node_modules/next/dist/server/app-render/rsc/taint.js +79 -0
  606. package/.next/standalone/node_modules/next/dist/server/app-render/segment-explorer-path.js +128 -0
  607. package/.next/standalone/node_modules/next/dist/server/app-render/server-inserted-html.js +77 -0
  608. package/.next/standalone/node_modules/next/dist/server/app-render/staged-rendering.js +343 -0
  609. package/.next/standalone/node_modules/next/dist/server/app-render/stale-time.js +111 -0
  610. package/.next/standalone/node_modules/next/dist/server/app-render/stream-ops.js +106 -0
  611. package/.next/standalone/node_modules/next/dist/server/app-render/stream-ops.web.js +163 -0
  612. package/.next/standalone/node_modules/next/dist/server/app-render/strip-flight-headers.js +18 -0
  613. package/.next/standalone/node_modules/next/dist/server/app-render/types.js +65 -0
  614. package/.next/standalone/node_modules/next/dist/server/app-render/use-flight-response.js +214 -0
  615. package/.next/standalone/node_modules/next/dist/server/app-render/vary-params.js +336 -0
  616. package/.next/standalone/node_modules/next/dist/server/app-render/walk-tree-with-flight-router-state.js +232 -0
  617. package/.next/standalone/node_modules/next/dist/server/app-render/work-async-storage-instance.js +14 -0
  618. package/.next/standalone/node_modules/next/dist/server/app-render/work-async-storage.external.js +13 -0
  619. package/.next/standalone/node_modules/next/dist/server/app-render/work-unit-async-storage-instance.js +14 -0
  620. package/.next/standalone/node_modules/next/dist/server/app-render/work-unit-async-storage.external.js +280 -0
  621. package/.next/standalone/node_modules/next/dist/server/async-storage/draft-mode-provider.js +62 -0
  622. package/.next/standalone/node_modules/next/dist/server/async-storage/request-store.js +144 -0
  623. package/.next/standalone/node_modules/next/dist/server/async-storage/with-store.js +6 -0
  624. package/.next/standalone/node_modules/next/dist/server/async-storage/work-store.js +91 -0
  625. package/.next/standalone/node_modules/next/dist/server/base-http/helpers.js +36 -0
  626. package/.next/standalone/node_modules/next/dist/server/base-http/index.js +54 -0
  627. package/.next/standalone/node_modules/next/dist/server/base-http/node.js +147 -0
  628. package/.next/standalone/node_modules/next/dist/server/base-http/web.js +124 -0
  629. package/.next/standalone/node_modules/next/dist/server/base-server.js +1874 -0
  630. package/.next/standalone/node_modules/next/dist/server/body-streams.js +114 -0
  631. package/.next/standalone/node_modules/next/dist/server/cache-dir.js +26 -0
  632. package/.next/standalone/node_modules/next/dist/server/capsize-font-metrics.json +181516 -0
  633. package/.next/standalone/node_modules/next/dist/server/ci-info.js +41 -0
  634. package/.next/standalone/node_modules/next/dist/server/client-component-renderer-logger.js +70 -0
  635. package/.next/standalone/node_modules/next/dist/server/config-schema.js +717 -0
  636. package/.next/standalone/node_modules/next/dist/server/config-shared.js +369 -0
  637. package/.next/standalone/node_modules/next/dist/server/config-utils.js +185 -0
  638. package/.next/standalone/node_modules/next/dist/server/config.js +1545 -0
  639. package/.next/standalone/node_modules/next/dist/server/create-deduped-by-callsite-server-error-logger.js +96 -0
  640. package/.next/standalone/node_modules/next/dist/server/crypto-utils.js +70 -0
  641. package/.next/standalone/node_modules/next/dist/server/dev/browser-logs/file-logger.js +186 -0
  642. package/.next/standalone/node_modules/next/dist/server/dev/browser-logs/receive-logs.js +558 -0
  643. package/.next/standalone/node_modules/next/dist/server/dev/browser-logs/source-map.js +222 -0
  644. package/.next/standalone/node_modules/next/dist/server/dev/debug-channel.js +87 -0
  645. package/.next/standalone/node_modules/next/dist/server/dev/dev-indicator-server-state.js +15 -0
  646. package/.next/standalone/node_modules/next/dist/server/dev/get-source-map-from-file.js +100 -0
  647. package/.next/standalone/node_modules/next/dist/server/dev/hot-middleware.js +274 -0
  648. package/.next/standalone/node_modules/next/dist/server/dev/hot-reloader-rspack.js +171 -0
  649. package/.next/standalone/node_modules/next/dist/server/dev/hot-reloader-shared-utils.js +56 -0
  650. package/.next/standalone/node_modules/next/dist/server/dev/hot-reloader-turbopack.js +1478 -0
  651. package/.next/standalone/node_modules/next/dist/server/dev/hot-reloader-types.js +58 -0
  652. package/.next/standalone/node_modules/next/dist/server/dev/hot-reloader-webpack.js +1386 -0
  653. package/.next/standalone/node_modules/next/dist/server/dev/log-requests.js +149 -0
  654. package/.next/standalone/node_modules/next/dist/server/dev/messages.js +74 -0
  655. package/.next/standalone/node_modules/next/dist/server/dev/middleware-turbopack.js +403 -0
  656. package/.next/standalone/node_modules/next/dist/server/dev/middleware-webpack.js +483 -0
  657. package/.next/standalone/node_modules/next/dist/server/dev/node-stack-frames.js +72 -0
  658. package/.next/standalone/node_modules/next/dist/server/dev/on-demand-entry-handler.js +773 -0
  659. package/.next/standalone/node_modules/next/dist/server/dev/parse-version-info.js +108 -0
  660. package/.next/standalone/node_modules/next/dist/server/dev/require-cache.js +79 -0
  661. package/.next/standalone/node_modules/next/dist/server/dev/serialized-errors.js +67 -0
  662. package/.next/standalone/node_modules/next/dist/server/dev/server-action-logger.js +37 -0
  663. package/.next/standalone/node_modules/next/dist/server/dev/static-paths-worker.js +104 -0
  664. package/.next/standalone/node_modules/next/dist/server/dev/turbopack-utils.js +687 -0
  665. package/.next/standalone/node_modules/next/dist/server/dynamic-rendering-utils.js +108 -0
  666. package/.next/standalone/node_modules/next/dist/server/font-utils.js +43 -0
  667. package/.next/standalone/node_modules/next/dist/server/get-app-route-from-entrypoint.js +30 -0
  668. package/.next/standalone/node_modules/next/dist/server/get-page-files.js +23 -0
  669. package/.next/standalone/node_modules/next/dist/server/get-route-from-entrypoint.js +35 -0
  670. package/.next/standalone/node_modules/next/dist/server/htmlescape.js +37 -0
  671. package/.next/standalone/node_modules/next/dist/server/image-optimizer.js +1220 -0
  672. package/.next/standalone/node_modules/next/dist/server/instrumentation/types.js +6 -0
  673. package/.next/standalone/node_modules/next/dist/server/instrumentation/utils.js +21 -0
  674. package/.next/standalone/node_modules/next/dist/server/internal-utils.js +39 -0
  675. package/.next/standalone/node_modules/next/dist/server/is-private-ip.js +36 -0
  676. package/.next/standalone/node_modules/next/dist/server/lib/app-dir-module.js +59 -0
  677. package/.next/standalone/node_modules/next/dist/server/lib/app-info-log.js +132 -0
  678. package/.next/standalone/node_modules/next/dist/server/lib/async-callback-set.js +29 -0
  679. package/.next/standalone/node_modules/next/dist/server/lib/cache-control.js +22 -0
  680. package/.next/standalone/node_modules/next/dist/server/lib/cache-handlers/default.external.js +18 -0
  681. package/.next/standalone/node_modules/next/dist/server/lib/cache-handlers/default.js +160 -0
  682. package/.next/standalone/node_modules/next/dist/server/lib/cache-handlers/types.js +8 -0
  683. package/.next/standalone/node_modules/next/dist/server/lib/chrome-devtools-workspace.js +116 -0
  684. package/.next/standalone/node_modules/next/dist/server/lib/clone-response.js +77 -0
  685. package/.next/standalone/node_modules/next/dist/server/lib/cpu-profile.js +59 -0
  686. package/.next/standalone/node_modules/next/dist/server/lib/decode-query-path-parameter.js +26 -0
  687. package/.next/standalone/node_modules/next/dist/server/lib/dedupe-fetch.js +163 -0
  688. package/.next/standalone/node_modules/next/dist/server/lib/dev-bundler-service.js +95 -0
  689. package/.next/standalone/node_modules/next/dist/server/lib/disk-lru-cache.external.js +57 -0
  690. package/.next/standalone/node_modules/next/dist/server/lib/etag.js +56 -0
  691. package/.next/standalone/node_modules/next/dist/server/lib/experimental/create-env-definitions.js +48 -0
  692. package/.next/standalone/node_modules/next/dist/server/lib/experimental/ppr.js +47 -0
  693. package/.next/standalone/node_modules/next/dist/server/lib/find-page-file.js +147 -0
  694. package/.next/standalone/node_modules/next/dist/server/lib/fix-mojibake.js +25 -0
  695. package/.next/standalone/node_modules/next/dist/server/lib/format-hostname.js +16 -0
  696. package/.next/standalone/node_modules/next/dist/server/lib/i18n-provider.js +129 -0
  697. package/.next/standalone/node_modules/next/dist/server/lib/implicit-tags.js +77 -0
  698. package/.next/standalone/node_modules/next/dist/server/lib/incremental-cache/file-system-cache.js +335 -0
  699. package/.next/standalone/node_modules/next/dist/server/lib/incremental-cache/index.js +501 -0
  700. package/.next/standalone/node_modules/next/dist/server/lib/incremental-cache/memory-cache.external.js +57 -0
  701. package/.next/standalone/node_modules/next/dist/server/lib/incremental-cache/shared-cache-controls.external.js +73 -0
  702. package/.next/standalone/node_modules/next/dist/server/lib/incremental-cache/tags-manifest.external.js +55 -0
  703. package/.next/standalone/node_modules/next/dist/server/lib/install-code-frame.js +22 -0
  704. package/.next/standalone/node_modules/next/dist/server/lib/is-ipv6.js +41 -0
  705. package/.next/standalone/node_modules/next/dist/server/lib/lazy-result.js +46 -0
  706. package/.next/standalone/node_modules/next/dist/server/lib/lru-cache.js +191 -0
  707. package/.next/standalone/node_modules/next/dist/server/lib/match-next-data-pathname.js +18 -0
  708. package/.next/standalone/node_modules/next/dist/server/lib/mock-request.js +416 -0
  709. package/.next/standalone/node_modules/next/dist/server/lib/module-loader/module-loader.js +8 -0
  710. package/.next/standalone/node_modules/next/dist/server/lib/module-loader/node-module-loader.js +25 -0
  711. package/.next/standalone/node_modules/next/dist/server/lib/module-loader/route-module-loader.js +26 -0
  712. package/.next/standalone/node_modules/next/dist/server/lib/node-fs-methods.js +28 -0
  713. package/.next/standalone/node_modules/next/dist/server/lib/parse-stack.js +46 -0
  714. package/.next/standalone/node_modules/next/dist/server/lib/patch-fetch.js +978 -0
  715. package/.next/standalone/node_modules/next/dist/server/lib/patch-set-header.js +38 -0
  716. package/.next/standalone/node_modules/next/dist/server/lib/postponed-request-body.js +64 -0
  717. package/.next/standalone/node_modules/next/dist/server/lib/render-server.js +155 -0
  718. package/.next/standalone/node_modules/next/dist/server/lib/router-server.js +683 -0
  719. package/.next/standalone/node_modules/next/dist/server/lib/router-utils/block-cross-site-dev.js +110 -0
  720. package/.next/standalone/node_modules/next/dist/server/lib/router-utils/build-data-route.js +48 -0
  721. package/.next/standalone/node_modules/next/dist/server/lib/router-utils/build-prefetch-segment-data-route.js +50 -0
  722. package/.next/standalone/node_modules/next/dist/server/lib/router-utils/cache-life-type-utils.js +211 -0
  723. package/.next/standalone/node_modules/next/dist/server/lib/router-utils/decode-path-params.js +42 -0
  724. package/.next/standalone/node_modules/next/dist/server/lib/router-utils/filesystem.js +591 -0
  725. package/.next/standalone/node_modules/next/dist/server/lib/router-utils/instrumentation-globals.external.js +89 -0
  726. package/.next/standalone/node_modules/next/dist/server/lib/router-utils/instrumentation-node-extensions.js +96 -0
  727. package/.next/standalone/node_modules/next/dist/server/lib/router-utils/is-postpone.js +16 -0
  728. package/.next/standalone/node_modules/next/dist/server/lib/router-utils/proxy-request.js +118 -0
  729. package/.next/standalone/node_modules/next/dist/server/lib/router-utils/resolve-routes.js +629 -0
  730. package/.next/standalone/node_modules/next/dist/server/lib/router-utils/route-types-utils.js +286 -0
  731. package/.next/standalone/node_modules/next/dist/server/lib/router-utils/router-server-context.js +26 -0
  732. package/.next/standalone/node_modules/next/dist/server/lib/router-utils/typegen.js +858 -0
  733. package/.next/standalone/node_modules/next/dist/server/lib/router-utils/types.js +6 -0
  734. package/.next/standalone/node_modules/next/dist/server/lib/server-action-request-meta.js +53 -0
  735. package/.next/standalone/node_modules/next/dist/server/lib/server-ipc/utils.js +81 -0
  736. package/.next/standalone/node_modules/next/dist/server/lib/source-maps.js +196 -0
  737. package/.next/standalone/node_modules/next/dist/server/lib/start-server.js +494 -0
  738. package/.next/standalone/node_modules/next/dist/server/lib/streaming-metadata.js +38 -0
  739. package/.next/standalone/node_modules/next/dist/server/lib/to-route.js +37 -0
  740. package/.next/standalone/node_modules/next/dist/server/lib/trace/constants.js +203 -0
  741. package/.next/standalone/node_modules/next/dist/server/lib/trace/tracer.js +280 -0
  742. package/.next/standalone/node_modules/next/dist/server/lib/trace/utils.js +16 -0
  743. package/.next/standalone/node_modules/next/dist/server/lib/types.js +6 -0
  744. package/.next/standalone/node_modules/next/dist/server/lib/utils.js +278 -0
  745. package/.next/standalone/node_modules/next/dist/server/lib/worker-utils.js +36 -0
  746. package/.next/standalone/node_modules/next/dist/server/load-components.js +179 -0
  747. package/.next/standalone/node_modules/next/dist/server/load-default-error-components.js +41 -0
  748. package/.next/standalone/node_modules/next/dist/server/load-manifest.external.js +117 -0
  749. package/.next/standalone/node_modules/next/dist/server/match-bundle.js +25 -0
  750. package/.next/standalone/node_modules/next/dist/server/mcp/get-mcp-middleware.js +49 -0
  751. package/.next/standalone/node_modules/next/dist/server/mcp/get-or-create-mcp-server.js +41 -0
  752. package/.next/standalone/node_modules/next/dist/server/mcp/mcp-telemetry-tracker.js +82 -0
  753. package/.next/standalone/node_modules/next/dist/server/mcp/tools/get-errors.js +114 -0
  754. package/.next/standalone/node_modules/next/dist/server/mcp/tools/get-logs.js +67 -0
  755. package/.next/standalone/node_modules/next/dist/server/mcp/tools/get-page-metadata.js +188 -0
  756. package/.next/standalone/node_modules/next/dist/server/mcp/tools/get-project-metadata.js +59 -0
  757. package/.next/standalone/node_modules/next/dist/server/mcp/tools/get-routes.js +136 -0
  758. package/.next/standalone/node_modules/next/dist/server/mcp/tools/get-server-action-by-id.js +121 -0
  759. package/.next/standalone/node_modules/next/dist/server/mcp/tools/next-instance-error-state.js +31 -0
  760. package/.next/standalone/node_modules/next/dist/server/mcp/tools/utils/browser-communication.js +90 -0
  761. package/.next/standalone/node_modules/next/dist/server/mcp/tools/utils/format-errors.js +137 -0
  762. package/.next/standalone/node_modules/next/dist/server/next-server.js +1429 -0
  763. package/.next/standalone/node_modules/next/dist/server/next-typescript.js +13 -0
  764. package/.next/standalone/node_modules/next/dist/server/next.js +455 -0
  765. package/.next/standalone/node_modules/next/dist/server/node-environment-baseline.js +25 -0
  766. package/.next/standalone/node_modules/next/dist/server/node-environment-extensions/console-dim.external.js +301 -0
  767. package/.next/standalone/node_modules/next/dist/server/node-environment-extensions/console-exit.js +49 -0
  768. package/.next/standalone/node_modules/next/dist/server/node-environment-extensions/console-file.js +56 -0
  769. package/.next/standalone/node_modules/next/dist/server/node-environment-extensions/date.js +52 -0
  770. package/.next/standalone/node_modules/next/dist/server/node-environment-extensions/error-inspect.js +8 -0
  771. package/.next/standalone/node_modules/next/dist/server/node-environment-extensions/fast-set-immediate.external.js +577 -0
  772. package/.next/standalone/node_modules/next/dist/server/node-environment-extensions/global-behaviors.js +33 -0
  773. package/.next/standalone/node_modules/next/dist/server/node-environment-extensions/io-utils.js +195 -0
  774. package/.next/standalone/node_modules/next/dist/server/node-environment-extensions/node-crypto.js +103 -0
  775. package/.next/standalone/node_modules/next/dist/server/node-environment-extensions/process-error-handlers.js +91 -0
  776. package/.next/standalone/node_modules/next/dist/server/node-environment-extensions/random.js +28 -0
  777. package/.next/standalone/node_modules/next/dist/server/node-environment-extensions/unhandled-rejection.external.js +508 -0
  778. package/.next/standalone/node_modules/next/dist/server/node-environment-extensions/web-crypto.js +45 -0
  779. package/.next/standalone/node_modules/next/dist/server/node-environment.js +19 -0
  780. package/.next/standalone/node_modules/next/dist/server/node-polyfill-crypto.js +21 -0
  781. package/.next/standalone/node_modules/next/dist/server/normalizers/absolute-filename-normalizer.js +33 -0
  782. package/.next/standalone/node_modules/next/dist/server/normalizers/built/app/app-bundle-path-normalizer.js +54 -0
  783. package/.next/standalone/node_modules/next/dist/server/normalizers/built/app/app-filename-normalizer.js +22 -0
  784. package/.next/standalone/node_modules/next/dist/server/normalizers/built/app/app-page-normalizer.js +40 -0
  785. package/.next/standalone/node_modules/next/dist/server/normalizers/built/app/app-pathname-normalizer.js +55 -0
  786. package/.next/standalone/node_modules/next/dist/server/normalizers/built/app/index.js +42 -0
  787. package/.next/standalone/node_modules/next/dist/server/normalizers/built/pages/index.js +44 -0
  788. package/.next/standalone/node_modules/next/dist/server/normalizers/built/pages/pages-bundle-path-normalizer.js +55 -0
  789. package/.next/standalone/node_modules/next/dist/server/normalizers/built/pages/pages-filename-normalizer.js +22 -0
  790. package/.next/standalone/node_modules/next/dist/server/normalizers/built/pages/pages-page-normalizer.js +19 -0
  791. package/.next/standalone/node_modules/next/dist/server/normalizers/built/pages/pages-pathname-normalizer.js +19 -0
  792. package/.next/standalone/node_modules/next/dist/server/normalizers/locale-route-normalizer.js +26 -0
  793. package/.next/standalone/node_modules/next/dist/server/normalizers/normalizer.js +6 -0
  794. package/.next/standalone/node_modules/next/dist/server/normalizers/normalizers.js +23 -0
  795. package/.next/standalone/node_modules/next/dist/server/normalizers/prefixing-normalizer.js +26 -0
  796. package/.next/standalone/node_modules/next/dist/server/normalizers/request/base-path.js +25 -0
  797. package/.next/standalone/node_modules/next/dist/server/normalizers/request/next-data.js +38 -0
  798. package/.next/standalone/node_modules/next/dist/server/normalizers/request/pathname-normalizer.js +6 -0
  799. package/.next/standalone/node_modules/next/dist/server/normalizers/request/prefix.js +39 -0
  800. package/.next/standalone/node_modules/next/dist/server/normalizers/request/rsc.js +19 -0
  801. package/.next/standalone/node_modules/next/dist/server/normalizers/request/segment-prefix-rsc.js +33 -0
  802. package/.next/standalone/node_modules/next/dist/server/normalizers/request/suffix.js +27 -0
  803. package/.next/standalone/node_modules/next/dist/server/normalizers/underscore-normalizer.js +17 -0
  804. package/.next/standalone/node_modules/next/dist/server/normalizers/wrap-normalizer-fn.js +17 -0
  805. package/.next/standalone/node_modules/next/dist/server/og/image-response.js +53 -0
  806. package/.next/standalone/node_modules/next/dist/server/patch-error-inspect.js +453 -0
  807. package/.next/standalone/node_modules/next/dist/server/pipe-readable.js +140 -0
  808. package/.next/standalone/node_modules/next/dist/server/post-process.js +39 -0
  809. package/.next/standalone/node_modules/next/dist/server/render-result.js +204 -0
  810. package/.next/standalone/node_modules/next/dist/server/render.js +1140 -0
  811. package/.next/standalone/node_modules/next/dist/server/request/connection.js +133 -0
  812. package/.next/standalone/node_modules/next/dist/server/request/cookies.js +235 -0
  813. package/.next/standalone/node_modules/next/dist/server/request/draft-mode.js +230 -0
  814. package/.next/standalone/node_modules/next/dist/server/request/fallback-params.js +69 -0
  815. package/.next/standalone/node_modules/next/dist/server/request/headers.js +229 -0
  816. package/.next/standalone/node_modules/next/dist/server/request/params.js +527 -0
  817. package/.next/standalone/node_modules/next/dist/server/request/pathname.js +119 -0
  818. package/.next/standalone/node_modules/next/dist/server/request/root-params.js +194 -0
  819. package/.next/standalone/node_modules/next/dist/server/request/search-params.js +526 -0
  820. package/.next/standalone/node_modules/next/dist/server/request/utils.js +51 -0
  821. package/.next/standalone/node_modules/next/dist/server/request-meta.js +55 -0
  822. package/.next/standalone/node_modules/next/dist/server/require-hook.js +82 -0
  823. package/.next/standalone/node_modules/next/dist/server/require.js +109 -0
  824. package/.next/standalone/node_modules/next/dist/server/response-cache/index.js +311 -0
  825. package/.next/standalone/node_modules/next/dist/server/response-cache/types.js +41 -0
  826. package/.next/standalone/node_modules/next/dist/server/response-cache/utils.js +104 -0
  827. package/.next/standalone/node_modules/next/dist/server/response-cache/web.js +101 -0
  828. package/.next/standalone/node_modules/next/dist/server/resume-data-cache/cache-store.js +96 -0
  829. package/.next/standalone/node_modules/next/dist/server/resume-data-cache/resume-data-cache.js +124 -0
  830. package/.next/standalone/node_modules/next/dist/server/revalidation-utils.js +157 -0
  831. package/.next/standalone/node_modules/next/dist/server/route-definitions/app-page-route-definition.js +16 -0
  832. package/.next/standalone/node_modules/next/dist/server/route-definitions/app-route-route-definition.js +6 -0
  833. package/.next/standalone/node_modules/next/dist/server/route-definitions/locale-route-definition.js +6 -0
  834. package/.next/standalone/node_modules/next/dist/server/route-definitions/pages-api-route-definition.js +6 -0
  835. package/.next/standalone/node_modules/next/dist/server/route-definitions/pages-route-definition.js +6 -0
  836. package/.next/standalone/node_modules/next/dist/server/route-definitions/route-definition.js +6 -0
  837. package/.next/standalone/node_modules/next/dist/server/route-kind.js +32 -0
  838. package/.next/standalone/node_modules/next/dist/server/route-matcher-managers/default-route-matcher-manager.js +239 -0
  839. package/.next/standalone/node_modules/next/dist/server/route-matcher-managers/dev-route-matcher-manager.js +120 -0
  840. package/.next/standalone/node_modules/next/dist/server/route-matcher-managers/route-matcher-manager.js +6 -0
  841. package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/app-page-route-matcher-provider.js +55 -0
  842. package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/app-route-route-matcher-provider.js +43 -0
  843. package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/dev/dev-app-page-route-matcher-provider.js +91 -0
  844. package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/dev/dev-app-route-route-matcher-provider.js +112 -0
  845. package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/dev/dev-pages-api-route-matcher-provider.js +77 -0
  846. package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/dev/dev-pages-route-matcher-provider.js +77 -0
  847. package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/dev/file-cache-route-matcher-provider.js +28 -0
  848. package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/dev/helpers/file-reader/batched-file-reader.js +106 -0
  849. package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/dev/helpers/file-reader/default-file-reader.js +42 -0
  850. package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/dev/helpers/file-reader/file-reader.js +6 -0
  851. package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/helpers/cached-route-matcher-provider.js +30 -0
  852. package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/helpers/manifest-loaders/manifest-loader.js +6 -0
  853. package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/helpers/manifest-loaders/node-manifest-loader.js +34 -0
  854. package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/helpers/manifest-loaders/server-manifest-loader.js +20 -0
  855. package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/manifest-route-matcher-provider.js +21 -0
  856. package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/pages-api-route-matcher-provider.js +55 -0
  857. package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/pages-route-matcher-provider.js +64 -0
  858. package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/route-matcher-provider.js +6 -0
  859. package/.next/standalone/node_modules/next/dist/server/route-matchers/app-page-route-matcher.js +18 -0
  860. package/.next/standalone/node_modules/next/dist/server/route-matchers/app-route-route-matcher.js +15 -0
  861. package/.next/standalone/node_modules/next/dist/server/route-matchers/locale-route-matcher.js +68 -0
  862. package/.next/standalone/node_modules/next/dist/server/route-matchers/pages-api-route-matcher.js +30 -0
  863. package/.next/standalone/node_modules/next/dist/server/route-matchers/pages-route-matcher.js +30 -0
  864. package/.next/standalone/node_modules/next/dist/server/route-matchers/route-matcher.js +54 -0
  865. package/.next/standalone/node_modules/next/dist/server/route-matches/app-page-route-match.js +6 -0
  866. package/.next/standalone/node_modules/next/dist/server/route-matches/app-route-route-match.js +6 -0
  867. package/.next/standalone/node_modules/next/dist/server/route-matches/locale-route-match.js +6 -0
  868. package/.next/standalone/node_modules/next/dist/server/route-matches/pages-api-route-match.js +16 -0
  869. package/.next/standalone/node_modules/next/dist/server/route-matches/pages-route-match.js +6 -0
  870. package/.next/standalone/node_modules/next/dist/server/route-matches/route-match.js +6 -0
  871. package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/helpers/prerender-manifest-matcher.js +51 -0
  872. package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/module.compiled.js +36 -0
  873. package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/module.js +162 -0
  874. package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/module.render.js +24 -0
  875. package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/normalize-request-url.js +25 -0
  876. package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/vendored/contexts/app-router-context.js +4 -0
  877. package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/vendored/contexts/entrypoints.js +87 -0
  878. package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/vendored/contexts/head-manager-context.js +4 -0
  879. package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/vendored/contexts/hooks-client-context.js +4 -0
  880. package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/vendored/contexts/image-config-context.js +4 -0
  881. package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/vendored/contexts/router-context.js +4 -0
  882. package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/vendored/contexts/server-inserted-html.js +4 -0
  883. package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/vendored/rsc/entrypoints.js +140 -0
  884. package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/vendored/rsc/react-compiler-runtime.js +4 -0
  885. package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/vendored/rsc/react-dom.js +4 -0
  886. package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/vendored/rsc/react-jsx-dev-runtime.js +4 -0
  887. package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/vendored/rsc/react-jsx-runtime.js +4 -0
  888. package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/vendored/rsc/react-server-dom-turbopack-server.js +4 -0
  889. package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/vendored/rsc/react-server-dom-turbopack-static.js +4 -0
  890. package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/vendored/rsc/react-server-dom-webpack-server.js +4 -0
  891. package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/vendored/rsc/react-server-dom-webpack-static.js +4 -0
  892. package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/vendored/rsc/react.js +4 -0
  893. package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/vendored/ssr/entrypoints.js +125 -0
  894. package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/vendored/ssr/react-compiler-runtime.js +4 -0
  895. package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/vendored/ssr/react-dom-server.js +4 -0
  896. package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/vendored/ssr/react-dom.js +4 -0
  897. package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/vendored/ssr/react-jsx-dev-runtime.js +4 -0
  898. package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/vendored/ssr/react-jsx-runtime.js +4 -0
  899. package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/vendored/ssr/react-server-dom-turbopack-client.js +4 -0
  900. package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/vendored/ssr/react-server-dom-webpack-client.js +4 -0
  901. package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/vendored/ssr/react.js +4 -0
  902. package/.next/standalone/node_modules/next/dist/server/route-modules/app-route/helpers/auto-implement-methods.js +85 -0
  903. package/.next/standalone/node_modules/next/dist/server/route-modules/app-route/helpers/clean-url.js +24 -0
  904. package/.next/standalone/node_modules/next/dist/server/route-modules/app-route/helpers/get-pathname-from-absolute-path.js +29 -0
  905. package/.next/standalone/node_modules/next/dist/server/route-modules/app-route/helpers/is-static-gen-enabled.js +15 -0
  906. package/.next/standalone/node_modules/next/dist/server/route-modules/app-route/helpers/parsed-url-query-to-params.js +20 -0
  907. package/.next/standalone/node_modules/next/dist/server/route-modules/app-route/module.compiled.js +36 -0
  908. package/.next/standalone/node_modules/next/dist/server/route-modules/app-route/module.js +899 -0
  909. package/.next/standalone/node_modules/next/dist/server/route-modules/app-route/shared-modules.js +56 -0
  910. package/.next/standalone/node_modules/next/dist/server/route-modules/checks.js +45 -0
  911. package/.next/standalone/node_modules/next/dist/server/route-modules/pages/builtin/_error.js +100 -0
  912. package/.next/standalone/node_modules/next/dist/server/route-modules/pages/module.compiled.js +20 -0
  913. package/.next/standalone/node_modules/next/dist/server/route-modules/pages/module.js +92 -0
  914. package/.next/standalone/node_modules/next/dist/server/route-modules/pages/module.render.js +24 -0
  915. package/.next/standalone/node_modules/next/dist/server/route-modules/pages/pages-handler.js +545 -0
  916. package/.next/standalone/node_modules/next/dist/server/route-modules/pages/vendored/contexts/app-router-context.js +4 -0
  917. package/.next/standalone/node_modules/next/dist/server/route-modules/pages/vendored/contexts/entrypoints.js +102 -0
  918. package/.next/standalone/node_modules/next/dist/server/route-modules/pages/vendored/contexts/head-manager-context.js +4 -0
  919. package/.next/standalone/node_modules/next/dist/server/route-modules/pages/vendored/contexts/hooks-client-context.js +4 -0
  920. package/.next/standalone/node_modules/next/dist/server/route-modules/pages/vendored/contexts/html-context.js +4 -0
  921. package/.next/standalone/node_modules/next/dist/server/route-modules/pages/vendored/contexts/image-config-context.js +4 -0
  922. package/.next/standalone/node_modules/next/dist/server/route-modules/pages/vendored/contexts/loadable-context.js +4 -0
  923. package/.next/standalone/node_modules/next/dist/server/route-modules/pages/vendored/contexts/loadable.js +4 -0
  924. package/.next/standalone/node_modules/next/dist/server/route-modules/pages/vendored/contexts/router-context.js +4 -0
  925. package/.next/standalone/node_modules/next/dist/server/route-modules/pages/vendored/contexts/server-inserted-html.js +4 -0
  926. package/.next/standalone/node_modules/next/dist/server/route-modules/pages-api/module.compiled.js +20 -0
  927. package/.next/standalone/node_modules/next/dist/server/route-modules/pages-api/module.js +58 -0
  928. package/.next/standalone/node_modules/next/dist/server/route-modules/route-module.js +650 -0
  929. package/.next/standalone/node_modules/next/dist/server/runtime-reacts.external.js +46 -0
  930. package/.next/standalone/node_modules/next/dist/server/send-payload.js +88 -0
  931. package/.next/standalone/node_modules/next/dist/server/send-response.js +70 -0
  932. package/.next/standalone/node_modules/next/dist/server/serve-static.js +66 -0
  933. package/.next/standalone/node_modules/next/dist/server/server-route-utils.js +30 -0
  934. package/.next/standalone/node_modules/next/dist/server/server-utils.js +323 -0
  935. package/.next/standalone/node_modules/next/dist/server/setup-http-agent-env.js +31 -0
  936. package/.next/standalone/node_modules/next/dist/server/stream-utils/encoded-tags.js +122 -0
  937. package/.next/standalone/node_modules/next/dist/server/stream-utils/node-web-streams-helper.js +918 -0
  938. package/.next/standalone/node_modules/next/dist/server/stream-utils/uint8array-helpers.js +74 -0
  939. package/.next/standalone/node_modules/next/dist/server/typescript/constant.js +98 -0
  940. package/.next/standalone/node_modules/next/dist/server/typescript/index.js +199 -0
  941. package/.next/standalone/node_modules/next/dist/server/typescript/rules/client-boundary.js +97 -0
  942. package/.next/standalone/node_modules/next/dist/server/typescript/rules/config.js +512 -0
  943. package/.next/standalone/node_modules/next/dist/server/typescript/rules/entry.js +149 -0
  944. package/.next/standalone/node_modules/next/dist/server/typescript/rules/error.js +38 -0
  945. package/.next/standalone/node_modules/next/dist/server/typescript/rules/metadata.js +234 -0
  946. package/.next/standalone/node_modules/next/dist/server/typescript/rules/server-boundary.js +115 -0
  947. package/.next/standalone/node_modules/next/dist/server/typescript/rules/server.js +79 -0
  948. package/.next/standalone/node_modules/next/dist/server/typescript/utils.js +212 -0
  949. package/.next/standalone/node_modules/next/dist/server/use-cache/cache-life.js +163 -0
  950. package/.next/standalone/node_modules/next/dist/server/use-cache/cache-tag.js +52 -0
  951. package/.next/standalone/node_modules/next/dist/server/use-cache/constants.js +28 -0
  952. package/.next/standalone/node_modules/next/dist/server/use-cache/handlers.js +121 -0
  953. package/.next/standalone/node_modules/next/dist/server/use-cache/use-cache-errors.js +36 -0
  954. package/.next/standalone/node_modules/next/dist/server/use-cache/use-cache-wrapper.js +1588 -0
  955. package/.next/standalone/node_modules/next/dist/server/utils.js +73 -0
  956. package/.next/standalone/node_modules/next/dist/server/web/adapter.js +392 -0
  957. package/.next/standalone/node_modules/next/dist/server/web/edge-route-module-wrapper.js +123 -0
  958. package/.next/standalone/node_modules/next/dist/server/web/error.js +54 -0
  959. package/.next/standalone/node_modules/next/dist/server/web/exports/index.js +56 -0
  960. package/.next/standalone/node_modules/next/dist/server/web/get-edge-preview-props.js +23 -0
  961. package/.next/standalone/node_modules/next/dist/server/web/globals.js +128 -0
  962. package/.next/standalone/node_modules/next/dist/server/web/http.js +39 -0
  963. package/.next/standalone/node_modules/next/dist/server/web/internal-edge-wait-until.js +64 -0
  964. package/.next/standalone/node_modules/next/dist/server/web/next-url.js +199 -0
  965. package/.next/standalone/node_modules/next/dist/server/web/sandbox/context.js +462 -0
  966. package/.next/standalone/node_modules/next/dist/server/web/sandbox/fetch-inline-assets.js +35 -0
  967. package/.next/standalone/node_modules/next/dist/server/web/sandbox/index.js +28 -0
  968. package/.next/standalone/node_modules/next/dist/server/web/sandbox/resource-managers.js +88 -0
  969. package/.next/standalone/node_modules/next/dist/server/web/sandbox/sandbox.js +137 -0
  970. package/.next/standalone/node_modules/next/dist/server/web/spec-extension/adapters/headers.js +192 -0
  971. package/.next/standalone/node_modules/next/dist/server/web/spec-extension/adapters/next-request.js +142 -0
  972. package/.next/standalone/node_modules/next/dist/server/web/spec-extension/adapters/reflect.js +30 -0
  973. package/.next/standalone/node_modules/next/dist/server/web/spec-extension/adapters/request-cookies.js +211 -0
  974. package/.next/standalone/node_modules/next/dist/server/web/spec-extension/cookies.js +29 -0
  975. package/.next/standalone/node_modules/next/dist/server/web/spec-extension/fetch-event.js +98 -0
  976. package/.next/standalone/node_modules/next/dist/server/web/spec-extension/image-response.js +22 -0
  977. package/.next/standalone/node_modules/next/dist/server/web/spec-extension/request.js +99 -0
  978. package/.next/standalone/node_modules/next/dist/server/web/spec-extension/response.js +136 -0
  979. package/.next/standalone/node_modules/next/dist/server/web/spec-extension/revalidate.js +214 -0
  980. package/.next/standalone/node_modules/next/dist/server/web/spec-extension/unstable-cache.js +289 -0
  981. package/.next/standalone/node_modules/next/dist/server/web/spec-extension/unstable-no-store.js +51 -0
  982. package/.next/standalone/node_modules/next/dist/server/web/spec-extension/url-pattern.js +14 -0
  983. package/.next/standalone/node_modules/next/dist/server/web/spec-extension/user-agent.js +46 -0
  984. package/.next/standalone/node_modules/next/dist/server/web/types.js +6 -0
  985. package/.next/standalone/node_modules/next/dist/server/web/utils.js +151 -0
  986. package/.next/standalone/node_modules/next/dist/server/web/web-on-close.js +87 -0
  987. package/.next/standalone/node_modules/next/dist/shared/lib/action-revalidation-kind.js +31 -0
  988. package/.next/standalone/node_modules/next/dist/shared/lib/app-router-context.shared-runtime.js +50 -0
  989. package/.next/standalone/node_modules/next/dist/shared/lib/app-router-types.js +46 -0
  990. package/.next/standalone/node_modules/next/dist/shared/lib/constants.js +448 -0
  991. package/.next/standalone/node_modules/next/dist/shared/lib/deep-freeze.js +30 -0
  992. package/.next/standalone/node_modules/next/dist/shared/lib/deployment-id.js +63 -0
  993. package/.next/standalone/node_modules/next/dist/shared/lib/dset.js +34 -0
  994. package/.next/standalone/node_modules/next/dist/shared/lib/encode-uri-path.js +15 -0
  995. package/.next/standalone/node_modules/next/dist/shared/lib/entry-constants.js +36 -0
  996. package/.next/standalone/node_modules/next/dist/shared/lib/error-source.js +36 -0
  997. package/.next/standalone/node_modules/next/dist/shared/lib/errors/canary-only-config-error.js +39 -0
  998. package/.next/standalone/node_modules/next/dist/shared/lib/errors/code-frame.js +20 -0
  999. package/.next/standalone/node_modules/next/dist/shared/lib/errors/constants.js +19 -0
  1000. package/.next/standalone/node_modules/next/dist/shared/lib/errors/empty-generate-static-params-error.js +24 -0
  1001. package/.next/standalone/node_modules/next/dist/shared/lib/errors/hard-deprecated-config-error.js +20 -0
  1002. package/.next/standalone/node_modules/next/dist/shared/lib/escape-regexp.js +22 -0
  1003. package/.next/standalone/node_modules/next/dist/shared/lib/get-hostname.js +23 -0
  1004. package/.next/standalone/node_modules/next/dist/shared/lib/hash.js +42 -0
  1005. package/.next/standalone/node_modules/next/dist/shared/lib/head-manager-context.shared-runtime.js +18 -0
  1006. package/.next/standalone/node_modules/next/dist/shared/lib/head.js +163 -0
  1007. package/.next/standalone/node_modules/next/dist/shared/lib/hooks-client-context.shared-runtime.js +60 -0
  1008. package/.next/standalone/node_modules/next/dist/shared/lib/html-context.shared-runtime.js +40 -0
  1009. package/.next/standalone/node_modules/next/dist/shared/lib/i18n/detect-domain-locale.js +25 -0
  1010. package/.next/standalone/node_modules/next/dist/shared/lib/i18n/get-locale-redirect.js +59 -0
  1011. package/.next/standalone/node_modules/next/dist/shared/lib/i18n/normalize-locale-path.js +54 -0
  1012. package/.next/standalone/node_modules/next/dist/shared/lib/image-blur-svg.js +22 -0
  1013. package/.next/standalone/node_modules/next/dist/shared/lib/image-config-context.shared-runtime.js +19 -0
  1014. package/.next/standalone/node_modules/next/dist/shared/lib/image-config.js +77 -0
  1015. package/.next/standalone/node_modules/next/dist/shared/lib/invariant-error.js +18 -0
  1016. package/.next/standalone/node_modules/next/dist/shared/lib/is-plain-object.js +42 -0
  1017. package/.next/standalone/node_modules/next/dist/shared/lib/is-thenable.js +20 -0
  1018. package/.next/standalone/node_modules/next/dist/shared/lib/isomorphic/path.js +14 -0
  1019. package/.next/standalone/node_modules/next/dist/shared/lib/lazy-dynamic/bailout-to-csr.js +37 -0
  1020. package/.next/standalone/node_modules/next/dist/shared/lib/loadable-context.shared-runtime.js +19 -0
  1021. package/.next/standalone/node_modules/next/dist/shared/lib/loadable.shared-runtime.js +246 -0
  1022. package/.next/standalone/node_modules/next/dist/shared/lib/match-local-pattern.js +46 -0
  1023. package/.next/standalone/node_modules/next/dist/shared/lib/match-remote-pattern.js +63 -0
  1024. package/.next/standalone/node_modules/next/dist/shared/lib/modern-browserslist-target.js +15 -0
  1025. package/.next/standalone/node_modules/next/dist/shared/lib/no-fallback-error.external.js +18 -0
  1026. package/.next/standalone/node_modules/next/dist/shared/lib/normalized-asset-prefix.js +28 -0
  1027. package/.next/standalone/node_modules/next/dist/shared/lib/page-path/absolute-path-to-page.js +26 -0
  1028. package/.next/standalone/node_modules/next/dist/shared/lib/page-path/denormalize-page-path.js +18 -0
  1029. package/.next/standalone/node_modules/next/dist/shared/lib/page-path/ensure-leading-slash.js +18 -0
  1030. package/.next/standalone/node_modules/next/dist/shared/lib/page-path/get-page-paths.js +40 -0
  1031. package/.next/standalone/node_modules/next/dist/shared/lib/page-path/normalize-data-path.js +23 -0
  1032. package/.next/standalone/node_modules/next/dist/shared/lib/page-path/normalize-page-path.js +26 -0
  1033. package/.next/standalone/node_modules/next/dist/shared/lib/page-path/normalize-path-sep.js +19 -0
  1034. package/.next/standalone/node_modules/next/dist/shared/lib/page-path/remove-page-path-tail.js +20 -0
  1035. package/.next/standalone/node_modules/next/dist/shared/lib/promise-with-resolvers.js +26 -0
  1036. package/.next/standalone/node_modules/next/dist/shared/lib/router/adapters.js +136 -0
  1037. package/.next/standalone/node_modules/next/dist/shared/lib/router/routes/app.js +122 -0
  1038. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/add-locale.js +28 -0
  1039. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/add-path-prefix.js +20 -0
  1040. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/add-path-suffix.js +20 -0
  1041. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/app-paths.js +62 -0
  1042. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/as-path-to-search-params.js +17 -0
  1043. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/cache-busting-search-param.js +24 -0
  1044. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/escape-path-delimiters.js +16 -0
  1045. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/format-next-pathname-info.js +27 -0
  1046. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/format-url.js +111 -0
  1047. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/get-dynamic-param.js +174 -0
  1048. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/get-next-pathname-info.js +52 -0
  1049. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/get-route-from-asset-path.js +25 -0
  1050. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/get-segment-param.js +90 -0
  1051. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/html-bots.js +17 -0
  1052. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/index.js +30 -0
  1053. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/interception-prefix-from-param-type.js +33 -0
  1054. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/interception-routes.js +108 -0
  1055. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/is-bot.js +57 -0
  1056. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/is-dynamic.js +26 -0
  1057. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/middleware-route-matcher.js +31 -0
  1058. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/parse-loader-tree.js +30 -0
  1059. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/parse-path.js +33 -0
  1060. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/parse-relative-url.js +43 -0
  1061. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/parse-url.js +38 -0
  1062. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/path-has-prefix.js +20 -0
  1063. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/path-match.js +49 -0
  1064. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/prepare-destination.js +292 -0
  1065. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/querystring.js +79 -0
  1066. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/relativize-url.js +40 -0
  1067. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/remove-path-prefix.js +39 -0
  1068. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/remove-trailing-slash.js +21 -0
  1069. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/resolve-param-value.js +116 -0
  1070. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/route-match-utils.js +113 -0
  1071. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/route-matcher.js +45 -0
  1072. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/route-regex.js +256 -0
  1073. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/sorted-routes.js +244 -0
  1074. package/.next/standalone/node_modules/next/dist/shared/lib/router-context.shared-runtime.js +18 -0
  1075. package/.next/standalone/node_modules/next/dist/shared/lib/segment-cache/segment-value-encoding.js +99 -0
  1076. package/.next/standalone/node_modules/next/dist/shared/lib/segment-cache/vary-params-decoding.js +32 -0
  1077. package/.next/standalone/node_modules/next/dist/shared/lib/segment.js +102 -0
  1078. package/.next/standalone/node_modules/next/dist/shared/lib/server-inserted-html.shared-runtime.js +35 -0
  1079. package/.next/standalone/node_modules/next/dist/shared/lib/server-reference-info.js +56 -0
  1080. package/.next/standalone/node_modules/next/dist/shared/lib/side-effect.js +63 -0
  1081. package/.next/standalone/node_modules/next/dist/shared/lib/size-limit.js +40 -0
  1082. package/.next/standalone/node_modules/next/dist/shared/lib/turbopack/internal-error.js +53 -0
  1083. package/.next/standalone/node_modules/next/dist/shared/lib/utils/reflect-utils.js +69 -0
  1084. package/.next/standalone/node_modules/next/dist/shared/lib/utils/warn-once.js +22 -0
  1085. package/.next/standalone/node_modules/next/dist/shared/lib/utils.js +207 -0
  1086. package/.next/standalone/node_modules/next/dist/shared/lib/zod.js +101 -0
  1087. package/.next/standalone/node_modules/next/dist/telemetry/anonymous-meta.js +89 -0
  1088. package/.next/standalone/node_modules/next/dist/telemetry/detached-flush.js +56 -0
  1089. package/.next/standalone/node_modules/next/dist/telemetry/events/build.js +174 -0
  1090. package/.next/standalone/node_modules/next/dist/telemetry/events/index.js +41 -0
  1091. package/.next/standalone/node_modules/next/dist/telemetry/events/plugins.js +51 -0
  1092. package/.next/standalone/node_modules/next/dist/telemetry/events/swc-load-failure.js +55 -0
  1093. package/.next/standalone/node_modules/next/dist/telemetry/events/version.js +66 -0
  1094. package/.next/standalone/node_modules/next/dist/telemetry/flush-telemetry.js +19 -0
  1095. package/.next/standalone/node_modules/next/dist/telemetry/post-telemetry-payload.js +48 -0
  1096. package/.next/standalone/node_modules/next/dist/telemetry/project-id.js +48 -0
  1097. package/.next/standalone/node_modules/next/dist/telemetry/storage.js +301 -0
  1098. package/.next/standalone/node_modules/next/dist/trace/index.js +58 -0
  1099. package/.next/standalone/node_modules/next/dist/trace/report/index.js +37 -0
  1100. package/.next/standalone/node_modules/next/dist/trace/report/to-json-build.js +40 -0
  1101. package/.next/standalone/node_modules/next/dist/trace/report/to-json.js +165 -0
  1102. package/.next/standalone/node_modules/next/dist/trace/report/to-telemetry.js +36 -0
  1103. package/.next/standalone/node_modules/next/dist/trace/shared.js +39 -0
  1104. package/.next/standalone/node_modules/next/dist/trace/trace.js +211 -0
  1105. package/.next/standalone/node_modules/next/package.json +378 -0
  1106. package/.next/standalone/node_modules/react/cjs/react-compiler-runtime.production.js +16 -0
  1107. package/.next/standalone/node_modules/react/cjs/react-jsx-dev-runtime.production.js +14 -0
  1108. package/.next/standalone/node_modules/react/cjs/react-jsx-runtime.production.js +34 -0
  1109. package/.next/standalone/node_modules/react/cjs/react.development.js +1284 -0
  1110. package/.next/standalone/node_modules/react/cjs/react.production.js +542 -0
  1111. package/.next/standalone/node_modules/react/compiler-runtime.js +14 -0
  1112. package/.next/standalone/node_modules/react/index.js +7 -0
  1113. package/.next/standalone/node_modules/react/jsx-dev-runtime.js +7 -0
  1114. package/.next/standalone/node_modules/react/jsx-runtime.js +7 -0
  1115. package/.next/standalone/node_modules/react/package.json +51 -0
  1116. package/.next/standalone/node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.js +6603 -0
  1117. package/.next/standalone/node_modules/react-dom/cjs/react-dom-server-legacy.node.production.js +6692 -0
  1118. package/.next/standalone/node_modules/react-dom/cjs/react-dom-server.browser.production.js +7410 -0
  1119. package/.next/standalone/node_modules/react-dom/cjs/react-dom-server.edge.production.js +7512 -0
  1120. package/.next/standalone/node_modules/react-dom/cjs/react-dom-server.node.production.js +7707 -0
  1121. package/.next/standalone/node_modules/react-dom/cjs/react-dom.production.js +210 -0
  1122. package/.next/standalone/node_modules/react-dom/index.js +38 -0
  1123. package/.next/standalone/node_modules/react-dom/package.json +117 -0
  1124. package/.next/standalone/node_modules/react-dom/server.browser.js +16 -0
  1125. package/.next/standalone/node_modules/react-dom/server.edge.js +17 -0
  1126. package/.next/standalone/node_modules/react-dom/server.node.js +18 -0
  1127. package/.next/standalone/node_modules/react-dom/static.node.js +14 -0
  1128. package/.next/standalone/node_modules/sharp/lib/channel.js +177 -0
  1129. package/.next/standalone/node_modules/sharp/lib/colour.js +195 -0
  1130. package/.next/standalone/node_modules/sharp/lib/composite.js +212 -0
  1131. package/.next/standalone/node_modules/sharp/lib/constructor.js +499 -0
  1132. package/.next/standalone/node_modules/sharp/lib/index.js +16 -0
  1133. package/.next/standalone/node_modules/sharp/lib/input.js +809 -0
  1134. package/.next/standalone/node_modules/sharp/lib/is.js +143 -0
  1135. package/.next/standalone/node_modules/sharp/lib/libvips.js +207 -0
  1136. package/.next/standalone/node_modules/sharp/lib/operation.js +1016 -0
  1137. package/.next/standalone/node_modules/sharp/lib/output.js +1666 -0
  1138. package/.next/standalone/node_modules/sharp/lib/resize.js +595 -0
  1139. package/.next/standalone/node_modules/sharp/lib/sharp.js +121 -0
  1140. package/.next/standalone/node_modules/sharp/lib/utility.js +291 -0
  1141. package/.next/standalone/node_modules/sharp/node_modules/semver/classes/comparator.js +143 -0
  1142. package/.next/standalone/node_modules/sharp/node_modules/semver/classes/range.js +557 -0
  1143. package/.next/standalone/node_modules/sharp/node_modules/semver/classes/semver.js +333 -0
  1144. package/.next/standalone/node_modules/sharp/node_modules/semver/functions/cmp.js +54 -0
  1145. package/.next/standalone/node_modules/sharp/node_modules/semver/functions/coerce.js +62 -0
  1146. package/.next/standalone/node_modules/sharp/node_modules/semver/functions/compare.js +7 -0
  1147. package/.next/standalone/node_modules/sharp/node_modules/semver/functions/eq.js +5 -0
  1148. package/.next/standalone/node_modules/sharp/node_modules/semver/functions/gt.js +5 -0
  1149. package/.next/standalone/node_modules/sharp/node_modules/semver/functions/gte.js +5 -0
  1150. package/.next/standalone/node_modules/sharp/node_modules/semver/functions/lt.js +5 -0
  1151. package/.next/standalone/node_modules/sharp/node_modules/semver/functions/lte.js +5 -0
  1152. package/.next/standalone/node_modules/sharp/node_modules/semver/functions/neq.js +5 -0
  1153. package/.next/standalone/node_modules/sharp/node_modules/semver/functions/parse.js +18 -0
  1154. package/.next/standalone/node_modules/sharp/node_modules/semver/functions/satisfies.js +12 -0
  1155. package/.next/standalone/node_modules/sharp/node_modules/semver/internal/constants.js +37 -0
  1156. package/.next/standalone/node_modules/sharp/node_modules/semver/internal/debug.js +11 -0
  1157. package/.next/standalone/node_modules/sharp/node_modules/semver/internal/identifiers.js +29 -0
  1158. package/.next/standalone/node_modules/sharp/node_modules/semver/internal/lrucache.js +42 -0
  1159. package/.next/standalone/node_modules/sharp/node_modules/semver/internal/parse-options.js +17 -0
  1160. package/.next/standalone/node_modules/sharp/node_modules/semver/internal/re.js +223 -0
  1161. package/.next/standalone/node_modules/sharp/node_modules/semver/package.json +78 -0
  1162. package/.next/standalone/node_modules/sharp/package.json +202 -0
  1163. package/.next/standalone/node_modules/styled-jsx/dist/index/index.js +499 -0
  1164. package/.next/standalone/node_modules/styled-jsx/index.js +1 -0
  1165. package/.next/standalone/node_modules/styled-jsx/package.json +132 -0
  1166. package/.next/standalone/node_modules/styled-jsx/style.js +1 -0
  1167. package/.next/standalone/package.json +74 -0
  1168. package/.next/standalone/server.js +38 -0
  1169. package/.next/static/TT_Tn5a_CoTFnbpWSJ3l4/_buildManifest.js +11 -0
  1170. package/.next/static/TT_Tn5a_CoTFnbpWSJ3l4/_clientMiddlewareManifest.js +1 -0
  1171. package/.next/static/TT_Tn5a_CoTFnbpWSJ3l4/_ssgManifest.js +1 -0
  1172. package/.next/static/chunks/0-28e3qf.ap4g.js +560 -0
  1173. package/.next/static/chunks/03~yq9q893hmn.js +1 -0
  1174. package/.next/static/chunks/0bxubuf.uxrcw.js +1 -0
  1175. package/.next/static/chunks/0dbhjjzl8qfwv.js +1 -0
  1176. package/.next/static/chunks/0h_tp13zktbmv.css +3 -0
  1177. package/.next/static/chunks/0ht900cau6_ur.js +31 -0
  1178. package/.next/static/chunks/0o5q7h7wr_tqc.js +1 -0
  1179. package/.next/static/chunks/0p5.qr0b94vxo.js +5 -0
  1180. package/.next/static/chunks/16g.ca89g7fib.js +1 -0
  1181. package/.next/static/chunks/turbopack-0mbyzpf8xm.r7.js +1 -0
  1182. package/.next/static/media/4fa387ec64143e14-s.0q3udbd2bu5yp.woff2 +0 -0
  1183. package/.next/static/media/7178b3e590c64307-s.11.cyxs5p-0z~.woff2 +0 -0
  1184. package/.next/static/media/797e433ab948586e-s.p.0.q-h669a_dqa.woff2 +0 -0
  1185. package/.next/static/media/8a480f0b521d4e75-s.06d3mdzz5bre_.woff2 +0 -0
  1186. package/.next/static/media/bbc41e54d2fcbd21-s.0gw~uztddq1df.woff2 +0 -0
  1187. package/.next/static/media/caa3a2e1cccd8315-s.p.16t1db8_9y2o~.woff2 +0 -0
  1188. package/.next/static/media/favicon.0x3dzn~oxb6tn.ico +0 -0
  1189. package/LICENSE +661 -0
  1190. package/README.md +175 -0
  1191. package/bin/cli.js +142 -0
  1192. package/next.config.ts +8 -0
  1193. package/package.json +74 -0
  1194. package/postcss.config.mjs +7 -0
  1195. package/public/file.svg +1 -0
  1196. package/public/globe.svg +1 -0
  1197. package/public/next.svg +1 -0
  1198. package/public/vercel.svg +1 -0
  1199. package/public/window.svg +1 -0
  1200. package/src/app/api/license/validate/route.ts +97 -0
  1201. package/src/app/api/projects/[id]/route.ts +21 -0
  1202. package/src/app/api/projects/[id]/sessions/[sessionId]/route.ts +22 -0
  1203. package/src/app/api/projects/route.ts +25 -0
  1204. package/src/app/api/stats/route.ts +15 -0
  1205. package/src/app/favicon.ico +0 -0
  1206. package/src/app/globals.css +181 -0
  1207. package/src/app/layout.tsx +35 -0
  1208. package/src/app/page.tsx +369 -0
  1209. package/src/components/ContextModal.tsx +573 -0
  1210. package/src/components/ProjectDetail.tsx +387 -0
  1211. package/src/components/Sidebar.tsx +247 -0
  1212. package/src/components/Sparkline.tsx +114 -0
  1213. package/src/components/StatsBar.tsx +145 -0
  1214. package/src/components/TerrainVisualization.tsx +730 -0
  1215. package/src/components/UpgradePrompt.tsx +240 -0
  1216. package/src/lib/claude-data.ts +826 -0
  1217. package/src/pro-loader.null.ts +6 -0
  1218. package/src/pro-loader.pro.ts +15 -0
  1219. package/src/pro-loader.ts +6 -0
  1220. package/tsconfig.json +34 -0
@@ -0,0 +1,560 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,52683,e=>{"use strict";let t,i,n,r,a;var s=e.i(43476),o=e.i(71645);function l({projects:e,selectedId:t,onSelect:i,onShowTerrain:n,onShowAnalytics:r}){let[a,h]=(0,o.useState)(""),c=(0,o.useMemo)(()=>{let t=a.toLowerCase();return e.filter(e=>!t||e.name.toLowerCase().includes(t)||e.path.toLowerCase().includes(t)).sort((e,t)=>new Date(t.lastActivity).getTime()-new Date(e.lastActivity).getTime())},[e,a]);return(0,s.jsxs)("aside",{className:"flex flex-col h-full w-72 bg-[#0f172a] border-r border-white/[0.06] flex-shrink-0",children:[(0,s.jsxs)("div",{className:"px-5 pt-5 pb-3",children:[(0,s.jsx)("h1",{className:"text-lg font-bold text-transparent bg-clip-text bg-gradient-to-r from-cyan-400 to-sky-400",style:{textShadow:"0 0 30px rgba(34, 211, 238, 0.3)",fontFamily:"var(--font-geist-sans), sans-serif"},children:(0,s.jsx)("span",{className:"drop-shadow-[0_0_12px_rgba(34,211,238,0.4)]",children:"Claude Code Inspector"})}),(0,s.jsx)("p",{className:"text-[11px] text-slate-500 mt-0.5 tracking-wide",children:"Project Dashboard"})]}),(0,s.jsxs)("div",{className:"px-4 pb-3",children:[(0,s.jsxs)("button",{onClick:n,className:"w-full flex items-center gap-2 px-3 py-2 rounded-lg bg-white/5 border border-white/10 text-sm text-slate-300 hover:bg-cyan-400/10 hover:border-cyan-400/20 hover:text-cyan-300 transition-all duration-200",children:[(0,s.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("path",{d:"M22 12L13 20L4 12L13 4Z"}),(0,s.jsx)("path",{d:"M22 12L13 4L4 12",opacity:"0.5"})]}),"3D Terrain View"]}),r&&(0,s.jsxs)("button",{onClick:r,className:"w-full flex items-center gap-2 px-3 py-2 mt-2 rounded-lg bg-white/5 border border-white/10 text-sm text-slate-300 hover:bg-purple-400/10 hover:border-purple-400/20 hover:text-purple-300 transition-all duration-200",children:[(0,s.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("line",{x1:"18",y1:"20",x2:"18",y2:"10"}),(0,s.jsx)("line",{x1:"12",y1:"20",x2:"12",y2:"4"}),(0,s.jsx)("line",{x1:"6",y1:"20",x2:"6",y2:"14"})]}),"Analytics"]})]}),(0,s.jsx)("div",{className:"px-4 pb-3",children:(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsxs)("svg",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,s.jsx)("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),(0,s.jsx)("input",{type:"text",value:a,onChange:e=>h(e.target.value),placeholder:"Filter projects...",className:"w-full bg-white/5 border border-white/10 rounded-lg pl-9 pr-3 py-2 text-sm text-slate-200 placeholder:text-slate-500 outline-none focus:border-cyan-400/50 focus:ring-1 focus:ring-cyan-400/20 transition-all duration-200",style:{fontFamily:"var(--font-geist-sans), sans-serif"}})]})}),(0,s.jsx)("div",{className:"px-5 pb-2",children:(0,s.jsxs)("span",{className:"text-[11px] text-slate-500 uppercase tracking-wider font-medium",children:[c.length," project",1!==c.length?"s":""]})}),(0,s.jsxs)("div",{className:"flex-1 overflow-y-auto px-2 pb-4 scrollbar-thin scrollbar-thumb-white/10 scrollbar-track-transparent",children:[c.map(e=>{var n,r;let a,o=e.id===t,l=(n=e.lastActivity,(a=(Date.now()-new Date(n).getTime())/36e5)<1?{color:"#22d3ee",intensity:1}:a<6?{color:"#38bdf8",intensity:.85}:a<24?{color:"#818cf8",intensity:.7}:a<72?{color:"#a78bfa",intensity:.55}:a<168?{color:"#94a3b8",intensity:.4}:{color:"#64748b",intensity:.25});return(0,s.jsxs)("button",{onClick:()=>i(e.id),className:`
2
+ relative w-full text-left rounded-lg px-3 py-2.5 mb-1 transition-all duration-200 group
3
+ ${o?"bg-cyan-400/10 border border-cyan-400/20":"bg-transparent border border-transparent hover:bg-white/[0.04] hover:border-white/[0.06]"}
4
+ `,children:[(0,s.jsx)("div",{className:"absolute left-0 top-2 bottom-2 w-[3px] rounded-full transition-all duration-300",style:{backgroundColor:l.color,opacity:o?1:l.intensity}}),(0,s.jsxs)("div",{className:"flex items-center justify-between mb-1 pl-2",children:[(0,s.jsx)("span",{className:`text-sm font-medium truncate ${o?"text-cyan-300":"text-slate-200 group-hover:text-slate-100"}`,style:{fontFamily:"var(--font-geist-sans), sans-serif"},children:e.name}),(0,s.jsx)("span",{className:"text-[10px] text-slate-500 flex-shrink-0 ml-2",children:function(e){let t=Date.now()-new Date(e).getTime();if(t<0)return"just now";let i=Math.floor(Math.floor(t/1e3)/60),n=Math.floor(i/60),r=Math.floor(n/24),a=Math.floor(r/7),s=Math.floor(r/30);return s>0?`${s}mo ago`:a>0?`${a}w ago`:r>0?`${r}d ago`:n>0?`${n}h ago`:i>0?`${i}m ago`:"just now"}(e.lastActivity)})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2 pl-2",children:[(0,s.jsxs)("span",{className:`
5
+ inline-flex items-center text-[10px] px-1.5 py-0.5 rounded-md
6
+ ${o?"bg-cyan-400/15 text-cyan-300":"bg-white/[0.06] text-slate-400"}
7
+ `,style:{fontFamily:"var(--font-geist-mono), monospace"},children:[e.sessionCount," session",1!==e.sessionCount?"s":""]}),(0,s.jsxs)("span",{className:`
8
+ inline-flex items-center text-[10px] px-1.5 py-0.5 rounded-md
9
+ ${o?"bg-sky-400/15 text-sky-300":"bg-white/[0.06] text-slate-400"}
10
+ `,style:{fontFamily:"var(--font-geist-mono), monospace"},children:[(r=e.totalTokens)>=1e9?`${(r/1e9).toFixed(1)}B`:r>=1e6?`${(r/1e6).toFixed(1)}M`:r>=1e3?`${(r/1e3).toFixed(1)}K`:r.toString()," tokens"]})]})]},e.id)}),0===c.length&&(0,s.jsx)("div",{className:"text-center py-8 text-slate-500 text-sm",children:a?"No matching projects":"No projects found"})]})]})}function h({data:e,width:t=120,height:i=32,color:n="#22d3ee",fillColor:r,className:a=""}){let{path:l,fillPath:c,gradientId:u}=(0,o.useMemo)(()=>{if(!e||e.length<2)return{path:"",fillPath:"",gradientId:""};let n=Math.max(...e),r=Math.min(...e),a=n-r||1,s=t-4,o=i-4,l=e.map((t,i)=>({x:2+i/(e.length-1)*s,y:2+o-(t-r)/a*o})),h=`M ${l[0].x},${l[0].y}`;for(let e=0;e<l.length-1;e++){let t=l[e],i=l[e+1],n=l[e-1]||t,r=l[e+2]||i,a=t.x+(i.x-n.x)*.3,s=t.y+(i.y-n.y)*.3,o=i.x-(r.x-t.x)*.3,c=i.y-(r.y-t.y)*.3;h+=` C ${a},${s} ${o},${c} ${i.x},${i.y}`}let c=h+` L ${l[l.length-1].x},${i} L ${l[0].x},${i} Z`;return{path:h,fillPath:c,gradientId:`sparkline-grad-${Math.random().toString(36).slice(2,9)}`}},[e,t,i]);if(!e||e.length<2)return(0,s.jsx)("svg",{width:t,height:i,className:a,viewBox:`0 0 ${t} ${i}`,children:(0,s.jsx)("line",{x1:4,y1:i/2,x2:t-4,y2:i/2,stroke:n,strokeOpacity:.3,strokeWidth:1,strokeDasharray:"2 4"})});let d=r||n;return(0,s.jsxs)("svg",{width:t,height:i,className:a,viewBox:`0 0 ${t} ${i}`,children:[(0,s.jsx)("defs",{children:(0,s.jsxs)("linearGradient",{id:u,x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,s.jsx)("stop",{offset:"0%",stopColor:d,stopOpacity:.3}),(0,s.jsx)("stop",{offset:"100%",stopColor:d,stopOpacity:0})]})}),(0,s.jsx)("path",{d:c,fill:`url(#${u})`}),(0,s.jsx)("path",{d:l,fill:"none",stroke:n,strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]})}function c(e){return e>=1e9?`${(e/1e9).toFixed(1)}B`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toLocaleString()}function u(e){try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return e}}function d(e,t){return e?e.length<=t?e:e.slice(0,t)+"...":"(empty)"}function p(e){let t=Date.now()-new Date(e).getTime();if(t<0)return"just now";let i=Math.floor(Math.floor(t/1e3)/60),n=Math.floor(i/60),r=Math.floor(n/24);return r>0?`${r}d ago`:n>0?`${n}h ago`:i>0?`${i}m ago`:"just now"}function f({label:e,value:t}){return(0,s.jsxs)("div",{className:"rounded-lg bg-white/5 border border-white/10 px-4 py-3",children:[(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-wider text-slate-500 mb-1",children:e}),(0,s.jsx)("p",{className:"text-lg font-semibold text-slate-100",style:{fontFamily:"var(--font-geist-mono), monospace"},children:t})]})}function m({session:e,isExpanded:t,onToggle:i,onClick:n}){let r=function(e){let t=Math.min(Math.max(e.messageCount,6),20),i=[],n=e.totalTokens/Math.max(e.messageCount,1),r=0;for(let e=0;e<t;e++)i.push(Math.round(r+=n*(.5+.8*Math.sin(e/(t-1)*Math.PI))));return i}(e);return(0,s.jsxs)("div",{className:`
11
+ rounded-xl border transition-all duration-300
12
+ ${t?"bg-white/[0.06] border-cyan-400/20 shadow-lg shadow-cyan-400/5":"bg-white/[0.03] border-white/[0.06] hover:bg-white/[0.05] hover:border-white/10"}
13
+ `,children:[(0,s.jsxs)("button",{onClick:i,className:"w-full text-left px-4 py-3 flex items-center justify-between gap-3",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[(0,s.jsx)("svg",{className:`w-4 h-4 text-slate-500 flex-shrink-0 transition-transform duration-200 ${t?"rotate-90":""}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,s.jsx)("polyline",{points:"9 18 15 12 9 6"})}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,s.jsxs)("span",{className:"text-xs text-slate-300 truncate",style:{fontFamily:"var(--font-geist-mono), monospace"},children:[e.id.slice(0,12),"..."]}),(0,s.jsx)("span",{className:"flex-shrink-0 text-[10px] px-1.5 py-0.5 rounded bg-sky-400/15 text-sky-300 font-medium",children:e.model})]}),(0,s.jsx)("p",{className:"text-xs text-slate-500 truncate",children:d(e.firstPrompt,80)})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3 flex-shrink-0",children:[(0,s.jsx)(h,{data:r,width:80,height:24,color:"#22d3ee"}),(0,s.jsxs)("div",{className:"text-right",children:[(0,s.jsx)("p",{className:"text-xs text-slate-300",style:{fontFamily:"var(--font-geist-mono), monospace"},children:c(e.totalTokens)}),(0,s.jsxs)("p",{className:"text-[10px] text-slate-500",children:[e.messageCount," msg",1!==e.messageCount?"s":""]})]})]})]}),t&&(0,s.jsx)("div",{className:"px-4 pb-4 border-t border-white/[0.06]",children:(0,s.jsxs)("div",{className:"pt-3 space-y-3",children:[(0,s.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2",children:[(0,s.jsxs)("div",{className:"rounded-lg bg-white/5 px-3 py-2",children:[(0,s.jsx)("p",{className:"text-[10px] text-slate-500 uppercase tracking-wider",children:"Input"}),(0,s.jsx)("p",{className:"text-sm font-medium text-emerald-400",style:{fontFamily:"var(--font-geist-mono), monospace"},children:c(e.totalInputTokens)})]}),(0,s.jsxs)("div",{className:"rounded-lg bg-white/5 px-3 py-2",children:[(0,s.jsx)("p",{className:"text-[10px] text-slate-500 uppercase tracking-wider",children:"Output"}),(0,s.jsx)("p",{className:"text-sm font-medium text-cyan-400",style:{fontFamily:"var(--font-geist-mono), monospace"},children:c(e.totalOutputTokens)})]}),(0,s.jsxs)("div",{className:"rounded-lg bg-white/5 px-3 py-2",children:[(0,s.jsx)("p",{className:"text-[10px] text-slate-500 uppercase tracking-wider",children:"Cache Write"}),(0,s.jsx)("p",{className:"text-sm font-medium text-amber-400",style:{fontFamily:"var(--font-geist-mono), monospace"},children:c(e.totalCacheCreationTokens)})]}),(0,s.jsxs)("div",{className:"rounded-lg bg-white/5 px-3 py-2",children:[(0,s.jsx)("p",{className:"text-[10px] text-slate-500 uppercase tracking-wider",children:"Cache Read"}),(0,s.jsx)("p",{className:"text-sm font-medium text-violet-400",style:{fontFamily:"var(--font-geist-mono), monospace"},children:c(e.totalCacheReadTokens)})]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-[10px] text-slate-500 uppercase tracking-wider mb-1",children:"First Prompt"}),(0,s.jsx)("div",{className:"bg-white/[0.03] rounded-lg px-3 py-2 border border-white/[0.04]",children:(0,s.jsx)("p",{className:"text-xs text-slate-300 leading-relaxed whitespace-pre-wrap break-words",style:{fontFamily:"var(--font-geist-mono), monospace"},children:d(e.firstPrompt,200)})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-[10px] text-slate-500 uppercase tracking-wider mb-1",children:"Last Prompt"}),(0,s.jsx)("div",{className:"bg-white/[0.03] rounded-lg px-3 py-2 border border-white/[0.04]",children:(0,s.jsx)("p",{className:"text-xs text-slate-300 leading-relaxed whitespace-pre-wrap break-words",style:{fontFamily:"var(--font-geist-mono), monospace"},children:d(e.lastPrompt,200)})})]})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between text-[11px] text-slate-500",children:[(0,s.jsx)("span",{children:u(e.firstTimestamp)}),(0,s.jsx)("span",{className:"text-slate-600",children:"---"}),(0,s.jsx)("span",{children:u(e.lastTimestamp)})]}),(0,s.jsx)("button",{onClick:e=>{e.stopPropagation(),n()},className:"w-full py-2 rounded-lg bg-cyan-400/10 border border-cyan-400/20 text-cyan-300 text-xs font-medium transition-all duration-200 hover:bg-cyan-400/20 hover:border-cyan-400/30",children:"View Full Details"})]})})]})}function g({project:e,onSessionClick:t}){let[i,n]=(0,o.useState)(null);return(0,s.jsxs)("div",{className:"flex-1 h-full overflow-y-auto bg-slate-900 p-6",children:[(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsx)("h2",{className:"text-2xl font-bold text-slate-100 mb-1",style:{fontFamily:"var(--font-geist-sans), sans-serif"},children:e.name}),(0,s.jsx)("p",{className:"text-sm text-slate-500 truncate",style:{fontFamily:"var(--font-geist-mono), monospace"},children:e.path})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 mb-6",children:[(0,s.jsx)(f,{label:"Sessions",value:e.sessionCount.toLocaleString()}),(0,s.jsx)(f,{label:"Total Tokens",value:c(e.totalTokens)}),(0,s.jsx)(f,{label:"First Activity",value:p(e.firstActivity)}),(0,s.jsx)(f,{label:"Last Activity",value:p(e.lastActivity)})]}),(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsx)("div",{className:"flex items-center gap-4 mb-2",children:(0,s.jsx)("span",{className:"text-[11px] text-slate-500 uppercase tracking-wider font-medium",children:"Token Distribution"})}),(0,s.jsx)("div",{className:"w-full h-2 rounded-full bg-white/5 overflow-hidden flex",children:e.totalTokens>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"h-full bg-emerald-400 transition-all duration-500",style:{width:`${e.totalInputTokens/e.totalTokens*100}%`}}),(0,s.jsx)("div",{className:"h-full bg-cyan-400 transition-all duration-500",style:{width:`${e.totalOutputTokens/e.totalTokens*100}%`}})]})}),(0,s.jsxs)("div",{className:"flex items-center gap-4 mt-1.5",children:[(0,s.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,s.jsx)("div",{className:"w-2 h-2 rounded-full bg-emerald-400"}),(0,s.jsxs)("span",{className:"text-[10px] text-slate-500",children:["Input (",c(e.totalInputTokens),")"]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,s.jsx)("div",{className:"w-2 h-2 rounded-full bg-cyan-400"}),(0,s.jsxs)("span",{className:"text-[10px] text-slate-500",children:["Output (",c(e.totalOutputTokens),")"]})]})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("h3",{className:"text-sm font-medium text-slate-300 mb-3",children:["Sessions (",e.sessions.length,")"]}),(0,s.jsxs)("div",{className:"space-y-2",children:[e.sessions.map(e=>(0,s.jsx)(m,{session:e,isExpanded:i===e.id,onToggle:()=>n(i===e.id?null:e.id),onClick:()=>t(e.id)},e.id)),0===e.sessions.length&&(0,s.jsx)("div",{className:"text-center py-12 text-slate-500 text-sm",children:"No sessions found for this project"})]})]})]})}let _=[{id:"overview",label:"Overview"},{id:"first-prompt",label:"First Prompt"},{id:"last-prompt",label:"Last Prompt"},{id:"token-usage",label:"Token Usage"},{id:"context-timeline",label:"Context Timeline"}];function v(e){return e>=1e9?`${(e/1e9).toFixed(1)}B`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toLocaleString()}function x(e){try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return e}}function y({segments:e,size:t=180}){let i=e.reduce((e,t)=>e+t.value,0);if(0===i)return(0,s.jsx)("div",{className:"flex items-center justify-center text-slate-500 text-sm",style:{width:t,height:t},children:"No data"});let n=(t-20)/2,r=t/2,a=n-12,o=-Math.PI/2,l=e.filter(e=>e.value>0).map(e=>{let t=e.value/i*2*Math.PI,n=o,s=o+t;o=s;let l=+(t>Math.PI),h=r+a*Math.cos(n),c=r+a*Math.sin(n),u=r+a*Math.cos(s-.01),d=r+a*Math.sin(s-.01),p=`M ${h} ${c} A ${a} ${a} 0 ${l} 1 ${u} ${d}`;return{...e,d:p}});return(0,s.jsxs)("svg",{width:t,height:t,viewBox:`0 0 ${t} ${t}`,children:[(0,s.jsx)("circle",{cx:r,cy:r,r:a,fill:"none",stroke:"rgba(255,255,255,0.05)",strokeWidth:24}),l.map((e,t)=>(0,s.jsx)("path",{d:e.d,fill:"none",stroke:e.color,strokeWidth:24,strokeLinecap:"round"},t)),(0,s.jsx)("text",{x:r,y:r-6,textAnchor:"middle",className:"text-xl font-bold",style:{fontFamily:"var(--font-geist-mono), monospace"},fill:"#e2e8f0",fontSize:"18",children:v(i)}),(0,s.jsx)("text",{x:r,y:r+12,textAnchor:"middle",fill:"#64748b",fontSize:"10",children:"total tokens"})]})}function M({snapshots:e,width:t=600,height:i=200}){if(!e||e.length<2)return(0,s.jsx)("div",{className:"flex items-center justify-center text-slate-500 text-sm rounded-lg bg-white/[0.02] border border-white/[0.06]",style:{width:"100%",height:i},children:"Not enough data points for timeline"});let n=t-60-20,r=i-20-30,a=Math.max(...e.map(e=>e.totalTokens)),o=Math.max(...e.map(e=>e.messageIndex)),l=e=>60+e/Math.max(o,1)*n,h=e=>20+r-e/Math.max(a,1)*r,c=e.map((e,t)=>`${0===t?"M":"L"} ${l(e.messageIndex)} ${h(e.totalTokens)}`).join(" "),u=e.map((e,t)=>`${0===t?"M":"L"} ${l(e.messageIndex)} ${h(e.inputTokens)}`).join(" "),d=e.map((e,t)=>`${0===t?"M":"L"} ${l(e.messageIndex)} ${h(e.outputTokens)}`).join(" "),p=c+` L ${l(e[e.length-1].messageIndex)} ${h(0)}`+` L ${l(e[0].messageIndex)} ${h(0)} Z`,f=[0,.25,.5,.75,1].map(e=>Math.round(e*a));return(0,s.jsxs)("svg",{width:"100%",height:i,viewBox:`0 0 ${t} ${i}`,preserveAspectRatio:"xMidYMid meet",children:[(0,s.jsx)("defs",{children:(0,s.jsxs)("linearGradient",{id:"timeline-fill",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,s.jsx)("stop",{offset:"0%",stopColor:"#22d3ee",stopOpacity:"0.15"}),(0,s.jsx)("stop",{offset:"100%",stopColor:"#22d3ee",stopOpacity:"0"})]})}),f.map((e,i)=>(0,s.jsxs)("g",{children:[(0,s.jsx)("line",{x1:60,y1:h(e),x2:t-20,y2:h(e),stroke:"rgba(255,255,255,0.05)",strokeDasharray:"4 4"}),(0,s.jsx)("text",{x:52,y:h(e)+4,textAnchor:"end",fill:"#64748b",fontSize:"9",style:{fontFamily:"var(--font-geist-mono), monospace"},children:v(e)})]},i)),(0,s.jsx)("text",{x:t/2,y:i-4,textAnchor:"middle",fill:"#64748b",fontSize:"9",children:"Message Index"}),(0,s.jsx)("path",{d:p,fill:"url(#timeline-fill)"}),(0,s.jsx)("path",{d:u,fill:"none",stroke:"#34d399",strokeWidth:"1.5",strokeOpacity:"0.7"}),(0,s.jsx)("path",{d:d,fill:"none",stroke:"#a78bfa",strokeWidth:"1.5",strokeOpacity:"0.7"}),(0,s.jsx)("path",{d:c,fill:"none",stroke:"#22d3ee",strokeWidth:"2"}),e.map((e,t)=>(0,s.jsx)("circle",{cx:l(e.messageIndex),cy:h(e.totalTokens),r:2.5,fill:"#22d3ee",stroke:"#0f172a",strokeWidth:1},t)),(0,s.jsxs)("g",{transform:`translate(${70}, 20)`,children:[(0,s.jsx)("circle",{cx:0,cy:0,r:3,fill:"#22d3ee"}),(0,s.jsx)("text",{x:8,y:3,fill:"#94a3b8",fontSize:"9",children:"Total"}),(0,s.jsx)("circle",{cx:60,cy:0,r:3,fill:"#34d399"}),(0,s.jsx)("text",{x:68,y:3,fill:"#94a3b8",fontSize:"9",children:"Input"}),(0,s.jsx)("circle",{cx:115,cy:0,r:3,fill:"#a78bfa"}),(0,s.jsx)("text",{x:123,y:3,fill:"#94a3b8",fontSize:"9",children:"Output"})]})]})}function S({data:e}){let t=[{label:"Model",value:e.model},{label:"Messages",value:e.messageCount.toLocaleString()},{label:"Total Tokens",value:v(e.totalTokens)},{label:"Input Tokens",value:v(e.totalInputTokens)},{label:"Output Tokens",value:v(e.totalOutputTokens)},{label:"Cache Write",value:v(e.totalCacheCreationTokens)},{label:"Cache Read",value:v(e.totalCacheReadTokens)},{label:"Started",value:x(e.firstTimestamp)},{label:"Last Activity",value:x(e.lastTimestamp)}];return(0,s.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3",children:t.map(e=>(0,s.jsxs)("div",{className:"rounded-lg bg-white/[0.04] border border-white/[0.06] px-4 py-3",children:[(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-wider text-slate-500 mb-1",children:e.label}),(0,s.jsx)("p",{className:"text-sm font-semibold text-slate-200 truncate",style:{fontFamily:"var(--font-geist-mono), monospace"},children:e.value})]},e.label))})}function b({text:e}){return(0,s.jsx)("div",{className:"rounded-lg bg-white/[0.03] border border-white/[0.06] p-4 max-h-[50vh] overflow-y-auto",children:(0,s.jsx)("div",{className:"text-sm text-slate-300 leading-relaxed",style:{fontFamily:"var(--font-geist-mono), monospace"},children:e?e.split(/(```[\s\S]*?```)/g).map((e,t)=>{if(e.startsWith("```")&&e.endsWith("```")){let i=e.slice(3,-3),n=i.indexOf("\n"),r=n>-1?i.slice(0,n).trim():"",a=n>-1?i.slice(n+1):i;return(0,s.jsxs)("div",{className:"my-2 rounded-lg overflow-hidden border border-white/[0.06]",children:[r&&(0,s.jsx)("div",{className:"px-3 py-1 bg-white/[0.04] text-[10px] text-slate-500 uppercase tracking-wider border-b border-white/[0.06]",children:r}),(0,s.jsx)("pre",{className:"p-3 bg-white/[0.02] overflow-x-auto",children:(0,s.jsx)("code",{className:"text-xs text-emerald-300 leading-relaxed",style:{fontFamily:"var(--font-geist-mono), monospace"},children:a})})]},t)}return(0,s.jsx)("span",{className:"whitespace-pre-wrap break-words",children:e},t)}):(0,s.jsx)("span",{className:"text-slate-500 italic",children:"No prompt data"})})})}function T({data:e}){let t=[{value:e.totalInputTokens,color:"#34d399",label:"Input"},{value:e.totalOutputTokens,color:"#22d3ee",label:"Output"},{value:e.totalCacheCreationTokens,color:"#f59e0b",label:"Cache Write"},{value:e.totalCacheReadTokens,color:"#a78bfa",label:"Cache Read"}],i=e.totalTokens||1;return(0,s.jsxs)("div",{className:"flex flex-col items-center gap-6",children:[(0,s.jsx)(y,{segments:t,size:200}),(0,s.jsx)("div",{className:"w-full space-y-2",children:t.map(e=>(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("div",{className:"w-3 h-3 rounded-full flex-shrink-0",style:{backgroundColor:e.color}}),(0,s.jsx)("span",{className:"text-sm text-slate-400 flex-1",children:e.label}),(0,s.jsx)("span",{className:"text-sm text-slate-200 font-medium",style:{fontFamily:"var(--font-geist-mono), monospace"},children:v(e.value)}),(0,s.jsxs)("span",{className:"text-xs text-slate-500 w-12 text-right",children:[(e.value/i*100).toFixed(1),"%"]})]},e.label))})]})}function E({snapshots:e}){return(0,s.jsx)("div",{className:"rounded-lg bg-white/[0.03] border border-white/[0.06] p-4",children:(0,s.jsx)(M,{snapshots:e,width:620,height:220})})}function w({isOpen:e,onClose:t,data:i}){let[n,r]=(0,o.useState)("overview"),[a,l]=(0,o.useState)(!1),[h,c]=(0,o.useState)(!1),u=(0,o.useRef)(null);(0,o.useEffect)(()=>{if(e)c(!0),requestAnimationFrame(()=>{requestAnimationFrame(()=>{l(!0)})});else{l(!1);let e=setTimeout(()=>c(!1),300);return()=>clearTimeout(e)}},[e]),(0,o.useEffect)(()=>{e&&r("overview")},[e]);let d=(0,o.useCallback)(e=>{"Escape"===e.key&&t()},[t]);return((0,o.useEffect)(()=>{if(e)return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[e,d]),h&&i)?(0,s.jsx)("div",{ref:u,className:`
14
+ fixed inset-0 z-50 flex items-center justify-center p-4
15
+ transition-all duration-300 ease-out
16
+ ${a?"bg-black/60 backdrop-blur-sm":"bg-black/0 backdrop-blur-none"}
17
+ `,onClick:e=>{e.target===u.current&&t()},children:(0,s.jsxs)("div",{className:`
18
+ relative w-full max-w-3xl max-h-[90vh] rounded-2xl
19
+ bg-slate-900/95 backdrop-blur-xl border border-white/10
20
+ shadow-2xl shadow-black/50
21
+ overflow-hidden flex flex-col
22
+ transition-all duration-300 ease-out
23
+ ${a?"opacity-100 scale-100 translate-y-0":"opacity-0 scale-95 translate-y-4"}
24
+ `,children:[(0,s.jsxs)("div",{className:"flex items-start justify-between px-6 pt-5 pb-3 border-b border-white/[0.06]",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("h2",{className:"text-lg font-bold text-slate-100 truncate",style:{fontFamily:"var(--font-geist-sans), sans-serif"},children:i.projectName}),(0,s.jsxs)("p",{className:"text-xs text-slate-500 truncate mt-0.5",style:{fontFamily:"var(--font-geist-mono), monospace"},children:["Session: ",i.sessionId.slice(0,20),"..."]})]}),(0,s.jsx)("button",{onClick:t,className:"flex-shrink-0 w-8 h-8 rounded-lg bg-white/5 border border-white/10 flex items-center justify-center text-slate-400 hover:text-slate-200 hover:bg-white/10 transition-all duration-200 ml-4",children:(0,s.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,s.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),(0,s.jsx)("div",{className:"flex gap-1 px-6 pt-3 pb-0 overflow-x-auto",children:_.map(e=>(0,s.jsx)("button",{onClick:()=>r(e.id),className:`
25
+ px-3 py-2 text-xs font-medium rounded-t-lg transition-all duration-200 whitespace-nowrap
26
+ ${n===e.id?"bg-white/[0.06] text-cyan-300 border-b-2 border-cyan-400":"text-slate-500 hover:text-slate-300 hover:bg-white/[0.03]"}
27
+ `,children:e.label},e.id))}),(0,s.jsxs)("div",{className:"flex-1 overflow-y-auto px-6 py-4",children:["overview"===n&&(0,s.jsx)(S,{data:i}),"first-prompt"===n&&(0,s.jsx)(b,{text:i.firstPrompt}),"last-prompt"===n&&(0,s.jsx)(b,{text:i.lastPrompt}),"token-usage"===n&&(0,s.jsx)(T,{data:i}),"context-timeline"===n&&(0,s.jsx)(E,{snapshots:i.contextSnapshots})]}),(0,s.jsxs)("div",{className:"flex items-center gap-4 px-6 py-3 border-t border-white/[0.06] text-[10px] text-slate-500",children:[(0,s.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,s.jsx)("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-sky-400"}),i.model]}),(0,s.jsxs)("span",{children:[i.messageCount," messages"]}),(0,s.jsxs)("span",{children:[v(i.totalTokens)," tokens"]}),(0,s.jsx)("span",{className:"ml-auto",children:"Press ESC to close"})]})]})}):null}function A(e){return e>=1e9?`${(e/1e9).toFixed(1)}B`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}function R({icon:e,label:t,value:i}){return(0,s.jsxs)("div",{className:"flex items-center gap-3 rounded-xl bg-white/5 backdrop-blur-xl border border-white/10 px-4 py-3 min-w-0 transition-all duration-300 hover:bg-white/[0.08] hover:border-white/20",children:[(0,s.jsx)("div",{className:"flex-shrink-0 w-9 h-9 rounded-lg bg-cyan-400/10 flex items-center justify-center text-cyan-400",children:e}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"text-[11px] uppercase tracking-wider text-slate-400 font-medium truncate",children:t}),(0,s.jsx)("p",{className:"text-base font-semibold text-slate-100 truncate",style:{fontFamily:"var(--font-geist-mono), monospace"},children:i})]})]})}function C(){return(0,s.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,s.jsx)("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})})}function P(){return(0,s.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,s.jsx)("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function L(){return(0,s.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,s.jsx)("path",{d:"M12 6v12M6 12h12"})]})}function N(){return(0,s.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("path",{d:"M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"}),(0,s.jsx)("polyline",{points:"22,6 12,13 2,6"})]})}function D(){return(0,s.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,s.jsx)("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})})}function I(){return(0,s.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("line",{x1:"18",y1:"20",x2:"18",y2:"10"}),(0,s.jsx)("line",{x1:"12",y1:"20",x2:"12",y2:"4"}),(0,s.jsx)("line",{x1:"6",y1:"20",x2:"6",y2:"14"})]})}function U({totalProjects:e,totalSessions:t,totalTokens:i,totalMessages:n,mostActiveProject:r,avgTokensPerSession:a}){return(0,s.jsx)("div",{className:"w-full px-4 py-3",children:(0,s.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3",children:[(0,s.jsx)(R,{icon:(0,s.jsx)(C,{}),label:"Projects",value:e.toLocaleString()}),(0,s.jsx)(R,{icon:(0,s.jsx)(P,{}),label:"Sessions",value:t.toLocaleString()}),(0,s.jsx)(R,{icon:(0,s.jsx)(L,{}),label:"Total Tokens",value:A(i)}),(0,s.jsx)(R,{icon:(0,s.jsx)(N,{}),label:"Messages",value:n.toLocaleString()}),(0,s.jsx)(R,{icon:(0,s.jsx)(D,{}),label:"Most Active",value:r||"---"}),(0,s.jsx)(R,{icon:(0,s.jsx)(I,{}),label:"Avg Tokens/Session",value:A(a)})]})})}let O="srgb",F="srgb-linear",B="linear",k="srgb",z="300 es";function V(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;let H={};function G(...e){console.log("THREE."+e.shift(),...e)}function j(e){let t=e[0];if("string"==typeof t&&t.startsWith("TSL:")){let t=e[1];t&&t.isStackTrace?e[0]+=" "+t.getLocation():e[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return e}function W(...e){let t="THREE."+(e=j(e)).shift();{let i=e[0];i&&i.isStackTrace?console.warn(i.getError(t)):console.warn(t,...e)}}function X(...e){let t="THREE."+(e=j(e)).shift();{let i=e[0];i&&i.isStackTrace?console.error(i.getError(t)):console.error(t,...e)}}function Y(...e){let t=e.join(" ");t in H||(H[t]=!0,W(...e))}let q={0:1,2:6,4:7,3:5,1:0,6:2,7:4,5:3};class K{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});let i=this._listeners;void 0===i[e]&&(i[e]=[]),-1===i[e].indexOf(t)&&i[e].push(t)}hasEventListener(e,t){let i=this._listeners;return void 0!==i&&void 0!==i[e]&&-1!==i[e].indexOf(t)}removeEventListener(e,t){let i=this._listeners;if(void 0===i)return;let n=i[e];if(void 0!==n){let e=n.indexOf(t);-1!==e&&n.splice(e,1)}}dispatchEvent(e){let t=this._listeners;if(void 0===t)return;let i=t[e.type];if(void 0!==i){e.target=this;let t=i.slice(0);for(let i=0,n=t.length;i<n;i++)t[i].call(this,e);e.target=null}}}let Z=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],J=Math.PI/180,$=180/Math.PI;function Q(){let e=0xffffffff*Math.random()|0,t=0xffffffff*Math.random()|0,i=0xffffffff*Math.random()|0,n=0xffffffff*Math.random()|0;return(Z[255&e]+Z[e>>8&255]+Z[e>>16&255]+Z[e>>24&255]+"-"+Z[255&t]+Z[t>>8&255]+"-"+Z[t>>16&15|64]+Z[t>>24&255]+"-"+Z[63&i|128]+Z[i>>8&255]+"-"+Z[i>>16&255]+Z[i>>24&255]+Z[255&n]+Z[n>>8&255]+Z[n>>16&255]+Z[n>>24&255]).toLowerCase()}function ee(e,t,i){return Math.max(t,Math.min(i,e))}function et(e,t,i){return(1-i)*e+i*t}function ei(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/0xffffffff;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/0x7fffffff,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error("Invalid component type.")}}function en(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(0xffffffff*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(0x7fffffff*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw Error("Invalid component type.")}}class er{constructor(e=0,t=0){er.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,i=this.y,n=e.elements;return this.x=n[0]*t+n[3]*i+n[6],this.y=n[1]*t+n[4]*i+n[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=ee(this.x,e.x,t.x),this.y=ee(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=ee(this.x,e,t),this.y=ee(this.y,e,t),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(ee(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());return 0===t?Math.PI/2:Math.acos(ee(this.dot(e)/t,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let i=Math.cos(t),n=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*i-a*n+e.x,this.y=r*n+a*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class ea{constructor(e=0,t=0,i=0,n=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=n}static slerpFlat(e,t,i,n,r,a,s){let o=i[n+0],l=i[n+1],h=i[n+2],c=i[n+3],u=r[a+0],d=r[a+1],p=r[a+2],f=r[a+3];if(c!==f||o!==u||l!==d||h!==p){let e=o*u+l*d+h*p+c*f;e<0&&(u=-u,d=-d,p=-p,f=-f,e=-e);let t=1-s;if(e<.9995){let i=Math.acos(e),n=Math.sin(i);o=o*(t=Math.sin(t*i)/n)+u*(s=Math.sin(s*i)/n),l=l*t+d*s,h=h*t+p*s,c=c*t+f*s}else{let e=1/Math.sqrt((o=o*t+u*s)*o+(l=l*t+d*s)*l+(h=h*t+p*s)*h+(c=c*t+f*s)*c);o*=e,l*=e,h*=e,c*=e}}e[t]=o,e[t+1]=l,e[t+2]=h,e[t+3]=c}static multiplyQuaternionsFlat(e,t,i,n,r,a){let s=i[n],o=i[n+1],l=i[n+2],h=i[n+3],c=r[a],u=r[a+1],d=r[a+2],p=r[a+3];return e[t]=s*p+h*c+o*d-l*u,e[t+1]=o*p+h*u+l*c-s*d,e[t+2]=l*p+h*d+s*u-o*c,e[t+3]=h*p-s*c-o*u-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,n){return this._x=e,this._y=t,this._z=i,this._w=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let i=e._x,n=e._y,r=e._z,a=e._order,s=Math.cos,o=Math.sin,l=s(i/2),h=s(n/2),c=s(r/2),u=o(i/2),d=o(n/2),p=o(r/2);switch(a){case"XYZ":this._x=u*h*c+l*d*p,this._y=l*d*c-u*h*p,this._z=l*h*p+u*d*c,this._w=l*h*c-u*d*p;break;case"YXZ":this._x=u*h*c+l*d*p,this._y=l*d*c-u*h*p,this._z=l*h*p-u*d*c,this._w=l*h*c+u*d*p;break;case"ZXY":this._x=u*h*c-l*d*p,this._y=l*d*c+u*h*p,this._z=l*h*p+u*d*c,this._w=l*h*c-u*d*p;break;case"ZYX":this._x=u*h*c-l*d*p,this._y=l*d*c+u*h*p,this._z=l*h*p-u*d*c,this._w=l*h*c+u*d*p;break;case"YZX":this._x=u*h*c+l*d*p,this._y=l*d*c+u*h*p,this._z=l*h*p-u*d*c,this._w=l*h*c-u*d*p;break;case"XZY":this._x=u*h*c-l*d*p,this._y=l*d*c-u*h*p,this._z=l*h*p+u*d*c,this._w=l*h*c+u*d*p;break;default:W("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!0===t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let i=t/2,n=Math.sin(i);return this._x=e.x*n,this._y=e.y*n,this._z=e.z*n,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,i=t[0],n=t[4],r=t[8],a=t[1],s=t[5],o=t[9],l=t[2],h=t[6],c=t[10],u=i+s+c;if(u>0){let e=.5/Math.sqrt(u+1);this._w=.25/e,this._x=(h-o)*e,this._y=(r-l)*e,this._z=(a-n)*e}else if(i>s&&i>c){let e=2*Math.sqrt(1+i-s-c);this._w=(h-o)/e,this._x=.25*e,this._y=(n+a)/e,this._z=(r+l)/e}else if(s>c){let e=2*Math.sqrt(1+s-i-c);this._w=(r-l)/e,this._x=(n+a)/e,this._y=.25*e,this._z=(o+h)/e}else{let e=2*Math.sqrt(1+c-i-s);this._w=(a-n)/e,this._x=(r+l)/e,this._y=(o+h)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<1e-8?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0):(this._x=0,this._y=-e.z,this._z=e.y)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x),this._w=i,this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(ee(this.dot(e),-1,1)))}rotateTowards(e,t){let i=this.angleTo(e);if(0===i)return this;let n=Math.min(1,t/i);return this.slerp(e,n),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let i=e._x,n=e._y,r=e._z,a=e._w,s=t._x,o=t._y,l=t._z,h=t._w;return this._x=i*h+a*s+n*l-r*o,this._y=n*h+a*o+r*s-i*l,this._z=r*h+a*l+i*o-n*s,this._w=a*h-i*s-n*o-r*l,this._onChangeCallback(),this}slerp(e,t){let i=e._x,n=e._y,r=e._z,a=e._w,s=this.dot(e);s<0&&(i=-i,n=-n,r=-r,a=-a,s=-s);let o=1-t;if(s<.9995){let e=Math.acos(s),l=Math.sin(e);o=Math.sin(o*e)/l,t=Math.sin(t*e)/l,this._x=this._x*o+i*t,this._y=this._y*o+n*t,this._z=this._z*o+r*t,this._w=this._w*o+a*t,this._onChangeCallback()}else this._x=this._x*o+i*t,this._y=this._y*o+n*t,this._z=this._z*o+r*t,this._w=this._w*o+a*t,this.normalize();return this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),n=Math.sqrt(1-i),r=Math.sqrt(i);return this.set(n*Math.sin(e),n*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class es{constructor(e=0,t=0,i=0){es.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return void 0===i&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(el.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(el.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,i=this.y,n=this.z,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6]*n,this.y=r[1]*t+r[4]*i+r[7]*n,this.z=r[2]*t+r[5]*i+r[8]*n,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,i=this.y,n=this.z,r=e.elements,a=1/(r[3]*t+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*t+r[4]*i+r[8]*n+r[12])*a,this.y=(r[1]*t+r[5]*i+r[9]*n+r[13])*a,this.z=(r[2]*t+r[6]*i+r[10]*n+r[14])*a,this}applyQuaternion(e){let t=this.x,i=this.y,n=this.z,r=e.x,a=e.y,s=e.z,o=e.w,l=2*(a*n-s*i),h=2*(s*t-r*n),c=2*(r*i-a*t);return this.x=t+o*l+a*c-s*h,this.y=i+o*h+s*l-r*c,this.z=n+o*c+r*h-a*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,i=this.y,n=this.z,r=e.elements;return this.x=r[0]*t+r[4]*i+r[8]*n,this.y=r[1]*t+r[5]*i+r[9]*n,this.z=r[2]*t+r[6]*i+r[10]*n,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=ee(this.x,e.x,t.x),this.y=ee(this.y,e.y,t.y),this.z=ee(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=ee(this.x,e,t),this.y=ee(this.y,e,t),this.z=ee(this.z,e,t),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(ee(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let i=e.x,n=e.y,r=e.z,a=t.x,s=t.y,o=t.z;return this.x=n*o-r*s,this.y=r*a-i*o,this.z=i*s-n*a,this}projectOnVector(e){let t=e.lengthSq();if(0===t)return this.set(0,0,0);let i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return eo.copy(this).projectOnVector(e),this.sub(eo)}reflect(e){return this.sub(eo.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());return 0===t?Math.PI/2:Math.acos(ee(this.dot(e)/t,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y,n=this.z-e.z;return t*t+i*i+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){let n=Math.sin(t)*e;return this.x=n*Math.sin(i),this.y=Math.cos(t)*e,this.z=n*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),n=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=n,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=2*Math.random()-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}let eo=new es,el=new ea;class eh{constructor(e,t,i,n,r,a,s,o,l){eh.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==e&&this.set(e,t,i,n,r,a,s,o,l)}set(e,t,i,n,r,a,s,o,l){let h=this.elements;return h[0]=e,h[1]=n,h[2]=s,h[3]=t,h[4]=r,h[5]=o,h[6]=i,h[7]=a,h[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,n=t.elements,r=this.elements,a=i[0],s=i[3],o=i[6],l=i[1],h=i[4],c=i[7],u=i[2],d=i[5],p=i[8],f=n[0],m=n[3],g=n[6],_=n[1],v=n[4],x=n[7],y=n[2],M=n[5],S=n[8];return r[0]=a*f+s*_+o*y,r[3]=a*m+s*v+o*M,r[6]=a*g+s*x+o*S,r[1]=l*f+h*_+c*y,r[4]=l*m+h*v+c*M,r[7]=l*g+h*x+c*S,r[2]=u*f+d*_+p*y,r[5]=u*m+d*v+p*M,r[8]=u*g+d*x+p*S,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],i=e[1],n=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],h=e[8];return t*a*h-t*s*l-i*r*h+i*s*o+n*r*l-n*a*o}invert(){let e=this.elements,t=e[0],i=e[1],n=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],h=e[8],c=h*a-s*l,u=s*o-h*r,d=l*r-a*o,p=t*c+i*u+n*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);let f=1/p;return e[0]=c*f,e[1]=(n*l-h*i)*f,e[2]=(s*i-n*a)*f,e[3]=u*f,e[4]=(h*t-n*o)*f,e[5]=(n*r-s*t)*f,e[6]=d*f,e[7]=(i*o-l*t)*f,e[8]=(a*t-i*r)*f,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,n,r,a,s){let o=Math.cos(r),l=Math.sin(r);return this.set(i*o,i*l,-i*(o*a+l*s)+a+e,-n*l,n*o,-n*(-l*a+o*s)+s+t,0,0,1),this}scale(e,t){return this.premultiply(ec.makeScale(e,t)),this}rotate(e){return this.premultiply(ec.makeRotation(-e)),this}translate(e,t){return this.premultiply(ec.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,i=e.elements;for(let e=0;e<9;e++)if(t[e]!==i[e])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}let ec=new eh,eu=new eh().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),ed=new eh().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715),ep=(n=[.64,.33,.3,.6,.15,.06],r=[.2126,.7152,.0722],a=[.3127,.329],(i={enabled:!0,workingColorSpace:F,spaces:{},convert:function(e,t,i){return!1!==this.enabled&&t!==i&&t&&i&&(this.spaces[t].transfer===k&&(e.r=ef(e.r),e.g=ef(e.g),e.b=ef(e.b)),this.spaces[t].primaries!==this.spaces[i].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[i].fromXYZ)),this.spaces[i].transfer===k&&(e.r=em(e.r),e.g=em(e.g),e.b=em(e.b))),e},workingToColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},colorSpaceToWorking:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return""===e?B:this.spaces[e].transfer},getToneMappingMode:function(e){return this.spaces[e].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(e,t=this.workingColorSpace){return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,i){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[i].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(e=this.workingColorSpace){return this.spaces[e].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(e,t){return Y("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(e,t)},toWorkingColorSpace:function(e,t){return Y("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),i.colorSpaceToWorking(e,t)}}).define({[F]:{primaries:n,whitePoint:a,transfer:B,toXYZ:eu,fromXYZ:ed,luminanceCoefficients:r,workingColorSpaceConfig:{unpackColorSpace:O},outputColorSpaceConfig:{drawingBufferColorSpace:O}},[O]:{primaries:n,whitePoint:a,transfer:k,toXYZ:eu,fromXYZ:ed,luminanceCoefficients:r,outputColorSpaceConfig:{drawingBufferColorSpace:O}}}),i);function ef(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function em(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}class eg{static getDataURL(e,i="image/png"){let n;if(/^data:/i.test(e.src)||"u"<typeof HTMLCanvasElement)return e.src;if(e instanceof HTMLCanvasElement)n=e;else{void 0===t&&(t=V("canvas")),t.width=e.width,t.height=e.height;let i=t.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=t}return n.toDataURL(i)}static sRGBToLinear(e){if("u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap){let t=V("canvas");t.width=e.width,t.height=e.height;let i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);let n=i.getImageData(0,0,e.width,e.height),r=n.data;for(let e=0;e<r.length;e++)r[e]=255*ef(r[e]/255);return i.putImageData(n,0,0),t}if(!e.data)return W("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e;{let t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(255*ef(t[e]/255)):t[e]=ef(t[e]);return{data:t,width:e.width,height:e.height}}}}let e_=0;class ev{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:e_++}),this.uuid=Q(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return"u">typeof HTMLVideoElement&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):"u">typeof VideoFrame&&t instanceof VideoFrame?e.set(t.displayHeight,t.displayWidth,0):null!==t?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){!0===e&&this.version++}toJSON(e){let t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];let i={uuid:this.uuid,url:""},n=this.data;if(null!==n){let e;if(Array.isArray(n)){e=[];for(let t=0,i=n.length;t<i;t++)n[t].isDataTexture?e.push(ex(n[t].image)):e.push(ex(n[t]))}else e=ex(n);i.url=e}return t||(e.images[this.uuid]=i),i}}function ex(e){return"u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap?eg.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(W("Texture: Unable to serialize Texture."),{})}let ey=0,eM=new es;class eS extends K{constructor(e=eS.DEFAULT_IMAGE,t=eS.DEFAULT_MAPPING,i=1001,n=1001,r=1006,a=1008,s=1023,o=1009,l=eS.DEFAULT_ANISOTROPY,h=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:ey++}),this.uuid=Q(),this.name="",this.source=new ev(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=n,this.magFilter=r,this.minFilter=a,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=o,this.offset=new er(0,0),this.repeat=new er(1,1),this.center=new er(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new eh,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!e&&!!e.depth&&e.depth>1,this.pmremVersion=0}get width(){return this.source.getSize(eM).x}get height(){return this.source.getSize(eM).y}get depth(){return this.source.getSize(eM).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let i=e[t];if(void 0===i){W(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let n=this[t];if(void 0===n){W(`Texture.setValues(): property '${t}' does not exist.`);continue}n&&i&&n.isVector2&&i.isVector2||n&&i&&n.isVector3&&i.isVector3||n&&i&&n.isMatrix3&&i.isMatrix3?n.copy(i):this[t]=i}}toJSON(e){let t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];let i={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case 1e3:e.x=e.x-Math.floor(e.x);break;case 1001:e.x=e.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case 1e3:e.y=e.y-Math.floor(e.y);break;case 1001:e.y=e.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){!0===e&&this.pmremVersion++}}eS.DEFAULT_IMAGE=null,eS.DEFAULT_MAPPING=300,eS.DEFAULT_ANISOTROPY=1;class eb{constructor(e=0,t=0,i=0,n=1){eb.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=n}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,n){return this.x=e,this.y=t,this.z=i,this.w=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,i=this.y,n=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*n+a[12]*r,this.y=a[1]*t+a[5]*i+a[9]*n+a[13]*r,this.z=a[2]*t+a[6]*i+a[10]*n+a[14]*r,this.w=a[3]*t+a[7]*i+a[11]*n+a[15]*r,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,n,r,a=e.elements,s=a[0],o=a[4],l=a[8],h=a[1],c=a[5],u=a[9],d=a[2],p=a[6],f=a[10];if(.01>Math.abs(o-h)&&.01>Math.abs(l-d)&&.01>Math.abs(u-p)){if(.1>Math.abs(o+h)&&.1>Math.abs(l+d)&&.1>Math.abs(u+p)&&.1>Math.abs(s+c+f-3))return this.set(1,0,0,0),this;t=Math.PI;let e=(s+1)/2,a=(c+1)/2,m=(f+1)/2,g=(o+h)/4,_=(l+d)/4,v=(u+p)/4;return e>a&&e>m?e<.01?(i=0,n=.707106781,r=.707106781):(n=g/(i=Math.sqrt(e)),r=_/i):a>m?a<.01?(i=.707106781,n=0,r=.707106781):(i=g/(n=Math.sqrt(a)),r=v/n):m<.01?(i=.707106781,n=.707106781,r=0):(i=_/(r=Math.sqrt(m)),n=v/r),this.set(i,n,r,t),this}let m=Math.sqrt((p-u)*(p-u)+(l-d)*(l-d)+(h-o)*(h-o));return .001>Math.abs(m)&&(m=1),this.x=(p-u)/m,this.y=(l-d)/m,this.z=(h-o)/m,this.w=Math.acos((s+c+f-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=ee(this.x,e.x,t.x),this.y=ee(this.y,e.y,t.y),this.z=ee(this.z,e.z,t.z),this.w=ee(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=ee(this.x,e,t),this.y=ee(this.y,e,t),this.z=ee(this.z,e,t),this.w=ee(this.w,e,t),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(ee(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class eT extends K{constructor(e=1,t=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:1006,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},i),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=i.depth,this.scissor=new eb(0,0,e,t),this.scissorTest=!1,this.viewport=new eb(0,0,e,t),this.textures=[];const n=new eS({width:e,height:t,depth:i.depth}),r=i.count;for(let e=0;e<r;e++)this.textures[e]=n.clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;this._setTextureOptions(i),this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples,this.multiview=i.multiview}_setTextureOptions(e={}){let t={minFilter:1006,generateMipmaps:!1,flipY:!1,internalFormat:null};void 0!==e.mapping&&(t.mapping=e.mapping),void 0!==e.wrapS&&(t.wrapS=e.wrapS),void 0!==e.wrapT&&(t.wrapT=e.wrapT),void 0!==e.wrapR&&(t.wrapR=e.wrapR),void 0!==e.magFilter&&(t.magFilter=e.magFilter),void 0!==e.minFilter&&(t.minFilter=e.minFilter),void 0!==e.format&&(t.format=e.format),void 0!==e.type&&(t.type=e.type),void 0!==e.anisotropy&&(t.anisotropy=e.anisotropy),void 0!==e.colorSpace&&(t.colorSpace=e.colorSpace),void 0!==e.flipY&&(t.flipY=e.flipY),void 0!==e.generateMipmaps&&(t.generateMipmaps=e.generateMipmaps),void 0!==e.internalFormat&&(t.internalFormat=e.internalFormat);for(let e=0;e<this.textures.length;e++)this.textures[e].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){null!==this._depthTexture&&(this._depthTexture.renderTarget=null),null!==e&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let n=0,r=this.textures.length;n<r;n++)this.textures[n].image.width=e,this.textures[n].image.height=t,this.textures[n].image.depth=i,!0!==this.textures[n].isData3DTexture&&(this.textures[n].isArrayTexture=this.textures[n].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,i=e.textures.length;t<i;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let i=Object.assign({},e.textures[t].image);this.textures[t].source=new ev(i)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class eE extends eT{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class ew extends eS{constructor(e=null,t=1,i=1,n=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:n},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class eA{constructor(e,t,i,n,r,a,s,o,l,h,c,u,d,p,f,m){eA.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,t,i,n,r,a,s,o,l,h,c,u,d,p,f,m)}set(e,t,i,n,r,a,s,o,l,h,c,u,d,p,f,m){let g=this.elements;return g[0]=e,g[4]=t,g[8]=i,g[12]=n,g[1]=r,g[5]=a,g[9]=s,g[13]=o,g[2]=l,g[6]=h,g[10]=c,g[14]=u,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new eA().fromArray(this.elements)}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){let t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return 0===this.determinant()?(e.set(1,0,0),t.set(0,1,0),i.set(0,0,1)):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2)),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){if(0===e.determinant())return this.identity();let t=this.elements,i=e.elements,n=1/eR.setFromMatrixColumn(e,0).length(),r=1/eR.setFromMatrixColumn(e,1).length(),a=1/eR.setFromMatrixColumn(e,2).length();return t[0]=i[0]*n,t[1]=i[1]*n,t[2]=i[2]*n,t[3]=0,t[4]=i[4]*r,t[5]=i[5]*r,t[6]=i[6]*r,t[7]=0,t[8]=i[8]*a,t[9]=i[9]*a,t[10]=i[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,i=e.x,n=e.y,r=e.z,a=Math.cos(i),s=Math.sin(i),o=Math.cos(n),l=Math.sin(n),h=Math.cos(r),c=Math.sin(r);if("XYZ"===e.order){let e=a*h,i=a*c,n=s*h,r=s*c;t[0]=o*h,t[4]=-o*c,t[8]=l,t[1]=i+n*l,t[5]=e-r*l,t[9]=-s*o,t[2]=r-e*l,t[6]=n+i*l,t[10]=a*o}else if("YXZ"===e.order){let e=o*h,i=o*c,n=l*h,r=l*c;t[0]=e+r*s,t[4]=n*s-i,t[8]=a*l,t[1]=a*c,t[5]=a*h,t[9]=-s,t[2]=i*s-n,t[6]=r+e*s,t[10]=a*o}else if("ZXY"===e.order){let e=o*h,i=o*c,n=l*h,r=l*c;t[0]=e-r*s,t[4]=-a*c,t[8]=n+i*s,t[1]=i+n*s,t[5]=a*h,t[9]=r-e*s,t[2]=-a*l,t[6]=s,t[10]=a*o}else if("ZYX"===e.order){let e=a*h,i=a*c,n=s*h,r=s*c;t[0]=o*h,t[4]=n*l-i,t[8]=e*l+r,t[1]=o*c,t[5]=r*l+e,t[9]=i*l-n,t[2]=-l,t[6]=s*o,t[10]=a*o}else if("YZX"===e.order){let e=a*o,i=a*l,n=s*o,r=s*l;t[0]=o*h,t[4]=r-e*c,t[8]=n*c+i,t[1]=c,t[5]=a*h,t[9]=-s*h,t[2]=-l*h,t[6]=i*c+n,t[10]=e-r*c}else if("XZY"===e.order){let e=a*o,i=a*l,n=s*o,r=s*l;t[0]=o*h,t[4]=-c,t[8]=l*h,t[1]=e*c+r,t[5]=a*h,t[9]=i*c-n,t[2]=n*c-i,t[6]=s*h,t[10]=r*c+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(eP,e,eL)}lookAt(e,t,i){let n=this.elements;return eI.subVectors(e,t),0===eI.lengthSq()&&(eI.z=1),eI.normalize(),eN.crossVectors(i,eI),0===eN.lengthSq()&&(1===Math.abs(i.z)?eI.x+=1e-4:eI.z+=1e-4,eI.normalize(),eN.crossVectors(i,eI)),eN.normalize(),eD.crossVectors(eI,eN),n[0]=eN.x,n[4]=eD.x,n[8]=eI.x,n[1]=eN.y,n[5]=eD.y,n[9]=eI.y,n[2]=eN.z,n[6]=eD.z,n[10]=eI.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,n=t.elements,r=this.elements,a=i[0],s=i[4],o=i[8],l=i[12],h=i[1],c=i[5],u=i[9],d=i[13],p=i[2],f=i[6],m=i[10],g=i[14],_=i[3],v=i[7],x=i[11],y=i[15],M=n[0],S=n[4],b=n[8],T=n[12],E=n[1],w=n[5],A=n[9],R=n[13],C=n[2],P=n[6],L=n[10],N=n[14],D=n[3],I=n[7],U=n[11],O=n[15];return r[0]=a*M+s*E+o*C+l*D,r[4]=a*S+s*w+o*P+l*I,r[8]=a*b+s*A+o*L+l*U,r[12]=a*T+s*R+o*N+l*O,r[1]=h*M+c*E+u*C+d*D,r[5]=h*S+c*w+u*P+d*I,r[9]=h*b+c*A+u*L+d*U,r[13]=h*T+c*R+u*N+d*O,r[2]=p*M+f*E+m*C+g*D,r[6]=p*S+f*w+m*P+g*I,r[10]=p*b+f*A+m*L+g*U,r[14]=p*T+f*R+m*N+g*O,r[3]=_*M+v*E+x*C+y*D,r[7]=_*S+v*w+x*P+y*I,r[11]=_*b+v*A+x*L+y*U,r[15]=_*T+v*R+x*N+y*O,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],i=e[4],n=e[8],r=e[12],a=e[1],s=e[5],o=e[9],l=e[13],h=e[2],c=e[6],u=e[10],d=e[14],p=e[3],f=e[7],m=e[11],g=e[15],_=o*d-l*u,v=s*d-l*c,x=s*u-o*c,y=a*d-l*h,M=a*u-o*h,S=a*c-s*h;return t*(f*_-m*v+g*x)-i*(p*_-m*y+g*M)+n*(p*v-f*y+g*S)-r*(p*x-f*M+m*S)}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(e,t,i){let n=this.elements;return e.isVector3?(n[12]=e.x,n[13]=e.y,n[14]=e.z):(n[12]=e,n[13]=t,n[14]=i),this}invert(){let e=this.elements,t=e[0],i=e[1],n=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],h=e[8],c=e[9],u=e[10],d=e[11],p=e[12],f=e[13],m=e[14],g=e[15],_=t*s-i*a,v=t*o-n*a,x=t*l-r*a,y=i*o-n*s,M=i*l-r*s,S=n*l-r*o,b=h*f-c*p,T=h*m-u*p,E=h*g-d*p,w=c*m-u*f,A=c*g-d*f,R=u*g-d*m,C=_*R-v*A+x*w+y*E-M*T+S*b;if(0===C)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let P=1/C;return e[0]=(s*R-o*A+l*w)*P,e[1]=(n*A-i*R-r*w)*P,e[2]=(f*S-m*M+g*y)*P,e[3]=(u*M-c*S-d*y)*P,e[4]=(o*E-a*R-l*T)*P,e[5]=(t*R-n*E+r*T)*P,e[6]=(m*x-p*S-g*v)*P,e[7]=(h*S-u*x+d*v)*P,e[8]=(a*A-s*E+l*b)*P,e[9]=(i*E-t*A-r*b)*P,e[10]=(p*M-f*x+g*_)*P,e[11]=(c*x-h*M-d*_)*P,e[12]=(s*T-a*w-o*b)*P,e[13]=(t*w-i*T+n*b)*P,e[14]=(f*v-p*y-m*_)*P,e[15]=(h*y-c*v+u*_)*P,this}scale(e){let t=this.elements,i=e.x,n=e.y,r=e.z;return t[0]*=i,t[4]*=n,t[8]*=r,t[1]*=i,t[5]*=n,t[9]*=r,t[2]*=i,t[6]*=n,t[10]*=r,t[3]*=i,t[7]*=n,t[11]*=r,this}getMaxScaleOnAxis(){let e=this.elements;return Math.sqrt(Math.max(e[0]*e[0]+e[1]*e[1]+e[2]*e[2],e[4]*e[4]+e[5]*e[5]+e[6]*e[6],e[8]*e[8]+e[9]*e[9]+e[10]*e[10]))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let i=Math.cos(t),n=Math.sin(t),r=1-i,a=e.x,s=e.y,o=e.z,l=r*a,h=r*s;return this.set(l*a+i,l*s-n*o,l*o+n*s,0,l*s+n*o,h*s+i,h*o-n*a,0,l*o-n*s,h*o+n*a,r*o*o+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,n,r,a){return this.set(1,i,r,0,e,1,a,0,t,n,1,0,0,0,0,1),this}compose(e,t,i){let n=this.elements,r=t._x,a=t._y,s=t._z,o=t._w,l=r+r,h=a+a,c=s+s,u=r*l,d=r*h,p=r*c,f=a*h,m=a*c,g=s*c,_=o*l,v=o*h,x=o*c,y=i.x,M=i.y,S=i.z;return n[0]=(1-(f+g))*y,n[1]=(d+x)*y,n[2]=(p-v)*y,n[3]=0,n[4]=(d-x)*M,n[5]=(1-(u+g))*M,n[6]=(m+_)*M,n[7]=0,n[8]=(p+v)*S,n[9]=(m-_)*S,n[10]=(1-(u+f))*S,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,this}decompose(e,t,i){let n=this.elements;e.x=n[12],e.y=n[13],e.z=n[14];let r=this.determinant();if(0===r)return i.set(1,1,1),t.identity(),this;let a=eR.set(n[0],n[1],n[2]).length(),s=eR.set(n[4],n[5],n[6]).length(),o=eR.set(n[8],n[9],n[10]).length();r<0&&(a=-a),eC.copy(this);let l=1/a,h=1/s,c=1/o;return eC.elements[0]*=l,eC.elements[1]*=l,eC.elements[2]*=l,eC.elements[4]*=h,eC.elements[5]*=h,eC.elements[6]*=h,eC.elements[8]*=c,eC.elements[9]*=c,eC.elements[10]*=c,t.setFromRotationMatrix(eC),i.x=a,i.y=s,i.z=o,this}makePerspective(e,t,i,n,r,a,s=2e3,o=!1){let l,h,c=this.elements;if(o)l=r/(a-r),h=a*r/(a-r);else if(2e3===s)l=-(a+r)/(a-r),h=-2*a*r/(a-r);else if(2001===s)l=-a/(a-r),h=-a*r/(a-r);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+s);return c[0]=2*r/(t-e),c[4]=0,c[8]=(t+e)/(t-e),c[12]=0,c[1]=0,c[5]=2*r/(i-n),c[9]=(i+n)/(i-n),c[13]=0,c[2]=0,c[6]=0,c[10]=l,c[14]=h,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,i,n,r,a,s=2e3,o=!1){let l,h,c=this.elements;if(o)l=1/(a-r),h=a/(a-r);else if(2e3===s)l=-2/(a-r),h=-(a+r)/(a-r);else if(2001===s)l=-1/(a-r),h=-r/(a-r);else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+s);return c[0]=2/(t-e),c[4]=0,c[8]=0,c[12]=-(t+e)/(t-e),c[1]=0,c[5]=2/(i-n),c[9]=0,c[13]=-(i+n)/(i-n),c[2]=0,c[6]=0,c[10]=l,c[14]=h,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,i=e.elements;for(let e=0;e<16;e++)if(t[e]!==i[e])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}let eR=new es,eC=new eA,eP=new es(0,0,0),eL=new es(1,1,1),eN=new es,eD=new es,eI=new es,eU=new eA,eO=new ea;class eF{constructor(e=0,t=0,i=0,n=eF.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=n}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,n=this._order){return this._x=e,this._y=t,this._z=i,this._order=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){let n=e.elements,r=n[0],a=n[4],s=n[8],o=n[1],l=n[5],h=n[9],c=n[2],u=n[6],d=n[10];switch(t){case"XYZ":this._y=Math.asin(ee(s,-1,1)),.9999999>Math.abs(s)?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(u,l),this._z=0);break;case"YXZ":this._x=Math.asin(-ee(h,-1,1)),.9999999>Math.abs(h)?(this._y=Math.atan2(s,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-c,r),this._z=0);break;case"ZXY":this._x=Math.asin(ee(u,-1,1)),.9999999>Math.abs(u)?(this._y=Math.atan2(-c,d),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-ee(c,-1,1)),.9999999>Math.abs(c)?(this._x=Math.atan2(u,d),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(ee(o,-1,1)),.9999999>Math.abs(o)?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-c,r)):(this._x=0,this._y=Math.atan2(s,d));break;case"XZY":this._z=Math.asin(-ee(a,-1,1)),.9999999>Math.abs(a)?(this._x=Math.atan2(u,l),this._y=Math.atan2(s,r)):(this._x=Math.atan2(-h,d),this._y=0);break;default:W("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===i&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return eU.makeRotationFromQuaternion(e),this.setFromRotationMatrix(eU,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return eO.setFromEuler(this),this.setFromQuaternion(eO,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}eF.DEFAULT_ORDER="XYZ";class eB{constructor(){this.mask=1}set(e){this.mask=1<<e>>>0}enable(e){this.mask|=1<<e}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e}disable(e){this.mask&=~(1<<e)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!=0}isEnabled(e){return(this.mask&1<<e)!=0}}let ek=0,ez=new es,eV=new ea,eH=new eA,eG=new es,ej=new es,eW=new es,eX=new ea,eY=new es(1,0,0),eq=new es(0,1,0),eK=new es(0,0,1),eZ={type:"added"},eJ={type:"removed"},e$={type:"childadded",child:null},eQ={type:"childremoved",child:null};class e0 extends K{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:ek++}),this.uuid=Q(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=e0.DEFAULT_UP.clone();const e=new es,t=new eF,i=new ea,n=new es(1,1,1);t._onChange(function(){i.setFromEuler(t,!1)}),i._onChange(function(){t.setFromQuaternion(i,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new eA},normalMatrix:{value:new eh}}),this.matrix=new eA,this.matrixWorld=new eA,this.matrixAutoUpdate=e0.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=e0.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new eB,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return eV.setFromAxisAngle(e,t),this.quaternion.multiply(eV),this}rotateOnWorldAxis(e,t){return eV.setFromAxisAngle(e,t),this.quaternion.premultiply(eV),this}rotateX(e){return this.rotateOnAxis(eY,e)}rotateY(e){return this.rotateOnAxis(eq,e)}rotateZ(e){return this.rotateOnAxis(eK,e)}translateOnAxis(e,t){return ez.copy(e).applyQuaternion(this.quaternion),this.position.add(ez.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(eY,e)}translateY(e){return this.translateOnAxis(eq,e)}translateZ(e){return this.translateOnAxis(eK,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(eH.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?eG.copy(e):eG.set(e,t,i);let n=this.parent;this.updateWorldMatrix(!0,!1),ej.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?eH.lookAt(ej,eG,this.up):eH.lookAt(eG,ej,this.up),this.quaternion.setFromRotationMatrix(eH),n&&(eH.extractRotation(n.matrixWorld),eV.setFromRotationMatrix(eH),this.quaternion.premultiply(eV.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?X("Object3D.add: object can't be added as a child of itself.",e):e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(eZ),e$.child=e,this.dispatchEvent(e$),e$.child=null):X("Object3D.add: object not an instance of THREE.Object3D.",e),this}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}let t=this.children.indexOf(e);return -1!==t&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(eJ),eQ.child=e,this.dispatchEvent(eQ),eQ.child=null),this}removeFromParent(){let e=this.parent;return null!==e&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),eH.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),eH.multiply(e.parent.matrixWorld)),e.applyMatrix4(eH),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(eZ),e$.child=e,this.dispatchEvent(e$),e$.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let i=0,n=this.children.length;i<n;i++){let n=this.children[i].getObjectByProperty(e,t);if(void 0!==n)return n}}getObjectsByProperty(e,t,i=[]){this[e]===t&&i.push(this);let n=this.children;for(let r=0,a=n.length;r<a;r++)n[r].getObjectsByProperty(e,t,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ej,e,eW),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ej,eX,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let i=0,n=t.length;i<n;i++)t[i].traverse(e)}traverseVisible(e){if(!1===this.visible)return;e(this);let t=this.children;for(let i=0,n=t.length;i<n;i++)t[i].traverseVisible(e)}traverseAncestors(e){let t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let e=this.pivot;if(null!==e){let t=e.x,i=e.y,n=e.z,r=this.matrix.elements;r[12]+=t-r[0]*t-r[4]*i-r[8]*n,r[13]+=i-r[1]*t-r[5]*i-r[9]*n,r[14]+=n-r[2]*t-r[6]*i-r[10]*n}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let i=0,n=t.length;i<n;i++)t[i].updateMatrixWorld(e)}updateWorldMatrix(e,t){let i=this.parent;if(!0===e&&null!==i&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),!0===t){let e=this.children;for(let t=0,i=e.length;t<i;t++)e[t].updateWorldMatrix(!1,!0)}}toJSON(e){let t=void 0===e||"string"==typeof e,i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let n={};function r(t,i){return void 0===t[i.uuid]&&(t[i.uuid]=i.toJSON(e)),i.uuid}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),!0===this.castShadow&&(n.castShadow=!0),!0===this.receiveShadow&&(n.receiveShadow=!0),!1===this.visible&&(n.visible=!1),!1===this.frustumCulled&&(n.frustumCulled=!1),0!==this.renderOrder&&(n.renderOrder=this.renderOrder),!1!==this.static&&(n.static=this.static),Object.keys(this.userData).length>0&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),n.up=this.up.toArray(),null!==this.pivot&&(n.pivot=this.pivot.toArray()),!1===this.matrixAutoUpdate&&(n.matrixAutoUpdate=!1),void 0!==this.morphTargetDictionary&&(n.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),void 0!==this.morphTargetInfluences&&(n.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(n.type="InstancedMesh",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(n.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(n.type="BatchedMesh",n.perObjectFrustumCulled=this.perObjectFrustumCulled,n.sortObjects=this.sortObjects,n.drawRanges=this._drawRanges,n.reservedRanges=this._reservedRanges,n.geometryInfo=this._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox?e.boundingBox.toJSON():void 0,boundingSphere:e.boundingSphere?e.boundingSphere.toJSON():void 0})),n.instanceInfo=this._instanceInfo.map(e=>({...e})),n.availableInstanceIds=this._availableInstanceIds.slice(),n.availableGeometryIds=this._availableGeometryIds.slice(),n.nextIndexStart=this._nextIndexStart,n.nextVertexStart=this._nextVertexStart,n.geometryCount=this._geometryCount,n.maxInstanceCount=this._maxInstanceCount,n.maxVertexCount=this._maxVertexCount,n.maxIndexCount=this._maxIndexCount,n.geometryInitialized=this._geometryInitialized,n.matricesTexture=this._matricesTexture.toJSON(e),n.indirectTexture=this._indirectTexture.toJSON(e),null!==this._colorsTexture&&(n.colorsTexture=this._colorsTexture.toJSON(e)),null!==this.boundingSphere&&(n.boundingSphere=this.boundingSphere.toJSON()),null!==this.boundingBox&&(n.boundingBox=this.boundingBox.toJSON())),this.isScene)this.background&&(this.background.isColor?n.background=this.background.toJSON():this.background.isTexture&&(n.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(n.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){n.geometry=r(e.geometries,this.geometry);let t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){let i=t.shapes;if(Array.isArray(i))for(let t=0,n=i.length;t<n;t++){let n=i[t];r(e.shapes,n)}else r(e.shapes,i)}}if(this.isSkinnedMesh&&(n.bindMode=this.bindMode,n.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(e.skeletons,this.skeleton),n.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){let t=[];for(let i=0,n=this.material.length;i<n;i++)t.push(r(e.materials,this.material[i]));n.material=t}else n.material=r(e.materials,this.material);if(this.children.length>0){n.children=[];for(let t=0;t<this.children.length;t++)n.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){n.animations=[];for(let t=0;t<this.animations.length;t++){let i=this.animations[t];n.animations.push(r(e.animations,i))}}if(t){let t=a(e.geometries),n=a(e.materials),r=a(e.textures),s=a(e.images),o=a(e.shapes),l=a(e.skeletons),h=a(e.animations),c=a(e.nodes);t.length>0&&(i.geometries=t),n.length>0&&(i.materials=n),r.length>0&&(i.textures=r),s.length>0&&(i.images=s),o.length>0&&(i.shapes=o),l.length>0&&(i.skeletons=l),h.length>0&&(i.animations=h),c.length>0&&(i.nodes=c)}return i.object=n,i;function a(e){let t=[];for(let i in e){let n=e[i];delete n.metadata,t.push(n)}return t}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),null!==e.pivot&&(this.pivot=e.pivot.clone()),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t<e.children.length;t++){let i=e.children[t];this.add(i.clone())}return this}}e0.DEFAULT_UP=new es(0,1,0),e0.DEFAULT_MATRIX_AUTO_UPDATE=!0,e0.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class e1 extends e0{constructor(){super(),this.isGroup=!0,this.type="Group"}}let e2={type:"move"};class e3{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new e1,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new e1,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new es,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new es),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new e1,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new es,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new es),this._grip}dispatchEvent(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(e,t,i){let n=null,r=null,a=null,s=this._targetRay,o=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(l&&e.hand){for(let n of(a=!0,e.hand.values())){let e=t.getJointPose(n,i),r=this._getHandJoint(l,n);null!==e&&(r.matrix.fromArray(e.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.matrixWorldNeedsUpdate=!0,r.jointRadius=e.radius),r.visible=null!==e}let n=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],s=n.position.distanceTo(r.position);l.inputState.pinching&&s>.025?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&s<=.015&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==o&&e.gripSpace&&null!==(r=t.getPose(e.gripSpace,i))&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1);null!==s&&(null===(n=t.getPose(e.targetRaySpace,i))&&null!==r&&(n=r),null!==n&&(s.matrix.fromArray(n.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,n.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(n.linearVelocity)):s.hasLinearVelocity=!1,n.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(n.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(e2)))}return null!==s&&(s.visible=null!==n),null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==a),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){let i=new e1;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}let e4={aliceblue:0xf0f8ff,antiquewhite:0xfaebd7,aqua:65535,aquamarine:8388564,azure:0xf0ffff,beige:0xf5f5dc,bisque:0xffe4c4,black:0,blanchedalmond:0xffebcd,blue:255,blueviolet:9055202,brown:0xa52a2a,burlywood:0xdeb887,cadetblue:6266528,chartreuse:8388352,chocolate:0xd2691e,coral:0xff7f50,cornflowerblue:6591981,cornsilk:0xfff8dc,crimson:0xdc143c,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:0xb8860b,darkgray:0xa9a9a9,darkgreen:25600,darkgrey:0xa9a9a9,darkkhaki:0xbdb76b,darkmagenta:9109643,darkolivegreen:5597999,darkorange:0xff8c00,darkorchid:0x9932cc,darkred:9109504,darksalmon:0xe9967a,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:0xff1493,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:0xb22222,floralwhite:0xfffaf0,forestgreen:2263842,fuchsia:0xff00ff,gainsboro:0xdcdcdc,ghostwhite:0xf8f8ff,gold:0xffd700,goldenrod:0xdaa520,gray:8421504,green:32768,greenyellow:0xadff2f,grey:8421504,honeydew:0xf0fff0,hotpink:0xff69b4,indianred:0xcd5c5c,indigo:4915330,ivory:0xfffff0,khaki:0xf0e68c,lavender:0xe6e6fa,lavenderblush:0xfff0f5,lawngreen:8190976,lemonchiffon:0xfffacd,lightblue:0xadd8e6,lightcoral:0xf08080,lightcyan:0xe0ffff,lightgoldenrodyellow:0xfafad2,lightgray:0xd3d3d3,lightgreen:9498256,lightgrey:0xd3d3d3,lightpink:0xffb6c1,lightsalmon:0xffa07a,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:0xb0c4de,lightyellow:0xffffe0,lime:65280,limegreen:3329330,linen:0xfaf0e6,magenta:0xff00ff,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:0xba55d3,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:0xc71585,midnightblue:1644912,mintcream:0xf5fffa,mistyrose:0xffe4e1,moccasin:0xffe4b5,navajowhite:0xffdead,navy:128,oldlace:0xfdf5e6,olive:8421376,olivedrab:7048739,orange:0xffa500,orangered:0xff4500,orchid:0xda70d6,palegoldenrod:0xeee8aa,palegreen:0x98fb98,paleturquoise:0xafeeee,palevioletred:0xdb7093,papayawhip:0xffefd5,peachpuff:0xffdab9,peru:0xcd853f,pink:0xffc0cb,plum:0xdda0dd,powderblue:0xb0e0e6,purple:8388736,rebeccapurple:6697881,red:0xff0000,rosybrown:0xbc8f8f,royalblue:4286945,saddlebrown:9127187,salmon:0xfa8072,sandybrown:0xf4a460,seagreen:3050327,seashell:0xfff5ee,sienna:0xa0522d,silver:0xc0c0c0,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:0xfffafa,springgreen:65407,steelblue:4620980,tan:0xd2b48c,teal:32896,thistle:0xd8bfd8,tomato:0xff6347,turquoise:4251856,violet:0xee82ee,wheat:0xf5deb3,white:0xffffff,whitesmoke:0xf5f5f5,yellow:0xffff00,yellowgreen:0x9acd32},e5={h:0,s:0,l:0},e6={h:0,s:0,l:0};function e8(e,t,i){return(i<0&&(i+=1),i>1&&(i-=1),i<1/6)?e+(t-e)*6*i:i<.5?t:i<2/3?e+(t-e)*6*(2/3-i):e}class e9{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){return void 0===t&&void 0===i?e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e):this.setRGB(e,t,i),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=O){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,ep.colorSpaceToWorking(this,t),this}setRGB(e,t,i,n=ep.workingColorSpace){return this.r=e,this.g=t,this.b=i,ep.colorSpaceToWorking(this,n),this}setHSL(e,t,i,n=ep.workingColorSpace){if(e=(e%1+1)%1,t=ee(t,0,1),i=ee(i,0,1),0===t)this.r=this.g=this.b=i;else{let n=i<=.5?i*(1+t):i+t-i*t,r=2*i-n;this.r=e8(r,n,e+1/3),this.g=e8(r,n,e),this.b=e8(r,n,e-1/3)}return ep.colorSpaceToWorking(this,n),this}setStyle(e,t=O){let i;function n(t){void 0!==t&&1>parseFloat(t)&&W("Color: Alpha component of "+e+" will be ignored.")}if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r,a=i[1],s=i[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:W("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){let n=i[1],r=n.length;if(3===r)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(6===r)return this.setHex(parseInt(n,16),t);W("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=O){let i=e4[e.toLowerCase()];return void 0!==i?this.setHex(i,t):W("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=ef(e.r),this.g=ef(e.g),this.b=ef(e.b),this}copyLinearToSRGB(e){return this.r=em(e.r),this.g=em(e.g),this.b=em(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=O){return ep.workingToColorSpace(e7.copy(this),e),65536*Math.round(ee(255*e7.r,0,255))+256*Math.round(ee(255*e7.g,0,255))+Math.round(ee(255*e7.b,0,255))}getHexString(e=O){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ep.workingColorSpace){let i,n;ep.workingToColorSpace(e7.copy(this),t);let r=e7.r,a=e7.g,s=e7.b,o=Math.max(r,a,s),l=Math.min(r,a,s),h=(l+o)/2;if(l===o)i=0,n=0;else{let e=o-l;switch(n=h<=.5?e/(o+l):e/(2-o-l),o){case r:i=(a-s)/e+6*(a<s);break;case a:i=(s-r)/e+2;break;case s:i=(r-a)/e+4}i/=6}return e.h=i,e.s=n,e.l=h,e}getRGB(e,t=ep.workingColorSpace){return ep.workingToColorSpace(e7.copy(this),t),e.r=e7.r,e.g=e7.g,e.b=e7.b,e}getStyle(e=O){ep.workingToColorSpace(e7.copy(this),e);let t=e7.r,i=e7.g,n=e7.b;return e!==O?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${n.toFixed(3)})`:`rgb(${Math.round(255*t)},${Math.round(255*i)},${Math.round(255*n)})`}offsetHSL(e,t,i){return this.getHSL(e5),this.setHSL(e5.h+e,e5.s+t,e5.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(e5),e.getHSL(e6);let i=et(e5.h,e6.h,t),n=et(e5.s,e6.s,t),r=et(e5.l,e6.l,t);return this.setHSL(i,n,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,i=this.g,n=this.b,r=e.elements;return this.r=r[0]*t+r[3]*i+r[6]*n,this.g=r[1]*t+r[4]*i+r[7]*n,this.b=r[2]*t+r[5]*i+r[8]*n,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}let e7=new e9;e9.NAMES=e4;class te{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new e9(e),this.density=t}clone(){return new te(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class tt extends e0{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new eF,this.environmentIntensity=1,this.environmentRotation=new eF,this.overrideMaterial=null,"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}let ti=new es,tn=new es,tr=new es,ta=new es,ts=new es,to=new es,tl=new es,th=new es,tc=new es,tu=new es,td=new eb,tp=new eb,tf=new eb;class tm{constructor(e=new es,t=new es,i=new es){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,n){n.subVectors(i,t),ti.subVectors(e,t),n.cross(ti);let r=n.lengthSq();return r>0?n.multiplyScalar(1/Math.sqrt(r)):n.set(0,0,0)}static getBarycoord(e,t,i,n,r){ti.subVectors(n,t),tn.subVectors(i,t),tr.subVectors(e,t);let a=ti.dot(ti),s=ti.dot(tn),o=ti.dot(tr),l=tn.dot(tn),h=tn.dot(tr),c=a*l-s*s;if(0===c)return r.set(0,0,0),null;let u=1/c,d=(l*o-s*h)*u,p=(a*h-s*o)*u;return r.set(1-d-p,p,d)}static containsPoint(e,t,i,n){return null!==this.getBarycoord(e,t,i,n,ta)&&ta.x>=0&&ta.y>=0&&ta.x+ta.y<=1}static getInterpolation(e,t,i,n,r,a,s,o){return null===this.getBarycoord(e,t,i,n,ta)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(r,ta.x),o.addScaledVector(a,ta.y),o.addScaledVector(s,ta.z),o)}static getInterpolatedAttribute(e,t,i,n,r,a){return td.setScalar(0),tp.setScalar(0),tf.setScalar(0),td.fromBufferAttribute(e,t),tp.fromBufferAttribute(e,i),tf.fromBufferAttribute(e,n),a.setScalar(0),a.addScaledVector(td,r.x),a.addScaledVector(tp,r.y),a.addScaledVector(tf,r.z),a}static isFrontFacing(e,t,i,n){return ti.subVectors(i,t),tn.subVectors(e,t),0>ti.cross(tn).dot(n)}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,n){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[n]),this}setFromAttributeAndIndices(e,t,i,n){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return ti.subVectors(this.c,this.b),tn.subVectors(this.a,this.b),.5*ti.cross(tn).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return tm.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return tm.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,n,r){return tm.getInterpolation(e,this.a,this.b,this.c,t,i,n,r)}containsPoint(e){return tm.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return tm.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let i,n,r=this.a,a=this.b,s=this.c;ts.subVectors(a,r),to.subVectors(s,r),th.subVectors(e,r);let o=ts.dot(th),l=to.dot(th);if(o<=0&&l<=0)return t.copy(r);tc.subVectors(e,a);let h=ts.dot(tc),c=to.dot(tc);if(h>=0&&c<=h)return t.copy(a);let u=o*c-h*l;if(u<=0&&o>=0&&h<=0)return i=o/(o-h),t.copy(r).addScaledVector(ts,i);tu.subVectors(e,s);let d=ts.dot(tu),p=to.dot(tu);if(p>=0&&d<=p)return t.copy(s);let f=d*l-o*p;if(f<=0&&l>=0&&p<=0)return n=l/(l-p),t.copy(r).addScaledVector(to,n);let m=h*p-d*c;if(m<=0&&c-h>=0&&d-p>=0)return tl.subVectors(s,a),n=(c-h)/(c-h+(d-p)),t.copy(a).addScaledVector(tl,n);let g=1/(m+f+u);return i=f*g,n=u*g,t.copy(r).addScaledVector(ts,i).addScaledVector(to,n)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class tg{constructor(e=new es(Infinity,Infinity,Infinity),t=new es(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t+=3)this.expandByPoint(tv.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(tv.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let i=tv.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=Infinity,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let i=e.geometry;if(void 0!==i){let n=i.getAttribute("position");if(!0===t&&void 0!==n&&!0!==e.isInstancedMesh)for(let t=0,i=n.count;t<i;t++)!0===e.isMesh?e.getVertexPosition(t,tv):tv.fromBufferAttribute(n,t),tv.applyMatrix4(e.matrixWorld),this.expandByPoint(tv);else void 0!==e.boundingBox?(null===e.boundingBox&&e.computeBoundingBox(),tx.copy(e.boundingBox)):(null===i.boundingBox&&i.computeBoundingBox(),tx.copy(i.boundingBox)),tx.applyMatrix4(e.matrixWorld),this.union(tx)}let n=e.children;for(let e=0,i=n.length;e<i;e++)this.expandByObject(n[e],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,tv),tv.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(tw),tA.subVectors(this.max,tw),ty.subVectors(e.a,tw),tM.subVectors(e.b,tw),tS.subVectors(e.c,tw),tb.subVectors(tM,ty),tT.subVectors(tS,tM),tE.subVectors(ty,tS);let t=[0,-tb.z,tb.y,0,-tT.z,tT.y,0,-tE.z,tE.y,tb.z,0,-tb.x,tT.z,0,-tT.x,tE.z,0,-tE.x,-tb.y,tb.x,0,-tT.y,tT.x,0,-tE.y,tE.x,0];return!!tP(t,ty,tM,tS,tA)&&!!tP(t=[1,0,0,0,1,0,0,0,1],ty,tM,tS,tA)&&(tR.crossVectors(tb,tT),tP(t=[tR.x,tR.y,tR.z],ty,tM,tS,tA))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,tv).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(tv).length()),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(t_[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),t_[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),t_[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),t_[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),t_[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),t_[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),t_[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),t_[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(t_)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}let t_=[new es,new es,new es,new es,new es,new es,new es,new es],tv=new es,tx=new tg,ty=new es,tM=new es,tS=new es,tb=new es,tT=new es,tE=new es,tw=new es,tA=new es,tR=new es,tC=new es;function tP(e,t,i,n,r){for(let a=0,s=e.length-3;a<=s;a+=3){tC.fromArray(e,a);let s=r.x*Math.abs(tC.x)+r.y*Math.abs(tC.y)+r.z*Math.abs(tC.z),o=t.dot(tC),l=i.dot(tC),h=n.dot(tC);if(Math.max(-Math.max(o,l,h),Math.min(o,l,h))>s)return!1}return!0}let tL=new es,tN=new er,tD=0;class tI{constructor(e,t,i=!1){if(Array.isArray(e))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:tD++}),this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=i,this.usage=35044,this.updateRanges=[],this.gpuType=1015,this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let n=0,r=this.itemSize;n<r;n++)this.array[e+n]=t.array[i+n];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(2===this.itemSize)for(let t=0,i=this.count;t<i;t++)tN.fromBufferAttribute(this,t),tN.applyMatrix3(e),this.setXY(t,tN.x,tN.y);else if(3===this.itemSize)for(let t=0,i=this.count;t<i;t++)tL.fromBufferAttribute(this,t),tL.applyMatrix3(e),this.setXYZ(t,tL.x,tL.y,tL.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)tL.fromBufferAttribute(this,t),tL.applyMatrix4(e),this.setXYZ(t,tL.x,tL.y,tL.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)tL.fromBufferAttribute(this,t),tL.applyNormalMatrix(e),this.setXYZ(t,tL.x,tL.y,tL.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)tL.fromBufferAttribute(this,t),tL.transformDirection(e),this.setXYZ(t,tL.x,tL.y,tL.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=ei(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=en(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=ei(t,this.array)),t}setX(e,t){return this.normalized&&(t=en(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=ei(t,this.array)),t}setY(e,t){return this.normalized&&(t=en(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=ei(t,this.array)),t}setZ(e,t){return this.normalized&&(t=en(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=ei(t,this.array)),t}setW(e,t){return this.normalized&&(t=en(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=en(t,this.array),i=en(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,n){return e*=this.itemSize,this.normalized&&(t=en(t,this.array),i=en(i,this.array),n=en(n,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=n,this}setXYZW(e,t,i,n,r){return e*=this.itemSize,this.normalized&&(t=en(t,this.array),i=en(i,this.array),n=en(n,this.array),r=en(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=n,this.array[e+3]=r,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),35044!==this.usage&&(e.usage=this.usage),e}}class tU extends tI{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class tO extends tI{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class tF extends tI{constructor(e,t,i){super(new Float32Array(e),t,i)}}let tB=new tg,tk=new es,tz=new es;class tV{constructor(e=new es,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let i=this.center;void 0!==t?i.copy(t):tB.setFromPoints(e).getCenter(i);let n=0;for(let t=0,r=e.length;t<r;t++)n=Math.max(n,i.distanceToSquared(e[t]));return this.radius=Math.sqrt(n),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let i=this.center.distanceToSquared(e);return t.copy(e),i>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?e.makeEmpty():(e.set(this.center,this.center),e.expandByScalar(this.radius)),e}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;tk.subVectors(e,this.center);let t=tk.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),i=(e-this.radius)*.5;this.center.addScaledVector(tk,i/e),this.radius+=i}return this}union(e){return e.isEmpty()||(this.isEmpty()?this.copy(e):!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(tz.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(tk.copy(e.center).add(tz)),this.expandByPoint(tk.copy(e.center).sub(tz)))),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let tH=0,tG=new eA,tj=new e0,tW=new es,tX=new tg,tY=new tg,tq=new es;class tK extends K{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:tH++}),this.uuid=Q(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(!function(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}(e)?tU:tO)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return void 0!==this.attributes[e]}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);let i=this.attributes.normal;if(void 0!==i){let t=new eh().getNormalMatrix(e);i.applyNormalMatrix(t),i.needsUpdate=!0}let n=this.attributes.tangent;return void 0!==n&&(n.transformDirection(e),n.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(e){return tG.makeRotationFromQuaternion(e),this.applyMatrix4(tG),this}rotateX(e){return tG.makeRotationX(e),this.applyMatrix4(tG),this}rotateY(e){return tG.makeRotationY(e),this.applyMatrix4(tG),this}rotateZ(e){return tG.makeRotationZ(e),this.applyMatrix4(tG),this}translate(e,t,i){return tG.makeTranslation(e,t,i),this.applyMatrix4(tG),this}scale(e,t,i){return tG.makeScale(e,t,i),this.applyMatrix4(tG),this}lookAt(e){return tj.lookAt(e),tj.updateMatrix(),this.applyMatrix4(tj.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(tW).negate(),this.translate(tW.x,tW.y,tW.z),this}setFromPoints(e){let t=this.getAttribute("position");if(void 0===t){let t=[];for(let i=0,n=e.length;i<n;i++){let n=e[i];t.push(n.x,n.y,n.z||0)}this.setAttribute("position",new tF(t,3))}else{let i=Math.min(e.length,t.count);for(let n=0;n<i;n++){let i=e[n];t.setXYZ(n,i.x,i.y,i.z||0)}e.length>t.count&&W("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new tg);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){X("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new es(-1/0,-1/0,-1/0),new es(Infinity,Infinity,Infinity));return}if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,i=t.length;e<i;e++){let i=t[e];tX.setFromBufferAttribute(i),this.morphTargetsRelative?(tq.addVectors(this.boundingBox.min,tX.min),this.boundingBox.expandByPoint(tq),tq.addVectors(this.boundingBox.max,tX.max),this.boundingBox.expandByPoint(tq)):(this.boundingBox.expandByPoint(tX.min),this.boundingBox.expandByPoint(tX.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&X('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new tV);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){X("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new es,1/0);return}if(e){let i=this.boundingSphere.center;if(tX.setFromBufferAttribute(e),t)for(let e=0,i=t.length;e<i;e++){let i=t[e];tY.setFromBufferAttribute(i),this.morphTargetsRelative?(tq.addVectors(tX.min,tY.min),tX.expandByPoint(tq),tq.addVectors(tX.max,tY.max),tX.expandByPoint(tq)):(tX.expandByPoint(tY.min),tX.expandByPoint(tY.max))}tX.getCenter(i);let n=0;for(let t=0,r=e.count;t<r;t++)tq.fromBufferAttribute(e,t),n=Math.max(n,i.distanceToSquared(tq));if(t)for(let r=0,a=t.length;r<a;r++){let a=t[r],s=this.morphTargetsRelative;for(let t=0,r=a.count;t<r;t++)tq.fromBufferAttribute(a,t),s&&(tW.fromBufferAttribute(e,t),tq.add(tW)),n=Math.max(n,i.distanceToSquared(tq))}this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&X('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(null===e||void 0===t.position||void 0===t.normal||void 0===t.uv)return void X("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");let i=t.position,n=t.normal,r=t.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new tI(new Float32Array(4*i.count),4));let a=this.getAttribute("tangent"),s=[],o=[];for(let e=0;e<i.count;e++)s[e]=new es,o[e]=new es;let l=new es,h=new es,c=new es,u=new er,d=new er,p=new er,f=new es,m=new es,g=this.groups;0===g.length&&(g=[{start:0,count:e.count}]);for(let t=0,n=g.length;t<n;++t){let n=g[t],a=n.start,_=n.count;for(let t=a,n=a+_;t<n;t+=3)!function(e,t,n){l.fromBufferAttribute(i,e),h.fromBufferAttribute(i,t),c.fromBufferAttribute(i,n),u.fromBufferAttribute(r,e),d.fromBufferAttribute(r,t),p.fromBufferAttribute(r,n),h.sub(l),c.sub(l),d.sub(u),p.sub(u);let a=1/(d.x*p.y-p.x*d.y);isFinite(a)&&(f.copy(h).multiplyScalar(p.y).addScaledVector(c,-d.y).multiplyScalar(a),m.copy(c).multiplyScalar(d.x).addScaledVector(h,-p.x).multiplyScalar(a),s[e].add(f),s[t].add(f),s[n].add(f),o[e].add(m),o[t].add(m),o[n].add(m))}(e.getX(t+0),e.getX(t+1),e.getX(t+2))}let _=new es,v=new es,x=new es,y=new es;function M(e){x.fromBufferAttribute(n,e),y.copy(x);let t=s[e];_.copy(t),_.sub(x.multiplyScalar(x.dot(t))).normalize(),v.crossVectors(y,t);let i=v.dot(o[e]);a.setXYZW(e,_.x,_.y,_.z,i<0?-1:1)}for(let t=0,i=g.length;t<i;++t){let i=g[t],n=i.start,r=i.count;for(let t=n,i=n+r;t<i;t+=3)M(e.getX(t+0)),M(e.getX(t+1)),M(e.getX(t+2))}}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(void 0!==t){let i=this.getAttribute("normal");if(void 0===i)i=new tI(new Float32Array(3*t.count),3),this.setAttribute("normal",i);else for(let e=0,t=i.count;e<t;e++)i.setXYZ(e,0,0,0);let n=new es,r=new es,a=new es,s=new es,o=new es,l=new es,h=new es,c=new es;if(e)for(let u=0,d=e.count;u<d;u+=3){let d=e.getX(u+0),p=e.getX(u+1),f=e.getX(u+2);n.fromBufferAttribute(t,d),r.fromBufferAttribute(t,p),a.fromBufferAttribute(t,f),h.subVectors(a,r),c.subVectors(n,r),h.cross(c),s.fromBufferAttribute(i,d),o.fromBufferAttribute(i,p),l.fromBufferAttribute(i,f),s.add(h),o.add(h),l.add(h),i.setXYZ(d,s.x,s.y,s.z),i.setXYZ(p,o.x,o.y,o.z),i.setXYZ(f,l.x,l.y,l.z)}else for(let e=0,s=t.count;e<s;e+=3)n.fromBufferAttribute(t,e+0),r.fromBufferAttribute(t,e+1),a.fromBufferAttribute(t,e+2),h.subVectors(a,r),c.subVectors(n,r),h.cross(c),i.setXYZ(e+0,h.x,h.y,h.z),i.setXYZ(e+1,h.x,h.y,h.z),i.setXYZ(e+2,h.x,h.y,h.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)tq.fromBufferAttribute(e,t),tq.normalize(),e.setXYZ(t,tq.x,tq.y,tq.z)}toNonIndexed(){function e(e,t){let i=e.array,n=e.itemSize,r=e.normalized,a=new i.constructor(t.length*n),s=0,o=0;for(let r=0,l=t.length;r<l;r++){s=e.isInterleavedBufferAttribute?t[r]*e.data.stride+e.offset:t[r]*n;for(let e=0;e<n;e++)a[o++]=i[s++]}return new tI(a,n,r)}if(null===this.index)return W("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new tK,i=this.index.array,n=this.attributes;for(let r in n){let a=e(n[r],i);t.setAttribute(r,a)}let r=this.morphAttributes;for(let n in r){let a=[],s=r[n];for(let t=0,n=s.length;t<n;t++){let n=e(s[t],i);a.push(n)}t.morphAttributes[n]=a}t.morphTargetsRelative=this.morphTargetsRelative;let a=this.groups;for(let e=0,i=a.length;e<i;e++){let i=a[e];t.addGroup(i.start,i.count,i.materialIndex)}return t}toJSON(){let e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),void 0!==this.parameters){let t=this.parameters;for(let i in t)void 0!==t[i]&&(e[i]=t[i]);return e}e.data={attributes:{}};let t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let i=this.attributes;for(let t in i){let n=i[t];e.data.attributes[t]=n.toJSON(e.data)}let n={},r=!1;for(let t in this.morphAttributes){let i=this.morphAttributes[t],a=[];for(let t=0,n=i.length;t<n;t++){let n=i[t];a.push(n.toJSON(e.data))}a.length>0&&(n[t]=a,r=!0)}r&&(e.data.morphAttributes=n,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let s=this.boundingSphere;return null!==s&&(e.data.boundingSphere=s.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let i=e.index;null!==i&&this.setIndex(i.clone());let n=e.attributes;for(let e in n){let i=n[e];this.setAttribute(e,i.clone(t))}let r=e.morphAttributes;for(let e in r){let i=[],n=r[e];for(let e=0,r=n.length;e<r;e++)i.push(n[e].clone(t));this.morphAttributes[e]=i}this.morphTargetsRelative=e.morphTargetsRelative;let a=e.groups;for(let e=0,t=a.length;e<t;e++){let t=a[e];this.addGroup(t.start,t.count,t.materialIndex)}let s=e.boundingBox;null!==s&&(this.boundingBox=s.clone());let o=e.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}let tZ=0;class tJ extends K{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:tZ++}),this.uuid=Q(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new e9(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(let t in e){let i=e[t];if(void 0===i){W(`Material: parameter '${t}' has value of undefined.`);continue}let n=this[t];if(void 0===n){W(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[t]=i}}toJSON(e){let t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});let i={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};function n(e){let t=[];for(let i in e){let n=e[i];delete n.metadata,t.push(n)}return t}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),void 0!==this.sheen&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),void 0!==this.dispersion&&(i.dispersion=this.dispersion),void 0!==this.iridescence&&(i.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(i.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),void 0!==this.anisotropy&&(i.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(i.combine=this.combine)),void 0!==this.envMapRotation&&(i.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(i.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(i.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(i.size=this.size),null!==this.shadowSide&&(i.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(i.blending=this.blending),0!==this.side&&(i.side=this.side),!0===this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=!0),204!==this.blendSrc&&(i.blendSrc=this.blendSrc),205!==this.blendDst&&(i.blendDst=this.blendDst),100!==this.blendEquation&&(i.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(i.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(i.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(i.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(i.depthFunc=this.depthFunc),!1===this.depthTest&&(i.depthTest=this.depthTest),!1===this.depthWrite&&(i.depthWrite=this.depthWrite),!1===this.colorWrite&&(i.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(i.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(i.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(i.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(i.stencilFuncMask=this.stencilFuncMask),7680!==this.stencilFail&&(i.stencilFail=this.stencilFail),7680!==this.stencilZFail&&(i.stencilZFail=this.stencilZFail),7680!==this.stencilZPass&&(i.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(i.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.alphaHash&&(i.alphaHash=!0),!0===this.alphaToCoverage&&(i.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=!0),!0===this.forceSinglePass&&(i.forceSinglePass=!0),!1===this.allowOverride&&(i.allowOverride=!1),!0===this.wireframe&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(i.flatShading=!0),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),!1===this.fog&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData),t){let t=n(e.textures),r=n(e.images);t.length>0&&(i.textures=t),r.length>0&&(i.images=r)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,i=null;if(null!==t){let e=t.length;i=Array(e);for(let n=0;n!==e;++n)i[n]=t[n].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}}let t$=new es,tQ=new es,t0=new es,t1=new es,t2=new es,t3=new es,t4=new es;class t5{constructor(e=new es,t=new es(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,t$)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=t$.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(t$.copy(this.origin).addScaledVector(this.direction,t),t$.distanceToSquared(e))}distanceSqToSegment(e,t,i,n){let r,a,s,o;tQ.copy(e).add(t).multiplyScalar(.5),t0.copy(t).sub(e).normalize(),t1.copy(this.origin).sub(tQ);let l=.5*e.distanceTo(t),h=-this.direction.dot(t0),c=t1.dot(this.direction),u=-t1.dot(t0),d=t1.lengthSq(),p=Math.abs(1-h*h);if(p>0)if(r=h*u-c,a=h*c-u,o=l*p,r>=0)if(a>=-o)if(a<=o){let e=1/p;r*=e,a*=e,s=r*(r+h*a+2*c)+a*(h*r+a+2*u)+d}else s=-(r=Math.max(0,-(h*(a=l)+c)))*r+a*(a+2*u)+d;else s=-(r=Math.max(0,-(h*(a=-l)+c)))*r+a*(a+2*u)+d;else a<=-o?(a=(r=Math.max(0,-(-h*l+c)))>0?-l:Math.min(Math.max(-l,-u),l),s=-r*r+a*(a+2*u)+d):a<=o?(r=0,s=(a=Math.min(Math.max(-l,-u),l))*(a+2*u)+d):(a=(r=Math.max(0,-(h*l+c)))>0?l:Math.min(Math.max(-l,-u),l),s=-r*r+a*(a+2*u)+d);else a=h>0?-l:l,s=-(r=Math.max(0,-(h*a+c)))*r+a*(a+2*u)+d;return i&&i.copy(this.origin).addScaledVector(this.direction,r),n&&n.copy(tQ).addScaledVector(t0,a),s}intersectSphere(e,t){t$.subVectors(e.center,this.origin);let i=t$.dot(this.direction),n=t$.dot(t$)-i*i,r=e.radius*e.radius;if(n>r)return null;let a=Math.sqrt(r-n),s=i-a,o=i+a;return o<0?null:s<0?this.at(o,t):this.at(s,t)}intersectsSphere(e){return!(e.radius<0)&&this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;let i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){let i=this.distanceToPlane(e);return null===i?null:this.at(i,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return!!(0===t||e.normal.dot(this.direction)*t<0)}intersectBox(e,t){let i,n,r,a,s,o,l=1/this.direction.x,h=1/this.direction.y,c=1/this.direction.z,u=this.origin;return(l>=0?(i=(e.min.x-u.x)*l,n=(e.max.x-u.x)*l):(i=(e.max.x-u.x)*l,n=(e.min.x-u.x)*l),h>=0?(r=(e.min.y-u.y)*h,a=(e.max.y-u.y)*h):(r=(e.max.y-u.y)*h,a=(e.min.y-u.y)*h),i>a||r>n||((r>i||isNaN(i))&&(i=r),(a<n||isNaN(n))&&(n=a),c>=0?(s=(e.min.z-u.z)*c,o=(e.max.z-u.z)*c):(s=(e.max.z-u.z)*c,o=(e.min.z-u.z)*c),i>o||s>n||((s>i||i!=i)&&(i=s),(o<n||n!=n)&&(n=o),n<0)))?null:this.at(i>=0?i:n,t)}intersectsBox(e){return null!==this.intersectBox(e,t$)}intersectTriangle(e,t,i,n,r){let a;t2.subVectors(t,e),t3.subVectors(i,e),t4.crossVectors(t2,t3);let s=this.direction.dot(t4);if(s>0){if(n)return null;a=1}else{if(!(s<0))return null;a=-1,s=-s}t1.subVectors(this.origin,e);let o=a*this.direction.dot(t3.crossVectors(t1,t3));if(o<0)return null;let l=a*this.direction.dot(t2.cross(t1));if(l<0||o+l>s)return null;let h=-a*t1.dot(t4);return h<0?null:this.at(h/s,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class t6 extends tJ{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new e9(0xffffff),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new eF,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}let t8=new eA,t9=new t5,t7=new tV,ie=new es,it=new es,ii=new es,ir=new es,ia=new es,is=new es,io=new es,il=new es;class ih extends e0{constructor(e=new tK,t=new t6){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let i=e[t[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=i.length;e<t;e++){let t=i[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}getVertexPosition(e,t){let i=this.geometry,n=i.attributes.position,r=i.morphAttributes.position,a=i.morphTargetsRelative;t.fromBufferAttribute(n,e);let s=this.morphTargetInfluences;if(r&&s){is.set(0,0,0);for(let i=0,n=r.length;i<n;i++){let n=s[i],o=r[i];0!==n&&(ia.fromBufferAttribute(o,e),a?is.addScaledVector(ia,n):is.addScaledVector(ia.sub(t),n))}t.add(is)}return t}raycast(e,t){let i=this.geometry,n=this.material,r=this.matrixWorld;void 0===n||(null===i.boundingSphere&&i.computeBoundingSphere(),t7.copy(i.boundingSphere),t7.applyMatrix4(r),t9.copy(e.ray).recast(e.near),!1===t7.containsPoint(t9.origin)&&(null===t9.intersectSphere(t7,ie)||t9.origin.distanceToSquared(ie)>(e.far-e.near)**2)||(t8.copy(r).invert(),t9.copy(e.ray).applyMatrix4(t8),(null===i.boundingBox||!1!==t9.intersectsBox(i.boundingBox))&&this._computeIntersections(e,t,t9)))}_computeIntersections(e,t,i){let n,r=this.geometry,a=this.material,s=r.index,o=r.attributes.position,l=r.attributes.uv,h=r.attributes.uv1,c=r.attributes.normal,u=r.groups,d=r.drawRange;if(null!==s)if(Array.isArray(a))for(let r=0,o=u.length;r<o;r++){let o=u[r],p=a[o.materialIndex],f=Math.max(o.start,d.start),m=Math.min(s.count,Math.min(o.start+o.count,d.start+d.count));for(let r=f;r<m;r+=3)(n=ic(this,p,e,i,l,h,c,s.getX(r),s.getX(r+1),s.getX(r+2)))&&(n.faceIndex=Math.floor(r/3),n.face.materialIndex=o.materialIndex,t.push(n))}else{let r=Math.max(0,d.start),o=Math.min(s.count,d.start+d.count);for(let u=r;u<o;u+=3)(n=ic(this,a,e,i,l,h,c,s.getX(u),s.getX(u+1),s.getX(u+2)))&&(n.faceIndex=Math.floor(u/3),t.push(n))}else if(void 0!==o)if(Array.isArray(a))for(let r=0,s=u.length;r<s;r++){let s=u[r],p=a[s.materialIndex],f=Math.max(s.start,d.start),m=Math.min(o.count,Math.min(s.start+s.count,d.start+d.count));for(let r=f;r<m;r+=3)(n=ic(this,p,e,i,l,h,c,r,r+1,r+2))&&(n.faceIndex=Math.floor(r/3),n.face.materialIndex=s.materialIndex,t.push(n))}else{let r=Math.max(0,d.start),s=Math.min(o.count,d.start+d.count);for(let o=r;o<s;o+=3)(n=ic(this,a,e,i,l,h,c,o,o+1,o+2))&&(n.faceIndex=Math.floor(o/3),t.push(n))}}}function ic(e,t,i,n,r,a,s,o,l,h){e.getVertexPosition(o,it),e.getVertexPosition(l,ii),e.getVertexPosition(h,ir);let c=function(e,t,i,n,r,a,s,o){if(null===(1===t.side?n.intersectTriangle(s,a,r,!0,o):n.intersectTriangle(r,a,s,0===t.side,o)))return null;il.copy(o),il.applyMatrix4(e.matrixWorld);let l=i.ray.origin.distanceTo(il);return l<i.near||l>i.far?null:{distance:l,point:il.clone(),object:e}}(e,t,i,n,it,ii,ir,io);if(c){let e=new es;tm.getBarycoord(io,it,ii,ir,e),r&&(c.uv=tm.getInterpolatedAttribute(r,o,l,h,e,new er)),a&&(c.uv1=tm.getInterpolatedAttribute(a,o,l,h,e,new er)),s&&(c.normal=tm.getInterpolatedAttribute(s,o,l,h,e,new es),c.normal.dot(n.direction)>0&&c.normal.multiplyScalar(-1));let t={a:o,b:l,c:h,normal:new es,materialIndex:0};tm.getNormal(it,ii,ir,t.normal),c.face=t,c.barycoord=e}return c}class iu extends eS{constructor(e=null,t=1,i=1,n,r,a,s,o,l=1003,h=1003,c,u){super(null,a,s,o,l,h,n,r,c,u),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}let id=new es,ip=new es,im=new eh;class ig{constructor(e=new es(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,n){return this.normal.set(e,t,i),this.constant=n,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){let n=id.subVectors(i,t).cross(ip.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(n,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){let i=e.delta(id),n=this.normal.dot(i);if(0===n)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;let r=-(e.start.dot(this.normal)+this.constant)/n;return r<0||r>1?null:t.copy(e.start).addScaledVector(i,r)}intersectsLine(e){let t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let i=t||im.getNormalMatrix(e),n=this.coplanarPoint(id).applyMatrix4(e),r=this.normal.applyMatrix3(i).normalize();return this.constant=-n.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}let i_=new tV,iv=new er(.5,.5),ix=new es;class iy{constructor(e=new ig,t=new ig,i=new ig,n=new ig,r=new ig,a=new ig){this.planes=[e,t,i,n,r,a]}set(e,t,i,n,r,a){let s=this.planes;return s[0].copy(e),s[1].copy(t),s[2].copy(i),s[3].copy(n),s[4].copy(r),s[5].copy(a),this}copy(e){let t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=2e3,i=!1){let n=this.planes,r=e.elements,a=r[0],s=r[1],o=r[2],l=r[3],h=r[4],c=r[5],u=r[6],d=r[7],p=r[8],f=r[9],m=r[10],g=r[11],_=r[12],v=r[13],x=r[14],y=r[15];if(n[0].setComponents(l-a,d-h,g-p,y-_).normalize(),n[1].setComponents(l+a,d+h,g+p,y+_).normalize(),n[2].setComponents(l+s,d+c,g+f,y+v).normalize(),n[3].setComponents(l-s,d-c,g-f,y-v).normalize(),i)n[4].setComponents(o,u,m,x).normalize(),n[5].setComponents(l-o,d-u,g-m,y-x).normalize();else if(n[4].setComponents(l-o,d-u,g-m,y-x).normalize(),2e3===t)n[5].setComponents(l+o,d+u,g+m,y+x).normalize();else if(2001===t)n[5].setComponents(o,u,m,x).normalize();else throw Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),i_.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),i_.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(i_)}intersectsSprite(e){return i_.center.set(0,0,0),i_.radius=.7071067811865476+iv.distanceTo(e.center),i_.applyMatrix4(e.matrixWorld),this.intersectsSphere(i_)}intersectsSphere(e){let t=this.planes,i=e.center,n=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(i)<n)return!1;return!0}intersectsBox(e){let t=this.planes;for(let i=0;i<6;i++){let n=t[i];if(ix.x=n.normal.x>0?e.max.x:e.min.x,ix.y=n.normal.y>0?e.max.y:e.min.y,ix.z=n.normal.z>0?e.max.z:e.min.z,0>n.distanceToPoint(ix))return!1}return!0}containsPoint(e){let t=this.planes;for(let i=0;i<6;i++)if(0>t[i].distanceToPoint(e))return!1;return!0}clone(){return new this.constructor().copy(this)}}class iM extends tJ{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new e9(0xffffff),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}let iS=new es,ib=new es,iT=new eA,iE=new t5,iw=new tV,iA=new es,iR=new es;class iC extends e0{constructor(e=new tK,t=new iM){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(null===e.index){let t=e.attributes.position,i=[0];for(let e=1,n=t.count;e<n;e++)iS.fromBufferAttribute(t,e-1),ib.fromBufferAttribute(t,e),i[e]=i[e-1],i[e]+=iS.distanceTo(ib);e.setAttribute("lineDistance",new tF(i,1))}else W("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){let i=this.geometry,n=this.matrixWorld,r=e.params.Line.threshold,a=i.drawRange;if(null===i.boundingSphere&&i.computeBoundingSphere(),iw.copy(i.boundingSphere),iw.applyMatrix4(n),iw.radius+=r,!1===e.ray.intersectsSphere(iw))return;iT.copy(n).invert(),iE.copy(e.ray).applyMatrix4(iT);let s=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s,l=this.isLineSegments?2:1,h=i.index,c=i.attributes.position;if(null!==h){let i=Math.max(0,a.start),n=Math.min(h.count,a.start+a.count);for(let r=i,a=n-1;r<a;r+=l){let i=iP(this,e,iE,o,h.getX(r),h.getX(r+1),r);i&&t.push(i)}if(this.isLineLoop){let r=iP(this,e,iE,o,h.getX(n-1),h.getX(i),n-1);r&&t.push(r)}}else{let i=Math.max(0,a.start),n=Math.min(c.count,a.start+a.count);for(let r=i,a=n-1;r<a;r+=l){let i=iP(this,e,iE,o,r,r+1,r);i&&t.push(i)}if(this.isLineLoop){let r=iP(this,e,iE,o,n-1,i,n-1);r&&t.push(r)}}}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let i=e[t[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=i.length;e<t;e++){let t=i[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}}function iP(e,t,i,n,r,a,s){let o=e.geometry.attributes.position;if(iS.fromBufferAttribute(o,r),ib.fromBufferAttribute(o,a),i.distanceSqToSegment(iS,ib,iA,iR)>n)return;iA.applyMatrix4(e.matrixWorld);let l=t.ray.origin.distanceTo(iA);if(!(l<t.near)&&!(l>t.far))return{distance:l,point:iR.clone().applyMatrix4(e.matrixWorld),index:s,face:null,faceIndex:null,barycoord:null,object:e}}let iL=new es,iN=new es;class iD extends iC{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(null===e.index){let t=e.attributes.position,i=[];for(let e=0,n=t.count;e<n;e+=2)iL.fromBufferAttribute(t,e),iN.fromBufferAttribute(t,e+1),i[e]=0===e?0:i[e-1],i[e+1]=i[e]+iL.distanceTo(iN);e.setAttribute("lineDistance",new tF(i,1))}else W("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class iI extends eS{constructor(e=[],t=301,i,n,r,a,s,o,l,h){super(e,t,i,n,r,a,s,o,l,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class iU extends eS{constructor(e,t,i=1014,n,r,a,s=1003,o=1003,l,h=1026,c=1){if(1026!==h&&1027!==h)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super({width:e,height:t,depth:c},n,r,a,s,o,h,i,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new ev(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return null!==this.compareFunction&&(t.compareFunction=this.compareFunction),t}}class iO extends iU{constructor(e,t=1014,i=301,n,r,a=1003,s=1003,o,l=1026){const h={width:e,height:e,depth:1};super(e,e,t,i,n,r,a,s,o,l),this.image=[h,h,h,h,h,h],this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class iF extends eS{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class iB extends tK{constructor(e=1,t=1,i=1,n=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:n,heightSegments:r,depthSegments:a};const s=this;n=Math.floor(n),r=Math.floor(r);const o=[],l=[],h=[],c=[];let u=0,d=0;function p(e,t,i,n,r,a,p,f,m,g,_){let v=a/m,x=p/g,y=a/2,M=p/2,S=f/2,b=m+1,T=g+1,E=0,w=0,A=new es;for(let a=0;a<T;a++){let s=a*x-M;for(let o=0;o<b;o++){let u=o*v-y;A[e]=u*n,A[t]=s*r,A[i]=S,l.push(A.x,A.y,A.z),A[e]=0,A[t]=0,A[i]=f>0?1:-1,h.push(A.x,A.y,A.z),c.push(o/m),c.push(1-a/g),E+=1}}for(let e=0;e<g;e++)for(let t=0;t<m;t++){let i=u+t+b*e,n=u+t+b*(e+1),r=u+(t+1)+b*(e+1),a=u+(t+1)+b*e;o.push(i,n,a),o.push(n,r,a),w+=6}s.addGroup(d,w,_),d+=w,u+=E}p("z","y","x",-1,-1,i,t,e,a=Math.floor(a),r,0),p("z","y","x",1,-1,i,t,-e,a,r,1),p("x","z","y",1,1,e,i,t,n,a,2),p("x","z","y",1,-1,e,i,-t,n,a,3),p("x","y","z",1,-1,e,t,i,n,r,4),p("x","y","z",-1,-1,e,t,-i,n,r,5),this.setIndex(o),this.setAttribute("position",new tF(l,3)),this.setAttribute("normal",new tF(h,3)),this.setAttribute("uv",new tF(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new iB(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class ik{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){W("Curve: .getPoint() not implemented.")}getPointAt(e,t){let i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],i,n=this.getPoint(0),r=0;t.push(0);for(let a=1;a<=e;a++)t.push(r+=(i=this.getPoint(a/e)).distanceTo(n)),n=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){let i,n=this.getLengths(),r=0,a=n.length;i=t||e*n[a-1];let s=0,o=a-1,l;for(;s<=o;)if((l=n[r=Math.floor(s+(o-s)/2)]-i)<0)s=r+1;else if(l>0)o=r-1;else{o=r;break}if(n[r=o]===i)return r/(a-1);let h=n[r],c=n[r+1];return(r+(i-h)/(c-h))/(a-1)}getTangent(e,t){let i=e-1e-4,n=e+1e-4;i<0&&(i=0),n>1&&(n=1);let r=this.getPoint(i),a=this.getPoint(n),s=t||(r.isVector2?new er:new es);return s.copy(a).sub(r).normalize(),s}getTangentAt(e,t){let i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t=!1){let i=new es,n=[],r=[],a=[],s=new es,o=new eA;for(let t=0;t<=e;t++){let i=t/e;n[t]=this.getTangentAt(i,new es)}r[0]=new es,a[0]=new es;let l=Number.MAX_VALUE,h=Math.abs(n[0].x),c=Math.abs(n[0].y),u=Math.abs(n[0].z);h<=l&&(l=h,i.set(1,0,0)),c<=l&&(l=c,i.set(0,1,0)),u<=l&&i.set(0,0,1),s.crossVectors(n[0],i).normalize(),r[0].crossVectors(n[0],s),a[0].crossVectors(n[0],r[0]);for(let t=1;t<=e;t++){if(r[t]=r[t-1].clone(),a[t]=a[t-1].clone(),s.crossVectors(n[t-1],n[t]),s.length()>Number.EPSILON){s.normalize();let e=Math.acos(ee(n[t-1].dot(n[t]),-1,1));r[t].applyMatrix4(o.makeRotationAxis(s,e))}a[t].crossVectors(n[t],r[t])}if(!0===t){let t=Math.acos(ee(r[0].dot(r[e]),-1,1));t/=e,n[0].dot(s.crossVectors(r[0],r[e]))>0&&(t=-t);for(let i=1;i<=e;i++)r[i].applyMatrix4(o.makeRotationAxis(n[i],t*i)),a[i].crossVectors(n[i],r[i])}return{tangents:n,normals:r,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class iz extends ik{constructor(e=0,t=0,i=1,n=1,r=0,a=2*Math.PI,s=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=n,this.aStartAngle=r,this.aEndAngle=a,this.aClockwise=s,this.aRotation=o}getPoint(e,t=new er){let i=2*Math.PI,n=this.aEndAngle-this.aStartAngle,r=Math.abs(n)<Number.EPSILON;for(;n<0;)n+=i;for(;n>i;)n-=i;n<Number.EPSILON&&(n=r?0:i),!0!==this.aClockwise||r||(n===i?n=-i:n-=i);let a=this.aStartAngle+e*n,s=this.aX+this.xRadius*Math.cos(a),o=this.aY+this.yRadius*Math.sin(a);if(0!==this.aRotation){let e=Math.cos(this.aRotation),t=Math.sin(this.aRotation),i=s-this.aX,n=o-this.aY;s=i*e-n*t+this.aX,o=i*t+n*e+this.aY}return t.set(s,o)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}function iV(){let e=0,t=0,i=0,n=0;function r(r,a,s,o){e=r,t=s,i=-3*r+3*a-2*s-o,n=2*r-2*a+s+o}return{initCatmullRom:function(e,t,i,n,a){r(t,i,a*(i-e),a*(n-t))},initNonuniformCatmullRom:function(e,t,i,n,a,s,o){let l=(t-e)/a-(i-e)/(a+s)+(i-t)/s,h=(i-t)/s-(n-t)/(s+o)+(n-i)/o;r(t,i,l*=s,h*=s)},calc:function(r){let a=r*r;return e+t*r+i*a+a*r*n}}}let iH=new es,iG=new iV,ij=new iV,iW=new iV;function iX(e,t,i,n,r){let a=(n-t)*.5,s=(r-i)*.5,o=e*e;return e*o*(2*i-2*n+a+s)+(-3*i+3*n-2*a-s)*o+a*e+i}function iY(e,t,i,n){let r;return(r=1-e)*r*t+2*(1-e)*e*i+e*e*n}function iq(e,t,i,n,r){let a,s;return(a=1-e)*a*a*t+3*(s=1-e)*s*e*i+3*(1-e)*e*e*n+e*e*e*r}class iK extends ik{constructor(e=new er,t=new er,i=new er,n=new er){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=n}getPoint(e,t=new er){let i=this.v0,n=this.v1,r=this.v2,a=this.v3;return t.set(iq(e,i.x,n.x,r.x,a.x),iq(e,i.y,n.y,r.y,a.y)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class iZ extends ik{constructor(e=new er,t=new er){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new er){return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new er){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class iJ extends ik{constructor(e=new er,t=new er,i=new er){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new er){let i=this.v0,n=this.v1,r=this.v2;return t.set(iY(e,i.x,n.x,r.x),iY(e,i.y,n.y,r.y)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class i$ extends ik{constructor(e=new es,t=new es,i=new es){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new es){let i=this.v0,n=this.v1,r=this.v2;return t.set(iY(e,i.x,n.x,r.x),iY(e,i.y,n.y,r.y),iY(e,i.z,n.z,r.z)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class iQ extends ik{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new er){let i=this.points,n=(i.length-1)*e,r=Math.floor(n),a=n-r,s=i[0===r?r:r-1],o=i[r],l=i[r>i.length-2?i.length-1:r+1],h=i[r>i.length-3?i.length-1:r+2];return t.set(iX(a,s.x,o.x,l.x,h.x),iX(a,s.y,o.y,l.y,h.y)),t}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let i=e.points[t];this.points.push(i.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){let i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let i=e.points[t];this.points.push(new er().fromArray(i))}return this}}class i0 extends tK{constructor(e=1,t=1,i=1,n=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:n};const r=e/2,a=t/2,s=Math.floor(i),o=Math.floor(n),l=s+1,h=o+1,c=e/s,u=t/o,d=[],p=[],f=[],m=[];for(let e=0;e<h;e++){const t=e*u-a;for(let i=0;i<l;i++){const n=i*c-r;p.push(n,-t,0),f.push(0,0,1),m.push(i/s),m.push(1-e/o)}}for(let e=0;e<o;e++)for(let t=0;t<s;t++){const i=t+l*e,n=t+l*(e+1),r=t+1+l*(e+1),a=t+1+l*e;d.push(i,n,a),d.push(n,r,a)}this.setIndex(d),this.setAttribute("position",new tF(p,3)),this.setAttribute("normal",new tF(f,3)),this.setAttribute("uv",new tF(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i0(e.width,e.height,e.widthSegments,e.heightSegments)}}class i1 extends tK{constructor(e=.5,t=1,i=32,n=1,r=0,a=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:i,phiSegments:n,thetaStart:r,thetaLength:a},i=Math.max(3,i);const s=[],o=[],l=[],h=[];let c=e;const u=(t-e)/(n=Math.max(1,n)),d=new es,p=new er;for(let e=0;e<=n;e++){for(let e=0;e<=i;e++){const n=r+e/i*a;d.x=c*Math.cos(n),d.y=c*Math.sin(n),o.push(d.x,d.y,d.z),l.push(0,0,1),p.x=(d.x/t+1)/2,p.y=(d.y/t+1)/2,h.push(p.x,p.y)}c+=u}for(let e=0;e<n;e++){const t=e*(i+1);for(let e=0;e<i;e++){const n=e+t,r=n+i+1,a=n+i+2,o=n+1;s.push(n,r,o),s.push(r,a,o)}}this.setIndex(s),this.setAttribute("position",new tF(o,3)),this.setAttribute("normal",new tF(l,3)),this.setAttribute("uv",new tF(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i1(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class i2 extends tK{constructor(e=1,t=32,i=16,n=0,r=2*Math.PI,a=0,s=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:n,phiLength:r,thetaStart:a,thetaLength:s},t=Math.max(3,Math.floor(t)),i=Math.max(2,Math.floor(i));const o=Math.min(a+s,Math.PI);let l=0;const h=[],c=new es,u=new es,d=[],p=[],f=[],m=[];for(let d=0;d<=i;d++){const g=[],_=d/i;let v=0;0===d&&0===a?v=.5/t:d===i&&o===Math.PI&&(v=-.5/t);for(let i=0;i<=t;i++){const o=i/t;c.x=-e*Math.cos(n+o*r)*Math.sin(a+_*s),c.y=e*Math.cos(a+_*s),c.z=e*Math.sin(n+o*r)*Math.sin(a+_*s),p.push(c.x,c.y,c.z),u.copy(c).normalize(),f.push(u.x,u.y,u.z),m.push(o+v,1-_),g.push(l++)}h.push(g)}for(let e=0;e<i;e++)for(let n=0;n<t;n++){const t=h[e][n+1],r=h[e][n],s=h[e+1][n],l=h[e+1][n+1];(0!==e||a>0)&&d.push(t,r,l),(e!==i-1||o<Math.PI)&&d.push(r,s,l)}this.setIndex(d),this.setAttribute("position",new tF(p,3)),this.setAttribute("normal",new tF(f,3)),this.setAttribute("uv",new tF(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i2(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}function i3(e){let t={};for(let i in e)for(let n in t[i]={},e[i]){let r=e[i][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(W("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[i][n]=null):t[i][n]=r.clone():Array.isArray(r)?t[i][n]=r.slice():t[i][n]=r}return t}function i4(e){let t={};for(let i=0;i<e.length;i++){let n=i3(e[i]);for(let e in n)t[e]=n[e]}return t}function i5(e){let t=e.getRenderTarget();return null===t?e.outputColorSpace:!0===t.isXRRenderTarget?t.texture.colorSpace:ep.workingColorSpace}class i6 extends tJ{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==e&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=i3(e.uniforms),this.uniformsGroups=function(e){let t=[];for(let i=0;i<e.length;i++)t.push(e[i].clone());return t}(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){let t=super.toJSON(e);for(let i in t.glslVersion=this.glslVersion,t.uniforms={},this.uniforms){let n=this.uniforms[i].value;n&&n.isTexture?t.uniforms[i]={type:"t",value:n.toJSON(e).uuid}:n&&n.isColor?t.uniforms[i]={type:"c",value:n.getHex()}:n&&n.isVector2?t.uniforms[i]={type:"v2",value:n.toArray()}:n&&n.isVector3?t.uniforms[i]={type:"v3",value:n.toArray()}:n&&n.isVector4?t.uniforms[i]={type:"v4",value:n.toArray()}:n&&n.isMatrix3?t.uniforms[i]={type:"m3",value:n.toArray()}:n&&n.isMatrix4?t.uniforms[i]={type:"m4",value:n.toArray()}:t.uniforms[i]={value:n}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let i={};for(let e in this.extensions)!0===this.extensions[e]&&(i[e]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class i8 extends i6{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class i9 extends tJ{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new e9(0xffffff),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new e9(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new er(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new eF,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class i7 extends tJ{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new e9(0xffffff),this.specular=new e9(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new e9(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new er(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new eF,this.combine=0,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class ne extends tJ{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class nt extends tJ{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}function ni(e,t){return e&&e.constructor!==t?"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e):e}class nn{constructor(e,t,i,n){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==n?n:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,i=this._cachedIndex,n=t[i],r=t[i-1];e:{t:{let a;i:{n:if(!(e<n)){for(let a=i+2;;){if(void 0===n){if(e<r)break n;return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===a)break;if(r=n,e<(n=t[++i]))break t}a=t.length;break i}if(!(e>=r)){let s=t[1];e<s&&(i=2,r=s);for(let a=i-2;;){if(void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(i===a)break;if(n=r,e>=(r=t[--i-1]))break t}a=i,i=0;break i}break e}for(;i<a;){let n=i+a>>>1;e<t[n]?a=n:i=n+1}if(n=t[i],void 0===(r=t[i-1]))return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===n)return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,r,n)}return this.interpolate_(i,r,e,n)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=e*n;for(let e=0;e!==n;++e)t[e]=i[r+e];return t}interpolate_(){throw Error("call to abstract method")}intervalChanged_(){}}class nr extends nn{constructor(e,t,i,n){super(e,t,i,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:2400,endingEnd:2400}}intervalChanged_(e,t,i){let n=this.parameterPositions,r=e-2,a=e+1,s=n[r],o=n[a];if(void 0===s)switch(this.getSettings_().endingStart){case 2401:r=e,s=2*t-i;break;case 2402:r=n.length-2,s=t+n[r]-n[r+1];break;default:r=e,s=i}if(void 0===o)switch(this.getSettings_().endingEnd){case 2401:a=e,o=2*i-t;break;case 2402:a=1,o=i+n[1]-n[0];break;default:a=e-1,o=t}let l=(i-t)*.5,h=this.valueSize;this._weightPrev=l/(t-s),this._weightNext=l/(o-i),this._offsetPrev=r*h,this._offsetNext=a*h}interpolate_(e,t,i,n){let r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=e*s,l=o-s,h=this._offsetPrev,c=this._offsetNext,u=this._weightPrev,d=this._weightNext,p=(i-t)/(n-t),f=p*p,m=f*p,g=-u*m+2*u*f-u*p,_=(1+u)*m+(-1.5-2*u)*f+(-.5+u)*p+1,v=(-1-d)*m+(1.5+d)*f+.5*p,x=d*m-d*f;for(let e=0;e!==s;++e)r[e]=g*a[h+e]+_*a[l+e]+v*a[o+e]+x*a[c+e];return r}}class na extends nn{constructor(e,t,i,n){super(e,t,i,n)}interpolate_(e,t,i,n){let r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=e*s,l=o-s,h=(i-t)/(n-t),c=1-h;for(let e=0;e!==s;++e)r[e]=a[l+e]*c+a[o+e]*h;return r}}class ns extends nn{constructor(e,t,i,n){super(e,t,i,n)}interpolate_(e){return this.copySampleValue_(e-1)}}class no extends nn{interpolate_(e,t,i,n){let r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=e*s,l=o-s,h=this.settings||this.DefaultSettings_,c=h.inTangents,u=h.outTangents;if(!c||!u){let e=(i-t)/(n-t),h=1-e;for(let t=0;t!==s;++t)r[t]=a[l+t]*h+a[o+t]*e;return r}let d=2*s,p=e-1;for(let h=0;h!==s;++h){let s,f,m,g,_,v=a[l+h],x=a[o+h],y=p*d+2*h,M=u[y],S=u[y+1],b=e*d+2*h,T=c[b],E=c[b+1],w=(i-t)/(n-t);for(let e=0;e<8;e++){f=(s=w*w)*w;let e=(_=(g=(m=1-w)*m)*m)*t+3*g*w*M+3*m*s*T+f*n-i;if(1e-10>Math.abs(e))break;let r=3*g*(M-t)+6*m*w*(T-M)+3*s*(n-T);if(1e-10>Math.abs(r))break;w-=e/r,w=Math.max(0,Math.min(1,w))}r[h]=_*v+3*g*w*S+3*m*s*E+f*x}return r}}class nl{constructor(e,t,i,n){if(void 0===e)throw Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=ni(t,this.TimeBufferType),this.values=ni(i,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}static toJSON(e){let t,i=e.constructor;if(i.toJSON!==this.toJSON)t=i.toJSON(e);else{t={name:e.name,times:ni(e.times,Array),values:ni(e.values,Array)};let i=e.getInterpolation();i!==e.DefaultInterpolation&&(t.interpolation=i)}return t.type=e.ValueTypeName,t}InterpolantFactoryMethodDiscrete(e){return new ns(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new na(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new nr(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new no(this.times,this.values,this.getValueSize(),e);return this.settings&&(t.settings=this.settings),t}setInterpolation(e){let t;switch(e){case 2300:t=this.InterpolantFactoryMethodDiscrete;break;case 2301:t=this.InterpolantFactoryMethodLinear;break;case 2302:t=this.InterpolantFactoryMethodSmooth;break;case 2303:t=this.InterpolantFactoryMethodBezier}if(void 0===t){let t="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(t);return W("KeyframeTrack:",t),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302;case this.InterpolantFactoryMethodBezier:return 2303}}getValueSize(){return this.values.length/this.times.length}shift(e){if(0!==e){let t=this.times;for(let i=0,n=t.length;i!==n;++i)t[i]+=e}return this}scale(e){if(1!==e){let t=this.times;for(let i=0,n=t.length;i!==n;++i)t[i]*=e}return this}trim(e,t){let i=this.times,n=i.length,r=0,a=n-1;for(;r!==n&&i[r]<e;)++r;for(;-1!==a&&i[a]>t;)--a;if(++a,0!==r||a!==n){r>=a&&(r=(a=Math.max(a,1))-1);let e=this.getValueSize();this.times=i.slice(r,a),this.values=this.values.slice(r*e,a*e)}return this}validate(){var e;let t=!0,i=this.getValueSize();i-Math.floor(i)!=0&&(X("KeyframeTrack: Invalid value size in track.",this),t=!1);let n=this.times,r=this.values,a=n.length;0===a&&(X("KeyframeTrack: Track is empty.",this),t=!1);let s=null;for(let e=0;e!==a;e++){let i=n[e];if("number"==typeof i&&isNaN(i)){X("KeyframeTrack: Time is not a valid number.",this,e,i),t=!1;break}if(null!==s&&s>i){X("KeyframeTrack: Out of order keys.",this,e,i,s),t=!1;break}s=i}if(void 0!==r&&ArrayBuffer.isView(e=r)&&!(e instanceof DataView))for(let e=0,i=r.length;e!==i;++e){let i=r[e];if(isNaN(i)){X("KeyframeTrack: Value is not a valid number.",this,e,i),t=!1;break}}return t}optimize(){let e=this.times.slice(),t=this.values.slice(),i=this.getValueSize(),n=2302===this.getInterpolation(),r=e.length-1,a=1;for(let s=1;s<r;++s){let r=!1,o=e[s];if(o!==e[s+1]&&(1!==s||o!==e[0]))if(n)r=!0;else{let e=s*i,n=e-i,a=e+i;for(let s=0;s!==i;++s){let i=t[e+s];if(i!==t[n+s]||i!==t[a+s]){r=!0;break}}}if(r){if(s!==a){e[a]=e[s];let n=s*i,r=a*i;for(let e=0;e!==i;++e)t[r+e]=t[n+e]}++a}}if(r>0){e[a]=e[r];for(let e=r*i,n=a*i,s=0;s!==i;++s)t[n+s]=t[e+s];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*i)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),i=new this.constructor(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}nl.prototype.ValueTypeName="",nl.prototype.TimeBufferType=Float32Array,nl.prototype.ValueBufferType=Float32Array,nl.prototype.DefaultInterpolation=2301;class nh extends nl{constructor(e,t,i){super(e,t,i)}}nh.prototype.ValueTypeName="bool",nh.prototype.ValueBufferType=Array,nh.prototype.DefaultInterpolation=2300,nh.prototype.InterpolantFactoryMethodLinear=void 0,nh.prototype.InterpolantFactoryMethodSmooth=void 0,(class extends nl{constructor(e,t,i,n){super(e,t,i,n)}}).prototype.ValueTypeName="color",(class extends nl{constructor(e,t,i,n){super(e,t,i,n)}}).prototype.ValueTypeName="number";class nc extends nn{constructor(e,t,i,n){super(e,t,i,n)}interpolate_(e,t,i,n){let r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=(i-t)/(n-t),l=e*s;for(let e=l+s;l!==e;l+=4)ea.slerpFlat(r,0,a,l-s,a,l,o);return r}}class nu extends nl{constructor(e,t,i,n){super(e,t,i,n)}InterpolantFactoryMethodLinear(e){return new nc(this.times,this.values,this.getValueSize(),e)}}nu.prototype.ValueTypeName="quaternion",nu.prototype.InterpolantFactoryMethodSmooth=void 0;class nd extends nl{constructor(e,t,i){super(e,t,i)}}nd.prototype.ValueTypeName="string",nd.prototype.ValueBufferType=Array,nd.prototype.DefaultInterpolation=2300,nd.prototype.InterpolantFactoryMethodLinear=void 0,nd.prototype.InterpolantFactoryMethodSmooth=void 0,(class extends nl{constructor(e,t,i,n){super(e,t,i,n)}}).prototype.ValueTypeName="vector",new WeakMap;class np extends e0{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new e9(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}}let nf=new eA,nm=new es,ng=new es;class n_{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new er(512,512),this.mapType=1009,this.map=null,this.mapPass=null,this.matrix=new eA,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new iy,this._frameExtents=new er(1,1),this._viewportCount=1,this._viewports=[new eb(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,i=this.matrix;nm.setFromMatrixPosition(e.matrixWorld),t.position.copy(nm),ng.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(ng),t.updateMatrixWorld(),nf.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(nf,t.coordinateSystem,t.reversedDepth),2001===t.coordinateSystem||t.reversedDepth?i.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(nf)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return 1!==this.intensity&&(e.intensity=this.intensity),0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),1!==this.radius&&(e.radius=this.radius),(512!==this.mapSize.x||512!==this.mapSize.y)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}let nv=new es,nx=new ea,ny=new es;class nM extends e0{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new eA,this.projectionMatrix=new eA,this.projectionMatrixInverse=new eA,this.coordinateSystem=2e3,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(nv,nx,ny),1===ny.x&&1===ny.y&&1===ny.z?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(nv,nx,ny.set(1,1,1)).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorld.decompose(nv,nx,ny),1===ny.x&&1===ny.y&&1===ny.z?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(nv,nx,ny.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}let nS=new es,nb=new er,nT=new er;class nE extends nM{constructor(e=50,t=1,i=.1,n=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=n,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=2*$*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(.5*J*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*$*Math.atan(Math.tan(.5*J*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,i){nS.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(nS.x,nS.y).multiplyScalar(-e/nS.z),nS.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(nS.x,nS.y).multiplyScalar(-e/nS.z)}getViewSize(e,t){return this.getViewBounds(e,nb,nT),t.subVectors(nT,nb)}setViewOffset(e,t,i,n,r,a){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(.5*J*this.fov)/this.zoom,i=2*t,n=this.aspect*i,r=-.5*n,a=this.view;if(null!==this.view&&this.view.enabled){let e=a.fullWidth,s=a.fullHeight;r+=a.offsetX*n/e,t-=a.offsetY*i/s,n*=a.width/e,i*=a.height/s}let s=this.filmOffset;0!==s&&(r+=e*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+n,t,t-i,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}class nw extends n_{constructor(){super(new nE(90,1,.5,500)),this.isPointLightShadow=!0}}class nA extends np{constructor(e,t,i=0,n=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=n,this.shadow=new nw}get power(){return 4*this.intensity*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}}class nR extends nM{constructor(e=-1,t=1,i=1,n=-1,r=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=n,this.near=r,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,i,n,r,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,n=(this.top+this.bottom)/2,r=i-e,a=i+e,s=n+t,o=n-t;if(null!==this.view&&this.view.enabled){let e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=e*this.view.offsetX,a=r+e*this.view.width,s-=t*this.view.offsetY,o=s-t*this.view.height}this.projectionMatrix.makeOrthographic(r,a,s,o,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}class nC extends n_{constructor(){super(new nR(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class nP extends np{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(e0.DEFAULT_UP),this.updateMatrix(),this.target=new e0,this.shadow=new nC}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}}class nL extends np{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}new WeakMap;class nN extends e0{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const n=new nE(-90,1,e,t);n.layers=this.layers,this.add(n);const r=new nE(-90,1,e,t);r.layers=this.layers,this.add(r);const a=new nE(-90,1,e,t);a.layers=this.layers,this.add(a);const s=new nE(-90,1,e,t);s.layers=this.layers,this.add(s);const o=new nE(-90,1,e,t);o.layers=this.layers,this.add(o);const l=new nE(-90,1,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[i,n,r,a,s,o]=t;for(let e of t)this.remove(e);if(2e3===e)i.up.set(0,1,0),i.lookAt(1,0,0),n.up.set(0,1,0),n.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),s.up.set(0,1,0),s.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else if(2001===e)i.up.set(0,-1,0),i.lookAt(-1,0,0),n.up.set(0,-1,0),n.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),s.up.set(0,-1,0),s.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1);else throw Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let e of t)this.add(e),e.updateMatrixWorld()}update(e,t){null===this.parent&&this.updateMatrixWorld();let{renderTarget:i,activeMipmapLevel:n}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[r,a,s,o,l,h]=this.children,c=e.getRenderTarget(),u=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;let f=i.texture.generateMipmaps;i.texture.generateMipmaps=!1;let m=!1;m=!0===e.isWebGLRenderer?e.state.buffers.depth.getReversed():e.reversedDepthBuffer,e.setRenderTarget(i,0,n),m&&!1===e.autoClear&&e.clearDepth(),e.render(t,r),e.setRenderTarget(i,1,n),m&&!1===e.autoClear&&e.clearDepth(),e.render(t,a),e.setRenderTarget(i,2,n),m&&!1===e.autoClear&&e.clearDepth(),e.render(t,s),e.setRenderTarget(i,3,n),m&&!1===e.autoClear&&e.clearDepth(),e.render(t,o),e.setRenderTarget(i,4,n),m&&!1===e.autoClear&&e.clearDepth(),e.render(t,l),i.texture.generateMipmaps=f,e.setRenderTarget(i,5,n),m&&!1===e.autoClear&&e.clearDepth(),e.render(t,h),e.setRenderTarget(c,u,d),e.xr.enabled=p,i.texture.needsPMREMUpdate=!0}}class nD extends nE{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class nI{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,void 0!==e.hidden&&(this._pageVisibilityHandler=nU.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){null!==this._pageVisibilityHandler&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return null!==this._pageVisibilityHandler&&!0===this._document.hidden?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(void 0!==e?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}}function nU(){!1===this._document.hidden&&this.reset()}let nO="\\[\\]\\.:\\/",nF=RegExp("["+nO+"]","g"),nB="[^"+nO+"]",nk="[^"+nO.replace("\\.","")+"]",nz=RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",nB)+/(WCOD+)?/.source.replace("WCOD",nk)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",nB)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",nB)+"$"),nV=["material","materials","bones","map"];class nH{constructor(e,t,i){this.path=t,this.parsedPath=i||nH.parseTrackName(t),this.node=nH.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new nH.Composite(e,t,i):new nH(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(nF,"")}static parseTrackName(e){let t=nz.exec(e);if(null===t)throw Error("PropertyBinding: Cannot parse trackName: "+e);let i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},n=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==n&&-1!==n){let e=i.nodeName.substring(n+1);-1!==nV.indexOf(e)&&(i.nodeName=i.nodeName.substring(0,n),i.objectName=e)}if(null===i.propertyName||0===i.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){let i=e.skeleton.getBoneByName(t);if(void 0!==i)return i}if(e.children){let i=function(e){for(let n=0;n<e.length;n++){let r=e[n];if(r.name===t||r.uuid===t)return r;let a=i(r.children);if(a)return a}return null},n=i(e.children);if(n)return n}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)e[t++]=i[n]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,i=t.objectName,n=t.propertyName,r=t.propertyIndex;if(e||(e=nH.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e)return void W("PropertyBinding: No target node found for track: "+this.path+".");if(i){let n=t.objectIndex;switch(i){case"materials":if(!e.material)return void X("PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.materials)return void X("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void X("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);e=e.skeleton.bones;for(let t=0;t<e.length;t++)if(e[t].name===n){n=t;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material)return void X("PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.map)return void X("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);e=e.material.map;break;default:if(void 0===e[i])return void X("PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[i]}if(void 0!==n){if(void 0===e[n])return void X("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[n]}}let a=e[n];if(void 0===a)return void X("PropertyBinding: Trying to update property for track: "+t.nodeName+"."+n+" but it wasn't found.",e);let s=this.Versioning.None;this.targetObject=e,!0===e.isMaterial?s=this.Versioning.NeedsUpdate:!0===e.isObject3D&&(s=this.Versioning.MatrixWorldNeedsUpdate);let o=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===n){if(!e.geometry)return void X("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!e.geometry.morphAttributes)return void X("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==e.morphTargetDictionary[r]&&(r=e.morphTargetDictionary[r])}o=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=r}else void 0!==a.fromArray&&void 0!==a.toArray?(o=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(o=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=n;this.getValue=this.GetterByBindingType[o],this.setValue=this.SetterByBindingTypeAndVersioning[o][s]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}nH.Composite=class{constructor(e,t,i){const n=i||nH.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,n)}getValue(e,t){this.bind();let i=this._targetGroup.nCachedObjects_,n=this._bindings[i];void 0!==n&&n.getValue(e,t)}setValue(e,t){let i=this._bindings;for(let n=this._targetGroup.nCachedObjects_,r=i.length;n!==r;++n)i[n].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}},nH.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},nH.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},nH.prototype.GetterByBindingType=[nH.prototype._getValue_direct,nH.prototype._getValue_array,nH.prototype._getValue_arrayElement,nH.prototype._getValue_toArray],nH.prototype.SetterByBindingTypeAndVersioning=[[nH.prototype._setValue_direct,nH.prototype._setValue_direct_setNeedsUpdate,nH.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[nH.prototype._setValue_array,nH.prototype._setValue_array_setNeedsUpdate,nH.prototype._setValue_array_setMatrixWorldNeedsUpdate],[nH.prototype._setValue_arrayElement,nH.prototype._setValue_arrayElement_setNeedsUpdate,nH.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[nH.prototype._setValue_fromArray,nH.prototype._setValue_fromArray_setNeedsUpdate,nH.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]],new Float32Array(1);let nG=new eA;class nj{constructor(e,t,i=0,n=1/0){this.ray=new t5(e,t),this.near=i,this.far=n,this.camera=null,this.layers=new eB,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):X("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return nG.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(nG),this}intersectObject(e,t=!0,i=[]){return nX(e,this,i,t),i.sort(nW),i}intersectObjects(e,t=!0,i=[]){for(let n=0,r=e.length;n<r;n++)nX(e[n],this,i,t);return i.sort(nW),i}}function nW(e,t){return e.distance-t.distance}function nX(e,t,i,n){let r=!0;if(e.layers.test(t.layers)&&!1===e.raycast(t,i)&&(r=!1),!0===r&&!0===n){let n=e.children;for(let e=0,r=n.length;e<r;e++)nX(n[e],t,i,!0)}}class nY{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1,W("THREE.Clock: This module has been deprecated. Please use THREE.Timer instead.")}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let t=performance.now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}class nq{constructor(e=1,t=0,i=0){this.radius=e,this.phi=t,this.theta=i}set(e,t,i){return this.radius=e,this.phi=t,this.theta=i,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=ee(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,i){return this.radius=Math.sqrt(e*e+t*t+i*i),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(ee(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class nK extends iD{constructor(e=10,t=10,i=4473924,n=8947848){i=new e9(i),n=new e9(n);const r=t/2,a=e/t,s=e/2,o=[],l=[];for(let e=0,h=0,c=-s;e<=t;e++,c+=a){o.push(-s,0,c,s,0,c),o.push(c,0,-s,c,0,s);const t=e===r?i:n;t.toArray(l,h),h+=3,t.toArray(l,h),h+=3,t.toArray(l,h),h+=3,t.toArray(l,h),h+=3}const h=new tK;h.setAttribute("position",new tF(o,3)),h.setAttribute("color",new tF(l,3)),super(h,new iM({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class nZ extends K{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){void 0===e?W("Controls: connect() now requires an element."):(null!==this.domElement&&this.disconnect(),this.domElement=e)}disconnect(){}dispose(){}update(){}}function nJ(e,t,i,n){let r=function(e){switch(e){case 1009:case 1010:return{byteLength:1,components:1};case 1012:case 1011:case 1016:return{byteLength:2,components:1};case 1017:case 1018:return{byteLength:2,components:4};case 1014:case 1013:case 1015:return{byteLength:4,components:1};case 35902:case 35899:return{byteLength:4,components:3}}throw Error(`Unknown texture type ${e}.`)}(n);switch(i){case 1021:return e*t;case 1028:case 1029:return e*t/r.components*r.byteLength;case 1030:case 1031:return e*t*2/r.components*r.byteLength;case 1022:return e*t*3/r.components*r.byteLength;case 1023:case 1033:return e*t*4/r.components*r.byteLength;case 33776:case 33777:case 36196:case 37492:case 37488:case 37489:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case 33778:case 33779:case 37496:case 37490:case 37491:case 37808:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case 35841:case 35843:return Math.max(e,16)*Math.max(t,8)/4;case 35840:case 35842:return Math.max(e,8)*Math.max(t,8)/2;case 37809:return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16;case 37810:return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16;case 37811:return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16;case 37812:return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16;case 37813:return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16;case 37814:return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16;case 37815:return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16;case 37816:return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16;case 37817:return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16;case 37818:return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16;case 37819:return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16;case 37820:return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16;case 37821:return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16;case 36492:case 36494:case 36495:case 36285:case 36286:return Math.ceil(e/4)*Math.ceil(t/4)*16;case 36283:case 36284:return Math.ceil(e/4)*Math.ceil(t/4)*8}throw Error(`Unable to determine texture byte length for ${i} format.`)}function n$(){let e=null,t=!1,i=null,n=null;function r(t,a){i(t,a),n=e.requestAnimationFrame(r)}return{start:function(){!0===t||null!==i&&(n=e.requestAnimationFrame(r),t=!0)},stop:function(){e.cancelAnimationFrame(n),t=!1},setAnimationLoop:function(e){i=e},setContext:function(t){e=t}}}function nQ(e){let t=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)},remove:function(i){i.isInterleavedBufferAttribute&&(i=i.data);let n=t.get(i);n&&(e.deleteBuffer(n.buffer),t.delete(i))},update:function(i,n){if(i.isInterleavedBufferAttribute&&(i=i.data),i.isGLBufferAttribute){let e=t.get(i);(!e||e.version<i.version)&&t.set(i,{buffer:i.buffer,type:i.type,bytesPerElement:i.elementSize,version:i.version});return}let r=t.get(i);if(void 0===r)t.set(i,function(t,i){let n,r=t.array,a=t.usage,s=r.byteLength,o=e.createBuffer();if(e.bindBuffer(i,o),e.bufferData(i,r,a),t.onUploadCallback(),r instanceof Float32Array)n=e.FLOAT;else if("u">typeof Float16Array&&r instanceof Float16Array)n=e.HALF_FLOAT;else if(r instanceof Uint16Array)n=t.isFloat16BufferAttribute?e.HALF_FLOAT:e.UNSIGNED_SHORT;else if(r instanceof Int16Array)n=e.SHORT;else if(r instanceof Uint32Array)n=e.UNSIGNED_INT;else if(r instanceof Int32Array)n=e.INT;else if(r instanceof Int8Array)n=e.BYTE;else if(r instanceof Uint8Array)n=e.UNSIGNED_BYTE;else if(r instanceof Uint8ClampedArray)n=e.UNSIGNED_BYTE;else throw Error("THREE.WebGLAttributes: Unsupported buffer data format: "+r);return{buffer:o,type:n,bytesPerElement:r.BYTES_PER_ELEMENT,version:t.version,size:s}}(i,n));else if(r.version<i.version){if(r.size!==i.array.byteLength)throw Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");!function(t,i,n){let r=i.array,a=i.updateRanges;if(e.bindBuffer(n,t),0===a.length)e.bufferSubData(n,0,r);else{a.sort((e,t)=>e.start-t.start);let t=0;for(let e=1;e<a.length;e++){let i=a[t],n=a[e];n.start<=i.start+i.count+1?i.count=Math.max(i.count,n.start+n.count-i.start):a[++t]=n}a.length=t+1;for(let t=0,i=a.length;t<i;t++){let i=a[t];e.bufferSubData(n,i.start*r.BYTES_PER_ELEMENT,r,i.start,i.count)}i.clearUpdateRanges()}i.onUploadCallback()}(r.buffer,i,n),r.version=i.version}}}}"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"183"}})),"u">typeof window&&(window.__THREE__?W("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="183");let n0={alphahash_fragment:"#ifdef USE_ALPHAHASH\n if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n const float ALPHA_HASH_SCALE = 0.05;\n float hash2D( vec2 value ) {\n return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n }\n float hash3D( vec3 value ) {\n return hash2D( vec2( hash2D( value.xy ), value.z ) );\n }\n float getAlphaHashThreshold( vec3 position ) {\n float maxDeriv = max(\n length( dFdx( position.xyz ) ),\n length( dFdy( position.xyz ) )\n );\n float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n vec2 pixScales = vec2(\n exp2( floor( log2( pixScale ) ) ),\n exp2( ceil( log2( pixScale ) ) )\n );\n vec2 alpha = vec2(\n hash3D( floor( pixScales.x * position.xyz ) ),\n hash3D( floor( pixScales.y * position.xyz ) )\n );\n float lerpFactor = fract( log2( pixScale ) );\n float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n float a = min( lerpFactor, 1.0 - lerpFactor );\n vec3 cases = vec3(\n x * x / ( 2.0 * a * ( 1.0 - a ) ),\n ( x - 0.5 * a ) / ( 1.0 - a ),\n 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n );\n float threshold = ( x < ( 1.0 - a ) )\n ? ( ( x < a ) ? cases.x : cases.y )\n : cases.z;\n return clamp( threshold , 1.0e-6, 1.0 );\n }\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n #ifdef ALPHA_TO_COVERAGE\n diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n if ( diffuseColor.a == 0.0 ) discard;\n #else\n if ( diffuseColor.a < alphaTest ) discard;\n #endif\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n uniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n reflectedLight.indirectDiffuse *= ambientOcclusion;\n #if defined( USE_CLEARCOAT ) \n clearcoatSpecularIndirect *= ambientOcclusion;\n #endif\n #if defined( USE_SHEEN ) \n sheenSpecularIndirect *= ambientOcclusion;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD )\n float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n #endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n uniform sampler2D aoMap;\n uniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#ifdef USE_BATCHING\n #if ! defined( GL_ANGLE_multi_draw )\n #define gl_DrawID _gl_DrawID\n uniform int _gl_DrawID;\n #endif\n uniform highp sampler2D batchingTexture;\n uniform highp usampler2D batchingIdTexture;\n mat4 getBatchingMatrix( const in float i ) {\n int size = textureSize( batchingTexture, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n float getIndirectIndex( const in int i ) {\n int size = textureSize( batchingIdTexture, 0 ).x;\n int x = i % size;\n int y = i / size;\n return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n }\n#endif\n#ifdef USE_BATCHING_COLOR\n uniform sampler2D batchingColorTexture;\n vec4 getBatchingColor( const in float i ) {\n int size = textureSize( batchingColorTexture, 0 ).x;\n int j = int( i );\n int x = j % size;\n int y = j / size;\n return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );\n }\n#endif",batching_vertex:"#ifdef USE_BATCHING\n mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n vPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n vec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n return 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( specularColor, 1.0, dotVH );\n float G = G_BlinnPhong_Implicit( );\n float D = D_BlinnPhong( shininess, dotNH );\n return F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n const mat3 XYZ_TO_REC709 = mat3(\n 3.2404542, -0.9692660, 0.0556434,\n -1.5371385, 1.8760108, -0.2040259,\n -0.4985314, 0.0415560, 1.0572252\n );\n vec3 Fresnel0ToIor( vec3 fresnel0 ) {\n vec3 sqrtF0 = sqrt( fresnel0 );\n return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n }\n vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n }\n float IorToFresnel0( float transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n }\n vec3 evalSensitivity( float OPD, vec3 shift ) {\n float phase = 2.0 * PI * OPD * 1.0e-9;\n vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n xyz /= 1.0685e-7;\n vec3 rgb = XYZ_TO_REC709 * xyz;\n return rgb;\n }\n vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n vec3 I;\n float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n float cosTheta2Sq = 1.0 - sinTheta2Sq;\n if ( cosTheta2Sq < 0.0 ) {\n return vec3( 1.0 );\n }\n float cosTheta2 = sqrt( cosTheta2Sq );\n float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n float R12 = F_Schlick( R0, 1.0, cosTheta1 );\n float T121 = 1.0 - R12;\n float phi12 = 0.0;\n if ( iridescenceIOR < outsideIOR ) phi12 = PI;\n float phi21 = PI - phi12;\n vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n vec3 phi23 = vec3( 0.0 );\n if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n vec3 phi = vec3( phi21 ) + phi23;\n vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n vec3 r123 = sqrt( R123 );\n vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n vec3 C0 = R12 + Rs;\n I = C0;\n vec3 Cm = Rs - T121;\n for ( int m = 1; m <= 2; ++ m ) {\n Cm *= r123;\n vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n I += Cm * Sm;\n }\n return max( I, vec3( 0.0 ) );\n }\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n vec2 dHdxy_fwd() {\n vec2 dSTdx = dFdx( vBumpMapUv );\n vec2 dSTdy = dFdy( vBumpMapUv );\n float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n return vec2( dBx, dBy );\n }\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n vec3 vN = surf_norm;\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n float fDet = dot( vSigmaX, R1 ) * faceDirection;\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n }\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n vec4 plane;\n #ifdef ALPHA_TO_COVERAGE\n float distanceToPlane, distanceGradient;\n float clipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n if ( clipOpacity == 0.0 ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n float unionClipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n }\n #pragma unroll_loop_end\n clipOpacity *= 1.0 - unionClipOpacity;\n #endif\n diffuseColor.a *= clipOpacity;\n if ( diffuseColor.a == 0.0 ) discard;\n #else\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n bool clipped = true;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n }\n #pragma unroll_loop_end\n if ( clipped ) discard;\n #endif\n #endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n vClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )\n diffuseColor *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n varying vec4 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n vColor = vec4( 1.0 );\n#endif\n#ifdef USE_COLOR_ALPHA\n vColor *= color;\n#elif defined( USE_COLOR )\n vColor.rgb *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n vColor.rgb *= instanceColor.rgb;\n#endif\n#ifdef USE_BATCHING_COLOR\n vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n return fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n float precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n float precisionSafeLength( vec3 v ) {\n float maxComponent = max3( abs( v ) );\n return length( v / maxComponent ) * maxComponent;\n }\n#endif\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n varying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n return vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n #define cubeUV_minMipLevel 4.0\n #define cubeUV_minTileSize 16.0\n float getFace( vec3 direction ) {\n vec3 absDirection = abs( direction );\n float face = - 1.0;\n if ( absDirection.x > absDirection.z ) {\n if ( absDirection.x > absDirection.y )\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if ( absDirection.z > absDirection.y )\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n }\n vec2 getUV( vec3 direction, float face ) {\n vec2 uv;\n if ( face == 0.0 ) {\n uv = vec2( direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 1.0 ) {\n uv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n } else if ( face == 2.0 ) {\n uv = vec2( - direction.x, direction.y ) / abs( direction.z );\n } else if ( face == 3.0 ) {\n uv = vec2( - direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 4.0 ) {\n uv = vec2( - direction.x, direction.z ) / abs( direction.y );\n } else {\n uv = vec2( direction.x, direction.y ) / abs( direction.z );\n }\n return 0.5 * ( uv + 1.0 );\n }\n vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n float face = getFace( direction );\n float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n mipInt = max( mipInt, cubeUV_minMipLevel );\n float faceSize = exp2( mipInt );\n highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n if ( face > 2.0 ) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n uv.x += filterInt * 3.0 * cubeUV_minTileSize;\n uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n uv.x *= CUBEUV_TEXEL_WIDTH;\n uv.y *= CUBEUV_TEXEL_HEIGHT;\n #ifdef texture2DGradEXT\n return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n #else\n return texture2D( envMap, uv ).rgb;\n #endif\n }\n #define cubeUV_r0 1.0\n #define cubeUV_m0 - 2.0\n #define cubeUV_r1 0.8\n #define cubeUV_m1 - 1.0\n #define cubeUV_r4 0.4\n #define cubeUV_m4 2.0\n #define cubeUV_r5 0.305\n #define cubeUV_m5 3.0\n #define cubeUV_r6 0.21\n #define cubeUV_m6 4.0\n float roughnessToMip( float roughness ) {\n float mip = 0.0;\n if ( roughness >= cubeUV_r1 ) {\n mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n } else if ( roughness >= cubeUV_r4 ) {\n mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n } else if ( roughness >= cubeUV_r5 ) {\n mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n } else if ( roughness >= cubeUV_r6 ) {\n mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n } else {\n mip = - 2.0 * log2( 1.16 * roughness ); }\n return mip;\n }\n vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n float mipF = fract( mip );\n float mipInt = floor( mip );\n vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n if ( mipF == 0.0 ) {\n return vec4( color0, 1.0 );\n } else {\n vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n return vec4( mix( color0, color1, mipF ), 1.0 );\n }\n }\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n vec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n mat3 bm = mat3( batchingMatrix );\n transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n transformedNormal = bm * transformedNormal;\n #ifdef USE_TANGENT\n transformedTangent = bm * transformedTangent;\n #endif\n#endif\n#ifdef USE_INSTANCING\n mat3 im = mat3( instanceMatrix );\n transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n transformedNormal = im * transformedNormal;\n #ifdef USE_TANGENT\n transformedTangent = im * transformedTangent;\n #endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n transformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n #ifdef FLIP_SIDED\n transformedTangent = - transformedTangent;\n #endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n emissiveColor = sRGBTransferEOTF( emissiveColor );\n #endif\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"vec4 LinearTransferOETF( in vec4 value ) {\n return value;\n}\nvec4 sRGBTransferEOTF( in vec4 value ) {\n return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vec3 cameraToFrag;\n if ( isOrthographic ) {\n cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToFrag = normalize( vWorldPosition - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToFrag, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_MIX )\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_ADD )\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n #endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n uniform float envMapIntensity;\n uniform float flipEnvMap;\n uniform mat3 envMapRotation;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n uniform float reflectivity;\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n varying vec3 vWorldPosition;\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n \n varying vec3 vWorldPosition;\n #else\n varying vec3 vReflect;\n uniform float refractionRatio;\n #endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n vec3 getIBLIrradiance( const in vec3 normal ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n return PI * envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 reflectVec = reflect( - viewDir, normal );\n reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n return envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n #ifdef USE_ANISOTROPY\n vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 bentNormal = cross( bitangent, viewDir );\n bentNormal = normalize( cross( bentNormal, bitangent ) );\n bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n return getIBLRadiance( viewDir, bentNormal, roughness );\n #else\n return vec3( 0.0 );\n #endif\n }\n #endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex;\n if ( isOrthographic ) {\n cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect( cameraToVertex, worldNormal );\n #else\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #endif\n#endif",fog_vertex:"#ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n #ifdef FOG_EXP2\n float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n #else\n float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n #endif\n gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n uniform vec3 fogColor;\n varying float vFogDepth;\n #ifdef FOG_EXP2\n uniform float fogDensity;\n #else\n uniform float fogNear;\n uniform float fogFar;\n #endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n uniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n float dotNL = dot( normal, lightDirection );\n vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n #ifdef USE_GRADIENTMAP\n return vec3( texture2D( gradientMap, coord ).r );\n #else\n vec2 fw = fwidth( coord ) * 0.5;\n return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n #endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n vec3 diffuseColor;\n float specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Lambert\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n uniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n float x = normal.x, y = normal.y, z = normal.z;\n vec3 result = shCoefficients[ 0 ] * 0.886227;\n result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n return irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if ( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n return smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n light.color = directionalLight.color;\n light.direction = directionalLight.direction;\n light.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = pointLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float lightDistance = length( lVector );\n light.color = pointLight.color;\n light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = spotLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float angleCos = dot( light.direction, spotLight.direction );\n float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n if ( spotAttenuation > 0.0 ) {\n float lightDistance = length( lVector );\n light.color = spotLight.color * spotAttenuation;\n light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n } else {\n light.color = vec3( 0.0 );\n light.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n uniform sampler2D ltc_1; uniform sampler2D ltc_2;\n uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n float dotNL = dot( normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n return irradiance;\n }\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n vec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Toon\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.metalness = metalnessFactor;\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n material.ior = ior;\n #ifdef USE_SPECULAR\n float specularIntensityFactor = specularIntensity;\n vec3 specularColorFactor = specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n #endif\n material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n #else\n float specularIntensityFactor = 1.0;\n vec3 specularColorFactor = vec3( 1.0 );\n material.specularF90 = 1.0;\n #endif\n material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;\n material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n#else\n material.specularColor = vec3( 0.04 );\n material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n material.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n material.clearcoat = clearcoat;\n material.clearcoatRoughness = clearcoatRoughness;\n material.clearcoatF0 = vec3( 0.04 );\n material.clearcoatF90 = 1.0;\n #ifdef USE_CLEARCOATMAP\n material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n #endif\n #ifdef USE_CLEARCOAT_ROUGHNESSMAP\n material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n #endif\n material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n material.clearcoatRoughness += geometryRoughness;\n material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n material.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n material.iridescence = iridescence;\n material.iridescenceIOR = iridescenceIOR;\n #ifdef USE_IRIDESCENCEMAP\n material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n #endif\n #ifdef USE_IRIDESCENCE_THICKNESSMAP\n material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n #else\n material.iridescenceThickness = iridescenceThicknessMaximum;\n #endif\n#endif\n#ifdef USE_SHEEN\n material.sheenColor = sheenColor;\n #ifdef USE_SHEEN_COLORMAP\n material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n #endif\n material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );\n #ifdef USE_SHEEN_ROUGHNESSMAP\n material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n #ifdef USE_ANISOTROPYMAP\n mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n #else\n vec2 anisotropyV = anisotropyVector;\n #endif\n material.anisotropy = length( anisotropyV );\n if( material.anisotropy == 0.0 ) {\n anisotropyV = vec2( 1.0, 0.0 );\n } else {\n anisotropyV /= material.anisotropy;\n material.anisotropy = saturate( material.anisotropy );\n }\n material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"uniform sampler2D dfgLUT;\nstruct PhysicalMaterial {\n vec3 diffuseColor;\n vec3 diffuseContribution;\n vec3 specularColor;\n vec3 specularColorBlended;\n float roughness;\n float metalness;\n float specularF90;\n float dispersion;\n #ifdef USE_CLEARCOAT\n float clearcoat;\n float clearcoatRoughness;\n vec3 clearcoatF0;\n float clearcoatF90;\n #endif\n #ifdef USE_IRIDESCENCE\n float iridescence;\n float iridescenceIOR;\n float iridescenceThickness;\n vec3 iridescenceFresnel;\n vec3 iridescenceF0;\n vec3 iridescenceFresnelDielectric;\n vec3 iridescenceFresnelMetallic;\n #endif\n #ifdef USE_SHEEN\n vec3 sheenColor;\n float sheenRoughness;\n #endif\n #ifdef IOR\n float ior;\n #endif\n #ifdef USE_TRANSMISSION\n float transmission;\n float transmissionAlpha;\n float thickness;\n float attenuationDistance;\n vec3 attenuationColor;\n #endif\n #ifdef USE_ANISOTROPY\n float anisotropy;\n float alphaT;\n vec3 anisotropyT;\n vec3 anisotropyB;\n #endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n float v = 0.5 / ( gv + gl );\n return v;\n }\n float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n float a2 = alphaT * alphaB;\n highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n highp float v2 = dot( v, v );\n float w2 = a2 / v2;\n return RECIPROCAL_PI * a2 * pow2 ( w2 );\n }\n#endif\n#ifdef USE_CLEARCOAT\n vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n vec3 f0 = material.clearcoatF0;\n float f90 = material.clearcoatF90;\n float roughness = material.clearcoatRoughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( V * D );\n }\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 f0 = material.specularColorBlended;\n float f90 = material.specularF90;\n float roughness = material.roughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n #ifdef USE_IRIDESCENCE\n F = mix( F, material.iridescenceFresnel, material.iridescence );\n #endif\n #ifdef USE_ANISOTROPY\n float dotTL = dot( material.anisotropyT, lightDir );\n float dotTV = dot( material.anisotropyT, viewDir );\n float dotTH = dot( material.anisotropyT, halfDir );\n float dotBL = dot( material.anisotropyB, lightDir );\n float dotBV = dot( material.anisotropyB, viewDir );\n float dotBH = dot( material.anisotropyB, halfDir );\n float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n #else\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n #endif\n return F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float dotNV = saturate( dot( N, V ) );\n vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n float l = length( f );\n return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n float x = dot( v1, v2 );\n float y = abs( x );\n float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n float b = 3.4175940 + ( 4.1616724 + y ) * y;\n float v = a / b;\n float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n return cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n vec3 lightNormal = cross( v1, v2 );\n if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n vec3 T1, T2;\n T1 = normalize( V - N * dot( V, N ) );\n T2 = - cross( N, T1 );\n mat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n vec3 coords[ 4 ];\n coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n coords[ 0 ] = normalize( coords[ 0 ] );\n coords[ 1 ] = normalize( coords[ 1 ] );\n coords[ 2 ] = normalize( coords[ 2 ] );\n coords[ 3 ] = normalize( coords[ 3 ] );\n vec3 vectorFormFactor = vec3( 0.0 );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n return vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n float alpha = pow2( roughness );\n float invAlpha = 1.0 / alpha;\n float cos2h = dotNH * dotNH;\n float sin2h = max( 1.0 - cos2h, 0.0078125 );\n return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float D = D_Charlie( sheenRoughness, dotNH );\n float V = V_Neubelt( dotNV, dotNL );\n return sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n float r2 = roughness * roughness;\n float rInv = 1.0 / ( roughness + 0.1 );\n float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;\n float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;\n float DG = exp( a * dotNV + b );\n return saturate( DG );\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n return specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n #ifdef USE_IRIDESCENCE\n vec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n #else\n vec3 Fr = specularColor;\n #endif\n vec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\nvec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;\n vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;\n vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;\n vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;\n float Ess_V = dfgV.x + dfgV.y;\n float Ess_L = dfgL.x + dfgL.y;\n float Ems_V = 1.0 - Ess_V;\n float Ems_L = 1.0 - Ess_L;\n vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;\n vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );\n float compensationFactor = Ems_V * Ems_L;\n vec3 multiScatter = Fms * compensationFactor;\n return singleScatter + multiScatter;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 normal = geometryNormal;\n vec3 viewDir = geometryViewDir;\n vec3 position = geometryPosition;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.roughness;\n vec3 rectCoords[ 4 ];\n rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n vec2 uv = LTC_Uv( normal, viewDir, roughness );\n vec4 t1 = texture2D( ltc_1, uv );\n vec4 t2 = texture2D( ltc_2, uv );\n mat3 mInv = mat3(\n vec3( t1.x, 0, t1.y ),\n vec3( 0, 1, 0 ),\n vec3( t1.z, 0, t1.w )\n );\n vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );\n reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n #ifdef USE_CLEARCOAT\n vec3 Ncc = geometryClearcoatNormal;\n vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );\n vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );\n vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );\n mat3 mInvClearcoat = mat3(\n vec3( t1Clearcoat.x, 0, t1Clearcoat.y ),\n vec3( 0, 1, 0 ),\n vec3( t1Clearcoat.z, 0, t1Clearcoat.w )\n );\n vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;\n clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );\n #endif\n }\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifdef USE_CLEARCOAT\n float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n vec3 ccIrradiance = dotNLcc * directLight.color;\n clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n #endif\n #ifdef USE_SHEEN\n \n sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n \n float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );\n \n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );\n \n irradiance *= sheenEnergyComp;\n \n #endif\n reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );\n #ifdef USE_SHEEN\n float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n diffuse *= sheenEnergyComp;\n #endif\n reflectedLight.indirectDiffuse += diffuse;\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n #ifdef USE_CLEARCOAT\n clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n #endif\n #ifdef USE_SHEEN\n sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;\n #endif\n vec3 singleScatteringDielectric = vec3( 0.0 );\n vec3 multiScatteringDielectric = vec3( 0.0 );\n vec3 singleScatteringMetallic = vec3( 0.0 );\n vec3 multiScatteringMetallic = vec3( 0.0 );\n #ifdef USE_IRIDESCENCE\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n #else\n computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n #endif\n vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );\n vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );\n vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;\n vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n vec3 indirectSpecular = radiance * singleScattering;\n indirectSpecular += multiScattering * cosineWeightedIrradiance;\n vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;\n #ifdef USE_SHEEN\n float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n indirectSpecular *= sheenEnergyComp;\n indirectDiffuse *= sheenEnergyComp;\n #endif\n reflectedLight.indirectSpecular += indirectSpecular;\n reflectedLight.indirectDiffuse += indirectDiffuse;\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n geometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n float dotNVi = saturate( dot( normal, geometryViewDir ) );\n if ( material.iridescenceThickness == 0.0 ) {\n material.iridescence = 0.0;\n } else {\n material.iridescence = saturate( material.iridescence );\n }\n if ( material.iridescence > 0.0 ) {\n material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );\n material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );\n material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n }\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointLightInfo( pointLight, geometryPosition, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n pointLightShadow = pointLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n vec4 spotColor;\n vec3 spotLightCoord;\n bool inSpotLightMap;\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotLightInfo( spotLight, geometryPosition, directLight );\n #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n #else\n #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #endif\n #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n #endif\n #undef SPOT_LIGHT_MAP_INDEX\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalLightInfo( directionalLight, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n RectAreaLight rectAreaLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n rectAreaLight = rectAreaLights[ i ];\n RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3( 0.0 );\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n #if defined( USE_LIGHT_PROBES )\n irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n #endif\n #if ( NUM_HEMI_LIGHTS > 0 )\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n irradiance += lightMapIrradiance;\n #endif\n #if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV )\n #if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )\n iblIrradiance += getIBLIrradiance( geometryNormal );\n #endif\n #endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n #ifdef USE_ANISOTROPY\n radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n #else\n radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n #endif\n #ifdef USE_CLEARCOAT\n clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n #endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n #if defined( LAMBERT ) || defined( PHONG )\n irradiance += iblIrradiance;\n #endif\n RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n uniform float logDepthBufFC;\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n vFragDepth = 1.0 + gl_Position.w;\n vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n vec4 sampledDiffuseColor = texture2D( map, vMapUv );\n #ifdef DECODE_VIDEO_TEXTURE\n sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n #endif\n diffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n uniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n #if defined( USE_POINTS_UV )\n vec2 uv = vUv;\n #else\n vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n #endif\n#endif\n#ifdef USE_MAP\n diffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n varying vec2 vUv;\n#else\n #if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n uniform mat3 uvTransform;\n #endif\n#endif\n#ifdef USE_MAP\n uniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n metalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n }\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n vColor *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n #if defined( USE_COLOR_ALPHA )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n #elif defined( USE_COLOR )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n #endif\n }\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n objectNormal *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n }\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n #ifndef USE_INSTANCING_MORPH\n uniform float morphTargetBaseInfluence;\n uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n #endif\n uniform sampler2DArray morphTargetsTexture;\n uniform ivec2 morphTargetsTextureSize;\n vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n int y = texelIndex / morphTargetsTextureSize.x;\n int x = texelIndex - y * morphTargetsTextureSize.x;\n ivec3 morphUV = ivec3( x, y, morphTargetIndex );\n return texelFetch( morphTargetsTexture, morphUV, 0 );\n }\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n transformed *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n }\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n vec3 fdx = dFdx( vViewPosition );\n vec3 fdy = dFdy( vViewPosition );\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal );\n #ifdef DOUBLE_SIDED\n normal *= faceDirection;\n #endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n #ifdef USE_TANGENT\n mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn = getTangentFrame( - vViewPosition, normal,\n #if defined( USE_NORMALMAP )\n vNormalMapUv\n #elif defined( USE_CLEARCOAT_NORMALMAP )\n vClearcoatNormalMapUv\n #else\n vUv\n #endif\n );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn[0] *= faceDirection;\n tbn[1] *= faceDirection;\n #endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n #ifdef USE_TANGENT\n mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn2[0] *= faceDirection;\n tbn2[1] *= faceDirection;\n #endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n #ifdef FLIP_SIDED\n normal = - normal;\n #endif\n #ifdef DOUBLE_SIDED\n normal = normal * faceDirection;\n #endif\n normal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n mapN.xy *= normalScale;\n normal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #ifdef USE_TANGENT\n vTangent = normalize( transformedTangent );\n vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n #endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n uniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( uv.st );\n vec2 st1 = dFdy( uv.st );\n vec3 N = surf_norm;\n vec3 q1perp = cross( q1, N );\n vec3 q0perp = cross( N, q0 );\n vec3 T = q1perp * st0.x + q0perp * st1.x;\n vec3 B = q1perp * st0.y + q0perp * st1.y;\n float det = max( dot( T, T ), dot( B, B ) );\n float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n return mat3( T * scale, B * scale, N );\n }\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n vec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n clearcoatMapN.xy *= clearcoatNormalScale;\n clearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n uniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform sampler2D clearcoatNormalMap;\n uniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n uniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n if( v <= 0.0 )\n return vec4( 0., 0., 0., 0. );\n if( v >= 1.0 )\n return vec4( 1., 1., 1., 1. );\n float vuf;\n float af = modf( v * PackFactors.a, vuf );\n float bf = modf( vuf * ShiftRight8, vuf );\n float gf = modf( vuf * ShiftRight8, vuf );\n return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n if( v <= 0.0 )\n return vec3( 0., 0., 0. );\n if( v >= 1.0 )\n return vec3( 1., 1., 1. );\n float vuf;\n float bf = modf( v * PackFactors.b, vuf );\n float gf = modf( vuf * ShiftRight8, vuf );\n return vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n if( v <= 0.0 )\n return vec2( 0., 0. );\n if( v >= 1.0 )\n return vec2( 1., 1. );\n float vuf;\n float gf = modf( v * 256., vuf );\n return vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n return dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n return dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in vec2 v ) {\n vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( const in vec4 v ) {\n return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n #ifdef USE_REVERSED_DEPTH_BUFFER\n \n return depth * ( far - near ) - far;\n #else\n return depth * ( near - far ) - near;\n #endif\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n \n #ifdef USE_REVERSED_DEPTH_BUFFER\n return ( near * far ) / ( ( near - far ) * depth - near );\n #else\n return ( near * far ) / ( ( far - near ) * depth - far );\n #endif\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n mvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n vec3 dithering( vec3 color ) {\n float grid_position = rand( gl_FragCoord.xy );\n vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n return color + dither_shift_RGB;\n }\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n roughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n #else\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n #else\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n struct SpotLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n #elif defined( SHADOWMAP_TYPE_BASIC )\n uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n #if defined( SHADOWMAP_TYPE_PCF )\n float interleavedGradientNoise( vec2 position ) {\n return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );\n }\n vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {\n const float goldenAngle = 2.399963229728653;\n float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );\n float theta = float( sampleIndex ) * goldenAngle + phi;\n return vec2( cos( theta ), sin( theta ) ) * r;\n }\n #endif\n #if defined( SHADOWMAP_TYPE_PCF )\n float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float radius = shadowRadius * texelSize.x;\n float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;\n shadow = (\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )\n ) * 0.2;\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #elif defined( SHADOWMAP_TYPE_VSM )\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n shadowCoord.z -= shadowBias;\n #else\n shadowCoord.z += shadowBias;\n #endif\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;\n float mean = distribution.x;\n float variance = distribution.y * distribution.y;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n float hard_shadow = step( mean, shadowCoord.z );\n #else\n float hard_shadow = step( shadowCoord.z, mean );\n #endif\n \n if ( hard_shadow == 1.0 ) {\n shadow = 1.0;\n } else {\n variance = max( variance, 0.0000001 );\n float d = shadowCoord.z - mean;\n float p_max = variance / ( variance + d * d );\n p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );\n shadow = max( hard_shadow, p_max );\n }\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #else\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n shadowCoord.z -= shadowBias;\n #else\n shadowCoord.z += shadowBias;\n #endif\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n float depth = texture2D( shadowMap, shadowCoord.xy ).r;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n shadow = step( depth, shadowCoord.z );\n #else\n shadow = step( shadowCoord.z, depth );\n #endif\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n float shadow = 1.0;\n vec3 lightToPosition = shadowCoord.xyz;\n vec3 bd3D = normalize( lightToPosition );\n vec3 absVec = abs( lightToPosition );\n float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n #ifdef USE_REVERSED_DEPTH_BUFFER\n float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n dp -= shadowBias;\n #else\n float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n dp += shadowBias;\n #endif\n float texelSize = shadowRadius / shadowMapSize.x;\n vec3 absDir = abs( bd3D );\n vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );\n tangent = normalize( cross( bd3D, tangent ) );\n vec3 bitangent = cross( bd3D, tangent );\n float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;\n vec2 sample0 = vogelDiskSample( 0, 5, phi );\n vec2 sample1 = vogelDiskSample( 1, 5, phi );\n vec2 sample2 = vogelDiskSample( 2, 5, phi );\n vec2 sample3 = vogelDiskSample( 3, 5, phi );\n vec2 sample4 = vogelDiskSample( 4, 5, phi );\n shadow = (\n texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )\n ) * 0.2;\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #elif defined( SHADOWMAP_TYPE_BASIC )\n float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n float shadow = 1.0;\n vec3 lightToPosition = shadowCoord.xyz;\n vec3 absVec = abs( lightToPosition );\n float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n dp += shadowBias;\n vec3 bd3D = normalize( lightToPosition );\n float depth = textureCube( shadowMap, bd3D ).r;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n depth = 1.0 - depth;\n #endif\n shadow = step( dp, depth );\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #endif\n #endif\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n struct SpotLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n vec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n shadowWorldPosition = worldPosition;\n #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n #endif\n vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n directionalLight = directionalLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n spotLight = spotLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n PointLightShadow pointLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n pointLight = pointLightShadows[ i ];\n shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #endif\n return shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n uniform highp sampler2D boneTexture;\n mat4 getBoneMatrix( const in float i ) {\n int size = textureSize( boneTexture, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n transformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n #ifdef USE_TANGENT\n objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n return saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n vec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n return a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n const mat3 ACESInputMat = mat3(\n vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),\n vec3( 0.04823, 0.01566, 0.83777 )\n );\n const mat3 ACESOutputMat = mat3(\n vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),\n vec3( -0.07367, -0.00605, 1.07602 )\n );\n color *= toneMappingExposure / 0.6;\n color = ACESInputMat * color;\n color = RRTAndODTFit( color );\n color = ACESOutputMat * color;\n return saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n vec3( 1.6605, - 0.1246, - 0.0182 ),\n vec3( - 0.5876, 1.1329, - 0.1006 ),\n vec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n vec3( 0.6274, 0.0691, 0.0164 ),\n vec3( 0.3293, 0.9195, 0.0880 ),\n vec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n vec3 x2 = x * x;\n vec3 x4 = x2 * x2;\n return + 15.5 * x4 * x2\n - 40.14 * x4 * x\n + 31.96 * x4\n - 6.868 * x2 * x\n + 0.4298 * x2\n + 0.1191 * x\n - 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n const mat3 AgXInsetMatrix = mat3(\n vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n );\n const mat3 AgXOutsetMatrix = mat3(\n vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n );\n const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;\n color *= toneMappingExposure;\n color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n color = AgXInsetMatrix * color;\n color = max( color, 1e-10 ); color = log2( color );\n color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n color = clamp( color, 0.0, 1.0 );\n color = agxDefaultContrastApprox( color );\n color = AgXOutsetMatrix * color;\n color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n color = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n color = clamp( color, 0.0, 1.0 );\n return color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n const float StartCompression = 0.8 - 0.04;\n const float Desaturation = 0.15;\n color *= toneMappingExposure;\n float x = min( color.r, min( color.g, color.b ) );\n float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n color -= offset;\n float peak = max( color.r, max( color.g, color.b ) );\n if ( peak < StartCompression ) return color;\n float d = 1. - StartCompression;\n float newPeak = 1. - d * d / ( peak + d - StartCompression );\n color *= newPeak / peak;\n float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n return mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n material.transmission = transmission;\n material.transmissionAlpha = 1.0;\n material.thickness = thickness;\n material.attenuationDistance = attenuationDistance;\n material.attenuationColor = attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n #endif\n #ifdef USE_THICKNESSMAP\n material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n #endif\n vec3 pos = vWorldPosition;\n vec3 v = normalize( cameraPosition - pos );\n vec3 n = inverseTransformDirection( normal, viewMatrix );\n vec4 transmitted = getIBLVolumeRefraction(\n n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,\n pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n material.attenuationColor, material.attenuationDistance );\n material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n uniform float transmission;\n uniform float thickness;\n uniform float attenuationDistance;\n uniform vec3 attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n uniform sampler2D transmissionMap;\n #endif\n #ifdef USE_THICKNESSMAP\n uniform sampler2D thicknessMap;\n #endif\n uniform vec2 transmissionSamplerSize;\n uniform sampler2D transmissionSamplerMap;\n uniform mat4 modelMatrix;\n uniform mat4 projectionMatrix;\n varying vec3 vWorldPosition;\n float w0( float a ) {\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n }\n float w1( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n }\n float w2( float a ){\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n }\n float w3( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * a );\n }\n float g0( float a ) {\n return w0( a ) + w1( a );\n }\n float g1( float a ) {\n return w2( a ) + w3( a );\n }\n float h0( float a ) {\n return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n }\n float h1( float a ) {\n return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n }\n vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n uv = uv * texelSize.zw + 0.5;\n vec2 iuv = floor( uv );\n vec2 fuv = fract( uv );\n float g0x = g0( fuv.x );\n float g1x = g1( fuv.x );\n float h0x = h0( fuv.x );\n float h1x = h1( fuv.x );\n float h0y = h0( fuv.y );\n float h1y = h1( fuv.y );\n vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n }\n vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n vec2 fLodSizeInv = 1.0 / fLodSize;\n vec2 cLodSizeInv = 1.0 / cLodSize;\n vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n return mix( fSample, cSample, fract( lod ) );\n }\n vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n vec3 modelScale;\n modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n return normalize( refractionVector ) * thickness * modelScale;\n }\n float applyIorToRoughness( const in float roughness, const in float ior ) {\n return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n }\n vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n }\n vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n if ( isinf( attenuationDistance ) ) {\n return vec3( 1.0 );\n } else {\n vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;\n }\n }\n vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n const in vec3 attenuationColor, const in float attenuationDistance ) {\n vec4 transmittedLight;\n vec3 transmittance;\n #ifdef USE_DISPERSION\n float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n for ( int i = 0; i < 3; i ++ ) {\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n transmittedLight[ i ] = transmissionSample[ i ];\n transmittedLight.a += transmissionSample.a;\n transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n }\n transmittedLight.a /= 3.0;\n #else\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n #endif\n vec3 attenuatedColor = transmittance * transmittedLight.rgb;\n vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n }\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n uniform mat3 mapTransform;\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n uniform mat3 alphaMapTransform;\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n uniform mat3 lightMapTransform;\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n uniform mat3 aoMapTransform;\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n uniform mat3 bumpMapTransform;\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n uniform mat3 normalMapTransform;\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n uniform mat3 displacementMapTransform;\n varying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n uniform mat3 emissiveMapTransform;\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n uniform mat3 metalnessMapTransform;\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n uniform mat3 roughnessMapTransform;\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n uniform mat3 anisotropyMapTransform;\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n uniform mat3 clearcoatMapTransform;\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform mat3 clearcoatNormalMapTransform;\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform mat3 clearcoatRoughnessMapTransform;\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n uniform mat3 sheenColorMapTransform;\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n uniform mat3 sheenRoughnessMapTransform;\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n uniform mat3 iridescenceMapTransform;\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform mat3 iridescenceThicknessMapTransform;\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n uniform mat3 specularMapTransform;\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n uniform mat3 specularColorMapTransform;\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n uniform mat3 specularIntensityMapTransform;\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n vUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n vec4 worldPosition = vec4( transformed, 1.0 );\n #ifdef USE_BATCHING\n worldPosition = batchingMatrix * worldPosition;\n #endif\n #ifdef USE_INSTANCING\n worldPosition = instanceMatrix * worldPosition;\n #endif\n worldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n gl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n vec4 texColor = texture2D( t2D, vUv );\n #ifdef DECODE_VIDEO_TEXTURE\n texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n uniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n #ifdef ENVMAP_TYPE_CUBE\n vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n #else\n vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n gl_FragColor = texColor;\n gl_FragColor.a *= opacity;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}",depth_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include <uv_vertex>\n #include <batching_vertex>\n #include <skinbase_vertex>\n #include <morphinstance_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n uniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n vec4 diffuseColor = vec4( 1.0 );\n #include <clipping_planes_fragment>\n #if DEPTH_PACKING == 3200\n diffuseColor.a = opacity;\n #endif\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <logdepthbuf_fragment>\n #ifdef USE_REVERSED_DEPTH_BUFFER\n float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];\n #else\n float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;\n #endif\n #if DEPTH_PACKING == 3200\n gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n #elif DEPTH_PACKING == 3201\n gl_FragColor = packDepthToRGBA( fragCoordZ );\n #elif DEPTH_PACKING == 3202\n gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n #elif DEPTH_PACKING == 3203\n gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n #endif\n}",distance_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <batching_vertex>\n #include <skinbase_vertex>\n #include <morphinstance_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <worldpos_vertex>\n #include <clipping_planes_vertex>\n vWorldPosition = worldPosition.xyz;\n}",distance_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n vec4 diffuseColor = vec4( 1.0 );\n #include <clipping_planes_fragment>\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n float dist = length( vWorldPosition - referencePosition );\n dist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n dist = saturate( dist );\n gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vec3 direction = normalize( vWorldDirection );\n vec2 sampleUV = equirectUv( direction );\n gl_FragColor = texture2D( tEquirect, sampleUV );\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n vLineDistance = scale * lineDistance;\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n discard;\n }\n vec3 outgoingLight = vec3( 0.0 );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n #else\n reflectedLight.indirectDiffuse += vec3( 1.0 );\n #endif\n #include <aomap_fragment>\n reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_lambert_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n vViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n vec3 viewDir = normalize( vViewPosition );\n vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n vec3 y = cross( viewDir, x );\n vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n #ifdef USE_MATCAP\n vec4 matcapColor = texture2D( matcap, uv );\n #else\n vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n #endif\n vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphinstance_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n vViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );\n #ifdef OPAQUE\n gl_FragColor.a = 1.0;\n #endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphinstance_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_phong_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n varying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n#ifdef USE_TRANSMISSION\n vWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n #define IOR\n #define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n uniform float ior;\n#endif\n#ifdef USE_SPECULAR\n uniform float specularIntensity;\n uniform vec3 specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n uniform sampler2D specularColorMap;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n uniform sampler2D specularIntensityMap;\n #endif\n#endif\n#ifdef USE_CLEARCOAT\n uniform float clearcoat;\n uniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n uniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n uniform float iridescence;\n uniform float iridescenceIOR;\n uniform float iridescenceThicknessMinimum;\n uniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n uniform vec3 sheenColor;\n uniform float sheenRoughness;\n #ifdef USE_SHEEN_COLORMAP\n uniform sampler2D sheenColorMap;\n #endif\n #ifdef USE_SHEEN_ROUGHNESSMAP\n uniform sampler2D sheenRoughnessMap;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n uniform vec2 anisotropyVector;\n #ifdef USE_ANISOTROPYMAP\n uniform sampler2D anisotropyMap;\n #endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <roughnessmap_fragment>\n #include <metalnessmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <clearcoat_normal_fragment_begin>\n #include <clearcoat_normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_physical_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n #include <transmission_fragment>\n vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n #ifdef USE_SHEEN\n \n outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;\n \n #endif\n #ifdef USE_CLEARCOAT\n float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n #endif\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_toon_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n varying vec2 vUv;\n uniform mat3 uvTransform;\n#endif\nvoid main() {\n #ifdef USE_POINTS_UV\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n #endif\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n gl_PointSize = size;\n #ifdef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n #endif\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n #include <logdepthbuf_fragment>\n #include <map_particle_fragment>\n #include <color_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphinstance_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n #include <logdepthbuf_fragment>\n gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n vec4 mvPosition = modelViewMatrix[ 3 ];\n vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n #ifndef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) scale *= - mvPosition.z;\n #endif\n vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n mvPosition.xy += rotatedPosition;\n gl_Position = projectionMatrix * mvPosition;\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n}"},n1={common:{diffuse:{value:new e9(0xffffff)},opacity:{value:1},map:{value:null},mapTransform:{value:new eh},alphaMap:{value:null},alphaMapTransform:{value:new eh},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new eh}},envmap:{envMap:{value:null},envMapRotation:{value:new eh},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new eh}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new eh}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new eh},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new eh},normalScale:{value:new er(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new eh},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new eh}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new eh}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new eh}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new e9(0xffffff)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new e9(0xffffff)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new eh},alphaTest:{value:0},uvTransform:{value:new eh}},sprite:{diffuse:{value:new e9(0xffffff)},opacity:{value:1},center:{value:new er(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new eh},alphaMap:{value:null},alphaMapTransform:{value:new eh},alphaTest:{value:0}}},n2={basic:{uniforms:i4([n1.common,n1.specularmap,n1.envmap,n1.aomap,n1.lightmap,n1.fog]),vertexShader:n0.meshbasic_vert,fragmentShader:n0.meshbasic_frag},lambert:{uniforms:i4([n1.common,n1.specularmap,n1.envmap,n1.aomap,n1.lightmap,n1.emissivemap,n1.bumpmap,n1.normalmap,n1.displacementmap,n1.fog,n1.lights,{emissive:{value:new e9(0)},envMapIntensity:{value:1}}]),vertexShader:n0.meshlambert_vert,fragmentShader:n0.meshlambert_frag},phong:{uniforms:i4([n1.common,n1.specularmap,n1.envmap,n1.aomap,n1.lightmap,n1.emissivemap,n1.bumpmap,n1.normalmap,n1.displacementmap,n1.fog,n1.lights,{emissive:{value:new e9(0)},specular:{value:new e9(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:n0.meshphong_vert,fragmentShader:n0.meshphong_frag},standard:{uniforms:i4([n1.common,n1.envmap,n1.aomap,n1.lightmap,n1.emissivemap,n1.bumpmap,n1.normalmap,n1.displacementmap,n1.roughnessmap,n1.metalnessmap,n1.fog,n1.lights,{emissive:{value:new e9(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:n0.meshphysical_vert,fragmentShader:n0.meshphysical_frag},toon:{uniforms:i4([n1.common,n1.aomap,n1.lightmap,n1.emissivemap,n1.bumpmap,n1.normalmap,n1.displacementmap,n1.gradientmap,n1.fog,n1.lights,{emissive:{value:new e9(0)}}]),vertexShader:n0.meshtoon_vert,fragmentShader:n0.meshtoon_frag},matcap:{uniforms:i4([n1.common,n1.bumpmap,n1.normalmap,n1.displacementmap,n1.fog,{matcap:{value:null}}]),vertexShader:n0.meshmatcap_vert,fragmentShader:n0.meshmatcap_frag},points:{uniforms:i4([n1.points,n1.fog]),vertexShader:n0.points_vert,fragmentShader:n0.points_frag},dashed:{uniforms:i4([n1.common,n1.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:n0.linedashed_vert,fragmentShader:n0.linedashed_frag},depth:{uniforms:i4([n1.common,n1.displacementmap]),vertexShader:n0.depth_vert,fragmentShader:n0.depth_frag},normal:{uniforms:i4([n1.common,n1.bumpmap,n1.normalmap,n1.displacementmap,{opacity:{value:1}}]),vertexShader:n0.meshnormal_vert,fragmentShader:n0.meshnormal_frag},sprite:{uniforms:i4([n1.sprite,n1.fog]),vertexShader:n0.sprite_vert,fragmentShader:n0.sprite_frag},background:{uniforms:{uvTransform:{value:new eh},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:n0.background_vert,fragmentShader:n0.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new eh}},vertexShader:n0.backgroundCube_vert,fragmentShader:n0.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:n0.cube_vert,fragmentShader:n0.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:n0.equirect_vert,fragmentShader:n0.equirect_frag},distance:{uniforms:i4([n1.common,n1.displacementmap,{referencePosition:{value:new es},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:n0.distance_vert,fragmentShader:n0.distance_frag},shadow:{uniforms:i4([n1.lights,n1.fog,{color:{value:new e9(0)},opacity:{value:1}}]),vertexShader:n0.shadow_vert,fragmentShader:n0.shadow_frag}};n2.physical={uniforms:i4([n2.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new eh},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new eh},clearcoatNormalScale:{value:new er(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new eh},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new eh},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new eh},sheen:{value:0},sheenColor:{value:new e9(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new eh},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new eh},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new eh},transmissionSamplerSize:{value:new er},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new eh},attenuationDistance:{value:0},attenuationColor:{value:new e9(0)},specularColor:{value:new e9(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new eh},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new eh},anisotropyVector:{value:new er},anisotropyMap:{value:null},anisotropyMapTransform:{value:new eh}}]),vertexShader:n0.meshphysical_vert,fragmentShader:n0.meshphysical_frag};let n3={r:0,b:0,g:0},n4=new eF,n5=new eA;function n6(e,t,i,n,r,a){let s,o,l=new e9(0),h=+(!0!==r),c=null,u=0,d=null;function p(e){let i=!0===e.isScene?e.background:null;if(i&&i.isTexture){let n=e.backgroundBlurriness>0;i=t.get(i,n)}return i}function f(t,n){t.getRGB(n3,i5(e)),i.buffers.color.setClear(n3.r,n3.g,n3.b,n,a)}return{getClearColor:function(){return l},setClearColor:function(e,t=1){l.set(e),f(l,h=t)},getClearAlpha:function(){return h},setClearAlpha:function(e){f(l,h=e)},render:function(t){let n=!1,r=p(t);null===r?f(l,h):r&&r.isColor&&(f(r,1),n=!0);let s=e.xr.getEnvironmentBlendMode();"additive"===s?i.buffers.color.setClear(0,0,0,1,a):"alpha-blend"===s&&i.buffers.color.setClear(0,0,0,0,a),(e.autoClear||n)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))},addToRenderList:function(t,i){let r=p(i);r&&(r.isCubeTexture||306===r.mapping)?(void 0===o&&((o=new ih(new iB(1,1,1),new i6({name:"BackgroundCubeMaterial",uniforms:i3(n2.backgroundCube.uniforms),vertexShader:n2.backgroundCube.vertexShader,fragmentShader:n2.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1}))).geometry.deleteAttribute("normal"),o.geometry.deleteAttribute("uv"),o.onBeforeRender=function(e,t,i){this.matrixWorld.copyPosition(i.matrixWorld)},Object.defineProperty(o.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(o)),n4.copy(i.backgroundRotation),n4.x*=-1,n4.y*=-1,n4.z*=-1,r.isCubeTexture&&!1===r.isRenderTargetTexture&&(n4.y*=-1,n4.z*=-1),o.material.uniforms.envMap.value=r,o.material.uniforms.flipEnvMap.value=r.isCubeTexture&&!1===r.isRenderTargetTexture?-1:1,o.material.uniforms.backgroundBlurriness.value=i.backgroundBlurriness,o.material.uniforms.backgroundIntensity.value=i.backgroundIntensity,o.material.uniforms.backgroundRotation.value.setFromMatrix4(n5.makeRotationFromEuler(n4)),o.material.toneMapped=ep.getTransfer(r.colorSpace)!==k,(c!==r||u!==r.version||d!==e.toneMapping)&&(o.material.needsUpdate=!0,c=r,u=r.version,d=e.toneMapping),o.layers.enableAll(),t.unshift(o,o.geometry,o.material,0,0,null)):r&&r.isTexture&&(void 0===s&&((s=new ih(new i0(2,2),new i6({name:"BackgroundMaterial",uniforms:i3(n2.background.uniforms),vertexShader:n2.background.vertexShader,fragmentShader:n2.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(s.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(s)),s.material.uniforms.t2D.value=r,s.material.uniforms.backgroundIntensity.value=i.backgroundIntensity,s.material.toneMapped=ep.getTransfer(r.colorSpace)!==k,!0===r.matrixAutoUpdate&&r.updateMatrix(),s.material.uniforms.uvTransform.value.copy(r.matrix),(c!==r||u!==r.version||d!==e.toneMapping)&&(s.material.needsUpdate=!0,c=r,u=r.version,d=e.toneMapping),s.layers.enableAll(),t.unshift(s,s.geometry,s.material,0,0,null))},dispose:function(){void 0!==o&&(o.geometry.dispose(),o.material.dispose(),o=void 0),void 0!==s&&(s.geometry.dispose(),s.material.dispose(),s=void 0)}}}function n8(e,t){let i=e.getParameter(e.MAX_VERTEX_ATTRIBS),n={},r=h(null),a=r,s=!1;function o(t){return e.bindVertexArray(t)}function l(t){return e.deleteVertexArray(t)}function h(e){let t=[],n=[],r=[];for(let e=0;e<i;e++)t[e]=0,n[e]=0,r[e]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:n,attributeDivisors:r,object:e,attributes:{},index:null}}function c(){let e=a.newAttributes;for(let t=0,i=e.length;t<i;t++)e[t]=0}function u(e){d(e,0)}function d(t,i){let n=a.newAttributes,r=a.enabledAttributes,s=a.attributeDivisors;n[t]=1,0===r[t]&&(e.enableVertexAttribArray(t),r[t]=1),s[t]!==i&&(e.vertexAttribDivisor(t,i),s[t]=i)}function p(){let t=a.newAttributes,i=a.enabledAttributes;for(let n=0,r=i.length;n<r;n++)i[n]!==t[n]&&(e.disableVertexAttribArray(n),i[n]=0)}function f(t,i,n,r,a,s,o){!0===o?e.vertexAttribIPointer(t,i,n,a,s):e.vertexAttribPointer(t,i,n,r,a,s)}function m(){g(),s=!0,a!==r&&o((a=r).object)}function g(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:function(i,r,l,m,g){var _,v,x;let y,M,S,b,T,E,w=!1,A=(_=i,v=m,x=l,y=!0===r.wireframe,void 0===(M=n[v.id])&&(M={},n[v.id]=M),void 0===(b=M[S=!0===_.isInstancedMesh?_.id:0])&&(b={},M[S]=b),void 0===(T=b[x.id])&&(T={},b[x.id]=T),void 0===(E=T[y])&&(E=h(e.createVertexArray()),T[y]=E),E);a!==A&&o((a=A).object),(w=function(e,t,i,n){let r=a.attributes,s=t.attributes,o=0,l=i.getAttributes();for(let t in l)if(l[t].location>=0){let i=r[t],n=s[t];if(void 0===n&&("instanceMatrix"===t&&e.instanceMatrix&&(n=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(n=e.instanceColor)),void 0===i||i.attribute!==n||n&&i.data!==n.data)return!0;o++}return a.attributesNum!==o||a.index!==n}(i,m,l,g))&&function(e,t,i,n){let r={},s=t.attributes,o=0,l=i.getAttributes();for(let t in l)if(l[t].location>=0){let i=s[t];void 0===i&&("instanceMatrix"===t&&e.instanceMatrix&&(i=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(i=e.instanceColor));let n={};n.attribute=i,i&&i.data&&(n.data=i.data),r[t]=n,o++}a.attributes=r,a.attributesNum=o,a.index=n}(i,m,l,g),null!==g&&t.update(g,e.ELEMENT_ARRAY_BUFFER),(w||s)&&(s=!1,function(i,n,r,a){c();let s=a.attributes,o=r.getAttributes(),l=n.defaultAttributeValues;for(let n in o){let r=o[n];if(r.location>=0){let o=s[n];if(void 0===o&&("instanceMatrix"===n&&i.instanceMatrix&&(o=i.instanceMatrix),"instanceColor"===n&&i.instanceColor&&(o=i.instanceColor)),void 0!==o){let n=o.normalized,s=o.itemSize,l=t.get(o);if(void 0===l)continue;let h=l.buffer,c=l.type,p=l.bytesPerElement,m=c===e.INT||c===e.UNSIGNED_INT||1013===o.gpuType;if(o.isInterleavedBufferAttribute){let t=o.data,l=t.stride,g=o.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e<r.locationSize;e++)d(r.location+e,t.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=t.meshPerAttribute*t.count)}else for(let e=0;e<r.locationSize;e++)u(r.location+e);e.bindBuffer(e.ARRAY_BUFFER,h);for(let e=0;e<r.locationSize;e++)f(r.location+e,s/r.locationSize,c,n,l*p,(g+s/r.locationSize*e)*p,m)}else{if(o.isInstancedBufferAttribute){for(let e=0;e<r.locationSize;e++)d(r.location+e,o.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=o.meshPerAttribute*o.count)}else for(let e=0;e<r.locationSize;e++)u(r.location+e);e.bindBuffer(e.ARRAY_BUFFER,h);for(let e=0;e<r.locationSize;e++)f(r.location+e,s/r.locationSize,c,n,s*p,s/r.locationSize*e*p,m)}}else if(void 0!==l){let t=l[n];if(void 0!==t)switch(t.length){case 2:e.vertexAttrib2fv(r.location,t);break;case 3:e.vertexAttrib3fv(r.location,t);break;case 4:e.vertexAttrib4fv(r.location,t);break;default:e.vertexAttrib1fv(r.location,t)}}}}p()}(i,r,l,m),null!==g&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(g).buffer))},reset:m,resetDefaultState:g,dispose:function(){for(let e in m(),n){let t=n[e];for(let e in t){let i=t[e];for(let e in i){let t=i[e];for(let e in t)l(t[e].object),delete t[e];delete i[e]}}delete n[e]}},releaseStatesOfGeometry:function(e){if(void 0===n[e.id])return;let t=n[e.id];for(let e in t){let i=t[e];for(let e in i){let t=i[e];for(let e in t)l(t[e].object),delete t[e];delete i[e]}}delete n[e.id]},releaseStatesOfObject:function(e){for(let t in n){let i=n[t],r=!0===e.isInstancedMesh?e.id:0,a=i[r];if(void 0!==a){for(let e in a){let t=a[e];for(let e in t)l(t[e].object),delete t[e];delete a[e]}delete i[r],0===Object.keys(i).length&&delete n[t]}}},releaseStatesOfProgram:function(e){for(let t in n){let i=n[t];for(let t in i){let n=i[t];if(void 0===n[e.id])continue;let r=n[e.id];for(let e in r)l(r[e].object),delete r[e];delete n[e.id]}}},initAttributes:c,enableAttribute:u,disableUnusedAttributes:p}}function n9(e,t,i){let n;function r(t,r,a){0!==a&&(e.drawArraysInstanced(n,t,r,a),i.update(r,n,a))}this.setMode=function(e){n=e},this.render=function(t,r){e.drawArrays(n,t,r),i.update(r,n,1)},this.renderInstances=r,this.renderMultiDraw=function(e,r,a){if(0===a)return;t.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,e,0,r,0,a);let s=0;for(let e=0;e<a;e++)s+=r[e];i.update(s,n,1)},this.renderMultiDrawInstances=function(e,a,s,o){if(0===s)return;let l=t.get("WEBGL_multi_draw");if(null===l)for(let t=0;t<e.length;t++)r(e[t],a[t],o[t]);else{l.multiDrawArraysInstancedWEBGL(n,e,0,a,0,o,0,s);let t=0;for(let e=0;e<s;e++)t+=a[e]*o[e];i.update(t,n,1)}}}function n7(e,t,i,n){let r;function a(t){if("highp"===t){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let s=void 0!==i.precision?i.precision:"highp",o=a(s);return o!==s&&(W("WebGLRenderer:",s,"not supported, using",o,"instead."),s=o),{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===t.has("EXT_texture_filter_anisotropic")){let i=t.get("EXT_texture_filter_anisotropic");r=e.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:a,textureFormatReadable:function(t){return 1023===t||n.convert(t)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(i){let r=1016===i&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return 1009===i||n.convert(i)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)||1015===i||!!r},precision:s,logarithmicDepthBuffer:!0===i.logarithmicDepthBuffer,reversedDepthBuffer:!0===i.reversedDepthBuffer&&t.has("EXT_clip_control"),maxTextures:e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),maxVertexTextures:e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxTextureSize:e.getParameter(e.MAX_TEXTURE_SIZE),maxCubemapSize:e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:e.getParameter(e.MAX_VERTEX_ATTRIBS),maxVertexUniforms:e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:e.getParameter(e.MAX_VARYING_VECTORS),maxFragmentUniforms:e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),maxSamples:e.getParameter(e.MAX_SAMPLES),samples:e.getParameter(e.SAMPLES)}}function re(e){let t=this,i=null,n=0,r=!1,a=!1,s=new ig,o=new eh,l={value:null,needsUpdate:!1};function h(e,i,n,r){let a=null!==e?e.length:0,h=null;if(0!==a){if(h=l.value,!0!==r||null===h){let t=n+4*a,r=i.matrixWorldInverse;o.getNormalMatrix(r),(null===h||h.length<t)&&(h=new Float32Array(t));for(let t=0,i=n;t!==a;++t,i+=4)s.copy(e[t]).applyMatrix4(r,o),s.normal.toArray(h,i),h[i+3]=s.constant}l.value=h,l.needsUpdate=!0}return t.numPlanes=a,t.numIntersection=0,h}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){let i=0!==e.length||t||0!==n||r;return r=t,n=e.length,i},this.beginShadows=function(){a=!0,h(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(e,t){i=h(e,t,0)},this.setState=function(s,o,c){let u=s.clippingPlanes,d=s.clipIntersection,p=s.clipShadows,f=e.get(s);if(r&&null!==u&&0!==u.length&&(!a||p)){let e=a?0:n,t=4*e,r=f.clippingState||null;l.value=r,r=h(u,o,t,c);for(let e=0;e!==t;++e)r[e]=i[e];f.clippingState=r,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=e}else a?h(null):(l.value!==i&&(l.value=i,l.needsUpdate=n>0),t.numPlanes=n,t.numIntersection=0)}}let rt=[.125,.215,.35,.446,.526,.582],ri=new nR,rn=new e9,rr=null,ra=0,rs=0,ro=!1,rl=new es;class rh{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,i=.1,n=100,r={}){let{size:a=256,position:s=rl}=r;rr=this._renderer.getRenderTarget(),ra=this._renderer.getActiveCubeFace(),rs=this._renderer.getActiveMipmapLevel(),ro=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);let o=this._allocateTargets();return o.depthBuffer=!0,this._sceneToCubeUV(e,i,n,o,s),t>0&&this._blur(o,0,0,t),this._applyPMREM(o),this._cleanup(o),o}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=rp(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=rd(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose(),null!==this._backgroundBox&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._ggxMaterial&&this._ggxMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(rr,ra,rs),this._renderer.xr.enabled=ro,e.scissorTest=!1,ru(e,0,0,e.width,e.height)}_fromTexture(e,t){301===e.mapping||302===e.mapping?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),rr=this._renderer.getRenderTarget(),ra=this._renderer.getActiveCubeFace(),rs=this._renderer.getActiveMipmapLevel(),ro=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:1006,minFilter:1006,generateMipmaps:!1,type:1016,format:1023,colorSpace:F,depthBuffer:!1},n=rc(e,t,i);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){var r,a;null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=rc(e,t,i);let{_lodMax:n}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=function(e){let t=[],i=[],n=[],r=e,a=e-4+1+rt.length;for(let s=0;s<a;s++){let a=Math.pow(2,r);t.push(a);let o=1/a;s>e-4?o=rt[s-e+4-1]:0===s&&(o=0),i.push(o);let l=1/(a-2),h=-l,c=1+l,u=[h,h,c,h,c,c,h,h,c,c,h,c],d=new Float32Array(108),p=new Float32Array(72),f=new Float32Array(36);for(let e=0;e<6;e++){let t=e%3*2/3-1,i=e>2?0:-1,n=[t,i,0,t+2/3,i,0,t+2/3,i+1,0,t,i,0,t+2/3,i+1,0,t,i+1,0];d.set(n,18*e),p.set(u,12*e);let r=[e,e,e,e,e,e];f.set(r,6*e)}let m=new tK;m.setAttribute("position",new tI(d,3)),m.setAttribute("uv",new tI(p,2)),m.setAttribute("faceIndex",new tI(f,1)),n.push(new ih(m,null)),r>4&&r--}return{lodMeshes:n,sizeLods:t,sigmas:i}}(n)),this._blurMaterial=(r=n,new i6({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:new Float32Array(20)},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:new es(0,1,0)}},vertexShader:rf(),fragmentShader:`
28
+
29
+ precision mediump float;
30
+ precision mediump int;
31
+
32
+ varying vec3 vOutputDirection;
33
+
34
+ uniform sampler2D envMap;
35
+ uniform int samples;
36
+ uniform float weights[ n ];
37
+ uniform bool latitudinal;
38
+ uniform float dTheta;
39
+ uniform float mipInt;
40
+ uniform vec3 poleAxis;
41
+
42
+ #define ENVMAP_TYPE_CUBE_UV
43
+ #include <cube_uv_reflection_fragment>
44
+
45
+ vec3 getSample( float theta, vec3 axis ) {
46
+
47
+ float cosTheta = cos( theta );
48
+ // Rodrigues' axis-angle rotation
49
+ vec3 sampleDirection = vOutputDirection * cosTheta
50
+ + cross( axis, vOutputDirection ) * sin( theta )
51
+ + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
52
+
53
+ return bilinearCubeUV( envMap, sampleDirection, mipInt );
54
+
55
+ }
56
+
57
+ void main() {
58
+
59
+ vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
60
+
61
+ if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
62
+
63
+ axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
64
+
65
+ }
66
+
67
+ axis = normalize( axis );
68
+
69
+ gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
70
+ gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
71
+
72
+ for ( int i = 1; i < n; i++ ) {
73
+
74
+ if ( i >= samples ) {
75
+
76
+ break;
77
+
78
+ }
79
+
80
+ float theta = dTheta * float( i );
81
+ gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
82
+ gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
83
+
84
+ }
85
+
86
+ }
87
+ `,blending:0,depthTest:!1,depthWrite:!1})),this._ggxMaterial=(a=n,new i6({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:256,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${a}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:rf(),fragmentShader:`
88
+
89
+ precision highp float;
90
+ precision highp int;
91
+
92
+ varying vec3 vOutputDirection;
93
+
94
+ uniform sampler2D envMap;
95
+ uniform float roughness;
96
+ uniform float mipInt;
97
+
98
+ #define ENVMAP_TYPE_CUBE_UV
99
+ #include <cube_uv_reflection_fragment>
100
+
101
+ #define PI 3.14159265359
102
+
103
+ // Van der Corput radical inverse
104
+ float radicalInverse_VdC(uint bits) {
105
+ bits = (bits << 16u) | (bits >> 16u);
106
+ bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
107
+ bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
108
+ bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
109
+ bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
110
+ return float(bits) * 2.3283064365386963e-10; // / 0x100000000
111
+ }
112
+
113
+ // Hammersley sequence
114
+ vec2 hammersley(uint i, uint N) {
115
+ return vec2(float(i) / float(N), radicalInverse_VdC(i));
116
+ }
117
+
118
+ // GGX VNDF importance sampling (Eric Heitz 2018)
119
+ // "Sampling the GGX Distribution of Visible Normals"
120
+ // https://jcgt.org/published/0007/04/01/
121
+ vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {
122
+ float alpha = roughness * roughness;
123
+
124
+ // Section 4.1: Orthonormal basis
125
+ vec3 T1 = vec3(1.0, 0.0, 0.0);
126
+ vec3 T2 = cross(V, T1);
127
+
128
+ // Section 4.2: Parameterization of projected area
129
+ float r = sqrt(Xi.x);
130
+ float phi = 2.0 * PI * Xi.y;
131
+ float t1 = r * cos(phi);
132
+ float t2 = r * sin(phi);
133
+ float s = 0.5 * (1.0 + V.z);
134
+ t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;
135
+
136
+ // Section 4.3: Reprojection onto hemisphere
137
+ vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V;
138
+
139
+ // Section 3.4: Transform back to ellipsoid configuration
140
+ return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));
141
+ }
142
+
143
+ void main() {
144
+ vec3 N = normalize(vOutputDirection);
145
+ vec3 V = N; // Assume view direction equals normal for pre-filtering
146
+
147
+ vec3 prefilteredColor = vec3(0.0);
148
+ float totalWeight = 0.0;
149
+
150
+ // For very low roughness, just sample the environment directly
151
+ if (roughness < 0.001) {
152
+ gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);
153
+ return;
154
+ }
155
+
156
+ // Tangent space basis for VNDF sampling
157
+ vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
158
+ vec3 tangent = normalize(cross(up, N));
159
+ vec3 bitangent = cross(N, tangent);
160
+
161
+ for(uint i = 0u; i < uint(GGX_SAMPLES); i++) {
162
+ vec2 Xi = hammersley(i, uint(GGX_SAMPLES));
163
+
164
+ // For PMREM, V = N, so in tangent space V is always (0, 0, 1)
165
+ vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);
166
+
167
+ // Transform H back to world space
168
+ vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);
169
+ vec3 L = normalize(2.0 * dot(V, H) * H - V);
170
+
171
+ float NdotL = max(dot(N, L), 0.0);
172
+
173
+ if(NdotL > 0.0) {
174
+ // Sample environment at fixed mip level
175
+ // VNDF importance sampling handles the distribution filtering
176
+ vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);
177
+
178
+ // Weight by NdotL for the split-sum approximation
179
+ // VNDF PDF naturally accounts for the visible microfacet distribution
180
+ prefilteredColor += sampleColor * NdotL;
181
+ totalWeight += NdotL;
182
+ }
183
+ }
184
+
185
+ if (totalWeight > 0.0) {
186
+ prefilteredColor = prefilteredColor / totalWeight;
187
+ }
188
+
189
+ gl_FragColor = vec4(prefilteredColor, 1.0);
190
+ }
191
+ `,blending:0,depthTest:!1,depthWrite:!1}))}return n}_compileMaterial(e){let t=new ih(new tK,e);this._renderer.compile(t,ri)}_sceneToCubeUV(e,t,i,n,r){let a=new nE(90,1,t,i),s=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],l=this._renderer,h=l.autoClear,c=l.toneMapping;l.getClearColor(rn),l.toneMapping=0,l.autoClear=!1,l.state.buffers.depth.getReversed()&&(l.setRenderTarget(n),l.clearDepth(),l.setRenderTarget(null)),null===this._backgroundBox&&(this._backgroundBox=new ih(new iB,new t6({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1})));let u=this._backgroundBox,d=u.material,p=!1,f=e.background;f?f.isColor&&(d.color.copy(f),e.background=null,p=!0):(d.color.copy(rn),p=!0);for(let t=0;t<6;t++){let i=t%3;0===i?(a.up.set(0,s[t],0),a.position.set(r.x,r.y,r.z),a.lookAt(r.x+o[t],r.y,r.z)):1===i?(a.up.set(0,0,s[t]),a.position.set(r.x,r.y,r.z),a.lookAt(r.x,r.y+o[t],r.z)):(a.up.set(0,s[t],0),a.position.set(r.x,r.y,r.z),a.lookAt(r.x,r.y,r.z+o[t]));let h=this._cubeSize;ru(n,i*h,t>2?h:0,h,h),l.setRenderTarget(n),p&&l.render(u,a),l.render(e,a)}l.toneMapping=c,l.autoClear=h,e.background=f}_textureToCubeUV(e,t){let i=this._renderer,n=301===e.mapping||302===e.mapping;n?(null===this._cubemapMaterial&&(this._cubemapMaterial=rp()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=rd());let r=n?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=r,r.uniforms.envMap.value=e;let s=this._cubeSize;ru(t,0,0,3*s,2*s),i.setRenderTarget(t),i.render(a,ri)}_applyPMREM(e){let t=this._renderer,i=t.autoClear;t.autoClear=!1;let n=this._lodMeshes.length;for(let t=1;t<n;t++)this._applyGGXFilter(e,t-1,t);t.autoClear=i}_applyGGXFilter(e,t,i){let n=this._renderer,r=this._pingPongRenderTarget,a=this._ggxMaterial,s=this._lodMeshes[i];s.material=a;let o=a.uniforms,l=i/(this._lodMeshes.length-1),h=t/(this._lodMeshes.length-1),c=Math.sqrt(l*l-h*h),{_lodMax:u}=this,d=this._sizeLods[i],p=3*d*(i>u-4?i-u+4:0),f=4*(this._cubeSize-d);o.envMap.value=e.texture,o.roughness.value=c*(0+1.25*l),o.mipInt.value=u-t,ru(r,p,f,3*d,2*d),n.setRenderTarget(r),n.render(s,ri),o.envMap.value=r.texture,o.roughness.value=0,o.mipInt.value=u-i,ru(e,p,f,3*d,2*d),n.setRenderTarget(e),n.render(s,ri)}_blur(e,t,i,n,r){let a=this._pingPongRenderTarget;this._halfBlur(e,a,t,i,n,"latitudinal",r),this._halfBlur(a,e,i,i,n,"longitudinal",r)}_halfBlur(e,t,i,n,r,a,s){let o=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&X("blur direction must be either latitudinal or longitudinal!");let h=this._lodMeshes[n];h.material=l;let c=l.uniforms,u=this._sizeLods[i]-1,d=isFinite(r)?Math.PI/(2*u):2*Math.PI/39,p=r/d,f=isFinite(r)?1+Math.floor(3*p):20;f>20&&W(`sigmaRadians, ${r}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);let m=[],g=0;for(let e=0;e<20;++e){let t=e/p,i=Math.exp(-t*t/2);m.push(i),0===e?g+=i:e<f&&(g+=2*i)}for(let e=0;e<m.length;e++)m[e]=m[e]/g;c.envMap.value=e.texture,c.samples.value=f,c.weights.value=m,c.latitudinal.value="latitudinal"===a,s&&(c.poleAxis.value=s);let{_lodMax:_}=this;c.dTheta.value=d,c.mipInt.value=_-i;let v=this._sizeLods[n],x=4*(this._cubeSize-v);ru(t,3*v*(n>_-4?n-_+4:0),x,3*v,2*v),o.setRenderTarget(t),o.render(h,ri)}}function rc(e,t,i){let n=new eE(e,t,i);return n.texture.mapping=306,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function ru(e,t,i,n,r){e.viewport.set(t,i,n,r),e.scissor.set(t,i,n,r)}function rd(){return new i6({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:rf(),fragmentShader:`
192
+
193
+ precision mediump float;
194
+ precision mediump int;
195
+
196
+ varying vec3 vOutputDirection;
197
+
198
+ uniform sampler2D envMap;
199
+
200
+ #include <common>
201
+
202
+ void main() {
203
+
204
+ vec3 outputDirection = normalize( vOutputDirection );
205
+ vec2 uv = equirectUv( outputDirection );
206
+
207
+ gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
208
+
209
+ }
210
+ `,blending:0,depthTest:!1,depthWrite:!1})}function rp(){return new i6({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:rf(),fragmentShader:`
211
+
212
+ precision mediump float;
213
+ precision mediump int;
214
+
215
+ uniform float flipEnvMap;
216
+
217
+ varying vec3 vOutputDirection;
218
+
219
+ uniform samplerCube envMap;
220
+
221
+ void main() {
222
+
223
+ gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
224
+
225
+ }
226
+ `,blending:0,depthTest:!1,depthWrite:!1})}function rf(){return`
227
+
228
+ precision mediump float;
229
+ precision mediump int;
230
+
231
+ attribute float faceIndex;
232
+
233
+ varying vec3 vOutputDirection;
234
+
235
+ // RH coordinate system; PMREM face-indexing convention
236
+ vec3 getDirection( vec2 uv, float face ) {
237
+
238
+ uv = 2.0 * uv - 1.0;
239
+
240
+ vec3 direction = vec3( uv, 1.0 );
241
+
242
+ if ( face == 0.0 ) {
243
+
244
+ direction = direction.zyx; // ( 1, v, u ) pos x
245
+
246
+ } else if ( face == 1.0 ) {
247
+
248
+ direction = direction.xzy;
249
+ direction.xz *= -1.0; // ( -u, 1, -v ) pos y
250
+
251
+ } else if ( face == 2.0 ) {
252
+
253
+ direction.x *= -1.0; // ( -u, v, 1 ) pos z
254
+
255
+ } else if ( face == 3.0 ) {
256
+
257
+ direction = direction.zyx;
258
+ direction.xz *= -1.0; // ( -1, v, -u ) neg x
259
+
260
+ } else if ( face == 4.0 ) {
261
+
262
+ direction = direction.xzy;
263
+ direction.xy *= -1.0; // ( -u, -1, v ) neg y
264
+
265
+ } else if ( face == 5.0 ) {
266
+
267
+ direction.z *= -1.0; // ( u, v, -1 ) neg z
268
+
269
+ }
270
+
271
+ return direction;
272
+
273
+ }
274
+
275
+ void main() {
276
+
277
+ vOutputDirection = getDirection( uv, faceIndex );
278
+ gl_Position = vec4( position, 1.0 );
279
+
280
+ }
281
+ `}class rm extends eE{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1};this.texture=new iI([i,i,i,i,i,i]),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let i={uniforms:{tEquirect:{value:null}},vertexShader:`
282
+
283
+ varying vec3 vWorldDirection;
284
+
285
+ vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
286
+
287
+ return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
288
+
289
+ }
290
+
291
+ void main() {
292
+
293
+ vWorldDirection = transformDirection( position, modelMatrix );
294
+
295
+ #include <begin_vertex>
296
+ #include <project_vertex>
297
+
298
+ }
299
+ `,fragmentShader:`
300
+
301
+ uniform sampler2D tEquirect;
302
+
303
+ varying vec3 vWorldDirection;
304
+
305
+ #include <common>
306
+
307
+ void main() {
308
+
309
+ vec3 direction = normalize( vWorldDirection );
310
+
311
+ vec2 sampleUV = equirectUv( direction );
312
+
313
+ gl_FragColor = texture2D( tEquirect, sampleUV );
314
+
315
+ }
316
+ `},n=new iB(5,5,5),r=new i6({name:"CubemapFromEquirect",uniforms:i3(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=t;let a=new ih(n,r),s=t.minFilter;return 1008===t.minFilter&&(t.minFilter=1006),new nN(1,10,this).update(e,a),t.minFilter=s,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,i=!0,n=!0){let r=e.getRenderTarget();for(let r=0;r<6;r++)e.setRenderTarget(this,r),e.clear(t,i,n);e.setRenderTarget(r)}}function rg(e){let t=new WeakMap,i=new WeakMap,n=null;function r(e,t){return 303===t?e.mapping=301:304===t&&(e.mapping=302),e}function a(e){let i=e.target;i.removeEventListener("dispose",a);let n=t.get(i);void 0!==n&&(t.delete(i),n.dispose())}function s(e){let t=e.target;t.removeEventListener("dispose",s);let n=i.get(t);void 0!==n&&(i.delete(t),n.dispose())}return{get:function(o,l=!1){return null==o?null:l?function(t){if(t&&t.isTexture){let r=t.mapping,a=303===r||304===r,o=301===r||302===r;if(a||o){let r=i.get(t),l=void 0!==r?r.texture.pmremVersion:0;if(t.isRenderTargetTexture&&t.pmremVersion!==l)return null===n&&(n=new rh(e)),(r=a?n.fromEquirectangular(t,r):n.fromCubemap(t,r)).texture.pmremVersion=t.pmremVersion,i.set(t,r),r.texture;{if(void 0!==r)return r.texture;let l=t.image;return a&&l&&l.height>0||o&&l&&function(e){let t=0;for(let i=0;i<6;i++)void 0!==e[i]&&t++;return 6===t}(l)?(null===n&&(n=new rh(e)),(r=a?n.fromEquirectangular(t):n.fromCubemap(t)).texture.pmremVersion=t.pmremVersion,i.set(t,r),t.addEventListener("dispose",s),r.texture):null}}}return t}(o):function(i){if(i&&i.isTexture){let n=i.mapping;if(303===n||304===n)if(t.has(i))return r(t.get(i).texture,i.mapping);else{let n=i.image;if(!n||!(n.height>0))return null;{let s=new rm(n.height);return s.fromEquirectangularTexture(e,i),t.set(i,s),i.addEventListener("dispose",a),r(s.texture,i.mapping)}}}return i}(o)},dispose:function(){t=new WeakMap,i=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function r_(e){let t={};function i(i){if(void 0!==t[i])return t[i];let n=e.getExtension(i);return t[i]=n,n}return{has:function(e){return null!==i(e)},init:function(){i("EXT_color_buffer_float"),i("WEBGL_clip_cull_distance"),i("OES_texture_float_linear"),i("EXT_color_buffer_half_float"),i("WEBGL_multisampled_render_to_texture"),i("WEBGL_render_shared_exponent")},get:function(e){let t=i(e);return null===t&&Y("WebGLRenderer: "+e+" extension not supported."),t}}}function rv(e,t,i,n){let r={},a=new WeakMap;function s(e){let o=e.target;for(let e in null!==o.index&&t.remove(o.index),o.attributes)t.remove(o.attributes[e]);o.removeEventListener("dispose",s),delete r[o.id];let l=a.get(o);l&&(t.remove(l),a.delete(o)),n.releaseStatesOfGeometry(o),!0===o.isInstancedBufferGeometry&&delete o._maxInstanceCount,i.memory.geometries--}function o(e){let i=[],n=e.index,r=e.attributes.position,s=0;if(void 0===r)return;if(null!==n){let e=n.array;s=n.version;for(let t=0,n=e.length;t<n;t+=3){let n=e[t+0],r=e[t+1],a=e[t+2];i.push(n,r,r,a,a,n)}}else{let e=r.array;s=r.version;for(let t=0,n=e.length/3-1;t<n;t+=3){let e=t+0,n=t+1,r=t+2;i.push(e,n,n,r,r,e)}}let o=new(r.count>=65535?tO:tU)(i,1);o.version=s;let l=a.get(e);l&&t.remove(l),a.set(e,o)}return{get:function(e,t){return!0===r[t.id]||(t.addEventListener("dispose",s),r[t.id]=!0,i.memory.geometries++),t},update:function(i){let n=i.attributes;for(let i in n)t.update(n[i],e.ARRAY_BUFFER)},getWireframeAttribute:function(e){let t=a.get(e);if(t){let i=e.index;null!==i&&t.version<i.version&&o(e)}else o(e);return a.get(e)}}}function rx(e,t,i){let n,r,a;function s(t,s,o){0!==o&&(e.drawElementsInstanced(n,s,r,t*a,o),i.update(s,n,o))}this.setMode=function(e){n=e},this.setIndex=function(e){r=e.type,a=e.bytesPerElement},this.render=function(t,s){e.drawElements(n,s,r,t*a),i.update(s,n,1)},this.renderInstances=s,this.renderMultiDraw=function(e,a,s){if(0===s)return;t.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,a,0,r,e,0,s);let o=0;for(let e=0;e<s;e++)o+=a[e];i.update(o,n,1)},this.renderMultiDrawInstances=function(e,o,l,h){if(0===l)return;let c=t.get("WEBGL_multi_draw");if(null===c)for(let t=0;t<e.length;t++)s(e[t]/a,o[t],h[t]);else{c.multiDrawElementsInstancedWEBGL(n,o,0,r,e,0,h,0,l);let t=0;for(let e=0;e<l;e++)t+=o[e]*h[e];i.update(t,n,1)}}}function ry(e){let t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function(){t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(i,n,r){switch(t.calls++,n){case e.TRIANGLES:t.triangles+=i/3*r;break;case e.LINES:t.lines+=i/2*r;break;case e.LINE_STRIP:t.lines+=r*(i-1);break;case e.LINE_LOOP:t.lines+=r*i;break;case e.POINTS:t.points+=r*i;break;default:X("WebGLInfo: Unknown draw mode:",n)}}}}function rM(e,t,i){let n=new WeakMap,r=new eb;return{update:function(a,s,o){let l=a.morphTargetInfluences,h=s.morphAttributes.position||s.morphAttributes.normal||s.morphAttributes.color,c=void 0!==h?h.length:0,u=n.get(s);if(void 0===u||u.count!==c){void 0!==u&&u.texture.dispose();let e=void 0!==s.morphAttributes.position,i=void 0!==s.morphAttributes.normal,a=void 0!==s.morphAttributes.color,o=s.morphAttributes.position||[],l=s.morphAttributes.normal||[],h=s.morphAttributes.color||[],d=0;!0===e&&(d=1),!0===i&&(d=2),!0===a&&(d=3);let p=s.attributes.position.count*d,f=1;p>t.maxTextureSize&&(f=Math.ceil(p/t.maxTextureSize),p=t.maxTextureSize);let m=new Float32Array(p*f*4*c),g=new ew(m,p,f,c);g.type=1015,g.needsUpdate=!0;let _=4*d;for(let t=0;t<c;t++){let n=o[t],s=l[t],c=h[t],u=p*f*4*t;for(let t=0;t<n.count;t++){let o=t*_;!0===e&&(r.fromBufferAttribute(n,t),m[u+o+0]=r.x,m[u+o+1]=r.y,m[u+o+2]=r.z,m[u+o+3]=0),!0===i&&(r.fromBufferAttribute(s,t),m[u+o+4]=r.x,m[u+o+5]=r.y,m[u+o+6]=r.z,m[u+o+7]=0),!0===a&&(r.fromBufferAttribute(c,t),m[u+o+8]=r.x,m[u+o+9]=r.y,m[u+o+10]=r.z,m[u+o+11]=4===c.itemSize?r.w:1)}}u={count:c,texture:g,size:new er(p,f)},n.set(s,u),s.addEventListener("dispose",function e(){g.dispose(),n.delete(s),s.removeEventListener("dispose",e)})}if(!0===a.isInstancedMesh&&null!==a.morphTexture)o.getUniforms().setValue(e,"morphTexture",a.morphTexture,i);else{let t=0;for(let e=0;e<l.length;e++)t+=l[e];let i=s.morphTargetsRelative?1:1-t;o.getUniforms().setValue(e,"morphTargetBaseInfluence",i),o.getUniforms().setValue(e,"morphTargetInfluences",l)}o.getUniforms().setValue(e,"morphTargetsTexture",u.texture,i),o.getUniforms().setValue(e,"morphTargetsTextureSize",u.size)}}}function rS(e,t,i,n,r){let a=new WeakMap;function s(e){let t=e.target;t.removeEventListener("dispose",s),n.releaseStatesOfObject(t),i.remove(t.instanceMatrix),null!==t.instanceColor&&i.remove(t.instanceColor)}return{update:function(n){let o=r.render.frame,l=n.geometry,h=t.get(n,l);if(a.get(h)!==o&&(t.update(h),a.set(h,o)),n.isInstancedMesh&&(!1===n.hasEventListener("dispose",s)&&n.addEventListener("dispose",s),a.get(n)!==o&&(i.update(n.instanceMatrix,e.ARRAY_BUFFER),null!==n.instanceColor&&i.update(n.instanceColor,e.ARRAY_BUFFER),a.set(n,o))),n.isSkinnedMesh){let e=n.skeleton;a.get(e)!==o&&(e.update(),a.set(e,o))}return h},dispose:function(){a=new WeakMap}}}let rb={1:"LINEAR_TONE_MAPPING",2:"REINHARD_TONE_MAPPING",3:"CINEON_TONE_MAPPING",4:"ACES_FILMIC_TONE_MAPPING",6:"AGX_TONE_MAPPING",7:"NEUTRAL_TONE_MAPPING",5:"CUSTOM_TONE_MAPPING"};function rT(e,t,i,n,r){let a,s=new eE(t,i,{type:e,depthBuffer:n,stencilBuffer:r}),o=new eE(t,i,{type:1016,depthBuffer:!1,stencilBuffer:!1}),l=new tK;l.setAttribute("position",new tF([-1,3,0,-1,-1,0,3,-1,0],3)),l.setAttribute("uv",new tF([0,2,0,0,2,0],2));let h=new i8({uniforms:{tDiffuse:{value:null}},vertexShader:`
317
+ precision highp float;
318
+
319
+ uniform mat4 modelViewMatrix;
320
+ uniform mat4 projectionMatrix;
321
+
322
+ attribute vec3 position;
323
+ attribute vec2 uv;
324
+
325
+ varying vec2 vUv;
326
+
327
+ void main() {
328
+ vUv = uv;
329
+ gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
330
+ }`,fragmentShader:`
331
+ precision highp float;
332
+
333
+ uniform sampler2D tDiffuse;
334
+
335
+ varying vec2 vUv;
336
+
337
+ #include <tonemapping_pars_fragment>
338
+ #include <colorspace_pars_fragment>
339
+
340
+ void main() {
341
+ gl_FragColor = texture2D( tDiffuse, vUv );
342
+
343
+ #ifdef LINEAR_TONE_MAPPING
344
+ gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );
345
+ #elif defined( REINHARD_TONE_MAPPING )
346
+ gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );
347
+ #elif defined( CINEON_TONE_MAPPING )
348
+ gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );
349
+ #elif defined( ACES_FILMIC_TONE_MAPPING )
350
+ gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );
351
+ #elif defined( AGX_TONE_MAPPING )
352
+ gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );
353
+ #elif defined( NEUTRAL_TONE_MAPPING )
354
+ gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );
355
+ #elif defined( CUSTOM_TONE_MAPPING )
356
+ gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );
357
+ #endif
358
+
359
+ #ifdef SRGB_TRANSFER
360
+ gl_FragColor = sRGBTransferOETF( gl_FragColor );
361
+ #endif
362
+ }`,depthTest:!1,depthWrite:!1}),c=new ih(l,h),u=new nR(-1,1,1,-1,0,1),d=null,p=null,f=!1,m=null,g=[],_=!1;this.setSize=function(e,t){s.setSize(e,t),o.setSize(e,t);for(let i=0;i<g.length;i++){let n=g[i];n.setSize&&n.setSize(e,t)}},this.setEffects=function(e){_=(g=e).length>0&&!0===g[0].isRenderPass;let t=s.width,i=s.height;for(let e=0;e<g.length;e++){let n=g[e];n.setSize&&n.setSize(t,i)}},this.begin=function(e,t){if(f||0===e.toneMapping&&0===g.length)return!1;if(m=t,null!==t){let e=t.width,i=t.height;(s.width!==e||s.height!==i)&&this.setSize(e,i)}return!1===_&&e.setRenderTarget(s),a=e.toneMapping,e.toneMapping=0,!0},this.hasRenderPass=function(){return _},this.end=function(e,t){e.toneMapping=a,f=!0;let i=s,n=o;for(let r=0;r<g.length;r++){let a=g[r];if(!1!==a.enabled&&(a.render(e,n,i,t),!1!==a.needsSwap)){let e=i;i=n,n=e}}if(d!==e.outputColorSpace||p!==e.toneMapping){d=e.outputColorSpace,p=e.toneMapping,h.defines={},ep.getTransfer(d)===k&&(h.defines.SRGB_TRANSFER="");let t=rb[p];t&&(h.defines[t]=""),h.needsUpdate=!0}h.uniforms.tDiffuse.value=i.texture,e.setRenderTarget(m),e.render(c,u),m=null,f=!1},this.isCompositing=function(){return f},this.dispose=function(){s.dispose(),o.dispose(),l.dispose(),h.dispose()}}let rE=new eS,rw=new iU(1,1),rA=new ew,rR=new class extends eS{constructor(e=null,t=1,i=1,n=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:n},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},rC=new iI,rP=[],rL=[],rN=new Float32Array(16),rD=new Float32Array(9),rI=new Float32Array(4);function rU(e,t,i){let n=e[0];if(n<=0||n>0)return e;let r=t*i,a=rP[r];if(void 0===a&&(a=new Float32Array(r),rP[r]=a),0!==t){n.toArray(a,0);for(let n=1,r=0;n!==t;++n)r+=i,e[n].toArray(a,r)}return a}function rO(e,t){if(e.length!==t.length)return!1;for(let i=0,n=e.length;i<n;i++)if(e[i]!==t[i])return!1;return!0}function rF(e,t){for(let i=0,n=t.length;i<n;i++)e[i]=t[i]}function rB(e,t){let i=rL[t];void 0===i&&(i=new Int32Array(t),rL[t]=i);for(let n=0;n!==t;++n)i[n]=e.allocateTextureUnit();return i}function rk(e,t){let i=this.cache;i[0]!==t&&(e.uniform1f(this.addr,t),i[0]=t)}function rz(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y)&&(e.uniform2f(this.addr,t.x,t.y),i[0]=t.x,i[1]=t.y);else{if(rO(i,t))return;e.uniform2fv(this.addr,t),rF(i,t)}}function rV(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z)&&(e.uniform3f(this.addr,t.x,t.y,t.z),i[0]=t.x,i[1]=t.y,i[2]=t.z);else if(void 0!==t.r)(i[0]!==t.r||i[1]!==t.g||i[2]!==t.b)&&(e.uniform3f(this.addr,t.r,t.g,t.b),i[0]=t.r,i[1]=t.g,i[2]=t.b);else{if(rO(i,t))return;e.uniform3fv(this.addr,t),rF(i,t)}}function rH(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z||i[3]!==t.w)&&(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=t.w);else{if(rO(i,t))return;e.uniform4fv(this.addr,t),rF(i,t)}}function rG(e,t){let i=this.cache,n=t.elements;if(void 0===n){if(rO(i,t))return;e.uniformMatrix2fv(this.addr,!1,t),rF(i,t)}else{if(rO(i,n))return;rI.set(n),e.uniformMatrix2fv(this.addr,!1,rI),rF(i,n)}}function rj(e,t){let i=this.cache,n=t.elements;if(void 0===n){if(rO(i,t))return;e.uniformMatrix3fv(this.addr,!1,t),rF(i,t)}else{if(rO(i,n))return;rD.set(n),e.uniformMatrix3fv(this.addr,!1,rD),rF(i,n)}}function rW(e,t){let i=this.cache,n=t.elements;if(void 0===n){if(rO(i,t))return;e.uniformMatrix4fv(this.addr,!1,t),rF(i,t)}else{if(rO(i,n))return;rN.set(n),e.uniformMatrix4fv(this.addr,!1,rN),rF(i,n)}}function rX(e,t){let i=this.cache;i[0]!==t&&(e.uniform1i(this.addr,t),i[0]=t)}function rY(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y)&&(e.uniform2i(this.addr,t.x,t.y),i[0]=t.x,i[1]=t.y);else{if(rO(i,t))return;e.uniform2iv(this.addr,t),rF(i,t)}}function rq(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z)&&(e.uniform3i(this.addr,t.x,t.y,t.z),i[0]=t.x,i[1]=t.y,i[2]=t.z);else{if(rO(i,t))return;e.uniform3iv(this.addr,t),rF(i,t)}}function rK(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z||i[3]!==t.w)&&(e.uniform4i(this.addr,t.x,t.y,t.z,t.w),i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=t.w);else{if(rO(i,t))return;e.uniform4iv(this.addr,t),rF(i,t)}}function rZ(e,t){let i=this.cache;i[0]!==t&&(e.uniform1ui(this.addr,t),i[0]=t)}function rJ(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y)&&(e.uniform2ui(this.addr,t.x,t.y),i[0]=t.x,i[1]=t.y);else{if(rO(i,t))return;e.uniform2uiv(this.addr,t),rF(i,t)}}function r$(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z)&&(e.uniform3ui(this.addr,t.x,t.y,t.z),i[0]=t.x,i[1]=t.y,i[2]=t.z);else{if(rO(i,t))return;e.uniform3uiv(this.addr,t),rF(i,t)}}function rQ(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z||i[3]!==t.w)&&(e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=t.w);else{if(rO(i,t))return;e.uniform4uiv(this.addr,t),rF(i,t)}}function r0(e,t,i){let n,r=this.cache,a=i.allocateTextureUnit();r[0]!==a&&(e.uniform1i(this.addr,a),r[0]=a),this.type===e.SAMPLER_2D_SHADOW?(rw.compareFunction=i.isReversedDepthBuffer()?518:515,n=rw):n=rE,i.setTexture2D(t||n,a)}function r1(e,t,i){let n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(e.uniform1i(this.addr,r),n[0]=r),i.setTexture3D(t||rR,r)}function r2(e,t,i){let n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(e.uniform1i(this.addr,r),n[0]=r),i.setTextureCube(t||rC,r)}function r3(e,t,i){let n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(e.uniform1i(this.addr,r),n[0]=r),i.setTexture2DArray(t||rA,r)}function r4(e,t){e.uniform1fv(this.addr,t)}function r5(e,t){let i=rU(t,this.size,2);e.uniform2fv(this.addr,i)}function r6(e,t){let i=rU(t,this.size,3);e.uniform3fv(this.addr,i)}function r8(e,t){let i=rU(t,this.size,4);e.uniform4fv(this.addr,i)}function r9(e,t){let i=rU(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,i)}function r7(e,t){let i=rU(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,i)}function ae(e,t){let i=rU(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,i)}function at(e,t){e.uniform1iv(this.addr,t)}function ai(e,t){e.uniform2iv(this.addr,t)}function an(e,t){e.uniform3iv(this.addr,t)}function ar(e,t){e.uniform4iv(this.addr,t)}function aa(e,t){e.uniform1uiv(this.addr,t)}function as(e,t){e.uniform2uiv(this.addr,t)}function ao(e,t){e.uniform3uiv(this.addr,t)}function al(e,t){e.uniform4uiv(this.addr,t)}function ah(e,t,i){let n,r=this.cache,a=t.length,s=rB(i,a);rO(r,s)||(e.uniform1iv(this.addr,s),rF(r,s)),n=this.type===e.SAMPLER_2D_SHADOW?rw:rE;for(let e=0;e!==a;++e)i.setTexture2D(t[e]||n,s[e])}function ac(e,t,i){let n=this.cache,r=t.length,a=rB(i,r);rO(n,a)||(e.uniform1iv(this.addr,a),rF(n,a));for(let e=0;e!==r;++e)i.setTexture3D(t[e]||rR,a[e])}function au(e,t,i){let n=this.cache,r=t.length,a=rB(i,r);rO(n,a)||(e.uniform1iv(this.addr,a),rF(n,a));for(let e=0;e!==r;++e)i.setTextureCube(t[e]||rC,a[e])}function ad(e,t,i){let n=this.cache,r=t.length,a=rB(i,r);rO(n,a)||(e.uniform1iv(this.addr,a),rF(n,a));for(let e=0;e!==r;++e)i.setTexture2DArray(t[e]||rA,a[e])}class ap{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.setValue=function(e){switch(e){case 5126:return rk;case 35664:return rz;case 35665:return rV;case 35666:return rH;case 35674:return rG;case 35675:return rj;case 35676:return rW;case 5124:case 35670:return rX;case 35667:case 35671:return rY;case 35668:case 35672:return rq;case 35669:case 35673:return rK;case 5125:return rZ;case 36294:return rJ;case 36295:return r$;case 36296:return rQ;case 35678:case 36198:case 36298:case 36306:case 35682:return r0;case 35679:case 36299:case 36307:return r1;case 35680:case 36300:case 36308:case 36293:return r2;case 36289:case 36303:case 36311:case 36292:return r3}}(t.type)}}class af{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=function(e){switch(e){case 5126:return r4;case 35664:return r5;case 35665:return r6;case 35666:return r8;case 35674:return r9;case 35675:return r7;case 35676:return ae;case 5124:case 35670:return at;case 35667:case 35671:return ai;case 35668:case 35672:return an;case 35669:case 35673:return ar;case 5125:return aa;case 36294:return as;case 36295:return ao;case 36296:return al;case 35678:case 36198:case 36298:case 36306:case 35682:return ah;case 35679:case 36299:case 36307:return ac;case 35680:case 36300:case 36308:case 36293:return au;case 36289:case 36303:case 36311:case 36292:return ad}}(t.type)}}class am{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,i){let n=this.seq;for(let r=0,a=n.length;r!==a;++r){let a=n[r];a.setValue(e,t[a.id],i)}}}let ag=/(\w+)(\])?(\[|\.)?/g;function a_(e,t){e.seq.push(t),e.map[t.id]=t}class av{constructor(e,t){this.seq=[],this.map={};const i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let n=0;n<i;++n){const i=e.getActiveUniform(t,n),r=e.getUniformLocation(t,i.name);!function(e,t,i){let n=e.name,r=n.length;for(ag.lastIndex=0;;){let a=ag.exec(n),s=ag.lastIndex,o=a[1],l="]"===a[2],h=a[3];if(l&&(o|=0),void 0===h||"["===h&&s+2===r){a_(i,void 0===h?new ap(o,e,t):new af(o,e,t));break}{let e=i.map[o];void 0===e&&a_(i,e=new am(o)),i=e}}}(i,r,this)}const n=[],r=[];for(const t of this.seq)t.type===e.SAMPLER_2D_SHADOW||t.type===e.SAMPLER_CUBE_SHADOW||t.type===e.SAMPLER_2D_ARRAY_SHADOW?n.push(t):r.push(t);n.length>0&&(this.seq=n.concat(r))}setValue(e,t,i,n){let r=this.map[t];void 0!==r&&r.setValue(e,i,n)}setOptional(e,t,i){let n=t[i];void 0!==n&&this.setValue(e,i,n)}static upload(e,t,i,n){for(let r=0,a=t.length;r!==a;++r){let a=t[r],s=i[a.id];!1!==s.needsUpdate&&a.setValue(e,s.value,n)}}static seqWithValue(e,t){let i=[];for(let n=0,r=e.length;n!==r;++n){let r=e[n];r.id in t&&i.push(r)}return i}}function ax(e,t,i){let n=e.createShader(t);return e.shaderSource(n,i),e.compileShader(n),n}let ay=0,aM=new eh;function aS(e,t,i){let n=e.getShaderParameter(t,e.COMPILE_STATUS),r=(e.getShaderInfoLog(t)||"").trim();if(n&&""===r)return"";let a=/ERROR: 0:(\d+)/.exec(r);if(!a)return r;{let n=parseInt(a[1]);return i.toUpperCase()+"\n\n"+r+"\n\n"+function(e,t){let i=e.split("\n"),n=[],r=Math.max(t-6,0),a=Math.min(t+6,i.length);for(let e=r;e<a;e++){let r=e+1;n.push(`${r===t?">":" "} ${r}: ${i[e]}`)}return n.join("\n")}(e.getShaderSource(t),n)}}let ab={1:"Linear",2:"Reinhard",3:"Cineon",4:"ACESFilmic",6:"AgX",7:"Neutral",5:"Custom"},aT=new es;function aE(e){return""!==e}function aw(e,t){let i=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,i).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function aA(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}let aR=/^[ \t]*#include +<([\w\d./]+)>/gm;function aC(e){return e.replace(aR,aL)}let aP=new Map;function aL(e,t){let i=n0[t];if(void 0===i){let e=aP.get(t);if(void 0!==e)i=n0[e],W('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,e);else throw Error("Can not resolve #include <"+t+">")}return aC(i)}let aN=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function aD(e){return e.replace(aN,aI)}function aI(e,t,i,n){let r="";for(let e=parseInt(t);e<parseInt(i);e++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+e+" ]").replace(/UNROLLED_LOOP_INDEX/g,e);return r}function aU(e){let t=`precision ${e.precision} float;
363
+ precision ${e.precision} int;
364
+ precision ${e.precision} sampler2D;
365
+ precision ${e.precision} samplerCube;
366
+ precision ${e.precision} sampler3D;
367
+ precision ${e.precision} sampler2DArray;
368
+ precision ${e.precision} sampler2DShadow;
369
+ precision ${e.precision} samplerCubeShadow;
370
+ precision ${e.precision} sampler2DArrayShadow;
371
+ precision ${e.precision} isampler2D;
372
+ precision ${e.precision} isampler3D;
373
+ precision ${e.precision} isamplerCube;
374
+ precision ${e.precision} isampler2DArray;
375
+ precision ${e.precision} usampler2D;
376
+ precision ${e.precision} usampler3D;
377
+ precision ${e.precision} usamplerCube;
378
+ precision ${e.precision} usampler2DArray;
379
+ `;return"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION"),t}let aO={1:"SHADOWMAP_TYPE_PCF",3:"SHADOWMAP_TYPE_VSM"},aF={301:"ENVMAP_TYPE_CUBE",302:"ENVMAP_TYPE_CUBE",306:"ENVMAP_TYPE_CUBE_UV"},aB={302:"ENVMAP_MODE_REFRACTION"},ak={0:"ENVMAP_BLENDING_MULTIPLY",1:"ENVMAP_BLENDING_MIX",2:"ENVMAP_BLENDING_ADD"};function az(e,t,i,n){var r,a;let s,o,l,h,c=e.getContext(),u=i.defines,d=i.vertexShader,p=i.fragmentShader,f=aO[i.shadowMapType]||"SHADOWMAP_TYPE_BASIC",m=!1===i.envMap?"ENVMAP_TYPE_CUBE":aF[i.envMapMode]||"ENVMAP_TYPE_CUBE",g=!1===i.envMap?"ENVMAP_MODE_REFLECTION":aB[i.envMapMode]||"ENVMAP_MODE_REFLECTION",_=!1===i.envMap?"ENVMAP_BLENDING_NONE":ak[i.combine]||"ENVMAP_BLENDING_NONE",v=function(e){let t=e.envMapCubeUVHeight;if(null===t)return null;let i=Math.log2(t)-2;return{texelWidth:1/(3*Math.max(Math.pow(2,i),112)),texelHeight:1/t,maxMip:i}}(i),x=[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(aE).join("\n"),y=function(e){let t=[];for(let i in e){let n=e[i];!1!==n&&t.push("#define "+i+" "+n)}return t.join("\n")}(u),M=c.createProgram(),S=i.glslVersion?"#version "+i.glslVersion+"\n":"";if(i.isRawShaderMaterial)(s=["#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,y].filter(aE).join("\n")).length>0&&(s+="\n"),(o=["#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,y].filter(aE).join("\n")).length>0&&(o+="\n");else{let e,t,n,l,h;s=[aU(i),"#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,y,i.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",i.batching?"#define USE_BATCHING":"",i.batchingColor?"#define USE_BATCHING_COLOR":"",i.instancing?"#define USE_INSTANCING":"",i.instancingColor?"#define USE_INSTANCING_COLOR":"",i.instancingMorph?"#define USE_INSTANCING_MORPH":"",i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+g:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",i.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",i.displacementMap?"#define USE_DISPLACEMENTMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.anisotropy?"#define USE_ANISOTROPY":"",i.anisotropyMap?"#define USE_ANISOTROPYMAP":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",i.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaHash?"#define USE_ALPHAHASH":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",i.mapUv?"#define MAP_UV "+i.mapUv:"",i.alphaMapUv?"#define ALPHAMAP_UV "+i.alphaMapUv:"",i.lightMapUv?"#define LIGHTMAP_UV "+i.lightMapUv:"",i.aoMapUv?"#define AOMAP_UV "+i.aoMapUv:"",i.emissiveMapUv?"#define EMISSIVEMAP_UV "+i.emissiveMapUv:"",i.bumpMapUv?"#define BUMPMAP_UV "+i.bumpMapUv:"",i.normalMapUv?"#define NORMALMAP_UV "+i.normalMapUv:"",i.displacementMapUv?"#define DISPLACEMENTMAP_UV "+i.displacementMapUv:"",i.metalnessMapUv?"#define METALNESSMAP_UV "+i.metalnessMapUv:"",i.roughnessMapUv?"#define ROUGHNESSMAP_UV "+i.roughnessMapUv:"",i.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+i.anisotropyMapUv:"",i.clearcoatMapUv?"#define CLEARCOATMAP_UV "+i.clearcoatMapUv:"",i.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+i.clearcoatNormalMapUv:"",i.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+i.clearcoatRoughnessMapUv:"",i.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+i.iridescenceMapUv:"",i.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+i.iridescenceThicknessMapUv:"",i.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+i.sheenColorMapUv:"",i.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+i.sheenRoughnessMapUv:"",i.specularMapUv?"#define SPECULARMAP_UV "+i.specularMapUv:"",i.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+i.specularColorMapUv:"",i.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+i.specularIntensityMapUv:"",i.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+i.transmissionMapUv:"",i.thicknessMapUv?"#define THICKNESSMAP_UV "+i.thicknessMapUv:"",i.vertexTangents&&!1===i.flatShading?"#define USE_TANGENT":"",i.vertexColors?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUv1s?"#define USE_UV1":"",i.vertexUv2s?"#define USE_UV2":"",i.vertexUv3s?"#define USE_UV3":"",i.pointsUvs?"#define USE_POINTS_UV":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&!1===i.flatShading?"#define USE_MORPHNORMALS":"",i.morphColors?"#define USE_MORPHCOLORS":"",i.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+i.morphTextureStride:"",i.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+i.morphTargetsCount:"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+f:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.numLightProbes>0?"#define USE_LIGHT_PROBES":"",i.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",i.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif","\n"].filter(aE).join("\n"),o=[aU(i),"#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,y,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",i.map?"#define USE_MAP":"",i.matcap?"#define USE_MATCAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+m:"",i.envMap?"#define "+g:"",i.envMap?"#define "+_:"",v?"#define CUBEUV_TEXEL_WIDTH "+v.texelWidth:"",v?"#define CUBEUV_TEXEL_HEIGHT "+v.texelHeight:"",v?"#define CUBEUV_MAX_MIP "+v.maxMip+".0":"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",i.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.anisotropy?"#define USE_ANISOTROPY":"",i.anisotropyMap?"#define USE_ANISOTROPYMAP":"",i.clearcoat?"#define USE_CLEARCOAT":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.dispersion?"#define USE_DISPERSION":"",i.iridescence?"#define USE_IRIDESCENCE":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",i.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaTest?"#define USE_ALPHATEST":"",i.alphaHash?"#define USE_ALPHAHASH":"",i.sheen?"#define USE_SHEEN":"",i.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.vertexTangents&&!1===i.flatShading?"#define USE_TANGENT":"",i.vertexColors||i.instancingColor?"#define USE_COLOR":"",i.vertexAlphas||i.batchingColor?"#define USE_COLOR_ALPHA":"",i.vertexUv1s?"#define USE_UV1":"",i.vertexUv2s?"#define USE_UV2":"",i.vertexUv3s?"#define USE_UV3":"",i.pointsUvs?"#define USE_POINTS_UV":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+f:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.numLightProbes>0?"#define USE_LIGHT_PROBES":"",i.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",i.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",i.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",i.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==i.toneMapping?"#define TONE_MAPPING":"",0!==i.toneMapping?n0.tonemapping_pars_fragment:"",0!==i.toneMapping?(r="toneMapping",void 0===(e=ab[a=i.toneMapping])?(W("WebGLProgram: Unsupported toneMapping:",a),"vec3 "+r+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+r+"( vec3 color ) { return "+e+"ToneMapping( color ); }"):"",i.dithering?"#define DITHERING":"",i.opaque?"#define OPAQUE":"",n0.colorspace_pars_fragment,(t=function(e){ep._getMatrix(aM,ep.workingColorSpace,e);let t=`mat3( ${aM.elements.map(e=>e.toFixed(4))} )`;switch(ep.getTransfer(e)){case B:return[t,"LinearTransferOETF"];case k:return[t,"sRGBTransferOETF"];default:return W("WebGLProgram: Unsupported color space: ",e),[t,"LinearTransferOETF"]}}(i.outputColorSpace),`vec4 linearToOutputTexel( vec4 value ) {
380
+ return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );
381
+ }`),(ep.getLuminanceCoefficients(aT),n=aT.x.toFixed(4),l=aT.y.toFixed(4),h=aT.z.toFixed(4),`float luminance( const in vec3 rgb ) {
382
+ const vec3 weights = vec3( ${n}, ${l}, ${h} );
383
+ return dot( weights, rgb );
384
+ }`),i.useDepthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(aE).join("\n")}d=aA(d=aw(d=aC(d),i),i),p=aA(p=aw(p=aC(p),i),i),d=aD(d),p=aD(p),!0!==i.isRawShaderMaterial&&(S="#version 300 es\n",s=[x,"#define attribute in\n#define varying out\n#define texture2D texture"].join("\n")+"\n"+s,o=["#define varying in",i.glslVersion===z?"":"layout(location = 0) out highp vec4 pc_fragColor;",i.glslVersion===z?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth\n#define texture2D texture\n#define textureCube texture\n#define texture2DProj textureProj\n#define texture2DLodEXT textureLod\n#define texture2DProjLodEXT textureProjLod\n#define textureCubeLodEXT textureLod\n#define texture2DGradEXT textureGrad\n#define texture2DProjGradEXT textureProjGrad\n#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+o);let b=S+s+d,T=S+o+p,E=ax(c,c.VERTEX_SHADER,b),w=ax(c,c.FRAGMENT_SHADER,T);function A(t){if(e.debug.checkShaderErrors){let i=c.getProgramInfoLog(M)||"",n=c.getShaderInfoLog(E)||"",r=c.getShaderInfoLog(w)||"",a=i.trim(),l=n.trim(),h=r.trim(),u=!0,d=!0;if(!1===c.getProgramParameter(M,c.LINK_STATUS))if(u=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(c,M,E,w);else{let e=aS(c,E,"vertex"),i=aS(c,w,"fragment");X("THREE.WebGLProgram: Shader Error "+c.getError()+" - VALIDATE_STATUS "+c.getProgramParameter(M,c.VALIDATE_STATUS)+"\n\nMaterial Name: "+t.name+"\nMaterial Type: "+t.type+"\n\nProgram Info Log: "+a+"\n"+e+"\n"+i)}else""!==a?W("WebGLProgram: Program Info Log:",a):(""===l||""===h)&&(d=!1);d&&(t.diagnostics={runnable:u,programLog:a,vertexShader:{log:l,prefix:s},fragmentShader:{log:h,prefix:o}})}c.deleteShader(E),c.deleteShader(w),l=new av(c,M),h=function(e,t){let i={},n=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let r=0;r<n;r++){let n=e.getActiveAttrib(t,r),a=n.name,s=1;n.type===e.FLOAT_MAT2&&(s=2),n.type===e.FLOAT_MAT3&&(s=3),n.type===e.FLOAT_MAT4&&(s=4),i[a]={type:n.type,location:e.getAttribLocation(t,a),locationSize:s}}return i}(c,M)}c.attachShader(M,E),c.attachShader(M,w),void 0!==i.index0AttributeName?c.bindAttribLocation(M,0,i.index0AttributeName):!0===i.morphTargets&&c.bindAttribLocation(M,0,"position"),c.linkProgram(M),this.getUniforms=function(){return void 0===l&&A(this),l},this.getAttributes=function(){return void 0===h&&A(this),h};let R=!1===i.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===R&&(R=c.getProgramParameter(M,37297)),R},this.destroy=function(){n.releaseStatesOfProgram(this),c.deleteProgram(M),this.program=void 0},this.type=i.shaderType,this.name=i.shaderName,this.id=ay++,this.cacheKey=t,this.usedTimes=1,this.program=M,this.vertexShader=E,this.fragmentShader=w,this}let aV=0;class aH{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){let t=e.vertexShader,i=e.fragmentShader,n=this._getShaderStage(t),r=this._getShaderStage(i),a=this._getShaderCacheForMaterial(e);return!1===a.has(n)&&(a.add(n),n.usedTimes++),!1===a.has(r)&&(a.add(r),r.usedTimes++),this}remove(e){for(let t of this.materialCache.get(e))t.usedTimes--,0===t.usedTimes&&this.shaderCache.delete(t.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,i=t.get(e);return void 0===i&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){let t=this.shaderCache,i=t.get(e);return void 0===i&&(i=new aG(e),t.set(e,i)),i}}class aG{constructor(e){this.id=aV++,this.code=e,this.usedTimes=0}}function aj(e,t,i,n,r,a){let s=new eB,o=new aH,l=new Set,h=[],c=new Map,u=n.logarithmicDepthBuffer,d=n.precision,p={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function f(e){return(l.add(e),0===e)?"uv":`uv${e}`}return{getParameters:function(r,s,h,c,m){let g,_,v,x,y=c.fog,M=m.geometry,S=r.isMeshStandardMaterial||r.isMeshLambertMaterial||r.isMeshPhongMaterial?c.environment:null,b=r.isMeshStandardMaterial||r.isMeshLambertMaterial&&!r.envMap||r.isMeshPhongMaterial&&!r.envMap,T=t.get(r.envMap||S,b),E=T&&306===T.mapping?T.image.height:null,w=p[r.type];null!==r.precision&&(d=n.getMaxPrecision(r.precision))!==r.precision&&W("WebGLProgram.getParameters:",r.precision,"not supported, using",d,"instead.");let A=M.morphAttributes.position||M.morphAttributes.normal||M.morphAttributes.color,R=void 0!==A?A.length:0,C=0;if(void 0!==M.morphAttributes.position&&(C=1),void 0!==M.morphAttributes.normal&&(C=2),void 0!==M.morphAttributes.color&&(C=3),w){let e=n2[w];g=e.vertexShader,_=e.fragmentShader}else g=r.vertexShader,_=r.fragmentShader,o.update(r),v=o.getVertexShaderID(r),x=o.getFragmentShaderID(r);let P=e.getRenderTarget(),L=e.state.buffers.depth.getReversed(),N=!0===m.isInstancedMesh,D=!0===m.isBatchedMesh,I=!!r.map,U=!!r.matcap,O=!!T,B=!!r.aoMap,z=!!r.lightMap,V=!!r.bumpMap,H=!!r.normalMap,G=!!r.displacementMap,j=!!r.emissiveMap,X=!!r.metalnessMap,Y=!!r.roughnessMap,q=r.anisotropy>0,K=r.clearcoat>0,Z=r.dispersion>0,J=r.iridescence>0,$=r.sheen>0,Q=r.transmission>0,ee=q&&!!r.anisotropyMap,et=K&&!!r.clearcoatMap,ei=K&&!!r.clearcoatNormalMap,en=K&&!!r.clearcoatRoughnessMap,er=J&&!!r.iridescenceMap,ea=J&&!!r.iridescenceThicknessMap,es=$&&!!r.sheenColorMap,eo=$&&!!r.sheenRoughnessMap,el=!!r.specularMap,eh=!!r.specularColorMap,ec=!!r.specularIntensityMap,eu=Q&&!!r.transmissionMap,ed=Q&&!!r.thicknessMap,ef=!!r.gradientMap,em=!!r.alphaMap,eg=r.alphaTest>0,e_=!!r.alphaHash,ev=!!r.extensions,ex=0;r.toneMapped&&(null===P||!0===P.isXRRenderTarget)&&(ex=e.toneMapping);let ey={shaderID:w,shaderType:r.type,shaderName:r.name,vertexShader:g,fragmentShader:_,defines:r.defines,customVertexShaderID:v,customFragmentShaderID:x,isRawShaderMaterial:!0===r.isRawShaderMaterial,glslVersion:r.glslVersion,precision:d,batching:D,batchingColor:D&&null!==m._colorsTexture,instancing:N,instancingColor:N&&null!==m.instanceColor,instancingMorph:N&&null!==m.morphTexture,outputColorSpace:null===P?e.outputColorSpace:!0===P.isXRRenderTarget?P.texture.colorSpace:F,alphaToCoverage:!!r.alphaToCoverage,map:I,matcap:U,envMap:O,envMapMode:O&&T.mapping,envMapCubeUVHeight:E,aoMap:B,lightMap:z,bumpMap:V,normalMap:H,displacementMap:G,emissiveMap:j,normalMapObjectSpace:H&&1===r.normalMapType,normalMapTangentSpace:H&&0===r.normalMapType,metalnessMap:X,roughnessMap:Y,anisotropy:q,anisotropyMap:ee,clearcoat:K,clearcoatMap:et,clearcoatNormalMap:ei,clearcoatRoughnessMap:en,dispersion:Z,iridescence:J,iridescenceMap:er,iridescenceThicknessMap:ea,sheen:$,sheenColorMap:es,sheenRoughnessMap:eo,specularMap:el,specularColorMap:eh,specularIntensityMap:ec,transmission:Q,transmissionMap:eu,thicknessMap:ed,gradientMap:ef,opaque:!1===r.transparent&&1===r.blending&&!1===r.alphaToCoverage,alphaMap:em,alphaTest:eg,alphaHash:e_,combine:r.combine,mapUv:I&&f(r.map.channel),aoMapUv:B&&f(r.aoMap.channel),lightMapUv:z&&f(r.lightMap.channel),bumpMapUv:V&&f(r.bumpMap.channel),normalMapUv:H&&f(r.normalMap.channel),displacementMapUv:G&&f(r.displacementMap.channel),emissiveMapUv:j&&f(r.emissiveMap.channel),metalnessMapUv:X&&f(r.metalnessMap.channel),roughnessMapUv:Y&&f(r.roughnessMap.channel),anisotropyMapUv:ee&&f(r.anisotropyMap.channel),clearcoatMapUv:et&&f(r.clearcoatMap.channel),clearcoatNormalMapUv:ei&&f(r.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:en&&f(r.clearcoatRoughnessMap.channel),iridescenceMapUv:er&&f(r.iridescenceMap.channel),iridescenceThicknessMapUv:ea&&f(r.iridescenceThicknessMap.channel),sheenColorMapUv:es&&f(r.sheenColorMap.channel),sheenRoughnessMapUv:eo&&f(r.sheenRoughnessMap.channel),specularMapUv:el&&f(r.specularMap.channel),specularColorMapUv:eh&&f(r.specularColorMap.channel),specularIntensityMapUv:ec&&f(r.specularIntensityMap.channel),transmissionMapUv:eu&&f(r.transmissionMap.channel),thicknessMapUv:ed&&f(r.thicknessMap.channel),alphaMapUv:em&&f(r.alphaMap.channel),vertexTangents:!!M.attributes.tangent&&(H||q),vertexColors:r.vertexColors,vertexAlphas:!0===r.vertexColors&&!!M.attributes.color&&4===M.attributes.color.itemSize,pointsUvs:!0===m.isPoints&&!!M.attributes.uv&&(I||em),fog:!!y,useFog:!0===r.fog,fogExp2:!!y&&y.isFogExp2,flatShading:!1===r.wireframe&&(!0===r.flatShading||void 0===M.attributes.normal&&!1===H&&(r.isMeshLambertMaterial||r.isMeshPhongMaterial||r.isMeshStandardMaterial||r.isMeshPhysicalMaterial)),sizeAttenuation:!0===r.sizeAttenuation,logarithmicDepthBuffer:u,reversedDepthBuffer:L,skinning:!0===m.isSkinnedMesh,morphTargets:void 0!==M.morphAttributes.position,morphNormals:void 0!==M.morphAttributes.normal,morphColors:void 0!==M.morphAttributes.color,morphTargetsCount:R,morphTextureStride:C,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numSpotLightMaps:s.spotLightMap.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numSpotLightShadowsWithMaps:s.numSpotLightShadowsWithMaps,numLightProbes:s.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:r.dithering,shadowMapEnabled:e.shadowMap.enabled&&h.length>0,shadowMapType:e.shadowMap.type,toneMapping:ex,decodeVideoTexture:I&&!0===r.map.isVideoTexture&&ep.getTransfer(r.map.colorSpace)===k,decodeVideoTextureEmissive:j&&!0===r.emissiveMap.isVideoTexture&&ep.getTransfer(r.emissiveMap.colorSpace)===k,premultipliedAlpha:r.premultipliedAlpha,doubleSided:2===r.side,flipSided:1===r.side,useDepthPacking:r.depthPacking>=0,depthPacking:r.depthPacking||0,index0AttributeName:r.index0AttributeName,extensionClipCullDistance:ev&&!0===r.extensions.clipCullDistance&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ev&&!0===r.extensions.multiDraw||D)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:r.customProgramCacheKey()};return ey.vertexUv1s=l.has(1),ey.vertexUv2s=l.has(2),ey.vertexUv3s=l.has(3),l.clear(),ey},getProgramCacheKey:function(t){var i,n,r,a;let o=[];if(t.shaderID?o.push(t.shaderID):(o.push(t.customVertexShaderID),o.push(t.customFragmentShaderID)),void 0!==t.defines)for(let e in t.defines)o.push(e),o.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(i=o,n=t,i.push(n.precision),i.push(n.outputColorSpace),i.push(n.envMapMode),i.push(n.envMapCubeUVHeight),i.push(n.mapUv),i.push(n.alphaMapUv),i.push(n.lightMapUv),i.push(n.aoMapUv),i.push(n.bumpMapUv),i.push(n.normalMapUv),i.push(n.displacementMapUv),i.push(n.emissiveMapUv),i.push(n.metalnessMapUv),i.push(n.roughnessMapUv),i.push(n.anisotropyMapUv),i.push(n.clearcoatMapUv),i.push(n.clearcoatNormalMapUv),i.push(n.clearcoatRoughnessMapUv),i.push(n.iridescenceMapUv),i.push(n.iridescenceThicknessMapUv),i.push(n.sheenColorMapUv),i.push(n.sheenRoughnessMapUv),i.push(n.specularMapUv),i.push(n.specularColorMapUv),i.push(n.specularIntensityMapUv),i.push(n.transmissionMapUv),i.push(n.thicknessMapUv),i.push(n.combine),i.push(n.fogExp2),i.push(n.sizeAttenuation),i.push(n.morphTargetsCount),i.push(n.morphAttributeCount),i.push(n.numDirLights),i.push(n.numPointLights),i.push(n.numSpotLights),i.push(n.numSpotLightMaps),i.push(n.numHemiLights),i.push(n.numRectAreaLights),i.push(n.numDirLightShadows),i.push(n.numPointLightShadows),i.push(n.numSpotLightShadows),i.push(n.numSpotLightShadowsWithMaps),i.push(n.numLightProbes),i.push(n.shadowMapType),i.push(n.toneMapping),i.push(n.numClippingPlanes),i.push(n.numClipIntersection),i.push(n.depthPacking),r=o,a=t,s.disableAll(),a.instancing&&s.enable(0),a.instancingColor&&s.enable(1),a.instancingMorph&&s.enable(2),a.matcap&&s.enable(3),a.envMap&&s.enable(4),a.normalMapObjectSpace&&s.enable(5),a.normalMapTangentSpace&&s.enable(6),a.clearcoat&&s.enable(7),a.iridescence&&s.enable(8),a.alphaTest&&s.enable(9),a.vertexColors&&s.enable(10),a.vertexAlphas&&s.enable(11),a.vertexUv1s&&s.enable(12),a.vertexUv2s&&s.enable(13),a.vertexUv3s&&s.enable(14),a.vertexTangents&&s.enable(15),a.anisotropy&&s.enable(16),a.alphaHash&&s.enable(17),a.batching&&s.enable(18),a.dispersion&&s.enable(19),a.batchingColor&&s.enable(20),a.gradientMap&&s.enable(21),r.push(s.mask),s.disableAll(),a.fog&&s.enable(0),a.useFog&&s.enable(1),a.flatShading&&s.enable(2),a.logarithmicDepthBuffer&&s.enable(3),a.reversedDepthBuffer&&s.enable(4),a.skinning&&s.enable(5),a.morphTargets&&s.enable(6),a.morphNormals&&s.enable(7),a.morphColors&&s.enable(8),a.premultipliedAlpha&&s.enable(9),a.shadowMapEnabled&&s.enable(10),a.doubleSided&&s.enable(11),a.flipSided&&s.enable(12),a.useDepthPacking&&s.enable(13),a.dithering&&s.enable(14),a.transmission&&s.enable(15),a.sheen&&s.enable(16),a.opaque&&s.enable(17),a.pointsUvs&&s.enable(18),a.decodeVideoTexture&&s.enable(19),a.decodeVideoTextureEmissive&&s.enable(20),a.alphaToCoverage&&s.enable(21),r.push(s.mask),o.push(e.outputColorSpace)),o.push(t.customProgramCacheKey),o.join()},getUniforms:function(e){let t,i=p[e.type];return t=i?i3(n2[i].uniforms):e.uniforms},acquireProgram:function(t,i){let n=c.get(i);return void 0!==n?++n.usedTimes:(n=new az(e,i,t,r),h.push(n),c.set(i,n)),n},releaseProgram:function(e){if(0==--e.usedTimes){let t=h.indexOf(e);h[t]=h[h.length-1],h.pop(),c.delete(e.cacheKey),e.destroy()}},releaseShaderCache:function(e){o.remove(e)},programs:h,dispose:function(){o.dispose()}}}function aW(){let e=new WeakMap;return{has:function(t){return e.has(t)},get:function(t){let i=e.get(t);return void 0===i&&(i={},e.set(t,i)),i},remove:function(t){e.delete(t)},update:function(t,i,n){e.get(t)[i]=n},dispose:function(){e=new WeakMap}}}function aX(e,t){if(e.groupOrder!==t.groupOrder)return e.groupOrder-t.groupOrder;if(e.renderOrder!==t.renderOrder)return e.renderOrder-t.renderOrder;if(e.material.id!==t.material.id)return e.material.id-t.material.id;if(e.materialVariant!==t.materialVariant)return e.materialVariant-t.materialVariant;if(e.z!==t.z)return e.z-t.z;else return e.id-t.id}function aY(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function aq(){let e=[],t=0,i=[],n=[],r=[];function a(e){let t=0;return e.isInstancedMesh&&(t+=2),e.isSkinnedMesh&&(t+=1),t}function s(i,n,r,s,o,l){let h=e[t];return void 0===h?(h={id:i.id,object:i,geometry:n,material:r,materialVariant:a(i),groupOrder:s,renderOrder:i.renderOrder,z:o,group:l},e[t]=h):(h.id=i.id,h.object=i,h.geometry=n,h.material=r,h.materialVariant=a(i),h.groupOrder=s,h.renderOrder=i.renderOrder,h.z=o,h.group=l),t++,h}return{opaque:i,transmissive:n,transparent:r,init:function(){t=0,i.length=0,n.length=0,r.length=0},push:function(e,t,a,o,l,h){let c=s(e,t,a,o,l,h);a.transmission>0?n.push(c):!0===a.transparent?r.push(c):i.push(c)},unshift:function(e,t,a,o,l,h){let c=s(e,t,a,o,l,h);a.transmission>0?n.unshift(c):!0===a.transparent?r.unshift(c):i.unshift(c)},finish:function(){for(let i=t,n=e.length;i<n;i++){let t=e[i];if(null===t.id)break;t.id=null,t.object=null,t.geometry=null,t.material=null,t.group=null}},sort:function(e,t){i.length>1&&i.sort(e||aX),n.length>1&&n.sort(t||aY),r.length>1&&r.sort(t||aY)}}}function aK(){let e=new WeakMap;return{get:function(t,i){let n,r=e.get(t);return void 0===r?(n=new aq,e.set(t,[n])):i>=r.length?(n=new aq,r.push(n)):n=r[i],n},dispose:function(){e=new WeakMap}}}function aZ(){let e={};return{get:function(t){let i;if(void 0!==e[t.id])return e[t.id];switch(t.type){case"DirectionalLight":i={direction:new es,color:new e9};break;case"SpotLight":i={position:new es,direction:new es,color:new e9,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new es,color:new e9,distance:0,decay:0};break;case"HemisphereLight":i={direction:new es,skyColor:new e9,groundColor:new e9};break;case"RectAreaLight":i={color:new e9,position:new es,halfWidth:new es,halfHeight:new es}}return e[t.id]=i,i}}}let aJ=0;function a$(e,t){return 2*!!t.castShadow-2*!!e.castShadow+ +!!t.map-!!e.map}function aQ(e){let t,i=new aZ,n=(t={},{get:function(e){let i;if(void 0!==t[e.id])return t[e.id];switch(e.type){case"DirectionalLight":case"SpotLight":i={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new er};break;case"PointLight":i={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new er,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=i,i}}),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let e=0;e<9;e++)r.probe.push(new es);let a=new es,s=new eA,o=new eA;return{setup:function(t){let a=0,s=0,o=0;for(let e=0;e<9;e++)r.probe[e].set(0,0,0);let l=0,h=0,c=0,u=0,d=0,p=0,f=0,m=0,g=0,_=0,v=0;t.sort(a$);for(let e=0,x=t.length;e<x;e++){let x=t[e],y=x.color,M=x.intensity,S=x.distance,b=null;if(x.shadow&&x.shadow.map&&(b=1030===x.shadow.map.texture.format?x.shadow.map.texture:x.shadow.map.depthTexture||x.shadow.map.texture),x.isAmbientLight)a+=y.r*M,s+=y.g*M,o+=y.b*M;else if(x.isLightProbe){for(let e=0;e<9;e++)r.probe[e].addScaledVector(x.sh.coefficients[e],M);v++}else if(x.isDirectionalLight){let e=i.get(x);if(e.color.copy(x.color).multiplyScalar(x.intensity),x.castShadow){let e=x.shadow,t=n.get(x);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,r.directionalShadow[l]=t,r.directionalShadowMap[l]=b,r.directionalShadowMatrix[l]=x.shadow.matrix,p++}r.directional[l]=e,l++}else if(x.isSpotLight){let e=i.get(x);e.position.setFromMatrixPosition(x.matrixWorld),e.color.copy(y).multiplyScalar(M),e.distance=S,e.coneCos=Math.cos(x.angle),e.penumbraCos=Math.cos(x.angle*(1-x.penumbra)),e.decay=x.decay,r.spot[c]=e;let t=x.shadow;if(x.map&&(r.spotLightMap[g]=x.map,g++,t.updateMatrices(x),x.castShadow&&_++),r.spotLightMatrix[c]=t.matrix,x.castShadow){let e=n.get(x);e.shadowIntensity=t.intensity,e.shadowBias=t.bias,e.shadowNormalBias=t.normalBias,e.shadowRadius=t.radius,e.shadowMapSize=t.mapSize,r.spotShadow[c]=e,r.spotShadowMap[c]=b,m++}c++}else if(x.isRectAreaLight){let e=i.get(x);e.color.copy(y).multiplyScalar(M),e.halfWidth.set(.5*x.width,0,0),e.halfHeight.set(0,.5*x.height,0),r.rectArea[u]=e,u++}else if(x.isPointLight){let e=i.get(x);if(e.color.copy(x.color).multiplyScalar(x.intensity),e.distance=x.distance,e.decay=x.decay,x.castShadow){let e=x.shadow,t=n.get(x);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,t.shadowCameraNear=e.camera.near,t.shadowCameraFar=e.camera.far,r.pointShadow[h]=t,r.pointShadowMap[h]=b,r.pointShadowMatrix[h]=x.shadow.matrix,f++}r.point[h]=e,h++}else if(x.isHemisphereLight){let e=i.get(x);e.skyColor.copy(x.color).multiplyScalar(M),e.groundColor.copy(x.groundColor).multiplyScalar(M),r.hemi[d]=e,d++}}u>0&&(!0===e.has("OES_texture_float_linear")?(r.rectAreaLTC1=n1.LTC_FLOAT_1,r.rectAreaLTC2=n1.LTC_FLOAT_2):(r.rectAreaLTC1=n1.LTC_HALF_1,r.rectAreaLTC2=n1.LTC_HALF_2)),r.ambient[0]=a,r.ambient[1]=s,r.ambient[2]=o;let x=r.hash;(x.directionalLength!==l||x.pointLength!==h||x.spotLength!==c||x.rectAreaLength!==u||x.hemiLength!==d||x.numDirectionalShadows!==p||x.numPointShadows!==f||x.numSpotShadows!==m||x.numSpotMaps!==g||x.numLightProbes!==v)&&(r.directional.length=l,r.spot.length=c,r.rectArea.length=u,r.point.length=h,r.hemi.length=d,r.directionalShadow.length=p,r.directionalShadowMap.length=p,r.pointShadow.length=f,r.pointShadowMap.length=f,r.spotShadow.length=m,r.spotShadowMap.length=m,r.directionalShadowMatrix.length=p,r.pointShadowMatrix.length=f,r.spotLightMatrix.length=m+g-_,r.spotLightMap.length=g,r.numSpotLightShadowsWithMaps=_,r.numLightProbes=v,x.directionalLength=l,x.pointLength=h,x.spotLength=c,x.rectAreaLength=u,x.hemiLength=d,x.numDirectionalShadows=p,x.numPointShadows=f,x.numSpotShadows=m,x.numSpotMaps=g,x.numLightProbes=v,r.version=aJ++)},setupView:function(e,t){let i=0,n=0,l=0,h=0,c=0,u=t.matrixWorldInverse;for(let t=0,d=e.length;t<d;t++){let d=e[t];if(d.isDirectionalLight){let e=r.directional[i];e.direction.setFromMatrixPosition(d.matrixWorld),a.setFromMatrixPosition(d.target.matrixWorld),e.direction.sub(a),e.direction.transformDirection(u),i++}else if(d.isSpotLight){let e=r.spot[l];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(u),e.direction.setFromMatrixPosition(d.matrixWorld),a.setFromMatrixPosition(d.target.matrixWorld),e.direction.sub(a),e.direction.transformDirection(u),l++}else if(d.isRectAreaLight){let e=r.rectArea[h];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(u),o.identity(),s.copy(d.matrixWorld),s.premultiply(u),o.extractRotation(s),e.halfWidth.set(.5*d.width,0,0),e.halfHeight.set(0,.5*d.height,0),e.halfWidth.applyMatrix4(o),e.halfHeight.applyMatrix4(o),h++}else if(d.isPointLight){let e=r.point[n];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(u),n++}else if(d.isHemisphereLight){let e=r.hemi[c];e.direction.setFromMatrixPosition(d.matrixWorld),e.direction.transformDirection(u),c++}}},state:r}}function a0(e){let t=new aQ(e),i=[],n=[],r={lightsArray:i,shadowsArray:n,camera:null,lights:t,transmissionRenderTarget:{}};return{init:function(e){r.camera=e,i.length=0,n.length=0},state:r,setupLights:function(){t.setup(i)},setupLightsView:function(e){t.setupView(i,e)},pushLight:function(e){i.push(e)},pushShadow:function(e){n.push(e)}}}function a1(e){let t=new WeakMap;return{get:function(i,n=0){let r,a=t.get(i);return void 0===a?(r=new a0(e),t.set(i,[r])):n>=a.length?(r=new a0(e),a.push(r)):r=a[n],r},dispose:function(){t=new WeakMap}}}let a2=[new es(1,0,0),new es(-1,0,0),new es(0,1,0),new es(0,-1,0),new es(0,0,1),new es(0,0,-1)],a3=[new es(0,-1,0),new es(0,-1,0),new es(0,0,1),new es(0,0,-1),new es(0,-1,0),new es(0,-1,0)],a4=new eA,a5=new es,a6=new es;function a8(e,t,i){let n=new iy,r=new er,a=new er,s=new eb,o=new ne,l=new nt,h={},c=i.maxTextureSize,u={0:1,1:0,2:2},d=new i6({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new er},radius:{value:4}},vertexShader:"void main() {\n gl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\nvoid main() {\n const float samples = float( VSM_SAMPLES );\n float mean = 0.0;\n float squared_mean = 0.0;\n float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n float uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n for ( float i = 0.0; i < samples; i ++ ) {\n float uvOffset = uvStart + i * uvStride;\n #ifdef HORIZONTAL_PASS\n vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean / samples;\n squared_mean = squared_mean / samples;\n float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );\n gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );\n}"}),p=d.clone();p.defines.HORIZONTAL_PASS=1;let f=new tK;f.setAttribute("position",new tI(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let m=new ih(f,d),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let _=this.type;function v(t,i,n,r){let a=null,s=!0===n.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==s)a=s;else if(a=!0===n.isPointLight?l:o,e.localClippingEnabled&&!0===i.clipShadows&&Array.isArray(i.clippingPlanes)&&0!==i.clippingPlanes.length||i.displacementMap&&0!==i.displacementScale||i.alphaMap&&i.alphaTest>0||i.map&&i.alphaTest>0||!0===i.alphaToCoverage){let e=a.uuid,t=i.uuid,n=h[e];void 0===n&&(n={},h[e]=n);let r=n[t];void 0===r&&(r=a.clone(),n[t]=r,i.addEventListener("dispose",x)),a=r}return a.visible=i.visible,a.wireframe=i.wireframe,3===r?a.side=null!==i.shadowSide?i.shadowSide:i.side:a.side=null!==i.shadowSide?i.shadowSide:u[i.side],a.alphaMap=i.alphaMap,a.alphaTest=!0===i.alphaToCoverage?.5:i.alphaTest,a.map=i.map,a.clipShadows=i.clipShadows,a.clippingPlanes=i.clippingPlanes,a.clipIntersection=i.clipIntersection,a.displacementMap=i.displacementMap,a.displacementScale=i.displacementScale,a.displacementBias=i.displacementBias,a.wireframeLinewidth=i.wireframeLinewidth,a.linewidth=i.linewidth,!0===n.isPointLight&&!0===a.isMeshDistanceMaterial&&(e.properties.get(a).light=n),a}function x(e){for(let t in e.target.removeEventListener("dispose",x),h){let i=h[t],n=e.target.uuid;n in i&&(i[n].dispose(),delete i[n])}}this.render=function(i,o,l){if(!1===g.enabled||!1===g.autoUpdate&&!1===g.needsUpdate||0===i.length)return;2===this.type&&(W("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=1);let h=e.getRenderTarget(),u=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),x=e.state;x.setBlending(0),!0===x.buffers.depth.getReversed()?x.buffers.color.setClear(0,0,0,0):x.buffers.color.setClear(1,1,1,1),x.buffers.depth.setTest(!0),x.setScissorTest(!1);let y=_!==this.type;y&&o.traverse(function(e){e.material&&(Array.isArray(e.material)?e.material.forEach(e=>e.needsUpdate=!0):e.material.needsUpdate=!0)});for(let h=0,u=i.length;h<u;h++){let u=i[h],f=u.shadow;if(void 0===f){W("WebGLShadowMap:",u,"has no shadow.");continue}if(!1===f.autoUpdate&&!1===f.needsUpdate)continue;r.copy(f.mapSize);let g=f.getFrameExtents();r.multiply(g),a.copy(f.mapSize),(r.x>c||r.y>c)&&(r.x>c&&(a.x=Math.floor(c/g.x),r.x=a.x*g.x,f.mapSize.x=a.x),r.y>c&&(a.y=Math.floor(c/g.y),r.y=a.y*g.y,f.mapSize.y=a.y));let _=e.state.buffers.depth.getReversed();if(f.camera._reversedDepth=_,null===f.map||!0===y){if(null!==f.map&&(null!==f.map.depthTexture&&(f.map.depthTexture.dispose(),f.map.depthTexture=null),f.map.dispose()),3===this.type){if(u.isPointLight){W("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}f.map=new eE(r.x,r.y,{format:1030,type:1016,minFilter:1006,magFilter:1006,generateMipmaps:!1}),f.map.texture.name=u.name+".shadowMap",f.map.depthTexture=new iU(r.x,r.y,1015),f.map.depthTexture.name=u.name+".shadowMapDepth",f.map.depthTexture.format=1026,f.map.depthTexture.compareFunction=null,f.map.depthTexture.minFilter=1003,f.map.depthTexture.magFilter=1003}else u.isPointLight?(f.map=new rm(r.x),f.map.depthTexture=new iO(r.x,1014)):(f.map=new eE(r.x,r.y),f.map.depthTexture=new iU(r.x,r.y,1014)),f.map.depthTexture.name=u.name+".shadowMap",f.map.depthTexture.format=1026,1===this.type?(f.map.depthTexture.compareFunction=_?518:515,f.map.depthTexture.minFilter=1006,f.map.depthTexture.magFilter=1006):(f.map.depthTexture.compareFunction=null,f.map.depthTexture.minFilter=1003,f.map.depthTexture.magFilter=1003);f.camera.updateProjectionMatrix()}let M=f.map.isWebGLCubeRenderTarget?6:1;for(let i=0;i<M;i++){if(f.map.isWebGLCubeRenderTarget)e.setRenderTarget(f.map,i),e.clear();else{0===i&&(e.setRenderTarget(f.map),e.clear());let t=f.getViewport(i);s.set(a.x*t.x,a.y*t.y,a.x*t.z,a.y*t.w),x.viewport(s)}if(u.isPointLight){let e=f.camera,t=f.matrix,n=u.distance||e.far;n!==e.far&&(e.far=n,e.updateProjectionMatrix()),a5.setFromMatrixPosition(u.matrixWorld),e.position.copy(a5),a6.copy(e.position),a6.add(a2[i]),e.up.copy(a3[i]),e.lookAt(a6),e.updateMatrixWorld(),t.makeTranslation(-a5.x,-a5.y,-a5.z),a4.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),f._frustum.setFromProjectionMatrix(a4,e.coordinateSystem,e.reversedDepth)}else f.updateMatrices(u);n=f.getFrustum(),function i(r,a,s,o,l){if(!1===r.visible)return;if(r.layers.test(a.layers)&&(r.isMesh||r.isLine||r.isPoints)&&(r.castShadow||r.receiveShadow&&3===l)&&(!r.frustumCulled||n.intersectsObject(r))){r.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,r.matrixWorld);let i=t.update(r),n=r.material;if(Array.isArray(n)){let t=i.groups;for(let h=0,c=t.length;h<c;h++){let c=t[h],u=n[c.materialIndex];if(u&&u.visible){let t=v(r,u,o,l);r.onBeforeShadow(e,r,a,s,i,t,c),e.renderBufferDirect(s,null,i,t,r,c),r.onAfterShadow(e,r,a,s,i,t,c)}}}else if(n.visible){let t=v(r,n,o,l);r.onBeforeShadow(e,r,a,s,i,t,null),e.renderBufferDirect(s,null,i,t,r,null),r.onAfterShadow(e,r,a,s,i,t,null)}}let h=r.children;for(let e=0,t=h.length;e<t;e++)i(h[e],a,s,o,l)}(o,l,f.camera,u,this.type)}!0!==f.isPointLightShadow&&3===this.type&&function(i,n){let a=t.update(m);d.defines.VSM_SAMPLES!==i.blurSamples&&(d.defines.VSM_SAMPLES=i.blurSamples,p.defines.VSM_SAMPLES=i.blurSamples,d.needsUpdate=!0,p.needsUpdate=!0),null===i.mapPass&&(i.mapPass=new eE(r.x,r.y,{format:1030,type:1016})),d.uniforms.shadow_pass.value=i.map.depthTexture,d.uniforms.resolution.value=i.mapSize,d.uniforms.radius.value=i.radius,e.setRenderTarget(i.mapPass),e.clear(),e.renderBufferDirect(n,null,a,d,m,null),p.uniforms.shadow_pass.value=i.mapPass.texture,p.uniforms.resolution.value=i.mapSize,p.uniforms.radius.value=i.radius,e.setRenderTarget(i.map),e.clear(),e.renderBufferDirect(n,null,a,p,m,null)}(f,l),f.needsUpdate=!1}_=this.type,g.needsUpdate=!1,e.setRenderTarget(h,u,f)}}function a9(e,t){let i=new function(){let t=!1,i=new eb,n=null,r=new eb(0,0,0,0);return{setMask:function(i){n===i||t||(e.colorMask(i,i,i,i),n=i)},setLocked:function(e){t=e},setClear:function(t,n,a,s,o){!0===o&&(t*=s,n*=s,a*=s),i.set(t,n,a,s),!1===r.equals(i)&&(e.clearColor(t,n,a,s),r.copy(i))},reset:function(){t=!1,n=null,r.set(-1,0,0,0)}}},n=new function(){let i=!1,n=!1,r=null,a=null,s=null;return{setReversed:function(e){if(n!==e){let i=t.get("EXT_clip_control");e?i.clipControlEXT(i.LOWER_LEFT_EXT,i.ZERO_TO_ONE_EXT):i.clipControlEXT(i.LOWER_LEFT_EXT,i.NEGATIVE_ONE_TO_ONE_EXT),n=e;let r=s;s=null,this.setClear(r)}},getReversed:function(){return n},setTest:function(t){t?k(e.DEPTH_TEST):z(e.DEPTH_TEST)},setMask:function(t){r===t||i||(e.depthMask(t),r=t)},setFunc:function(t){if(n&&(t=q[t]),a!==t){switch(t){case 0:e.depthFunc(e.NEVER);break;case 1:e.depthFunc(e.ALWAYS);break;case 2:e.depthFunc(e.LESS);break;case 3:default:e.depthFunc(e.LEQUAL);break;case 4:e.depthFunc(e.EQUAL);break;case 5:e.depthFunc(e.GEQUAL);break;case 6:e.depthFunc(e.GREATER);break;case 7:e.depthFunc(e.NOTEQUAL)}a=t}},setLocked:function(e){i=e},setClear:function(t){s!==t&&(s=t,n&&(t=1-t),e.clearDepth(t))},reset:function(){i=!1,r=null,a=null,s=null,n=!1}}},r=new function(){let t=!1,i=null,n=null,r=null,a=null,s=null,o=null,l=null,h=null;return{setTest:function(i){t||(i?k(e.STENCIL_TEST):z(e.STENCIL_TEST))},setMask:function(n){i===n||t||(e.stencilMask(n),i=n)},setFunc:function(t,i,s){(n!==t||r!==i||a!==s)&&(e.stencilFunc(t,i,s),n=t,r=i,a=s)},setOp:function(t,i,n){(s!==t||o!==i||l!==n)&&(e.stencilOp(t,i,n),s=t,o=i,l=n)},setLocked:function(e){t=e},setClear:function(t){h!==t&&(e.clearStencil(t),h=t)},reset:function(){t=!1,i=null,n=null,r=null,a=null,s=null,o=null,l=null,h=null}}},a=new WeakMap,s=new WeakMap,o={},l={},h=new WeakMap,c=[],u=null,d=!1,p=null,f=null,m=null,g=null,_=null,v=null,x=null,y=new e9(0,0,0),M=0,S=!1,b=null,T=null,E=null,w=null,A=null,R=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),C=!1,P=e.getParameter(e.VERSION);-1!==P.indexOf("WebGL")?C=parseFloat(/^WebGL (\d)/.exec(P)[1])>=1:-1!==P.indexOf("OpenGL ES")&&(C=parseFloat(/^OpenGL ES (\d)/.exec(P)[1])>=2);let L=null,N={},D=e.getParameter(e.SCISSOR_BOX),I=e.getParameter(e.VIEWPORT),U=new eb().fromArray(D),O=new eb().fromArray(I);function F(t,i,n,r){let a=new Uint8Array(4),s=e.createTexture();e.bindTexture(t,s),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let s=0;s<n;s++)t===e.TEXTURE_3D||t===e.TEXTURE_2D_ARRAY?e.texImage3D(i,0,e.RGBA,1,1,r,0,e.RGBA,e.UNSIGNED_BYTE,a):e.texImage2D(i+s,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,a);return s}let B={};function k(t){!0!==o[t]&&(e.enable(t),o[t]=!0)}function z(t){!1!==o[t]&&(e.disable(t),o[t]=!1)}B[e.TEXTURE_2D]=F(e.TEXTURE_2D,e.TEXTURE_2D,1),B[e.TEXTURE_CUBE_MAP]=F(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),B[e.TEXTURE_2D_ARRAY]=F(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),B[e.TEXTURE_3D]=F(e.TEXTURE_3D,e.TEXTURE_3D,1,1),i.setClear(0,0,0,1),n.setClear(1),r.setClear(0),k(e.DEPTH_TEST),n.setFunc(3),j(!1),W(1),k(e.CULL_FACE),G(0);let V={100:e.FUNC_ADD,101:e.FUNC_SUBTRACT,102:e.FUNC_REVERSE_SUBTRACT};V[103]=e.MIN,V[104]=e.MAX;let H={200:e.ZERO,201:e.ONE,202:e.SRC_COLOR,204:e.SRC_ALPHA,210:e.SRC_ALPHA_SATURATE,208:e.DST_COLOR,206:e.DST_ALPHA,203:e.ONE_MINUS_SRC_COLOR,205:e.ONE_MINUS_SRC_ALPHA,209:e.ONE_MINUS_DST_COLOR,207:e.ONE_MINUS_DST_ALPHA,211:e.CONSTANT_COLOR,212:e.ONE_MINUS_CONSTANT_COLOR,213:e.CONSTANT_ALPHA,214:e.ONE_MINUS_CONSTANT_ALPHA};function G(t,i,n,r,a,s,o,l,h,c){if(0===t){!0===d&&(z(e.BLEND),d=!1);return}if(!1===d&&(k(e.BLEND),d=!0),5!==t){if(t!==p||c!==S){if((100!==f||100!==_)&&(e.blendEquation(e.FUNC_ADD),f=100,_=100),c)switch(t){case 1:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendFunc(e.ONE,e.ONE);break;case 3:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case 4:e.blendFuncSeparate(e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA,e.ZERO,e.ONE);break;default:X("WebGLState: Invalid blending: ",t)}else switch(t){case 1:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE,e.ONE,e.ONE);break;case 3:X("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case 4:X("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:X("WebGLState: Invalid blending: ",t)}m=null,g=null,v=null,x=null,y.set(0,0,0),M=0,p=t,S=c}return}a=a||i,s=s||n,o=o||r,(i!==f||a!==_)&&(e.blendEquationSeparate(V[i],V[a]),f=i,_=a),(n!==m||r!==g||s!==v||o!==x)&&(e.blendFuncSeparate(H[n],H[r],H[s],H[o]),m=n,g=r,v=s,x=o),(!1===l.equals(y)||h!==M)&&(e.blendColor(l.r,l.g,l.b,h),y.copy(l),M=h),p=t,S=!1}function j(t){b!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),b=t)}function W(t){0!==t?(k(e.CULL_FACE),t!==T&&(1===t?e.cullFace(e.BACK):2===t?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))):z(e.CULL_FACE),T=t}function Y(t,i,r){t?(k(e.POLYGON_OFFSET_FILL),(w!==i||A!==r)&&(w=i,A=r,n.getReversed()&&(i=-i),e.polygonOffset(i,r))):z(e.POLYGON_OFFSET_FILL)}return{buffers:{color:i,depth:n,stencil:r},enable:k,disable:z,bindFramebuffer:function(t,i){return l[t]!==i&&(e.bindFramebuffer(t,i),l[t]=i,t===e.DRAW_FRAMEBUFFER&&(l[e.FRAMEBUFFER]=i),t===e.FRAMEBUFFER&&(l[e.DRAW_FRAMEBUFFER]=i),!0)},drawBuffers:function(t,i){let n=c,r=!1;if(t){void 0===(n=h.get(i))&&(n=[],h.set(i,n));let a=t.textures;if(n.length!==a.length||n[0]!==e.COLOR_ATTACHMENT0){for(let t=0,i=a.length;t<i;t++)n[t]=e.COLOR_ATTACHMENT0+t;n.length=a.length,r=!0}}else n[0]!==e.BACK&&(n[0]=e.BACK,r=!0);r&&e.drawBuffers(n)},useProgram:function(t){return u!==t&&(e.useProgram(t),u=t,!0)},setBlending:G,setMaterial:function(t,a){2===t.side?z(e.CULL_FACE):k(e.CULL_FACE);let s=1===t.side;a&&(s=!s),j(s),1===t.blending&&!1===t.transparent?G(0):G(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.blendColor,t.blendAlpha,t.premultipliedAlpha),n.setFunc(t.depthFunc),n.setTest(t.depthTest),n.setMask(t.depthWrite),i.setMask(t.colorWrite);let o=t.stencilWrite;r.setTest(o),o&&(r.setMask(t.stencilWriteMask),r.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),r.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),Y(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),!0===t.alphaToCoverage?k(e.SAMPLE_ALPHA_TO_COVERAGE):z(e.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:j,setCullFace:W,setLineWidth:function(t){t!==E&&(C&&e.lineWidth(t),E=t)},setPolygonOffset:Y,setScissorTest:function(t){t?k(e.SCISSOR_TEST):z(e.SCISSOR_TEST)},activeTexture:function(t){void 0===t&&(t=e.TEXTURE0+R-1),L!==t&&(e.activeTexture(t),L=t)},bindTexture:function(t,i,n){void 0===n&&(n=null===L?e.TEXTURE0+R-1:L);let r=N[n];void 0===r&&(r={type:void 0,texture:void 0},N[n]=r),(r.type!==t||r.texture!==i)&&(L!==n&&(e.activeTexture(n),L=n),e.bindTexture(t,i||B[t]),r.type=t,r.texture=i)},unbindTexture:function(){let t=N[L];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D(...arguments)}catch(e){X("WebGLState:",e)}},compressedTexImage3D:function(){try{e.compressedTexImage3D(...arguments)}catch(e){X("WebGLState:",e)}},texImage2D:function(){try{e.texImage2D(...arguments)}catch(e){X("WebGLState:",e)}},texImage3D:function(){try{e.texImage3D(...arguments)}catch(e){X("WebGLState:",e)}},updateUBOMapping:function(t,i){let n=s.get(i);void 0===n&&(n=new WeakMap,s.set(i,n));let r=n.get(t);void 0===r&&(r=e.getUniformBlockIndex(i,t.name),n.set(t,r))},uniformBlockBinding:function(t,i){let n=s.get(i).get(t);a.get(i)!==n&&(e.uniformBlockBinding(i,n,t.__bindingPointIndex),a.set(i,n))},texStorage2D:function(){try{e.texStorage2D(...arguments)}catch(e){X("WebGLState:",e)}},texStorage3D:function(){try{e.texStorage3D(...arguments)}catch(e){X("WebGLState:",e)}},texSubImage2D:function(){try{e.texSubImage2D(...arguments)}catch(e){X("WebGLState:",e)}},texSubImage3D:function(){try{e.texSubImage3D(...arguments)}catch(e){X("WebGLState:",e)}},compressedTexSubImage2D:function(){try{e.compressedTexSubImage2D(...arguments)}catch(e){X("WebGLState:",e)}},compressedTexSubImage3D:function(){try{e.compressedTexSubImage3D(...arguments)}catch(e){X("WebGLState:",e)}},scissor:function(t){!1===U.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),U.copy(t))},viewport:function(t){!1===O.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),O.copy(t))},reset:function(){e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.blendColor(0,0,0,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),n.setReversed(!1),e.clearDepth(1),e.stencilMask(0xffffffff),e.stencilFunc(e.ALWAYS,0,0xffffffff),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),o={},L=null,N={},l={},h=new WeakMap,c=[],u=null,d=!1,p=null,f=null,m=null,g=null,_=null,v=null,x=null,y=new e9(0,0,0),M=0,S=!1,b=null,T=null,E=null,w=null,A=null,U.set(0,0,e.canvas.width,e.canvas.height),O.set(0,0,e.canvas.width,e.canvas.height),i.reset(),n.reset(),r.reset()}}}function a7(e,t,i,n,r,a,s){let o,l=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,h="u">typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),c=new er,u=new WeakMap,d=new WeakMap,p=!1;try{p="u">typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function f(e,t){return p?new OffscreenCanvas(e,t):V("canvas")}function m(e,t,i){let n=1,r=q(e);if((r.width>i||r.height>i)&&(n=i/Math.max(r.width,r.height)),n<1)if("u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap||"u">typeof VideoFrame&&e instanceof VideoFrame){let i=Math.floor(n*r.width),a=Math.floor(n*r.height);void 0===o&&(o=f(i,a));let s=t?f(i,a):o;return s.width=i,s.height=a,s.getContext("2d").drawImage(e,0,0,i,a),W("WebGLRenderer: Texture has been resized from ("+r.width+"x"+r.height+") to ("+i+"x"+a+")."),s}else"data"in e&&W("WebGLRenderer: Image in DataTexture is too big ("+r.width+"x"+r.height+").");return e}function g(e){return e.generateMipmaps}function _(t){e.generateMipmap(t)}function v(i,n,r,a,s=!1){if(null!==i){if(void 0!==e[i])return e[i];W("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+i+"'")}let o=n;if(n===e.RED&&(r===e.FLOAT&&(o=e.R32F),r===e.HALF_FLOAT&&(o=e.R16F),r===e.UNSIGNED_BYTE&&(o=e.R8)),n===e.RED_INTEGER&&(r===e.UNSIGNED_BYTE&&(o=e.R8UI),r===e.UNSIGNED_SHORT&&(o=e.R16UI),r===e.UNSIGNED_INT&&(o=e.R32UI),r===e.BYTE&&(o=e.R8I),r===e.SHORT&&(o=e.R16I),r===e.INT&&(o=e.R32I)),n===e.RG&&(r===e.FLOAT&&(o=e.RG32F),r===e.HALF_FLOAT&&(o=e.RG16F),r===e.UNSIGNED_BYTE&&(o=e.RG8)),n===e.RG_INTEGER&&(r===e.UNSIGNED_BYTE&&(o=e.RG8UI),r===e.UNSIGNED_SHORT&&(o=e.RG16UI),r===e.UNSIGNED_INT&&(o=e.RG32UI),r===e.BYTE&&(o=e.RG8I),r===e.SHORT&&(o=e.RG16I),r===e.INT&&(o=e.RG32I)),n===e.RGB_INTEGER&&(r===e.UNSIGNED_BYTE&&(o=e.RGB8UI),r===e.UNSIGNED_SHORT&&(o=e.RGB16UI),r===e.UNSIGNED_INT&&(o=e.RGB32UI),r===e.BYTE&&(o=e.RGB8I),r===e.SHORT&&(o=e.RGB16I),r===e.INT&&(o=e.RGB32I)),n===e.RGBA_INTEGER&&(r===e.UNSIGNED_BYTE&&(o=e.RGBA8UI),r===e.UNSIGNED_SHORT&&(o=e.RGBA16UI),r===e.UNSIGNED_INT&&(o=e.RGBA32UI),r===e.BYTE&&(o=e.RGBA8I),r===e.SHORT&&(o=e.RGBA16I),r===e.INT&&(o=e.RGBA32I)),n===e.RGB&&(r===e.UNSIGNED_INT_5_9_9_9_REV&&(o=e.RGB9_E5),r===e.UNSIGNED_INT_10F_11F_11F_REV&&(o=e.R11F_G11F_B10F)),n===e.RGBA){let t=s?B:ep.getTransfer(a);r===e.FLOAT&&(o=e.RGBA32F),r===e.HALF_FLOAT&&(o=e.RGBA16F),r===e.UNSIGNED_BYTE&&(o=t===k?e.SRGB8_ALPHA8:e.RGBA8),r===e.UNSIGNED_SHORT_4_4_4_4&&(o=e.RGBA4),r===e.UNSIGNED_SHORT_5_5_5_1&&(o=e.RGB5_A1)}return(o===e.R16F||o===e.R32F||o===e.RG16F||o===e.RG32F||o===e.RGBA16F||o===e.RGBA32F)&&t.get("EXT_color_buffer_float"),o}function x(t,i){let n;return t?null===i||1014===i||1020===i?n=e.DEPTH24_STENCIL8:1015===i?n=e.DEPTH32F_STENCIL8:1012===i&&(n=e.DEPTH24_STENCIL8,W("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===i||1014===i||1020===i?n=e.DEPTH_COMPONENT24:1015===i?n=e.DEPTH_COMPONENT32F:1012===i&&(n=e.DEPTH_COMPONENT16),n}function y(e,t){return!0===g(e)||e.isFramebufferTexture&&1003!==e.minFilter&&1006!==e.minFilter?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function M(e){let t=e.target;t.removeEventListener("dispose",M),function(e){let t=n.get(e);if(void 0===t.__webglInit)return;let i=e.source,r=d.get(i);if(r){let n=r[t.__cacheKey];n.usedTimes--,0===n.usedTimes&&b(e),0===Object.keys(r).length&&d.delete(i)}n.remove(e)}(t),t.isVideoTexture&&u.delete(t)}function S(t){let i=t.target;i.removeEventListener("dispose",S),function(t){let i=n.get(t);if(t.depthTexture&&(t.depthTexture.dispose(),n.remove(t.depthTexture)),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(i.__webglFramebuffer[t]))for(let n=0;n<i.__webglFramebuffer[t].length;n++)e.deleteFramebuffer(i.__webglFramebuffer[t][n]);else e.deleteFramebuffer(i.__webglFramebuffer[t]);i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer[t])}else{if(Array.isArray(i.__webglFramebuffer))for(let t=0;t<i.__webglFramebuffer.length;t++)e.deleteFramebuffer(i.__webglFramebuffer[t]);else e.deleteFramebuffer(i.__webglFramebuffer);if(i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&e.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer)for(let t=0;t<i.__webglColorRenderbuffer.length;t++)i.__webglColorRenderbuffer[t]&&e.deleteRenderbuffer(i.__webglColorRenderbuffer[t]);i.__webglDepthRenderbuffer&&e.deleteRenderbuffer(i.__webglDepthRenderbuffer)}let r=t.textures;for(let t=0,i=r.length;t<i;t++){let i=n.get(r[t]);i.__webglTexture&&(e.deleteTexture(i.__webglTexture),s.memory.textures--),n.remove(r[t])}n.remove(t)}(i)}function b(t){let i=n.get(t);e.deleteTexture(i.__webglTexture);let r=t.source,a=d.get(r);delete a[i.__cacheKey],s.memory.textures--}let T=0;function E(t,r){var a;let o,l=n.get(t);if(t.isVideoTexture&&(a=t,o=s.render.frame,u.get(a)!==o&&(u.set(a,o),a.update())),!1===t.isRenderTargetTexture&&!0!==t.isExternalTexture&&t.version>0&&l.__version!==t.version){let e=t.image;if(null===e)W("WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==e.complete)return void N(l,t,r);W("WebGLRenderer: Texture marked for update but image is incomplete")}}else t.isExternalTexture&&(l.__webglTexture=t.sourceTexture?t.sourceTexture:null);i.bindTexture(e.TEXTURE_2D,l.__webglTexture,e.TEXTURE0+r)}let w={1e3:e.REPEAT,1001:e.CLAMP_TO_EDGE,1002:e.MIRRORED_REPEAT},A={1003:e.NEAREST,1004:e.NEAREST_MIPMAP_NEAREST,1005:e.NEAREST_MIPMAP_LINEAR,1006:e.LINEAR,1007:e.LINEAR_MIPMAP_NEAREST,1008:e.LINEAR_MIPMAP_LINEAR},R={512:e.NEVER,519:e.ALWAYS,513:e.LESS,515:e.LEQUAL,514:e.EQUAL,518:e.GEQUAL,516:e.GREATER,517:e.NOTEQUAL};function C(i,a){if((1015===a.type&&!1===t.has("OES_texture_float_linear")&&(1006===a.magFilter||1007===a.magFilter||1005===a.magFilter||1008===a.magFilter||1006===a.minFilter||1007===a.minFilter||1005===a.minFilter||1008===a.minFilter)&&W("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(i,e.TEXTURE_WRAP_S,w[a.wrapS]),e.texParameteri(i,e.TEXTURE_WRAP_T,w[a.wrapT]),(i===e.TEXTURE_3D||i===e.TEXTURE_2D_ARRAY)&&e.texParameteri(i,e.TEXTURE_WRAP_R,w[a.wrapR]),e.texParameteri(i,e.TEXTURE_MAG_FILTER,A[a.magFilter]),e.texParameteri(i,e.TEXTURE_MIN_FILTER,A[a.minFilter]),a.compareFunction&&(e.texParameteri(i,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(i,e.TEXTURE_COMPARE_FUNC,R[a.compareFunction])),!0===t.has("EXT_texture_filter_anisotropic"))&&1003!==a.magFilter&&(1005===a.minFilter||1008===a.minFilter)&&(1015!==a.type||!1!==t.has("OES_texture_float_linear"))&&(a.anisotropy>1||n.get(a).__currentAnisotropy)){let s=t.get("EXT_texture_filter_anisotropic");e.texParameterf(i,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),n.get(a).__currentAnisotropy=a.anisotropy}}function P(t,i){let n,r=!1;void 0===t.__webglInit&&(t.__webglInit=!0,i.addEventListener("dispose",M));let a=i.source,o=d.get(a);void 0===o&&(o={},d.set(a,o));let l=((n=[]).push(i.wrapS),n.push(i.wrapT),n.push(i.wrapR||0),n.push(i.magFilter),n.push(i.minFilter),n.push(i.anisotropy),n.push(i.internalFormat),n.push(i.format),n.push(i.type),n.push(i.generateMipmaps),n.push(i.premultiplyAlpha),n.push(i.flipY),n.push(i.unpackAlignment),n.push(i.colorSpace),n.join());if(l!==t.__cacheKey){void 0===o[l]&&(o[l]={texture:e.createTexture(),usedTimes:0},s.memory.textures++,r=!0),o[l].usedTimes++;let n=o[t.__cacheKey];void 0!==n&&(o[t.__cacheKey].usedTimes--,0===n.usedTimes&&b(i)),t.__cacheKey=l,t.__webglTexture=o[l].texture}return r}function L(e,t,i){return Math.floor(Math.floor(e/i)/t)}function N(t,s,o){let l=e.TEXTURE_2D;(s.isDataArrayTexture||s.isCompressedArrayTexture)&&(l=e.TEXTURE_2D_ARRAY),s.isData3DTexture&&(l=e.TEXTURE_3D);let h=P(t,s),c=s.source;i.bindTexture(l,t.__webglTexture,e.TEXTURE0+o);let u=n.get(c);if(c.version!==u.__version||!0===h){let t;i.activeTexture(e.TEXTURE0+o);let n=ep.getPrimaries(ep.workingColorSpace),d=""===s.colorSpace?null:ep.getPrimaries(s.colorSpace),p=""===s.colorSpace||n===d?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,s.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,s.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,p);let f=m(s.image,!1,r.maxTextureSize);f=Y(s,f);let M=a.convert(s.format,s.colorSpace),S=a.convert(s.type),b=v(s.internalFormat,M,S,s.colorSpace,s.isVideoTexture);C(l,s);let T=s.mipmaps,E=!0!==s.isVideoTexture,w=void 0===u.__version||!0===h,A=c.dataReady,R=y(s,f);if(s.isDepthTexture)b=x(1027===s.format,s.type),w&&(E?i.texStorage2D(e.TEXTURE_2D,1,b,f.width,f.height):i.texImage2D(e.TEXTURE_2D,0,b,f.width,f.height,0,M,S,null));else if(s.isDataTexture)if(T.length>0){E&&w&&i.texStorage2D(e.TEXTURE_2D,R,b,T[0].width,T[0].height);for(let n=0,r=T.length;n<r;n++)t=T[n],E?A&&i.texSubImage2D(e.TEXTURE_2D,n,0,0,t.width,t.height,M,S,t.data):i.texImage2D(e.TEXTURE_2D,n,b,t.width,t.height,0,M,S,t.data);s.generateMipmaps=!1}else E?(w&&i.texStorage2D(e.TEXTURE_2D,R,b,f.width,f.height),A&&function(t,n,r,a){let s=t.updateRanges;if(0===s.length)i.texSubImage2D(e.TEXTURE_2D,0,0,0,n.width,n.height,r,a,n.data);else{s.sort((e,t)=>e.start-t.start);let o=0;for(let e=1;e<s.length;e++){let t=s[o],i=s[e],r=t.start+t.count,a=L(i.start,n.width,4),l=L(t.start,n.width,4);i.start<=r+1&&a===l&&L(i.start+i.count-1,n.width,4)===a?t.count=Math.max(t.count,i.start+i.count-t.start):s[++o]=i}s.length=o+1;let l=e.getParameter(e.UNPACK_ROW_LENGTH),h=e.getParameter(e.UNPACK_SKIP_PIXELS),c=e.getParameter(e.UNPACK_SKIP_ROWS);e.pixelStorei(e.UNPACK_ROW_LENGTH,n.width);for(let t=0,o=s.length;t<o;t++){let o=s[t],l=Math.floor(o.start/4),h=Math.ceil(o.count/4),c=l%n.width,u=Math.floor(l/n.width);e.pixelStorei(e.UNPACK_SKIP_PIXELS,c),e.pixelStorei(e.UNPACK_SKIP_ROWS,u),i.texSubImage2D(e.TEXTURE_2D,0,c,u,h,1,r,a,n.data)}t.clearUpdateRanges(),e.pixelStorei(e.UNPACK_ROW_LENGTH,l),e.pixelStorei(e.UNPACK_SKIP_PIXELS,h),e.pixelStorei(e.UNPACK_SKIP_ROWS,c)}}(s,f,M,S)):i.texImage2D(e.TEXTURE_2D,0,b,f.width,f.height,0,M,S,f.data);else if(s.isCompressedTexture)if(s.isCompressedArrayTexture){E&&w&&i.texStorage3D(e.TEXTURE_2D_ARRAY,R,b,T[0].width,T[0].height,f.depth);for(let n=0,r=T.length;n<r;n++)if(t=T[n],1023!==s.format)if(null!==M)if(E){if(A)if(s.layerUpdates.size>0){let r=nJ(t.width,t.height,s.format,s.type);for(let a of s.layerUpdates){let s=t.data.subarray(a*r/t.data.BYTES_PER_ELEMENT,(a+1)*r/t.data.BYTES_PER_ELEMENT);i.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,n,0,0,a,t.width,t.height,1,M,s)}s.clearLayerUpdates()}else i.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,n,0,0,0,t.width,t.height,f.depth,M,t.data)}else i.compressedTexImage3D(e.TEXTURE_2D_ARRAY,n,b,t.width,t.height,f.depth,0,t.data,0,0);else W("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else E?A&&i.texSubImage3D(e.TEXTURE_2D_ARRAY,n,0,0,0,t.width,t.height,f.depth,M,S,t.data):i.texImage3D(e.TEXTURE_2D_ARRAY,n,b,t.width,t.height,f.depth,0,M,S,t.data)}else{E&&w&&i.texStorage2D(e.TEXTURE_2D,R,b,T[0].width,T[0].height);for(let n=0,r=T.length;n<r;n++)t=T[n],1023!==s.format?null!==M?E?A&&i.compressedTexSubImage2D(e.TEXTURE_2D,n,0,0,t.width,t.height,M,t.data):i.compressedTexImage2D(e.TEXTURE_2D,n,b,t.width,t.height,0,t.data):W("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):E?A&&i.texSubImage2D(e.TEXTURE_2D,n,0,0,t.width,t.height,M,S,t.data):i.texImage2D(e.TEXTURE_2D,n,b,t.width,t.height,0,M,S,t.data)}else if(s.isDataArrayTexture)if(E){if(w&&i.texStorage3D(e.TEXTURE_2D_ARRAY,R,b,f.width,f.height,f.depth),A)if(s.layerUpdates.size>0){let t=nJ(f.width,f.height,s.format,s.type);for(let n of s.layerUpdates){let r=f.data.subarray(n*t/f.data.BYTES_PER_ELEMENT,(n+1)*t/f.data.BYTES_PER_ELEMENT);i.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,n,f.width,f.height,1,M,S,r)}s.clearLayerUpdates()}else i.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,f.width,f.height,f.depth,M,S,f.data)}else i.texImage3D(e.TEXTURE_2D_ARRAY,0,b,f.width,f.height,f.depth,0,M,S,f.data);else if(s.isData3DTexture)E?(w&&i.texStorage3D(e.TEXTURE_3D,R,b,f.width,f.height,f.depth),A&&i.texSubImage3D(e.TEXTURE_3D,0,0,0,0,f.width,f.height,f.depth,M,S,f.data)):i.texImage3D(e.TEXTURE_3D,0,b,f.width,f.height,f.depth,0,M,S,f.data);else if(s.isFramebufferTexture){if(w)if(E)i.texStorage2D(e.TEXTURE_2D,R,b,f.width,f.height);else{let t=f.width,n=f.height;for(let r=0;r<R;r++)i.texImage2D(e.TEXTURE_2D,r,b,t,n,0,M,S,null),t>>=1,n>>=1}}else if(T.length>0){if(E&&w){let t=q(T[0]);i.texStorage2D(e.TEXTURE_2D,R,b,t.width,t.height)}for(let n=0,r=T.length;n<r;n++)t=T[n],E?A&&i.texSubImage2D(e.TEXTURE_2D,n,0,0,M,S,t):i.texImage2D(e.TEXTURE_2D,n,b,M,S,t);s.generateMipmaps=!1}else if(E){if(w){let t=q(f);i.texStorage2D(e.TEXTURE_2D,R,b,t.width,t.height)}A&&i.texSubImage2D(e.TEXTURE_2D,0,0,0,M,S,f)}else i.texImage2D(e.TEXTURE_2D,0,b,M,S,f);g(s)&&_(l),u.__version=c.version,s.onUpdate&&s.onUpdate(s)}t.__version=s.version}function D(t,r,s,o,h,c){let u=a.convert(s.format,s.colorSpace),d=a.convert(s.type),p=v(s.internalFormat,u,d,s.colorSpace),f=n.get(r),m=n.get(s);if(m.__renderTarget=r,!f.__hasExternalTextures){let t=Math.max(1,r.width>>c),n=Math.max(1,r.height>>c);h===e.TEXTURE_3D||h===e.TEXTURE_2D_ARRAY?i.texImage3D(h,c,p,t,n,r.depth,0,u,d,null):i.texImage2D(h,c,p,t,n,0,u,d,null)}i.bindFramebuffer(e.FRAMEBUFFER,t),j(r)?l.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,o,h,m.__webglTexture,0,G(r)):(h===e.TEXTURE_2D||h>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&h<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,o,h,m.__webglTexture,c),i.bindFramebuffer(e.FRAMEBUFFER,null)}function I(t,i,n){if(e.bindRenderbuffer(e.RENDERBUFFER,t),i.depthBuffer){let r=i.depthTexture,a=r&&r.isDepthTexture?r.type:null,s=x(i.stencilBuffer,a),o=i.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;j(i)?l.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,G(i),s,i.width,i.height):n?e.renderbufferStorageMultisample(e.RENDERBUFFER,G(i),s,i.width,i.height):e.renderbufferStorage(e.RENDERBUFFER,s,i.width,i.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,o,e.RENDERBUFFER,t)}else{let t=i.textures;for(let r=0;r<t.length;r++){let s=t[r],o=a.convert(s.format,s.colorSpace),h=a.convert(s.type),c=v(s.internalFormat,o,h,s.colorSpace);j(i)?l.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,G(i),c,i.width,i.height):n?e.renderbufferStorageMultisample(e.RENDERBUFFER,G(i),c,i.width,i.height):e.renderbufferStorage(e.RENDERBUFFER,c,i.width,i.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function U(t,r,s){let o=!0===r.isWebGLCubeRenderTarget;if(i.bindFramebuffer(e.FRAMEBUFFER,t),!(r.depthTexture&&r.depthTexture.isDepthTexture))throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");let h=n.get(r.depthTexture);if(h.__renderTarget=r,h.__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),o){if(void 0===h.__webglInit&&(h.__webglInit=!0,r.depthTexture.addEventListener("dispose",M)),void 0===h.__webglTexture){let t;h.__webglTexture=e.createTexture(),i.bindTexture(e.TEXTURE_CUBE_MAP,h.__webglTexture),C(e.TEXTURE_CUBE_MAP,r.depthTexture);let n=a.convert(r.depthTexture.format),s=a.convert(r.depthTexture.type);1026===r.depthTexture.format?t=e.DEPTH_COMPONENT24:1027===r.depthTexture.format&&(t=e.DEPTH24_STENCIL8);for(let i=0;i<6;i++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,t,r.width,r.height,0,n,s,null)}}else E(r.depthTexture,0);let c=h.__webglTexture,u=G(r),d=o?e.TEXTURE_CUBE_MAP_POSITIVE_X+s:e.TEXTURE_2D,p=1027===r.depthTexture.format?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;if(1026===r.depthTexture.format)j(r)?l.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,p,d,c,0,u):e.framebufferTexture2D(e.FRAMEBUFFER,p,d,c,0);else if(1027===r.depthTexture.format)j(r)?l.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,p,d,c,0,u):e.framebufferTexture2D(e.FRAMEBUFFER,p,d,c,0);else throw Error("Unknown depthTexture format")}function O(t){let r=n.get(t),a=!0===t.isWebGLCubeRenderTarget;if(r.__boundDepthTexture!==t.depthTexture){let e=t.depthTexture;if(r.__depthDisposeCallback&&r.__depthDisposeCallback(),e){let t=()=>{delete r.__boundDepthTexture,delete r.__depthDisposeCallback,e.removeEventListener("dispose",t)};e.addEventListener("dispose",t),r.__depthDisposeCallback=t}r.__boundDepthTexture=e}if(t.depthTexture&&!r.__autoAllocateDepthBuffer)if(a)for(let e=0;e<6;e++)U(r.__webglFramebuffer[e],t,e);else{let e=t.texture.mipmaps;e&&e.length>0?U(r.__webglFramebuffer[0],t,0):U(r.__webglFramebuffer,t,0)}else if(a){r.__webglDepthbuffer=[];for(let n=0;n<6;n++)if(i.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer[n]),void 0===r.__webglDepthbuffer[n])r.__webglDepthbuffer[n]=e.createRenderbuffer(),I(r.__webglDepthbuffer[n],t,!1);else{let i=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,a=r.__webglDepthbuffer[n];e.bindRenderbuffer(e.RENDERBUFFER,a),e.framebufferRenderbuffer(e.FRAMEBUFFER,i,e.RENDERBUFFER,a)}}else{let n=t.texture.mipmaps;if(n&&n.length>0?i.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer[0]):i.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer),void 0===r.__webglDepthbuffer)r.__webglDepthbuffer=e.createRenderbuffer(),I(r.__webglDepthbuffer,t,!1);else{let i=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,n=r.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,n),e.framebufferRenderbuffer(e.FRAMEBUFFER,i,e.RENDERBUFFER,n)}}i.bindFramebuffer(e.FRAMEBUFFER,null)}let z=[],H=[];function G(e){return Math.min(r.maxSamples,e.samples)}function j(e){let i=n.get(e);return e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==i.__useRenderToTexture}function Y(e,t){let i=e.colorSpace,n=e.format,r=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||i!==F&&""!==i&&(ep.getTransfer(i)===k?(1023!==n||1009!==r)&&W("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):X("WebGLTextures: Unsupported texture color space:",i)),t}function q(e){return"u">typeof HTMLImageElement&&e instanceof HTMLImageElement?(c.width=e.naturalWidth||e.width,c.height=e.naturalHeight||e.height):"u">typeof VideoFrame&&e instanceof VideoFrame?(c.width=e.displayWidth,c.height=e.displayHeight):(c.width=e.width,c.height=e.height),c}this.allocateTextureUnit=function(){let e=T;return e>=r.maxTextures&&W("WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+r.maxTextures),T+=1,e},this.resetTextureUnits=function(){T=0},this.setTexture2D=E,this.setTexture2DArray=function(t,r){let a=n.get(t);!1===t.isRenderTargetTexture&&t.version>0&&a.__version!==t.version?N(a,t,r):(t.isExternalTexture&&(a.__webglTexture=t.sourceTexture?t.sourceTexture:null),i.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+r))},this.setTexture3D=function(t,r){let a=n.get(t);!1===t.isRenderTargetTexture&&t.version>0&&a.__version!==t.version?N(a,t,r):i.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+r)},this.setTextureCube=function(t,s){let o=n.get(t);!0!==t.isCubeDepthTexture&&t.version>0&&o.__version!==t.version?function(t,s,o){if(6!==s.image.length)return;let l=P(t,s),h=s.source;i.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+o);let c=n.get(h);if(h.version!==c.__version||!0===l){let t;i.activeTexture(e.TEXTURE0+o);let n=ep.getPrimaries(ep.workingColorSpace),u=""===s.colorSpace?null:ep.getPrimaries(s.colorSpace),d=""===s.colorSpace||n===u?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,s.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,s.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,d);let p=s.isCompressedTexture||s.image[0].isCompressedTexture,f=s.image[0]&&s.image[0].isDataTexture,x=[];for(let e=0;e<6;e++)p||f?x[e]=f?s.image[e].image:s.image[e]:x[e]=m(s.image[e],!0,r.maxCubemapSize),x[e]=Y(s,x[e]);let M=x[0],S=a.convert(s.format,s.colorSpace),b=a.convert(s.type),T=v(s.internalFormat,S,b,s.colorSpace),E=!0!==s.isVideoTexture,w=void 0===c.__version||!0===l,A=h.dataReady,R=y(s,M);if(C(e.TEXTURE_CUBE_MAP,s),p){E&&w&&i.texStorage2D(e.TEXTURE_CUBE_MAP,R,T,M.width,M.height);for(let n=0;n<6;n++){t=x[n].mipmaps;for(let r=0;r<t.length;r++){let a=t[r];1023!==s.format?null!==S?E?A&&i.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,r,0,0,a.width,a.height,S,a.data):i.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,r,T,a.width,a.height,0,a.data):W("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):E?A&&i.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,r,0,0,a.width,a.height,S,b,a.data):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,r,T,a.width,a.height,0,S,b,a.data)}}}else{if(t=s.mipmaps,E&&w){t.length>0&&R++;let n=q(x[0]);i.texStorage2D(e.TEXTURE_CUBE_MAP,R,T,n.width,n.height)}for(let n=0;n<6;n++)if(f){E?A&&i.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,0,0,x[n].width,x[n].height,S,b,x[n].data):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,T,x[n].width,x[n].height,0,S,b,x[n].data);for(let r=0;r<t.length;r++){let a=t[r].image[n].image;E?A&&i.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,r+1,0,0,a.width,a.height,S,b,a.data):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,r+1,T,a.width,a.height,0,S,b,a.data)}}else{E?A&&i.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,0,0,S,b,x[n]):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,T,S,b,x[n]);for(let r=0;r<t.length;r++){let a=t[r];E?A&&i.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,r+1,0,0,S,b,a.image[n]):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,r+1,T,S,b,a.image[n])}}}g(s)&&_(e.TEXTURE_CUBE_MAP),c.__version=h.version,s.onUpdate&&s.onUpdate(s)}t.__version=s.version}(o,t,s):i.bindTexture(e.TEXTURE_CUBE_MAP,o.__webglTexture,e.TEXTURE0+s)},this.rebindTextures=function(t,i,r){let a=n.get(t);void 0!==i&&D(a.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),void 0!==r&&O(t)},this.setupRenderTarget=function(t){let r=t.texture,o=n.get(t),l=n.get(r);t.addEventListener("dispose",S);let h=t.textures,c=!0===t.isWebGLCubeRenderTarget,u=h.length>1;if(!u&&(void 0===l.__webglTexture&&(l.__webglTexture=e.createTexture()),l.__version=r.version,s.memory.textures++),c){o.__webglFramebuffer=[];for(let t=0;t<6;t++)if(r.mipmaps&&r.mipmaps.length>0){o.__webglFramebuffer[t]=[];for(let i=0;i<r.mipmaps.length;i++)o.__webglFramebuffer[t][i]=e.createFramebuffer()}else o.__webglFramebuffer[t]=e.createFramebuffer()}else{if(r.mipmaps&&r.mipmaps.length>0){o.__webglFramebuffer=[];for(let t=0;t<r.mipmaps.length;t++)o.__webglFramebuffer[t]=e.createFramebuffer()}else o.__webglFramebuffer=e.createFramebuffer();if(u)for(let t=0,i=h.length;t<i;t++){let i=n.get(h[t]);void 0===i.__webglTexture&&(i.__webglTexture=e.createTexture(),s.memory.textures++)}if(t.samples>0&&!1===j(t)){o.__webglMultisampledFramebuffer=e.createFramebuffer(),o.__webglColorRenderbuffer=[],i.bindFramebuffer(e.FRAMEBUFFER,o.__webglMultisampledFramebuffer);for(let i=0;i<h.length;i++){let n=h[i];o.__webglColorRenderbuffer[i]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,o.__webglColorRenderbuffer[i]);let r=a.convert(n.format,n.colorSpace),s=a.convert(n.type),l=v(n.internalFormat,r,s,n.colorSpace,!0===t.isXRRenderTarget),c=G(t);e.renderbufferStorageMultisample(e.RENDERBUFFER,c,l,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+i,e.RENDERBUFFER,o.__webglColorRenderbuffer[i])}e.bindRenderbuffer(e.RENDERBUFFER,null),t.depthBuffer&&(o.__webglDepthRenderbuffer=e.createRenderbuffer(),I(o.__webglDepthRenderbuffer,t,!0)),i.bindFramebuffer(e.FRAMEBUFFER,null)}}if(c){i.bindTexture(e.TEXTURE_CUBE_MAP,l.__webglTexture),C(e.TEXTURE_CUBE_MAP,r);for(let i=0;i<6;i++)if(r.mipmaps&&r.mipmaps.length>0)for(let n=0;n<r.mipmaps.length;n++)D(o.__webglFramebuffer[i][n],t,r,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+i,n);else D(o.__webglFramebuffer[i],t,r,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+i,0);g(r)&&_(e.TEXTURE_CUBE_MAP),i.unbindTexture()}else if(u){for(let r=0,a=h.length;r<a;r++){let a=h[r],s=n.get(a),l=e.TEXTURE_2D;(t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(l=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),i.bindTexture(l,s.__webglTexture),C(l,a),D(o.__webglFramebuffer,t,a,e.COLOR_ATTACHMENT0+r,l,0),g(a)&&_(l)}i.unbindTexture()}else{let n=e.TEXTURE_2D;if((t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(n=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),i.bindTexture(n,l.__webglTexture),C(n,r),r.mipmaps&&r.mipmaps.length>0)for(let i=0;i<r.mipmaps.length;i++)D(o.__webglFramebuffer[i],t,r,e.COLOR_ATTACHMENT0,n,i);else D(o.__webglFramebuffer,t,r,e.COLOR_ATTACHMENT0,n,0);g(r)&&_(n),i.unbindTexture()}t.depthBuffer&&O(t)},this.updateRenderTargetMipmap=function(t){let r=t.textures;for(let a=0,s=r.length;a<s;a++){let s=r[a];if(g(s)){let r=t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:t.isWebGL3DRenderTarget?e.TEXTURE_3D:t.isWebGLArrayRenderTarget||t.isCompressedArrayTexture?e.TEXTURE_2D_ARRAY:e.TEXTURE_2D,a=n.get(s).__webglTexture;i.bindTexture(r,a),_(r),i.unbindTexture()}}},this.updateMultisampleRenderTarget=function(t){if(t.samples>0){if(!1===j(t)){let r=t.textures,a=t.width,s=t.height,o=e.COLOR_BUFFER_BIT,l=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,c=n.get(t),u=r.length>1;if(u)for(let t=0;t<r.length;t++)i.bindFramebuffer(e.FRAMEBUFFER,c.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,null),i.bindFramebuffer(e.FRAMEBUFFER,c.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,null,0);i.bindFramebuffer(e.READ_FRAMEBUFFER,c.__webglMultisampledFramebuffer);let d=t.texture.mipmaps;d&&d.length>0?i.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglFramebuffer[0]):i.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglFramebuffer);for(let i=0;i<r.length;i++){if(t.resolveDepthBuffer&&(t.depthBuffer&&(o|=e.DEPTH_BUFFER_BIT),t.stencilBuffer&&t.resolveStencilBuffer&&(o|=e.STENCIL_BUFFER_BIT)),u){e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,c.__webglColorRenderbuffer[i]);let t=n.get(r[i]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)}e.blitFramebuffer(0,0,a,s,0,0,a,s,o,e.NEAREST),!0===h&&(z.length=0,H.length=0,z.push(e.COLOR_ATTACHMENT0+i),t.depthBuffer&&!1===t.resolveDepthBuffer&&(z.push(l),H.push(l),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,H)),e.invalidateFramebuffer(e.READ_FRAMEBUFFER,z))}if(i.bindFramebuffer(e.READ_FRAMEBUFFER,null),i.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),u)for(let t=0;t<r.length;t++){i.bindFramebuffer(e.FRAMEBUFFER,c.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,c.__webglColorRenderbuffer[t]);let a=n.get(r[t]).__webglTexture;i.bindFramebuffer(e.FRAMEBUFFER,c.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,a,0)}i.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglMultisampledFramebuffer)}else if(t.depthBuffer&&!1===t.resolveDepthBuffer&&h){let i=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[i])}}},this.setupDepthRenderbuffer=O,this.setupFrameBufferTexture=D,this.useMultisampledRTT=j,this.isReversedDepthBuffer=function(){return i.buffers.depth.getReversed()}}function se(e,t){return{convert:function(i,n=""){let r,a=ep.getTransfer(n);if(1009===i)return e.UNSIGNED_BYTE;if(1017===i)return e.UNSIGNED_SHORT_4_4_4_4;if(1018===i)return e.UNSIGNED_SHORT_5_5_5_1;if(35902===i)return e.UNSIGNED_INT_5_9_9_9_REV;if(35899===i)return e.UNSIGNED_INT_10F_11F_11F_REV;if(1010===i)return e.BYTE;if(1011===i)return e.SHORT;if(1012===i)return e.UNSIGNED_SHORT;if(1013===i)return e.INT;if(1014===i)return e.UNSIGNED_INT;if(1015===i)return e.FLOAT;if(1016===i)return e.HALF_FLOAT;if(1021===i)return e.ALPHA;if(1022===i)return e.RGB;if(1023===i)return e.RGBA;if(1026===i)return e.DEPTH_COMPONENT;if(1027===i)return e.DEPTH_STENCIL;if(1028===i)return e.RED;if(1029===i)return e.RED_INTEGER;if(1030===i)return e.RG;if(1031===i)return e.RG_INTEGER;if(1033===i)return e.RGBA_INTEGER;if(33776===i||33777===i||33778===i||33779===i)if(a===k){if(null===(r=t.get("WEBGL_compressed_texture_s3tc_srgb")))return null;if(33776===i)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(33777===i)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(33778===i)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(33779===i)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(null===(r=t.get("WEBGL_compressed_texture_s3tc")))return null;if(33776===i)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===i)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===i)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===i)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===i||35841===i||35842===i||35843===i){if(null===(r=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(35840===i)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===i)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===i)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===i)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===i||37492===i||37496===i||37488===i||37489===i||37490===i||37491===i){if(null===(r=t.get("WEBGL_compressed_texture_etc")))return null;if(36196===i||37492===i)return a===k?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(37496===i)return a===k?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC;if(37488===i)return r.COMPRESSED_R11_EAC;if(37489===i)return r.COMPRESSED_SIGNED_R11_EAC;if(37490===i)return r.COMPRESSED_RG11_EAC;if(37491===i)return r.COMPRESSED_SIGNED_RG11_EAC}if(37808===i||37809===i||37810===i||37811===i||37812===i||37813===i||37814===i||37815===i||37816===i||37817===i||37818===i||37819===i||37820===i||37821===i){if(null===(r=t.get("WEBGL_compressed_texture_astc")))return null;if(37808===i)return a===k?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(37809===i)return a===k?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(37810===i)return a===k?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(37811===i)return a===k?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(37812===i)return a===k?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(37813===i)return a===k?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(37814===i)return a===k?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(37815===i)return a===k?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(37816===i)return a===k?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(37817===i)return a===k?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(37818===i)return a===k?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(37819===i)return a===k?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(37820===i)return a===k?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(37821===i)return a===k?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}if(36492===i||36494===i||36495===i){if(null===(r=t.get("EXT_texture_compression_bptc")))return null;if(36492===i)return a===k?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(36494===i)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(36495===i)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(36283===i||36284===i||36285===i||36286===i){if(null===(r=t.get("EXT_texture_compression_rgtc")))return null;if(36283===i)return r.COMPRESSED_RED_RGTC1_EXT;if(36284===i)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(36285===i)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(36286===i)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return 1020===i?e.UNSIGNED_INT_24_8:void 0!==e[i]?e[i]:null}}}let st=`
385
+ void main() {
386
+
387
+ gl_Position = vec4( position, 1.0 );
388
+
389
+ }`,si=`
390
+ uniform sampler2DArray depthColor;
391
+ uniform float depthWidth;
392
+ uniform float depthHeight;
393
+
394
+ void main() {
395
+
396
+ vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
397
+
398
+ if ( coord.x >= 1.0 ) {
399
+
400
+ gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
401
+
402
+ } else {
403
+
404
+ gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
405
+
406
+ }
407
+
408
+ }`;class sn{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(null===this.texture){let i=new iF(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=i}}getMesh(e){if(null!==this.texture&&null===this.mesh){let t=e.cameras[0].viewport,i=new i6({vertexShader:st,fragmentShader:si,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new ih(new i0(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class sr extends K{constructor(e,t){super();const i=this;let n=null,r=1,a=null,s="local-floor",o=1,l=null,h=null,c=null,u=null,d=null,p=null;const f="u">typeof XRWebGLBinding,m=new sn,g={},_=t.getContextAttributes();let v=null,x=null;const y=[],M=[],S=new er;let b=null;const T=new nE;T.viewport=new eb;const E=new nE;E.viewport=new eb;const w=[T,E],A=new nD;let R=null,C=null;function P(e){let t=M.indexOf(e.inputSource);if(-1===t)return;let i=y[t];void 0!==i&&(i.update(e.inputSource,e.frame,l||a),i.dispatchEvent({type:e.type,data:e.inputSource}))}function L(){n.removeEventListener("select",P),n.removeEventListener("selectstart",P),n.removeEventListener("selectend",P),n.removeEventListener("squeeze",P),n.removeEventListener("squeezestart",P),n.removeEventListener("squeezeend",P),n.removeEventListener("end",L),n.removeEventListener("inputsourceschange",N);for(let e=0;e<y.length;e++){let t=M[e];null!==t&&(M[e]=null,y[e].disconnect(t))}for(let e in R=null,C=null,m.reset(),g)delete g[e];e.setRenderTarget(v),d=null,u=null,c=null,n=null,x=null,F.stop(),i.isPresenting=!1,e.setPixelRatio(b),e.setSize(S.width,S.height,!1),i.dispatchEvent({type:"sessionend"})}function N(e){for(let t=0;t<e.removed.length;t++){let i=e.removed[t],n=M.indexOf(i);n>=0&&(M[n]=null,y[n].disconnect(i))}for(let t=0;t<e.added.length;t++){let i=e.added[t],n=M.indexOf(i);if(-1===n){for(let e=0;e<y.length;e++)if(e>=M.length){M.push(i),n=e;break}else if(null===M[e]){M[e]=i,n=e;break}if(-1===n)break}let r=y[n];r&&r.connect(i)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=y[e];return void 0===t&&(t=new e3,y[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=y[e];return void 0===t&&(t=new e3,y[e]=t),t.getGripSpace()},this.getHand=function(e){let t=y[e];return void 0===t&&(t=new e3,y[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){r=e,!0===i.isPresenting&&W("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){s=e,!0===i.isPresenting&&W("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(e){l=e},this.getBaseLayer=function(){return null!==u?u:d},this.getBinding=function(){return null===c&&f&&(c=new XRWebGLBinding(n,t)),c},this.getFrame=function(){return p},this.getSession=function(){return n},this.setSession=async function(h){if(null!==(n=h)){if(v=e.getRenderTarget(),n.addEventListener("select",P),n.addEventListener("selectstart",P),n.addEventListener("selectend",P),n.addEventListener("squeeze",P),n.addEventListener("squeezestart",P),n.addEventListener("squeezeend",P),n.addEventListener("end",L),n.addEventListener("inputsourceschange",N),!0!==_.xrCompatible&&await t.makeXRCompatible(),b=e.getPixelRatio(),e.getSize(S),f&&"createProjectionLayer"in XRWebGLBinding.prototype){let i=null,a=null,s=null;_.depth&&(s=_.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,i=_.stencil?1027:1026,a=_.stencil?1020:1014);let o={colorFormat:t.RGBA8,depthFormat:s,scaleFactor:r};u=(c=this.getBinding()).createProjectionLayer(o),n.updateRenderState({layers:[u]}),e.setPixelRatio(1),e.setSize(u.textureWidth,u.textureHeight,!1),x=new eE(u.textureWidth,u.textureHeight,{format:1023,type:1009,depthTexture:new iU(u.textureWidth,u.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,i),stencilBuffer:_.stencil,colorSpace:e.outputColorSpace,samples:4*!!_.antialias,resolveDepthBuffer:!1===u.ignoreDepthValues,resolveStencilBuffer:!1===u.ignoreDepthValues})}else{let i={antialias:_.antialias,alpha:!0,depth:_.depth,stencil:_.stencil,framebufferScaleFactor:r};d=new XRWebGLLayer(n,t,i),n.updateRenderState({baseLayer:d}),e.setPixelRatio(1),e.setSize(d.framebufferWidth,d.framebufferHeight,!1),x=new eE(d.framebufferWidth,d.framebufferHeight,{format:1023,type:1009,colorSpace:e.outputColorSpace,stencilBuffer:_.stencil,resolveDepthBuffer:!1===d.ignoreDepthValues,resolveStencilBuffer:!1===d.ignoreDepthValues})}x.isXRRenderTarget=!0,this.setFoveation(o),l=null,a=await n.requestReferenceSpace(s),F.setContext(n),F.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==n)return n.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};const D=new es,I=new es;function U(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){var t,i,r;if(null===n)return;let a=e.near,s=e.far;null!==m.texture&&(m.depthNear>0&&(a=m.depthNear),m.depthFar>0&&(s=m.depthFar)),A.near=E.near=T.near=a,A.far=E.far=T.far=s,(R!==A.near||C!==A.far)&&(n.updateRenderState({depthNear:A.near,depthFar:A.far}),R=A.near,C=A.far),A.layers.mask=6|e.layers.mask,T.layers.mask=-5&A.layers.mask,E.layers.mask=-3&A.layers.mask;let o=e.parent,l=A.cameras;U(A,o);for(let e=0;e<l.length;e++)U(l[e],o);2===l.length?function(e,t,i){D.setFromMatrixPosition(t.matrixWorld),I.setFromMatrixPosition(i.matrixWorld);let n=D.distanceTo(I),r=t.projectionMatrix.elements,a=i.projectionMatrix.elements,s=r[14]/(r[10]-1),o=r[14]/(r[10]+1),l=(r[9]+1)/r[5],h=(r[9]-1)/r[5],c=(r[8]-1)/r[0],u=(a[8]+1)/a[0],d=n/(-c+u),p=-(d*c);if(t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(p),e.translateZ(d),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert(),-1===r[10])e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse);else{let t=s+d,i=o+d;e.projectionMatrix.makePerspective(s*c-p,s*u+(n-p),l*o/i*t,h*o/i*t,t,i),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}}(A,T,E):A.projectionMatrix.copy(T.projectionMatrix),t=e,i=A,null===(r=o)?t.matrix.copy(i.matrixWorld):(t.matrix.copy(r.matrixWorld),t.matrix.invert(),t.matrix.multiply(i.matrixWorld)),t.matrix.decompose(t.position,t.quaternion,t.scale),t.updateMatrixWorld(!0),t.projectionMatrix.copy(i.projectionMatrix),t.projectionMatrixInverse.copy(i.projectionMatrixInverse),t.isPerspectiveCamera&&(t.fov=2*$*Math.atan(1/t.projectionMatrix.elements[5]),t.zoom=1)},this.getCamera=function(){return A},this.getFoveation=function(){if(null!==u||null!==d)return o},this.setFoveation=function(e){o=e,null!==u&&(u.fixedFoveation=e),null!==d&&void 0!==d.fixedFoveation&&(d.fixedFoveation=e)},this.hasDepthSensing=function(){return null!==m.texture},this.getDepthSensingMesh=function(){return m.getMesh(A)},this.getCameraTexture=function(e){return g[e]};let O=null;const F=new n$;F.setAnimationLoop(function(t,r){if(h=r.getViewerPose(l||a),p=r,null!==h){let t=h.views;null!==d&&(e.setRenderTargetFramebuffer(x,d.framebuffer),e.setRenderTarget(x));let r=!1;t.length!==A.cameras.length&&(A.cameras.length=0,r=!0);for(let i=0;i<t.length;i++){let n=t[i],a=null;if(null!==d)a=d.getViewport(n);else{let t=c.getViewSubImage(u,n);a=t.viewport,0===i&&(e.setRenderTargetTextures(x,t.colorTexture,t.depthStencilTexture),e.setRenderTarget(x))}let s=w[i];void 0===s&&((s=new nE).layers.enable(i),s.viewport=new eb,w[i]=s),s.matrix.fromArray(n.transform.matrix),s.matrix.decompose(s.position,s.quaternion,s.scale),s.projectionMatrix.fromArray(n.projectionMatrix),s.projectionMatrixInverse.copy(s.projectionMatrix).invert(),s.viewport.set(a.x,a.y,a.width,a.height),0===i&&(A.matrix.copy(s.matrix),A.matrix.decompose(A.position,A.quaternion,A.scale)),!0===r&&A.cameras.push(s)}let a=n.enabledFeatures;if(a&&a.includes("depth-sensing")&&"gpu-optimized"==n.depthUsage&&f){let e=(c=i.getBinding()).getDepthInformation(t[0]);e&&e.isValid&&e.texture&&m.init(e,n.renderState)}if(a&&a.includes("camera-access")&&f){e.state.unbindTexture(),c=i.getBinding();for(let e=0;e<t.length;e++){let i=t[e].camera;if(i){let e=g[i];e||(e=new iF,g[i]=e);let t=c.getCameraImage(i);e.sourceTexture=t}}}}for(let e=0;e<y.length;e++){let t=M[e],i=y[e];null!==t&&void 0!==i&&i.update(t,r,l||a)}O&&O(t,r),r.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:r}),p=null}),this.setAnimationLoop=function(e){O=e},this.dispose=function(){}}}let sa=new eF,ss=new eA;function so(e,t){function i(e,t){!0===e.matrixAutoUpdate&&e.updateMatrix(),t.value.copy(e.matrix)}function n(e,n){e.opacity.value=n.opacity,n.color&&e.diffuse.value.copy(n.color),n.emissive&&e.emissive.value.copy(n.emissive).multiplyScalar(n.emissiveIntensity),n.map&&(e.map.value=n.map,i(n.map,e.mapTransform)),n.alphaMap&&(e.alphaMap.value=n.alphaMap,i(n.alphaMap,e.alphaMapTransform)),n.bumpMap&&(e.bumpMap.value=n.bumpMap,i(n.bumpMap,e.bumpMapTransform),e.bumpScale.value=n.bumpScale,1===n.side&&(e.bumpScale.value*=-1)),n.normalMap&&(e.normalMap.value=n.normalMap,i(n.normalMap,e.normalMapTransform),e.normalScale.value.copy(n.normalScale),1===n.side&&e.normalScale.value.negate()),n.displacementMap&&(e.displacementMap.value=n.displacementMap,i(n.displacementMap,e.displacementMapTransform),e.displacementScale.value=n.displacementScale,e.displacementBias.value=n.displacementBias),n.emissiveMap&&(e.emissiveMap.value=n.emissiveMap,i(n.emissiveMap,e.emissiveMapTransform)),n.specularMap&&(e.specularMap.value=n.specularMap,i(n.specularMap,e.specularMapTransform)),n.alphaTest>0&&(e.alphaTest.value=n.alphaTest);let r=t.get(n),a=r.envMap,s=r.envMapRotation;a&&(e.envMap.value=a,sa.copy(s),sa.x*=-1,sa.y*=-1,sa.z*=-1,a.isCubeTexture&&!1===a.isRenderTargetTexture&&(sa.y*=-1,sa.z*=-1),e.envMapRotation.value.setFromMatrix4(ss.makeRotationFromEuler(sa)),e.flipEnvMap.value=a.isCubeTexture&&!1===a.isRenderTargetTexture?-1:1,e.reflectivity.value=n.reflectivity,e.ior.value=n.ior,e.refractionRatio.value=n.refractionRatio),n.lightMap&&(e.lightMap.value=n.lightMap,e.lightMapIntensity.value=n.lightMapIntensity,i(n.lightMap,e.lightMapTransform)),n.aoMap&&(e.aoMap.value=n.aoMap,e.aoMapIntensity.value=n.aoMapIntensity,i(n.aoMap,e.aoMapTransform))}return{refreshFogUniforms:function(t,i){i.color.getRGB(t.fogColor.value,i5(e)),i.isFog?(t.fogNear.value=i.near,t.fogFar.value=i.far):i.isFogExp2&&(t.fogDensity.value=i.density)},refreshMaterialUniforms:function(e,r,a,s,o){var l,h,c,u,d,p,f,m,g,_,v,x,y,M,S,b,T,E,w,A,R,C,P;let L;r.isMeshBasicMaterial?n(e,r):r.isMeshLambertMaterial?(n(e,r),r.envMap&&(e.envMapIntensity.value=r.envMapIntensity)):r.isMeshToonMaterial?(n(e,r),l=e,(h=r).gradientMap&&(l.gradientMap.value=h.gradientMap)):r.isMeshPhongMaterial?(n(e,r),c=e,u=r,c.specular.value.copy(u.specular),c.shininess.value=Math.max(u.shininess,1e-4),r.envMap&&(e.envMapIntensity.value=r.envMapIntensity)):r.isMeshStandardMaterial?(n(e,r),d=e,p=r,d.metalness.value=p.metalness,p.metalnessMap&&(d.metalnessMap.value=p.metalnessMap,i(p.metalnessMap,d.metalnessMapTransform)),d.roughness.value=p.roughness,p.roughnessMap&&(d.roughnessMap.value=p.roughnessMap,i(p.roughnessMap,d.roughnessMapTransform)),p.envMap&&(d.envMapIntensity.value=p.envMapIntensity),r.isMeshPhysicalMaterial&&(f=e,m=r,g=o,f.ior.value=m.ior,m.sheen>0&&(f.sheenColor.value.copy(m.sheenColor).multiplyScalar(m.sheen),f.sheenRoughness.value=m.sheenRoughness,m.sheenColorMap&&(f.sheenColorMap.value=m.sheenColorMap,i(m.sheenColorMap,f.sheenColorMapTransform)),m.sheenRoughnessMap&&(f.sheenRoughnessMap.value=m.sheenRoughnessMap,i(m.sheenRoughnessMap,f.sheenRoughnessMapTransform))),m.clearcoat>0&&(f.clearcoat.value=m.clearcoat,f.clearcoatRoughness.value=m.clearcoatRoughness,m.clearcoatMap&&(f.clearcoatMap.value=m.clearcoatMap,i(m.clearcoatMap,f.clearcoatMapTransform)),m.clearcoatRoughnessMap&&(f.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap,i(m.clearcoatRoughnessMap,f.clearcoatRoughnessMapTransform)),m.clearcoatNormalMap&&(f.clearcoatNormalMap.value=m.clearcoatNormalMap,i(m.clearcoatNormalMap,f.clearcoatNormalMapTransform),f.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),1===m.side&&f.clearcoatNormalScale.value.negate())),m.dispersion>0&&(f.dispersion.value=m.dispersion),m.iridescence>0&&(f.iridescence.value=m.iridescence,f.iridescenceIOR.value=m.iridescenceIOR,f.iridescenceThicknessMinimum.value=m.iridescenceThicknessRange[0],f.iridescenceThicknessMaximum.value=m.iridescenceThicknessRange[1],m.iridescenceMap&&(f.iridescenceMap.value=m.iridescenceMap,i(m.iridescenceMap,f.iridescenceMapTransform)),m.iridescenceThicknessMap&&(f.iridescenceThicknessMap.value=m.iridescenceThicknessMap,i(m.iridescenceThicknessMap,f.iridescenceThicknessMapTransform))),m.transmission>0&&(f.transmission.value=m.transmission,f.transmissionSamplerMap.value=g.texture,f.transmissionSamplerSize.value.set(g.width,g.height),m.transmissionMap&&(f.transmissionMap.value=m.transmissionMap,i(m.transmissionMap,f.transmissionMapTransform)),f.thickness.value=m.thickness,m.thicknessMap&&(f.thicknessMap.value=m.thicknessMap,i(m.thicknessMap,f.thicknessMapTransform)),f.attenuationDistance.value=m.attenuationDistance,f.attenuationColor.value.copy(m.attenuationColor)),m.anisotropy>0&&(f.anisotropyVector.value.set(m.anisotropy*Math.cos(m.anisotropyRotation),m.anisotropy*Math.sin(m.anisotropyRotation)),m.anisotropyMap&&(f.anisotropyMap.value=m.anisotropyMap,i(m.anisotropyMap,f.anisotropyMapTransform))),f.specularIntensity.value=m.specularIntensity,f.specularColor.value.copy(m.specularColor),m.specularColorMap&&(f.specularColorMap.value=m.specularColorMap,i(m.specularColorMap,f.specularColorMapTransform)),m.specularIntensityMap&&(f.specularIntensityMap.value=m.specularIntensityMap,i(m.specularIntensityMap,f.specularIntensityMapTransform)))):r.isMeshMatcapMaterial?(n(e,r),_=e,(v=r).matcap&&(_.matcap.value=v.matcap)):r.isMeshDepthMaterial?n(e,r):r.isMeshDistanceMaterial?(n(e,r),x=e,y=r,L=t.get(y).light,x.referencePosition.value.setFromMatrixPosition(L.matrixWorld),x.nearDistance.value=L.shadow.camera.near,x.farDistance.value=L.shadow.camera.far):r.isMeshNormalMaterial?n(e,r):r.isLineBasicMaterial?(M=e,S=r,M.diffuse.value.copy(S.color),M.opacity.value=S.opacity,S.map&&(M.map.value=S.map,i(S.map,M.mapTransform)),r.isLineDashedMaterial&&(b=e,T=r,b.dashSize.value=T.dashSize,b.totalSize.value=T.dashSize+T.gapSize,b.scale.value=T.scale)):r.isPointsMaterial?(E=e,w=r,A=a,R=s,E.diffuse.value.copy(w.color),E.opacity.value=w.opacity,E.size.value=w.size*A,E.scale.value=.5*R,w.map&&(E.map.value=w.map,i(w.map,E.uvTransform)),w.alphaMap&&(E.alphaMap.value=w.alphaMap,i(w.alphaMap,E.alphaMapTransform)),w.alphaTest>0&&(E.alphaTest.value=w.alphaTest)):r.isSpriteMaterial?(C=e,P=r,C.diffuse.value.copy(P.color),C.opacity.value=P.opacity,C.rotation.value=P.rotation,P.map&&(C.map.value=P.map,i(P.map,C.mapTransform)),P.alphaMap&&(C.alphaMap.value=P.alphaMap,i(P.alphaMap,C.alphaMapTransform)),P.alphaTest>0&&(C.alphaTest.value=P.alphaTest)):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function sl(e,t,i,n){let r={},a={},s=[],o=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function l(e){let t={boundary:0,storage:0};return"number"==typeof e||"boolean"==typeof e?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?W("WebGLRenderer: Texture samplers can not be part of an uniforms group."):W("WebGLRenderer: Unsupported uniform value type.",e),t}function h(t){let i=t.target;i.removeEventListener("dispose",h);let n=s.indexOf(i.__bindingPointIndex);s.splice(n,1),e.deleteBuffer(r[i.id]),delete r[i.id],delete a[i.id]}return{bind:function(e,t){let i=t.program;n.uniformBlockBinding(e,i)},update:function(i,c){var u;let d,p,f,m,g=r[i.id];void 0===g&&(function(e){let t=e.uniforms,i=0;for(let e=0,n=t.length;e<n;e++){let n=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0,t=n.length;e<t;e++){let t=n[e],r=Array.isArray(t.value)?t.value:[t.value];for(let e=0,n=r.length;e<n;e++){let n=l(r[e]),a=i%16,s=a%n.boundary,o=a+s;i+=s,0!==o&&16-o<n.storage&&(i+=16-o),t.__data=new Float32Array(n.storage/Float32Array.BYTES_PER_ELEMENT),t.__offset=i,i+=n.storage}}}let n=i%16;n>0&&(i+=16-n),e.__size=i,e.__cache={}}(i),(u=i).__bindingPointIndex=d=function(){for(let e=0;e<o;e++)if(-1===s.indexOf(e))return s.push(e),e;return X("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}(),p=e.createBuffer(),f=u.__size,m=u.usage,e.bindBuffer(e.UNIFORM_BUFFER,p),e.bufferData(e.UNIFORM_BUFFER,f,m),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,d,p),g=p,r[i.id]=g,i.addEventListener("dispose",h));let _=c.program;n.updateUBOMapping(i,_);let v=t.render.frame;a[i.id]!==v&&(function(t){let i=r[t.id],n=t.uniforms,a=t.__cache;e.bindBuffer(e.UNIFORM_BUFFER,i);for(let t=0,i=n.length;t<i;t++){let i=Array.isArray(n[t])?n[t]:[n[t]];for(let n=0,r=i.length;n<r;n++){let r=i[n];if(!0===function(e,t,i,n){let r=e.value,a=t+"_"+i;if(void 0===n[a])return"number"==typeof r||"boolean"==typeof r?n[a]=r:n[a]=r.clone(),!0;{let e=n[a];if("number"==typeof r||"boolean"==typeof r){if(e!==r)return n[a]=r,!0}else if(!1===e.equals(r))return e.copy(r),!0}return!1}(r,t,n,a)){let t=r.__offset,i=Array.isArray(r.value)?r.value:[r.value],n=0;for(let a=0;a<i.length;a++){let s=i[a],o=l(s);"number"==typeof s||"boolean"==typeof s?(r.__data[0]=s,e.bufferSubData(e.UNIFORM_BUFFER,t+n,r.__data)):s.isMatrix3?(r.__data[0]=s.elements[0],r.__data[1]=s.elements[1],r.__data[2]=s.elements[2],r.__data[3]=0,r.__data[4]=s.elements[3],r.__data[5]=s.elements[4],r.__data[6]=s.elements[5],r.__data[7]=0,r.__data[8]=s.elements[6],r.__data[9]=s.elements[7],r.__data[10]=s.elements[8],r.__data[11]=0):(s.toArray(r.__data,n),n+=o.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(e.UNIFORM_BUFFER,t,r.__data)}}}e.bindBuffer(e.UNIFORM_BUFFER,null)}(i),a[i.id]=v)},dispose:function(){for(let t in r)e.deleteBuffer(r[t]);s=[],r={},a={}}}}let sh=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),sc=null;class su{constructor(e={}){let t,i,n,r,a,s,o,l,h,c,u,d,p,f,m,g,_,v,x,y,M,S,b,T;const{canvas:E=function(){let e=V("canvas");return e.style.display="block",e}(),context:w=null,depth:A=!0,stencil:R=!1,alpha:C=!1,antialias:P=!1,premultipliedAlpha:L=!0,preserveDrawingBuffer:N=!1,powerPreference:D="default",failIfMajorPerformanceCaveat:I=!1,reversedDepthBuffer:U=!1,outputBufferType:B=1009}=e;if(this.isWebGLRenderer=!0,null!==w){if("u">typeof WebGLRenderingContext&&w instanceof WebGLRenderingContext)throw Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");t=w.getContextAttributes().alpha}else t=C;const k=new Set([1033,1031,1029]),z=new Set([1009,1014,1012,1020,1017,1018]),H=new Uint32Array(4),j=new Int32Array(4);let q=null,K=null;const Z=[],J=[];let $=null;this.domElement=E,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=0,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const Q=this;let ee=!1;this._outputColorSpace=O;let et=0,ei=0,en=null,er=-1,ea=null;const eo=new eb,el=new eb;let eh=null;const ec=new e9(0);let eu=0,ed=E.width,ef=E.height,em=1,eg=null,e_=null;const ev=new eb(0,0,ed,ef),ex=new eb(0,0,ed,ef);let ey=!1;const eM=new iy;let eS=!1,eT=!1;const ew=new eA,eR=new es,eC=new eb,eP={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let eL=!1;function eN(){return null===en?em:1}let eD=w;function eI(e,t){return E.getContext(e,t)}try{if("setAttribute"in E&&E.setAttribute("data-engine","three.js r183"),E.addEventListener("webglcontextlost",eF,!1),E.addEventListener("webglcontextrestored",eB,!1),E.addEventListener("webglcontextcreationerror",ek,!1),null===eD){const e="webgl2";if(eD=eI(e,{alpha:!0,depth:A,stencil:R,antialias:P,premultipliedAlpha:L,preserveDrawingBuffer:N,powerPreference:D,failIfMajorPerformanceCaveat:I}),null===eD)if(eI(e))throw Error("Error creating WebGL context with your selected attributes.");else throw Error("Error creating WebGL context.")}}catch(e){throw X("WebGLRenderer: "+e.message),e}function eU(){(i=new r_(eD)).init(),S=new se(eD,i),n=new n7(eD,i,e,S),r=new a9(eD,i),n.reversedDepthBuffer&&U&&r.buffers.depth.setReversed(!0),a=new ry(eD),s=new aW,o=new a7(eD,i,r,s,n,S,a),l=new rg(Q),h=new nQ(eD),b=new n8(eD,h),c=new rv(eD,h,a,b),u=new rS(eD,c,h,b,a),x=new rM(eD,n,o),g=new re(s),d=new aj(Q,l,i,n,b,g),p=new so(Q,s),f=new aK,m=new a1(i),v=new n6(Q,l,r,u,t,L),_=new a8(Q,u,n),T=new sl(eD,a,n,r),y=new n9(eD,i,a),M=new rx(eD,i,a),a.programs=d.programs,Q.capabilities=n,Q.extensions=i,Q.properties=s,Q.renderLists=f,Q.shadowMap=_,Q.state=r,Q.info=a}eU(),1009!==B&&($=new rT(B,E.width,E.height,A,R));const eO=new sr(Q,eD);function eF(e){e.preventDefault(),G("WebGLRenderer: Context Lost."),ee=!0}function eB(){G("WebGLRenderer: Context Restored."),ee=!1;let e=a.autoReset,t=_.enabled,i=_.autoUpdate,n=_.needsUpdate,r=_.type;eU(),a.autoReset=e,_.enabled=t,_.autoUpdate=i,_.needsUpdate=n,_.type=r}function ek(e){X("WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function ez(e){var t,i;let n,r=e.target;r.removeEventListener("dispose",ez),i=t=r,void 0!==(n=s.get(i).programs)&&(n.forEach(function(e){d.releaseProgram(e)}),i.isShaderMaterial&&d.releaseShaderCache(i)),s.remove(t)}function eV(e,t,i){!0===e.transparent&&2===e.side&&!1===e.forceSinglePass?(e.side=1,e.needsUpdate=!0,eJ(e,t,i),e.side=0,e.needsUpdate=!0,eJ(e,t,i),e.side=2):eJ(e,t,i)}this.xr=eO,this.getContext=function(){return eD},this.getContextAttributes=function(){return eD.getContextAttributes()},this.forceContextLoss=function(){let e=i.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){let e=i.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return em},this.setPixelRatio=function(e){void 0!==e&&(em=e,this.setSize(ed,ef,!1))},this.getSize=function(e){return e.set(ed,ef)},this.setSize=function(e,t,i=!0){eO.isPresenting?W("WebGLRenderer: Can't change size while VR device is presenting."):(ed=e,ef=t,E.width=Math.floor(e*em),E.height=Math.floor(t*em),!0===i&&(E.style.width=e+"px",E.style.height=t+"px"),null!==$&&$.setSize(E.width,E.height),this.setViewport(0,0,e,t))},this.getDrawingBufferSize=function(e){return e.set(ed*em,ef*em).floor()},this.setDrawingBufferSize=function(e,t,i){ed=e,ef=t,em=i,E.width=Math.floor(e*i),E.height=Math.floor(t*i),this.setViewport(0,0,e,t)},this.setEffects=function(e){if(1009===B)return void console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");if(e){for(let t=0;t<e.length;t++)if(!0===e[t].isOutputPass){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}$.setEffects(e||[])},this.getCurrentViewport=function(e){return e.copy(eo)},this.getViewport=function(e){return e.copy(ev)},this.setViewport=function(e,t,i,n){e.isVector4?ev.set(e.x,e.y,e.z,e.w):ev.set(e,t,i,n),r.viewport(eo.copy(ev).multiplyScalar(em).round())},this.getScissor=function(e){return e.copy(ex)},this.setScissor=function(e,t,i,n){e.isVector4?ex.set(e.x,e.y,e.z,e.w):ex.set(e,t,i,n),r.scissor(el.copy(ex).multiplyScalar(em).round())},this.getScissorTest=function(){return ey},this.setScissorTest=function(e){r.setScissorTest(ey=e)},this.setOpaqueSort=function(e){eg=e},this.setTransparentSort=function(e){e_=e},this.getClearColor=function(e){return e.copy(v.getClearColor())},this.setClearColor=function(){v.setClearColor(...arguments)},this.getClearAlpha=function(){return v.getClearAlpha()},this.setClearAlpha=function(){v.setClearAlpha(...arguments)},this.clear=function(e=!0,t=!0,i=!0){let n=0;if(e){let e=!1;if(null!==en){let t=en.texture.format;e=k.has(t)}if(e){let e=en.texture.type,t=z.has(e),i=v.getClearColor(),n=v.getClearAlpha(),r=i.r,a=i.g,s=i.b;t?(H[0]=r,H[1]=a,H[2]=s,H[3]=n,eD.clearBufferuiv(eD.COLOR,0,H)):(j[0]=r,j[1]=a,j[2]=s,j[3]=n,eD.clearBufferiv(eD.COLOR,0,j))}else n|=eD.COLOR_BUFFER_BIT}t&&(n|=eD.DEPTH_BUFFER_BIT),i&&(n|=eD.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(0xffffffff)),0!==n&&eD.clear(n)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){E.removeEventListener("webglcontextlost",eF,!1),E.removeEventListener("webglcontextrestored",eB,!1),E.removeEventListener("webglcontextcreationerror",ek,!1),v.dispose(),f.dispose(),m.dispose(),s.dispose(),l.dispose(),u.dispose(),b.dispose(),T.dispose(),d.dispose(),eO.dispose(),eO.removeEventListener("sessionstart",eG),eO.removeEventListener("sessionend",ej),eW.stop()},this.renderBufferDirect=function(e,t,a,u,d,f){let m;null===t&&(t=eP);let _=d.isMesh&&0>d.matrixWorld.determinant(),v=function(e,t,i,a,h){var c,u;!0!==t.isScene&&(t=eP),o.resetTextureUnits();let d=t.fog,f=a.isMeshStandardMaterial||a.isMeshLambertMaterial||a.isMeshPhongMaterial?t.environment:null,m=null===en?Q.outputColorSpace:!0===en.isXRRenderTarget?en.texture.colorSpace:F,_=a.isMeshStandardMaterial||a.isMeshLambertMaterial&&!a.envMap||a.isMeshPhongMaterial&&!a.envMap,v=l.get(a.envMap||f,_),y=!0===a.vertexColors&&!!i.attributes.color&&4===i.attributes.color.itemSize,M=!!i.attributes.tangent&&(!!a.normalMap||a.anisotropy>0),S=!!i.morphAttributes.position,b=!!i.morphAttributes.normal,E=!!i.morphAttributes.color,w=0;a.toneMapped&&(null===en||!0===en.isXRRenderTarget)&&(w=Q.toneMapping);let A=i.morphAttributes.position||i.morphAttributes.normal||i.morphAttributes.color,R=void 0!==A?A.length:0,C=s.get(a),P=K.state.lights;if(!0===eS&&(!0===eT||e!==ea)){let t=e===ea&&a.id===er;g.setState(a,e,t)}let L=!1;a.version===C.__version?C.needsLights&&C.lightsStateVersion!==P.state.version||C.outputColorSpace!==m||h.isBatchedMesh&&!1===C.batching?L=!0:h.isBatchedMesh||!0!==C.batching?h.isBatchedMesh&&!0===C.batchingColor&&null===h.colorTexture||h.isBatchedMesh&&!1===C.batchingColor&&null!==h.colorTexture||h.isInstancedMesh&&!1===C.instancing?L=!0:h.isInstancedMesh||!0!==C.instancing?h.isSkinnedMesh&&!1===C.skinning?L=!0:h.isSkinnedMesh||!0!==C.skinning?h.isInstancedMesh&&!0===C.instancingColor&&null===h.instanceColor||h.isInstancedMesh&&!1===C.instancingColor&&null!==h.instanceColor||h.isInstancedMesh&&!0===C.instancingMorph&&null===h.morphTexture||h.isInstancedMesh&&!1===C.instancingMorph&&null!==h.morphTexture||C.envMap!==v||!0===a.fog&&C.fog!==d||void 0!==C.numClippingPlanes&&(C.numClippingPlanes!==g.numPlanes||C.numIntersection!==g.numIntersection)||C.vertexAlphas!==y||C.vertexTangents!==M||C.morphTargets!==S||C.morphNormals!==b||C.morphColors!==E||C.toneMapping!==w?L=!0:C.morphTargetsCount!==R&&(L=!0):L=!0:L=!0:L=!0:(L=!0,C.__version=a.version);let N=C.currentProgram;!0===L&&(N=eJ(a,t,h));let D=!1,I=!1,U=!1,O=N.getUniforms(),B=C.uniforms;if(r.useProgram(N.program)&&(D=!0,I=!0,U=!0),a.id!==er&&(er=a.id,I=!0),D||ea!==e){r.buffers.depth.getReversed()&&!0!==e.reversedDepth&&(e._reversedDepth=!0,e.updateProjectionMatrix()),O.setValue(eD,"projectionMatrix",e.projectionMatrix),O.setValue(eD,"viewMatrix",e.matrixWorldInverse);let t=O.map.cameraPosition;void 0!==t&&t.setValue(eD,eR.setFromMatrixPosition(e.matrixWorld)),n.logarithmicDepthBuffer&&O.setValue(eD,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(a.isMeshPhongMaterial||a.isMeshToonMaterial||a.isMeshLambertMaterial||a.isMeshBasicMaterial||a.isMeshStandardMaterial||a.isShaderMaterial)&&O.setValue(eD,"isOrthographic",!0===e.isOrthographicCamera),ea!==e&&(ea=e,I=!0,U=!0)}if(C.needsLights&&(P.state.directionalShadowMap.length>0&&O.setValue(eD,"directionalShadowMap",P.state.directionalShadowMap,o),P.state.spotShadowMap.length>0&&O.setValue(eD,"spotShadowMap",P.state.spotShadowMap,o),P.state.pointShadowMap.length>0&&O.setValue(eD,"pointShadowMap",P.state.pointShadowMap,o)),h.isSkinnedMesh){O.setOptional(eD,h,"bindMatrix"),O.setOptional(eD,h,"bindMatrixInverse");let e=h.skeleton;e&&(null===e.boneTexture&&e.computeBoneTexture(),O.setValue(eD,"boneTexture",e.boneTexture,o))}h.isBatchedMesh&&(O.setOptional(eD,h,"batchingTexture"),O.setValue(eD,"batchingTexture",h._matricesTexture,o),O.setOptional(eD,h,"batchingIdTexture"),O.setValue(eD,"batchingIdTexture",h._indirectTexture,o),O.setOptional(eD,h,"batchingColorTexture"),null!==h._colorsTexture&&O.setValue(eD,"batchingColorTexture",h._colorsTexture,o));let k=i.morphAttributes;if((void 0!==k.position||void 0!==k.normal||void 0!==k.color)&&x.update(h,i,N),(I||C.receiveShadow!==h.receiveShadow)&&(C.receiveShadow=h.receiveShadow,O.setValue(eD,"receiveShadow",h.receiveShadow)),(a.isMeshStandardMaterial||a.isMeshLambertMaterial||a.isMeshPhongMaterial)&&null===a.envMap&&null!==t.environment&&(B.envMapIntensity.value=t.environmentIntensity),void 0!==B.dfgLUT&&(B.dfgLUT.value=(null===sc&&((sc=new iu(sh,16,16,1030,1016)).name="DFG_LUT",sc.minFilter=1006,sc.magFilter=1006,sc.wrapS=1001,sc.wrapT=1001,sc.generateMipmaps=!1,sc.needsUpdate=!0),sc)),I&&(O.setValue(eD,"toneMappingExposure",Q.toneMappingExposure),C.needsLights&&(c=B,u=U,c.ambientLightColor.needsUpdate=u,c.lightProbe.needsUpdate=u,c.directionalLights.needsUpdate=u,c.directionalLightShadows.needsUpdate=u,c.pointLights.needsUpdate=u,c.pointLightShadows.needsUpdate=u,c.spotLights.needsUpdate=u,c.spotLightShadows.needsUpdate=u,c.rectAreaLights.needsUpdate=u,c.hemisphereLights.needsUpdate=u),d&&!0===a.fog&&p.refreshFogUniforms(B,d),p.refreshMaterialUniforms(B,a,em,ef,K.state.transmissionRenderTarget[e.id]),av.upload(eD,e$(C),B,o)),a.isShaderMaterial&&!0===a.uniformsNeedUpdate&&(av.upload(eD,e$(C),B,o),a.uniformsNeedUpdate=!1),a.isSpriteMaterial&&O.setValue(eD,"center",h.center),O.setValue(eD,"modelViewMatrix",h.modelViewMatrix),O.setValue(eD,"normalMatrix",h.normalMatrix),O.setValue(eD,"modelMatrix",h.matrixWorld),a.isShaderMaterial||a.isRawShaderMaterial){let e=a.uniformsGroups;for(let t=0,i=e.length;t<i;t++){let i=e[t];T.update(i,N),T.bind(i,N)}}return N}(e,t,a,u,d);r.setMaterial(u,_);let S=a.index,E=1;if(!0===u.wireframe){if(void 0===(S=c.getWireframeAttribute(a)))return;E=2}let w=a.drawRange,A=a.attributes.position,R=w.start*E,C=(w.start+w.count)*E;null!==f&&(R=Math.max(R,f.start*E),C=Math.min(C,(f.start+f.count)*E)),null!==S?(R=Math.max(R,0),C=Math.min(C,S.count)):null!=A&&(R=Math.max(R,0),C=Math.min(C,A.count));let P=C-R;if(P<0||P===1/0)return;b.setup(d,u,v,a,S);let L=y;if(null!==S&&(m=h.get(S),(L=M).setIndex(m)),d.isMesh)!0===u.wireframe?(r.setLineWidth(u.wireframeLinewidth*eN()),L.setMode(eD.LINES)):L.setMode(eD.TRIANGLES);else if(d.isLine){let e=u.linewidth;void 0===e&&(e=1),r.setLineWidth(e*eN()),d.isLineSegments?L.setMode(eD.LINES):d.isLineLoop?L.setMode(eD.LINE_LOOP):L.setMode(eD.LINE_STRIP)}else d.isPoints?L.setMode(eD.POINTS):d.isSprite&&L.setMode(eD.TRIANGLES);if(d.isBatchedMesh)if(null!==d._multiDrawInstances)Y("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),L.renderMultiDrawInstances(d._multiDrawStarts,d._multiDrawCounts,d._multiDrawCount,d._multiDrawInstances);else if(i.get("WEBGL_multi_draw"))L.renderMultiDraw(d._multiDrawStarts,d._multiDrawCounts,d._multiDrawCount);else{let e=d._multiDrawStarts,t=d._multiDrawCounts,i=d._multiDrawCount,n=S?h.get(S).bytesPerElement:1,r=s.get(u).currentProgram.getUniforms();for(let a=0;a<i;a++)r.setValue(eD,"_gl_DrawID",a),L.render(e[a]/n,t[a])}else if(d.isInstancedMesh)L.renderInstances(R,P,d.count);else if(a.isInstancedBufferGeometry){let e=void 0!==a._maxInstanceCount?a._maxInstanceCount:1/0,t=Math.min(a.instanceCount,e);L.renderInstances(R,P,t)}else L.render(R,P)},this.compile=function(e,t,i=null){null===i&&(i=e),(K=m.get(i)).init(t),J.push(K),i.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(K.pushLight(e),e.castShadow&&K.pushShadow(e))}),e!==i&&e.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(K.pushLight(e),e.castShadow&&K.pushShadow(e))}),K.setupLights();let n=new Set;return e.traverse(function(e){if(!(e.isMesh||e.isPoints||e.isLine||e.isSprite))return;let t=e.material;if(t)if(Array.isArray(t))for(let r=0;r<t.length;r++){let a=t[r];eV(a,i,e),n.add(a)}else eV(t,i,e),n.add(t)}),K=J.pop(),n},this.compileAsync=function(e,t,n=null){let r=this.compile(e,t,n);return new Promise(t=>{function n(){(r.forEach(function(e){s.get(e).currentProgram.isReady()&&r.delete(e)}),0===r.size)?t(e):setTimeout(n,10)}null!==i.get("KHR_parallel_shader_compile")?n():setTimeout(n,10)})};let eH=null;function eG(){eW.stop()}function ej(){eW.start()}const eW=new n$;function eX(e,t,i,n){if(!1===e.visible)return;if(e.layers.test(t.layers)){if(e.isGroup)i=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)K.pushLight(e),e.castShadow&&K.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||eM.intersectsSprite(e)){n&&eC.setFromMatrixPosition(e.matrixWorld).applyMatrix4(ew);let t=u.update(e),r=e.material;r.visible&&q.push(e,t,r,i,eC.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||eM.intersectsObject(e))){let t=u.update(e),r=e.material;if(n&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),eC.copy(e.boundingSphere.center)):(null===t.boundingSphere&&t.computeBoundingSphere(),eC.copy(t.boundingSphere.center)),eC.applyMatrix4(e.matrixWorld).applyMatrix4(ew)),Array.isArray(r)){let n=t.groups;for(let a=0,s=n.length;a<s;a++){let s=n[a],o=r[s.materialIndex];o&&o.visible&&q.push(e,t,o,i,eC.z,s)}}else r.visible&&q.push(e,t,r,i,eC.z,null)}}let r=e.children;for(let e=0,a=r.length;e<a;e++)eX(r[e],t,i,n)}function eY(e,t,i,n){let{opaque:a,transmissive:s,transparent:o}=e;K.setupLightsView(i),!0===eS&&g.setGlobalState(Q.clippingPlanes,i),n&&r.viewport(eo.copy(n)),a.length>0&&eK(a,t,i),s.length>0&&eK(s,t,i),o.length>0&&eK(o,t,i),r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),r.setPolygonOffset(!1)}function eq(e,t,r,a){if(null!==(!0===r.isScene?r.overrideMaterial:null))return;if(void 0===K.state.transmissionRenderTarget[a.id]){let e=i.has("EXT_color_buffer_half_float")||i.has("EXT_color_buffer_float");K.state.transmissionRenderTarget[a.id]=new eE(1,1,{generateMipmaps:!0,type:e?1016:1009,minFilter:1008,samples:Math.max(4,n.samples),stencilBuffer:R,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ep.workingColorSpace})}let s=K.state.transmissionRenderTarget[a.id],l=a.viewport||eo;s.setSize(l.z*Q.transmissionResolutionScale,l.w*Q.transmissionResolutionScale);let h=Q.getRenderTarget(),c=Q.getActiveCubeFace(),u=Q.getActiveMipmapLevel();Q.setRenderTarget(s),Q.getClearColor(ec),(eu=Q.getClearAlpha())<1&&Q.setClearColor(0xffffff,.5),Q.clear(),eL&&v.render(r);let d=Q.toneMapping;Q.toneMapping=0;let p=a.viewport;if(void 0!==a.viewport&&(a.viewport=void 0),K.setupLightsView(a),!0===eS&&g.setGlobalState(Q.clippingPlanes,a),eK(e,r,a),o.updateMultisampleRenderTarget(s),o.updateRenderTargetMipmap(s),!1===i.has("WEBGL_multisampled_render_to_texture")){let e=!1;for(let i=0,n=t.length;i<n;i++){let{object:n,geometry:s,material:o,group:l}=t[i];if(2===o.side&&n.layers.test(a.layers)){let t=o.side;o.side=1,o.needsUpdate=!0,eZ(n,r,a,s,o,l),o.side=t,o.needsUpdate=!0,e=!0}}!0===e&&(o.updateMultisampleRenderTarget(s),o.updateRenderTargetMipmap(s))}Q.setRenderTarget(h,c,u),Q.setClearColor(ec,eu),void 0!==p&&(a.viewport=p),Q.toneMapping=d}function eK(e,t,i){let n=!0===t.isScene?t.overrideMaterial:null;for(let r=0,a=e.length;r<a;r++){let a=e[r],{object:s,geometry:o,group:l}=a,h=a.material;!0===h.allowOverride&&null!==n&&(h=n),s.layers.test(i.layers)&&eZ(s,t,i,o,h,l)}}function eZ(e,t,i,n,r,a){e.onBeforeRender(Q,t,i,n,r,a),e.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),r.onBeforeRender(Q,t,i,n,e,a),!0===r.transparent&&2===r.side&&!1===r.forceSinglePass?(r.side=1,r.needsUpdate=!0,Q.renderBufferDirect(i,t,n,r,e,a),r.side=0,r.needsUpdate=!0,Q.renderBufferDirect(i,t,n,r,e,a),r.side=2):Q.renderBufferDirect(i,t,n,r,e,a),e.onAfterRender(Q,t,i,n,r,a)}function eJ(e,t,i){var n;!0!==t.isScene&&(t=eP);let r=s.get(e),a=K.state.lights,o=K.state.shadowsArray,h=a.state.version,c=d.getParameters(e,a.state,o,t,i),u=d.getProgramCacheKey(c),p=r.programs;r.environment=e.isMeshStandardMaterial||e.isMeshLambertMaterial||e.isMeshPhongMaterial?t.environment:null,r.fog=t.fog;let f=e.isMeshStandardMaterial||e.isMeshLambertMaterial&&!e.envMap||e.isMeshPhongMaterial&&!e.envMap;r.envMap=l.get(e.envMap||r.environment,f),r.envMapRotation=null!==r.environment&&null===e.envMap?t.environmentRotation:e.envMapRotation,void 0===p&&(e.addEventListener("dispose",ez),r.programs=p=new Map);let m=p.get(u);if(void 0!==m){if(r.currentProgram===m&&r.lightsStateVersion===h)return eQ(e,c),m}else c.uniforms=d.getUniforms(e),e.onBeforeCompile(c,Q),m=d.acquireProgram(c,u),p.set(u,m),r.uniforms=c.uniforms;let _=r.uniforms;return(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(_.clippingPlanes=g.uniform),eQ(e,c),r.needsLights=(n=e).isMeshLambertMaterial||n.isMeshToonMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.isShadowMaterial||n.isShaderMaterial&&!0===n.lights,r.lightsStateVersion=h,r.needsLights&&(_.ambientLightColor.value=a.state.ambient,_.lightProbe.value=a.state.probe,_.directionalLights.value=a.state.directional,_.directionalLightShadows.value=a.state.directionalShadow,_.spotLights.value=a.state.spot,_.spotLightShadows.value=a.state.spotShadow,_.rectAreaLights.value=a.state.rectArea,_.ltc_1.value=a.state.rectAreaLTC1,_.ltc_2.value=a.state.rectAreaLTC2,_.pointLights.value=a.state.point,_.pointLightShadows.value=a.state.pointShadow,_.hemisphereLights.value=a.state.hemi,_.directionalShadowMatrix.value=a.state.directionalShadowMatrix,_.spotLightMatrix.value=a.state.spotLightMatrix,_.spotLightMap.value=a.state.spotLightMap,_.pointShadowMatrix.value=a.state.pointShadowMatrix),r.currentProgram=m,r.uniformsList=null,m}function e$(e){if(null===e.uniformsList){let t=e.currentProgram.getUniforms();e.uniformsList=av.seqWithValue(t.seq,e.uniforms)}return e.uniformsList}function eQ(e,t){let i=s.get(e);i.outputColorSpace=t.outputColorSpace,i.batching=t.batching,i.batchingColor=t.batchingColor,i.instancing=t.instancing,i.instancingColor=t.instancingColor,i.instancingMorph=t.instancingMorph,i.skinning=t.skinning,i.morphTargets=t.morphTargets,i.morphNormals=t.morphNormals,i.morphColors=t.morphColors,i.morphTargetsCount=t.morphTargetsCount,i.numClippingPlanes=t.numClippingPlanes,i.numIntersection=t.numClipIntersection,i.vertexAlphas=t.vertexAlphas,i.vertexTangents=t.vertexTangents,i.toneMapping=t.toneMapping}eW.setAnimationLoop(function(e){eH&&eH(e)}),"u">typeof self&&eW.setContext(self),this.setAnimationLoop=function(e){eH=e,eO.setAnimationLoop(e),null===e?eW.stop():eW.start()},eO.addEventListener("sessionstart",eG),eO.addEventListener("sessionend",ej),this.render=function(e,t){if(void 0!==t&&!0!==t.isCamera)return void X("WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===ee)return;let i=!0===eO.enabled&&!0===eO.isPresenting,n=null!==$&&(null===en||i)&&$.begin(Q,en);if(!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0===eO.enabled&&!0===eO.isPresenting&&(null===$||!1===$.isCompositing())&&(!0===eO.cameraAutoUpdate&&eO.updateCamera(t),t=eO.getCamera()),!0===e.isScene&&e.onBeforeRender(Q,e,t,en),(K=m.get(e,J.length)).init(t),J.push(K),ew.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),eM.setFromProjectionMatrix(ew,2e3,t.reversedDepth),eT=this.localClippingEnabled,eS=g.init(this.clippingPlanes,eT),(q=f.get(e,Z.length)).init(),Z.push(q),!0===eO.enabled&&!0===eO.isPresenting){let e=Q.xr.getDepthSensingMesh();null!==e&&eX(e,t,-1/0,Q.sortObjects)}eX(e,t,0,Q.sortObjects),q.finish(),!0===Q.sortObjects&&q.sort(eg,e_),(eL=!1===eO.enabled||!1===eO.isPresenting||!1===eO.hasDepthSensing())&&v.addToRenderList(q,e),this.info.render.frame++,!0===eS&&g.beginShadows();let r=K.state.shadowsArray;if(_.render(r,e,t),!0===eS&&g.endShadows(),!0===this.info.autoReset&&this.info.reset(),!1===(n&&$.hasRenderPass())){let i=q.opaque,n=q.transmissive;if(K.setupLights(),t.isArrayCamera){let r=t.cameras;if(n.length>0)for(let t=0,a=r.length;t<a;t++)eq(i,n,e,r[t]);eL&&v.render(e);for(let t=0,i=r.length;t<i;t++){let i=r[t];eY(q,e,i,i.viewport)}}else n.length>0&&eq(i,n,e,t),eL&&v.render(e),eY(q,e,t)}null!==en&&0===ei&&(o.updateMultisampleRenderTarget(en),o.updateRenderTargetMipmap(en)),n&&$.end(Q),!0===e.isScene&&e.onAfterRender(Q,e,t),b.resetDefaultState(),er=-1,ea=null,J.pop(),J.length>0?(K=J[J.length-1],!0===eS&&g.setGlobalState(Q.clippingPlanes,K.state.camera)):K=null,Z.pop(),q=Z.length>0?Z[Z.length-1]:null},this.getActiveCubeFace=function(){return et},this.getActiveMipmapLevel=function(){return ei},this.getRenderTarget=function(){return en},this.setRenderTargetTextures=function(e,t,i){let n=s.get(e);n.__autoAllocateDepthBuffer=!1===e.resolveDepthBuffer,!1===n.__autoAllocateDepthBuffer&&(n.__useRenderToTexture=!1),s.get(e.texture).__webglTexture=t,s.get(e.depthTexture).__webglTexture=n.__autoAllocateDepthBuffer?void 0:i,n.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(e,t){let i=s.get(e);i.__webglFramebuffer=t,i.__useDefaultFramebuffer=void 0===t};const e0=eD.createFramebuffer();this.setRenderTarget=function(e,t=0,i=0){en=e,et=t,ei=i;let n=null,a=!1,l=!1;if(e){let h=s.get(e);if(void 0!==h.__useDefaultFramebuffer){r.bindFramebuffer(eD.FRAMEBUFFER,h.__webglFramebuffer),eo.copy(e.viewport),el.copy(e.scissor),eh=e.scissorTest,r.viewport(eo),r.scissor(el),r.setScissorTest(eh),er=-1;return}if(void 0===h.__webglFramebuffer)o.setupRenderTarget(e);else if(h.__hasExternalTextures)o.rebindTextures(e,s.get(e.texture).__webglTexture,s.get(e.depthTexture).__webglTexture);else if(e.depthBuffer){let t=e.depthTexture;if(h.__boundDepthTexture!==t){if(null!==t&&s.has(t)&&(e.width!==t.image.width||e.height!==t.image.height))throw Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");o.setupDepthRenderbuffer(e)}}let c=e.texture;(c.isData3DTexture||c.isDataArrayTexture||c.isCompressedArrayTexture)&&(l=!0);let u=s.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(n=Array.isArray(u[t])?u[t][i]:u[t],a=!0):n=e.samples>0&&!1===o.useMultisampledRTT(e)?s.get(e).__webglMultisampledFramebuffer:Array.isArray(u)?u[i]:u,eo.copy(e.viewport),el.copy(e.scissor),eh=e.scissorTest}else eo.copy(ev).multiplyScalar(em).floor(),el.copy(ex).multiplyScalar(em).floor(),eh=ey;if(0!==i&&(n=e0),r.bindFramebuffer(eD.FRAMEBUFFER,n)&&r.drawBuffers(e,n),r.viewport(eo),r.scissor(el),r.setScissorTest(eh),a){let n=s.get(e.texture);eD.framebufferTexture2D(eD.FRAMEBUFFER,eD.COLOR_ATTACHMENT0,eD.TEXTURE_CUBE_MAP_POSITIVE_X+t,n.__webglTexture,i)}else if(l)for(let n=0;n<e.textures.length;n++){let r=s.get(e.textures[n]);eD.framebufferTextureLayer(eD.FRAMEBUFFER,eD.COLOR_ATTACHMENT0+n,r.__webglTexture,i,t)}else if(null!==e&&0!==i){let t=s.get(e.texture);eD.framebufferTexture2D(eD.FRAMEBUFFER,eD.COLOR_ATTACHMENT0,eD.TEXTURE_2D,t.__webglTexture,i)}er=-1},this.readRenderTargetPixels=function(e,t,i,a,o,l,h,c=0){if(!(e&&e.isWebGLRenderTarget))return void X("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let u=s.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==h&&(u=u[h]),u){r.bindFramebuffer(eD.FRAMEBUFFER,u);try{let r=e.textures[c],s=r.format,h=r.type;if(e.textures.length>1&&eD.readBuffer(eD.COLOR_ATTACHMENT0+c),!n.textureFormatReadable(s))return void X("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!n.textureTypeReadable(h))return void X("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-a&&i>=0&&i<=e.height-o&&eD.readPixels(t,i,a,o,S.convert(s),S.convert(h),l)}finally{let e=null!==en?s.get(en).__webglFramebuffer:null;r.bindFramebuffer(eD.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,i,a,o,l,h,c=0){if(!(e&&e.isWebGLRenderTarget))throw Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let u=s.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==h&&(u=u[h]),u)if(t>=0&&t<=e.width-a&&i>=0&&i<=e.height-o){var d;r.bindFramebuffer(eD.FRAMEBUFFER,u);let h=e.textures[c],p=h.format,f=h.type;if(e.textures.length>1&&eD.readBuffer(eD.COLOR_ATTACHMENT0+c),!n.textureFormatReadable(p))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!n.textureTypeReadable(f))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let m=eD.createBuffer();eD.bindBuffer(eD.PIXEL_PACK_BUFFER,m),eD.bufferData(eD.PIXEL_PACK_BUFFER,l.byteLength,eD.STREAM_READ),eD.readPixels(t,i,a,o,S.convert(p),S.convert(f),0);let g=null!==en?s.get(en).__webglFramebuffer:null;r.bindFramebuffer(eD.FRAMEBUFFER,g);let _=eD.fenceSync(eD.SYNC_GPU_COMMANDS_COMPLETE,0);return eD.flush(),await (d=eD,new Promise(function(e,t){setTimeout(function i(){switch(d.clientWaitSync(_,d.SYNC_FLUSH_COMMANDS_BIT,0)){case d.WAIT_FAILED:t();break;case d.TIMEOUT_EXPIRED:setTimeout(i,4);break;default:e()}},4)})),eD.bindBuffer(eD.PIXEL_PACK_BUFFER,m),eD.getBufferSubData(eD.PIXEL_PACK_BUFFER,0,l),eD.deleteBuffer(m),eD.deleteSync(_),l}else throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(e,t=null,i=0){let n=Math.pow(2,-i),a=Math.floor(e.image.width*n),s=Math.floor(e.image.height*n),l=null!==t?t.x:0,h=null!==t?t.y:0;o.setTexture2D(e,0),eD.copyTexSubImage2D(eD.TEXTURE_2D,i,0,0,l,h,a,s),r.unbindTexture()};const e1=eD.createFramebuffer(),e2=eD.createFramebuffer();this.copyTextureToTexture=function(e,t,i=null,n=null,a=0,l=0){let h,c,u,d,p,f,m,g,_,v,x=e.isCompressedTexture?e.mipmaps[l]:e.image;if(null!==i)h=i.max.x-i.min.x,c=i.max.y-i.min.y,u=i.isBox3?i.max.z-i.min.z:1,d=i.min.x,p=i.min.y,f=i.isBox3?i.min.z:0;else{let t=Math.pow(2,-a);h=Math.floor(x.width*t),c=Math.floor(x.height*t),u=e.isDataArrayTexture?x.depth:e.isData3DTexture?Math.floor(x.depth*t):1,d=0,p=0,f=0}null!==n?(m=n.x,g=n.y,_=n.z):(m=0,g=0,_=0);let y=S.convert(t.format),M=S.convert(t.type);t.isData3DTexture?(o.setTexture3D(t,0),v=eD.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(o.setTexture2DArray(t,0),v=eD.TEXTURE_2D_ARRAY):(o.setTexture2D(t,0),v=eD.TEXTURE_2D),eD.pixelStorei(eD.UNPACK_FLIP_Y_WEBGL,t.flipY),eD.pixelStorei(eD.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),eD.pixelStorei(eD.UNPACK_ALIGNMENT,t.unpackAlignment);let b=eD.getParameter(eD.UNPACK_ROW_LENGTH),T=eD.getParameter(eD.UNPACK_IMAGE_HEIGHT),E=eD.getParameter(eD.UNPACK_SKIP_PIXELS),w=eD.getParameter(eD.UNPACK_SKIP_ROWS),A=eD.getParameter(eD.UNPACK_SKIP_IMAGES);eD.pixelStorei(eD.UNPACK_ROW_LENGTH,x.width),eD.pixelStorei(eD.UNPACK_IMAGE_HEIGHT,x.height),eD.pixelStorei(eD.UNPACK_SKIP_PIXELS,d),eD.pixelStorei(eD.UNPACK_SKIP_ROWS,p),eD.pixelStorei(eD.UNPACK_SKIP_IMAGES,f);let R=e.isDataArrayTexture||e.isData3DTexture,C=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){let i=s.get(e),n=s.get(t),o=s.get(i.__renderTarget),v=s.get(n.__renderTarget);r.bindFramebuffer(eD.READ_FRAMEBUFFER,o.__webglFramebuffer),r.bindFramebuffer(eD.DRAW_FRAMEBUFFER,v.__webglFramebuffer);for(let i=0;i<u;i++)R&&(eD.framebufferTextureLayer(eD.READ_FRAMEBUFFER,eD.COLOR_ATTACHMENT0,s.get(e).__webglTexture,a,f+i),eD.framebufferTextureLayer(eD.DRAW_FRAMEBUFFER,eD.COLOR_ATTACHMENT0,s.get(t).__webglTexture,l,_+i)),eD.blitFramebuffer(d,p,h,c,m,g,h,c,eD.DEPTH_BUFFER_BIT,eD.NEAREST);r.bindFramebuffer(eD.READ_FRAMEBUFFER,null),r.bindFramebuffer(eD.DRAW_FRAMEBUFFER,null)}else if(0!==a||e.isRenderTargetTexture||s.has(e)){let i=s.get(e),n=s.get(t);r.bindFramebuffer(eD.READ_FRAMEBUFFER,e1),r.bindFramebuffer(eD.DRAW_FRAMEBUFFER,e2);for(let e=0;e<u;e++)R?eD.framebufferTextureLayer(eD.READ_FRAMEBUFFER,eD.COLOR_ATTACHMENT0,i.__webglTexture,a,f+e):eD.framebufferTexture2D(eD.READ_FRAMEBUFFER,eD.COLOR_ATTACHMENT0,eD.TEXTURE_2D,i.__webglTexture,a),C?eD.framebufferTextureLayer(eD.DRAW_FRAMEBUFFER,eD.COLOR_ATTACHMENT0,n.__webglTexture,l,_+e):eD.framebufferTexture2D(eD.DRAW_FRAMEBUFFER,eD.COLOR_ATTACHMENT0,eD.TEXTURE_2D,n.__webglTexture,l),0!==a?eD.blitFramebuffer(d,p,h,c,m,g,h,c,eD.COLOR_BUFFER_BIT,eD.NEAREST):C?eD.copyTexSubImage3D(v,l,m,g,_+e,d,p,h,c):eD.copyTexSubImage2D(v,l,m,g,d,p,h,c);r.bindFramebuffer(eD.READ_FRAMEBUFFER,null),r.bindFramebuffer(eD.DRAW_FRAMEBUFFER,null)}else C?e.isDataTexture||e.isData3DTexture?eD.texSubImage3D(v,l,m,g,_,h,c,u,y,M,x.data):t.isCompressedArrayTexture?eD.compressedTexSubImage3D(v,l,m,g,_,h,c,u,y,x.data):eD.texSubImage3D(v,l,m,g,_,h,c,u,y,M,x):e.isDataTexture?eD.texSubImage2D(eD.TEXTURE_2D,l,m,g,h,c,y,M,x.data):e.isCompressedTexture?eD.compressedTexSubImage2D(eD.TEXTURE_2D,l,m,g,x.width,x.height,y,x.data):eD.texSubImage2D(eD.TEXTURE_2D,l,m,g,h,c,y,M,x);eD.pixelStorei(eD.UNPACK_ROW_LENGTH,b),eD.pixelStorei(eD.UNPACK_IMAGE_HEIGHT,T),eD.pixelStorei(eD.UNPACK_SKIP_PIXELS,E),eD.pixelStorei(eD.UNPACK_SKIP_ROWS,w),eD.pixelStorei(eD.UNPACK_SKIP_IMAGES,A),0===l&&t.generateMipmaps&&eD.generateMipmap(v),r.unbindTexture()},this.initRenderTarget=function(e){void 0===s.get(e).__webglFramebuffer&&o.setupRenderTarget(e)},this.initTexture=function(e){e.isCubeTexture?o.setTextureCube(e,0):e.isData3DTexture?o.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?o.setTexture2DArray(e,0):o.setTexture2D(e,0),r.unbindTexture()},this.resetState=function(){et=0,ei=0,en=null,r.reset(),b.reset()},"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return 2e3}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=ep._getDrawingBufferColorSpace(e),t.unpackColorSpace=ep._getUnpackColorSpace()}}let sd={type:"change"},sp={type:"start"},sf={type:"end"},sm=new t5,sg=new ig,s_=Math.cos(70*J),sv=new es,sx=2*Math.PI;class sy extends nZ{constructor(e,t=null){super(e,t),this.state=-1,this.target=new es,this.cursor=new es,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:0,MIDDLE:1,RIGHT:2},this.touches={ONE:0,TWO:2},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._cursorStyle="auto",this._domElementKeyEvents=null,this._lastPosition=new es,this._lastQuaternion=new ea,this._lastTargetPosition=new es,this._quat=new ea().setFromUnitVectors(e.up,new es(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new nq,this._sphericalDelta=new nq,this._scale=1,this._panOffset=new es,this._rotateStart=new er,this._rotateEnd=new er,this._rotateDelta=new er,this._panStart=new er,this._panEnd=new er,this._panDelta=new er,this._dollyStart=new er,this._dollyEnd=new er,this._dollyDelta=new er,this._dollyDirection=new es,this._mouse=new er,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=sS.bind(this),this._onPointerDown=sM.bind(this),this._onPointerUp=sb.bind(this),this._onContextMenu=sP.bind(this),this._onMouseWheel=sw.bind(this),this._onKeyDown=sA.bind(this),this._onTouchStart=sR.bind(this),this._onTouchMove=sC.bind(this),this._onMouseDown=sT.bind(this),this._onMouseMove=sE.bind(this),this._interceptControlDown=sL.bind(this),this._interceptControlUp=sN.bind(this),null!==this.domElement&&this.connect(this.domElement),this.update()}set cursorStyle(e){this._cursorStyle=e,"grab"===e?this.domElement.style.cursor="grab":this.domElement.style.cursor="auto"}get cursorStyle(){return this._cursorStyle}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){null!==this._domElementKeyEvents&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(sd),this.update(),this.state=-1}pan(e,t){this._pan(e,t),this.update()}dollyIn(e){this._dollyIn(e),this.update()}dollyOut(e){this._dollyOut(e),this.update()}rotateLeft(e){this._rotateLeft(e),this.update()}rotateUp(e){this._rotateUp(e),this.update()}update(e=null){let t=this.object.position;sv.copy(t).sub(this.target),sv.applyQuaternion(this._quat),this._spherical.setFromVector3(sv),this.autoRotate&&-1===this.state&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let i=this.minAzimuthAngle,n=this.maxAzimuthAngle;isFinite(i)&&isFinite(n)&&(i<-Math.PI?i+=sx:i>Math.PI&&(i-=sx),n<-Math.PI?n+=sx:n>Math.PI&&(n-=sx),i<=n?this._spherical.theta=Math.max(i,Math.min(n,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(i+n)/2?Math.max(i,this._spherical.theta):Math.min(n,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),!0===this.enableDamping?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let r=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{let e=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),r=e!=this._spherical.radius}if(sv.setFromSpherical(this._spherical),sv.applyQuaternion(this._quatInverse),t.copy(this.target).add(sv),this.object.lookAt(this.target),!0===this.enableDamping?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let e=null;if(this.object.isPerspectiveCamera){let t=sv.length();e=this._clampDistance(t*this._scale);let i=t-e;this.object.position.addScaledVector(this._dollyDirection,i),this.object.updateMatrixWorld(),r=!!i}else if(this.object.isOrthographicCamera){let t=new es(this._mouse.x,this._mouse.y,0);t.unproject(this.object);let i=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),r=i!==this.object.zoom;let n=new es(this._mouse.x,this._mouse.y,0);n.unproject(this.object),this.object.position.sub(n).add(t),this.object.updateMatrixWorld(),e=sv.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;null!==e&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(e).add(this.object.position):(sm.origin.copy(this.object.position),sm.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(sm.direction))<s_?this.object.lookAt(this.target):(sg.setFromNormalAndCoplanarPoint(this.object.up,this.target),sm.intersectPlane(sg,this.target))))}else if(this.object.isOrthographicCamera){let e=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),e!==this.object.zoom&&(this.object.updateProjectionMatrix(),r=!0)}return this._scale=1,this._performCursorZoom=!1,!!(r||this._lastPosition.distanceToSquared(this.object.position)>1e-6||8*(1-this._lastQuaternion.dot(this.object.quaternion))>1e-6||this._lastTargetPosition.distanceToSquared(this.target)>1e-6)&&(this.dispatchEvent(sd),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0)}_getAutoRotationAngle(e){return null!==e?sx/60*this.autoRotateSpeed*e:sx/60/60*this.autoRotateSpeed}_getZoomScale(e){let t=Math.abs(.01*e);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){sv.setFromMatrixColumn(t,0),sv.multiplyScalar(-e),this._panOffset.add(sv)}_panUp(e,t){!0===this.screenSpacePanning?sv.setFromMatrixColumn(t,1):(sv.setFromMatrixColumn(t,0),sv.crossVectors(this.object.up,sv)),sv.multiplyScalar(e),this._panOffset.add(sv)}_pan(e,t){let i=this.domElement;if(this.object.isPerspectiveCamera){let n=this.object.position;sv.copy(n).sub(this.target);let r=sv.length();r*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*r/i.clientHeight,this.object.matrix),this._panUp(2*t*r/i.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/i.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/i.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;let i=this.domElement.getBoundingClientRect(),n=e-i.left,r=t-i.top,a=i.width,s=i.height;this._mouse.x=n/a*2-1,this._mouse.y=-(r/s*2)+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(sx*this._rotateDelta.x/t.clientHeight),this._rotateUp(sx*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(sx*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-sx*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(sx*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-sx*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(1===this._pointers.length)this._rotateStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),i=.5*(e.pageX+t.x),n=.5*(e.pageY+t.y);this._rotateStart.set(i,n)}}_handleTouchStartPan(e){if(1===this._pointers.length)this._panStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),i=.5*(e.pageX+t.x),n=.5*(e.pageY+t.y);this._panStart.set(i,n)}}_handleTouchStartDolly(e){let t=this._getSecondPointerPosition(e),i=e.pageX-t.x,n=e.pageY-t.y,r=Math.sqrt(i*i+n*n);this._dollyStart.set(0,r)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(1==this._pointers.length)this._rotateEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),i=.5*(e.pageX+t.x),n=.5*(e.pageY+t.y);this._rotateEnd.set(i,n)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(sx*this._rotateDelta.x/t.clientHeight),this._rotateUp(sx*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(1===this._pointers.length)this._panEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),i=.5*(e.pageX+t.x),n=.5*(e.pageY+t.y);this._panEnd.set(i,n)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){let t=this._getSecondPointerPosition(e),i=e.pageX-t.x,n=e.pageY-t.y,r=Math.sqrt(i*i+n*n);this._dollyEnd.set(0,r),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);let a=(e.pageX+t.x)*.5,s=(e.pageY+t.y)*.5;this._updateZoomParameters(a,s)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return void this._pointers.splice(t,1)}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];void 0===t&&(t=new er,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){let t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){let t=e.deltaMode,i={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:i.deltaY*=16;break;case 2:i.deltaY*=100}return e.ctrlKey&&!this._controlActive&&(i.deltaY*=10),i}}function sM(e){!1===this.enabled||(0===this._pointers.length&&(this.domElement.setPointerCapture(e.pointerId),this.domElement.ownerDocument.addEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this._onPointerUp)),this._isTrackingPointer(e)||(this._addPointer(e),"touch"===e.pointerType?this._onTouchStart(e):this._onMouseDown(e),"grab"===this._cursorStyle&&(this.domElement.style.cursor="grabbing")))}function sS(e){!1!==this.enabled&&("touch"===e.pointerType?this._onTouchMove(e):this._onMouseMove(e))}function sb(e){switch(this._removePointer(e),this._pointers.length){case 0:this.domElement.releasePointerCapture(e.pointerId),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(sf),this.state=-1,"grab"===this._cursorStyle&&(this.domElement.style.cursor="grab");break;case 1:let t=this._pointers[0],i=this._pointerPositions[t];this._onTouchStart({pointerId:t,pageX:i.x,pageY:i.y})}}function sT(e){let t;switch(e.button){case 0:t=this.mouseButtons.LEFT;break;case 1:t=this.mouseButtons.MIDDLE;break;case 2:t=this.mouseButtons.RIGHT;break;default:t=-1}switch(t){case 1:if(!1===this.enableZoom)return;this._handleMouseDownDolly(e),this.state=1;break;case 0:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===this.enablePan)return;this._handleMouseDownPan(e),this.state=2}else{if(!1===this.enableRotate)return;this._handleMouseDownRotate(e),this.state=0}break;case 2:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===this.enableRotate)return;this._handleMouseDownRotate(e),this.state=0}else{if(!1===this.enablePan)return;this._handleMouseDownPan(e),this.state=2}break;default:this.state=-1}-1!==this.state&&this.dispatchEvent(sp)}function sE(e){switch(this.state){case 0:if(!1===this.enableRotate)return;this._handleMouseMoveRotate(e);break;case 1:if(!1===this.enableZoom)return;this._handleMouseMoveDolly(e);break;case 2:if(!1===this.enablePan)return;this._handleMouseMovePan(e)}}function sw(e){!1!==this.enabled&&!1!==this.enableZoom&&-1===this.state&&(e.preventDefault(),this.dispatchEvent(sp),this._handleMouseWheel(this._customWheelEvent(e)),this.dispatchEvent(sf))}function sA(e){!1!==this.enabled&&this._handleKeyDown(e)}function sR(e){switch(this._trackPointer(e),this._pointers.length){case 1:switch(this.touches.ONE){case 0:if(!1===this.enableRotate)return;this._handleTouchStartRotate(e),this.state=3;break;case 1:if(!1===this.enablePan)return;this._handleTouchStartPan(e),this.state=4;break;default:this.state=-1}break;case 2:switch(this.touches.TWO){case 2:if(!1===this.enableZoom&&!1===this.enablePan)return;this._handleTouchStartDollyPan(e),this.state=5;break;case 3:if(!1===this.enableZoom&&!1===this.enableRotate)return;this._handleTouchStartDollyRotate(e),this.state=6;break;default:this.state=-1}break;default:this.state=-1}-1!==this.state&&this.dispatchEvent(sp)}function sC(e){switch(this._trackPointer(e),this.state){case 3:if(!1===this.enableRotate)return;this._handleTouchMoveRotate(e),this.update();break;case 4:if(!1===this.enablePan)return;this._handleTouchMovePan(e),this.update();break;case 5:if(!1===this.enableZoom&&!1===this.enablePan)return;this._handleTouchMoveDollyPan(e),this.update();break;case 6:if(!1===this.enableZoom&&!1===this.enableRotate)return;this._handleTouchMoveDollyRotate(e),this.update();break;default:this.state=-1}}function sP(e){!1!==this.enabled&&e.preventDefault()}function sL(e){"Control"===e.key&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function sN(e){"Control"===e.key&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}let sD={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:`
409
+
410
+ varying vec2 vUv;
411
+
412
+ void main() {
413
+
414
+ vUv = uv;
415
+ gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
416
+
417
+ }`,fragmentShader:`
418
+
419
+ uniform float opacity;
420
+
421
+ uniform sampler2D tDiffuse;
422
+
423
+ varying vec2 vUv;
424
+
425
+ void main() {
426
+
427
+ vec4 texel = texture2D( tDiffuse, vUv );
428
+ gl_FragColor = opacity * texel;
429
+
430
+
431
+ }`};class sI{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}}let sU=new nR(-1,1,1,-1,0,1),sO=new class extends tK{constructor(){super(),this.setAttribute("position",new tF([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new tF([0,2,0,0,2,0],2))}};class sF{constructor(e){this._mesh=new ih(sO,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,sU)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class sB extends sI{constructor(e,t="tDiffuse"){super(),this.textureID=t,this.uniforms=null,this.material=null,e instanceof i6?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=i3(e.uniforms),this.material=new i6({name:void 0!==e.name?e.name:"unspecified",defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this._fsQuad=new sF(this.material)}render(e,t,i){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=i.texture),this._fsQuad.material=this.material,this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil)),this._fsQuad.render(e)}dispose(){this.material.dispose(),this._fsQuad.dispose()}}class sk extends sI{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,i){let n,r,a=e.getContext(),s=e.state;s.buffers.color.setMask(!1),s.buffers.depth.setMask(!1),s.buffers.color.setLocked(!0),s.buffers.depth.setLocked(!0),this.inverse?(n=0,r=1):(n=1,r=0),s.buffers.stencil.setTest(!0),s.buffers.stencil.setOp(a.REPLACE,a.REPLACE,a.REPLACE),s.buffers.stencil.setFunc(a.ALWAYS,n,0xffffffff),s.buffers.stencil.setClear(r),s.buffers.stencil.setLocked(!0),e.setRenderTarget(i),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),s.buffers.color.setLocked(!1),s.buffers.depth.setLocked(!1),s.buffers.color.setMask(!0),s.buffers.depth.setMask(!0),s.buffers.stencil.setLocked(!1),s.buffers.stencil.setFunc(a.EQUAL,1,0xffffffff),s.buffers.stencil.setOp(a.KEEP,a.KEEP,a.KEEP),s.buffers.stencil.setLocked(!0)}}class sz extends sI{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}class sV{constructor(e,t){if(this.renderer=e,this._pixelRatio=e.getPixelRatio(),void 0===t){const i=e.getSize(new er);this._width=i.width,this._height=i.height,(t=new eE(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:1016})).texture.name="EffectComposer.rt1"}else this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new sB(sD),this.copyPass.material.blending=0,this.timer=new nI}swapBuffers(){let e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){let t=this.passes.indexOf(e);-1!==t&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){this.timer.update(),void 0===e&&(e=this.timer.getDelta());let t=this.renderer.getRenderTarget(),i=!1;for(let t=0,n=this.passes.length;t<n;t++){let n=this.passes[t];if(!1!==n.enabled){if(n.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(t),n.render(this.renderer,this.writeBuffer,this.readBuffer,e,i),n.needsSwap){if(i){let t=this.renderer.getContext(),i=this.renderer.state.buffers.stencil;i.setFunc(t.NOTEQUAL,1,0xffffffff),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),i.setFunc(t.EQUAL,1,0xffffffff)}this.swapBuffers()}void 0!==sk&&(n instanceof sk?i=!0:n instanceof sz&&(i=!1))}}this.renderer.setRenderTarget(t)}reset(e){if(void 0===e){let t=this.renderer.getSize(new er);this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,(e=this.renderTarget1.clone()).setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;let i=this._width*this._pixelRatio,n=this._height*this._pixelRatio;this.renderTarget1.setSize(i,n),this.renderTarget2.setSize(i,n);for(let e=0;e<this.passes.length;e++)this.passes[e].setSize(i,n)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}}class sH extends sI{constructor(e,t,i=null,n=null,r=null){super(),this.scene=e,this.camera=t,this.overrideMaterial=i,this.clearColor=n,this.clearAlpha=r,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this.isRenderPass=!0,this._oldClearColor=new e9}render(e,t,i){let n,r,a=e.autoClear;e.autoClear=!1,null!==this.overrideMaterial&&(r=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),null!==this.clearColor&&(e.getClearColor(this._oldClearColor),e.setClearColor(this.clearColor,e.getClearAlpha())),null!==this.clearAlpha&&(n=e.getClearAlpha(),e.setClearAlpha(this.clearAlpha)),!0==this.clearDepth&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:i),!0===this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),null!==this.clearColor&&e.setClearColor(this._oldClearColor),null!==this.clearAlpha&&e.setClearAlpha(n),null!==this.overrideMaterial&&(this.scene.overrideMaterial=r),e.autoClear=a}}let sG={name:"LuminosityHighPassShader",uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new e9(0)},defaultOpacity:{value:0}},vertexShader:`
432
+
433
+ varying vec2 vUv;
434
+
435
+ void main() {
436
+
437
+ vUv = uv;
438
+
439
+ gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
440
+
441
+ }`,fragmentShader:`
442
+
443
+ uniform sampler2D tDiffuse;
444
+ uniform vec3 defaultColor;
445
+ uniform float defaultOpacity;
446
+ uniform float luminosityThreshold;
447
+ uniform float smoothWidth;
448
+
449
+ varying vec2 vUv;
450
+
451
+ void main() {
452
+
453
+ vec4 texel = texture2D( tDiffuse, vUv );
454
+
455
+ float v = luminance( texel.xyz );
456
+
457
+ vec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );
458
+
459
+ float alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );
460
+
461
+ gl_FragColor = mix( outputColor, texel, alpha );
462
+
463
+ }`};class sj extends sI{constructor(e,t=1,i,n){super(),this.strength=t,this.radius=i,this.threshold=n,this.resolution=void 0!==e?new er(e.x,e.y):new er(256,256),this.clearColor=new e9(0,0,0),this.needsSwap=!1,this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;let r=Math.round(this.resolution.x/2),a=Math.round(this.resolution.y/2);this.renderTargetBright=new eE(r,a,{type:1016}),this.renderTargetBright.texture.name="UnrealBloomPass.bright",this.renderTargetBright.texture.generateMipmaps=!1;for(let e=0;e<this.nMips;e++){const t=new eE(r,a,{type:1016});t.texture.name="UnrealBloomPass.h"+e,t.texture.generateMipmaps=!1,this.renderTargetsHorizontal.push(t);const i=new eE(r,a,{type:1016});i.texture.name="UnrealBloomPass.v"+e,i.texture.generateMipmaps=!1,this.renderTargetsVertical.push(i),r=Math.round(r/2),a=Math.round(a/2)}this.highPassUniforms=i3(sG.uniforms),this.highPassUniforms.luminosityThreshold.value=n,this.highPassUniforms.smoothWidth.value=.01,this.materialHighPassFilter=new i6({uniforms:this.highPassUniforms,vertexShader:sG.vertexShader,fragmentShader:sG.fragmentShader}),this.separableBlurMaterials=[];const s=[6,10,14,18,22];r=Math.round(this.resolution.x/2),a=Math.round(this.resolution.y/2);for(let e=0;e<this.nMips;e++)this.separableBlurMaterials.push(this._getSeparableBlurMaterial(s[e])),this.separableBlurMaterials[e].uniforms.invSize.value=new er(1/r,1/a),r=Math.round(r/2),a=Math.round(a/2);this.compositeMaterial=this._getCompositeMaterial(this.nMips),this.compositeMaterial.uniforms.blurTexture1.value=this.renderTargetsVertical[0].texture,this.compositeMaterial.uniforms.blurTexture2.value=this.renderTargetsVertical[1].texture,this.compositeMaterial.uniforms.blurTexture3.value=this.renderTargetsVertical[2].texture,this.compositeMaterial.uniforms.blurTexture4.value=this.renderTargetsVertical[3].texture,this.compositeMaterial.uniforms.blurTexture5.value=this.renderTargetsVertical[4].texture,this.compositeMaterial.uniforms.bloomStrength.value=t,this.compositeMaterial.uniforms.bloomRadius.value=.1,this.compositeMaterial.uniforms.bloomFactors.value=[1,.8,.6,.4,.2],this.bloomTintColors=[new es(1,1,1),new es(1,1,1),new es(1,1,1),new es(1,1,1),new es(1,1,1)],this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,this.copyUniforms=i3(sD.uniforms),this.blendMaterial=new i6({uniforms:this.copyUniforms,vertexShader:sD.vertexShader,fragmentShader:sD.fragmentShader,premultipliedAlpha:!0,blending:2,depthTest:!1,depthWrite:!1,transparent:!0}),this._oldClearColor=new e9,this._oldClearAlpha=1,this._basic=new t6,this._fsQuad=new sF(null)}dispose(){for(let e=0;e<this.renderTargetsHorizontal.length;e++)this.renderTargetsHorizontal[e].dispose();for(let e=0;e<this.renderTargetsVertical.length;e++)this.renderTargetsVertical[e].dispose();this.renderTargetBright.dispose();for(let e=0;e<this.separableBlurMaterials.length;e++)this.separableBlurMaterials[e].dispose();this.compositeMaterial.dispose(),this.blendMaterial.dispose(),this._basic.dispose(),this._fsQuad.dispose()}setSize(e,t){let i=Math.round(e/2),n=Math.round(t/2);this.renderTargetBright.setSize(i,n);for(let e=0;e<this.nMips;e++)this.renderTargetsHorizontal[e].setSize(i,n),this.renderTargetsVertical[e].setSize(i,n),this.separableBlurMaterials[e].uniforms.invSize.value=new er(1/i,1/n),i=Math.round(i/2),n=Math.round(n/2)}render(e,t,i,n,r){e.getClearColor(this._oldClearColor),this._oldClearAlpha=e.getClearAlpha();let a=e.autoClear;e.autoClear=!1,e.setClearColor(this.clearColor,0),r&&e.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this._fsQuad.material=this._basic,this._basic.map=i.texture,e.setRenderTarget(null),e.clear(),this._fsQuad.render(e)),this.highPassUniforms.tDiffuse.value=i.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this._fsQuad.material=this.materialHighPassFilter,e.setRenderTarget(this.renderTargetBright),e.clear(),this._fsQuad.render(e);let s=this.renderTargetBright;for(let t=0;t<this.nMips;t++)this._fsQuad.material=this.separableBlurMaterials[t],this.separableBlurMaterials[t].uniforms.colorTexture.value=s.texture,this.separableBlurMaterials[t].uniforms.direction.value=sj.BlurDirectionX,e.setRenderTarget(this.renderTargetsHorizontal[t]),e.clear(),this._fsQuad.render(e),this.separableBlurMaterials[t].uniforms.colorTexture.value=this.renderTargetsHorizontal[t].texture,this.separableBlurMaterials[t].uniforms.direction.value=sj.BlurDirectionY,e.setRenderTarget(this.renderTargetsVertical[t]),e.clear(),this._fsQuad.render(e),s=this.renderTargetsVertical[t];this._fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,e.setRenderTarget(this.renderTargetsHorizontal[0]),e.clear(),this._fsQuad.render(e),this._fsQuad.material=this.blendMaterial,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,r&&e.state.buffers.stencil.setTest(!0),this.renderToScreen?e.setRenderTarget(null):e.setRenderTarget(i),this._fsQuad.render(e),e.setClearColor(this._oldClearColor,this._oldClearAlpha),e.autoClear=a}_getSeparableBlurMaterial(e){let t=[],i=e/3;for(let n=0;n<e;n++)t.push(.39894*Math.exp(-.5*n*n/(i*i))/i);return new i6({defines:{KERNEL_RADIUS:e},uniforms:{colorTexture:{value:null},invSize:{value:new er(.5,.5)},direction:{value:new er(.5,.5)},gaussianCoefficients:{value:t}},vertexShader:`
464
+
465
+ varying vec2 vUv;
466
+
467
+ void main() {
468
+
469
+ vUv = uv;
470
+ gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
471
+
472
+ }`,fragmentShader:`
473
+
474
+ #include <common>
475
+
476
+ varying vec2 vUv;
477
+
478
+ uniform sampler2D colorTexture;
479
+ uniform vec2 invSize;
480
+ uniform vec2 direction;
481
+ uniform float gaussianCoefficients[KERNEL_RADIUS];
482
+
483
+ void main() {
484
+
485
+ float weightSum = gaussianCoefficients[0];
486
+ vec3 diffuseSum = texture2D( colorTexture, vUv ).rgb * weightSum;
487
+
488
+ for ( int i = 1; i < KERNEL_RADIUS; i ++ ) {
489
+
490
+ float x = float( i );
491
+ float w = gaussianCoefficients[i];
492
+ vec2 uvOffset = direction * invSize * x;
493
+ vec3 sample1 = texture2D( colorTexture, vUv + uvOffset ).rgb;
494
+ vec3 sample2 = texture2D( colorTexture, vUv - uvOffset ).rgb;
495
+ diffuseSum += ( sample1 + sample2 ) * w;
496
+
497
+ }
498
+
499
+ gl_FragColor = vec4( diffuseSum, 1.0 );
500
+
501
+ }`})}_getCompositeMaterial(e){return new i6({defines:{NUM_MIPS:e},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:`
502
+
503
+ varying vec2 vUv;
504
+
505
+ void main() {
506
+
507
+ vUv = uv;
508
+ gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
509
+
510
+ }`,fragmentShader:`
511
+
512
+ varying vec2 vUv;
513
+
514
+ uniform sampler2D blurTexture1;
515
+ uniform sampler2D blurTexture2;
516
+ uniform sampler2D blurTexture3;
517
+ uniform sampler2D blurTexture4;
518
+ uniform sampler2D blurTexture5;
519
+ uniform float bloomStrength;
520
+ uniform float bloomRadius;
521
+ uniform float bloomFactors[NUM_MIPS];
522
+ uniform vec3 bloomTintColors[NUM_MIPS];
523
+
524
+ float lerpBloomFactor( const in float factor ) {
525
+
526
+ float mirrorFactor = 1.2 - factor;
527
+ return mix( factor, mirrorFactor, bloomRadius );
528
+
529
+ }
530
+
531
+ void main() {
532
+
533
+ // 3.0 for backwards compatibility with previous alpha-based intensity
534
+ vec3 bloom = 3.0 * bloomStrength * (
535
+ lerpBloomFactor( bloomFactors[ 0 ] ) * bloomTintColors[ 0 ] * texture2D( blurTexture1, vUv ).rgb +
536
+ lerpBloomFactor( bloomFactors[ 1 ] ) * bloomTintColors[ 1 ] * texture2D( blurTexture2, vUv ).rgb +
537
+ lerpBloomFactor( bloomFactors[ 2 ] ) * bloomTintColors[ 2 ] * texture2D( blurTexture3, vUv ).rgb +
538
+ lerpBloomFactor( bloomFactors[ 3 ] ) * bloomTintColors[ 3 ] * texture2D( blurTexture4, vUv ).rgb +
539
+ lerpBloomFactor( bloomFactors[ 4 ] ) * bloomTintColors[ 4 ] * texture2D( blurTexture5, vUv ).rgb
540
+ );
541
+
542
+ float bloomAlpha = max( bloom.r, max( bloom.g, bloom.b ) );
543
+ gl_FragColor = vec4( bloom, bloomAlpha );
544
+
545
+ }`})}}sj.BlurDirectionX=new er(1,0),sj.BlurDirectionY=new er(0,1);let sW=new e9("#0f172a"),sX=new e9("#1e3a5f"),sY=new e9("#0ea5e9"),sq=new e9("#22d3ee"),sK=new e9("#f0f9ff"),sZ=({data:e,onPointClick:t,onPointHover:i,className:n})=>{let r=(0,o.useRef)(null),a=(0,o.useRef)(null),l=(0,o.useRef)(null),h=(0,o.useRef)(null),c=(0,o.useRef)(null),u=(0,o.useRef)(null),d=(0,o.useRef)(0),p=(0,o.useRef)(new nj),f=(0,o.useRef)(new er(-9999,-9999)),m=(0,o.useRef)([]),g=(0,o.useRef)(new Map),_=(0,o.useRef)(null),v=(0,o.useRef)(0),x=(0,o.useRef)(0),y=(0,o.useRef)(null),M=(0,o.useRef)(null),S=(0,o.useRef)(!0),b=(0,o.useRef)(!1),T=(0,o.useRef)(null),[E,w]=(0,o.useState)([]),A=(0,o.useCallback)(()=>{let t=r.current;if(!t)return;a.current&&(cancelAnimationFrame(d.current),a.current.dispose(),a.current.domElement.remove()),l.current&&l.current.traverse(e=>{e instanceof ih&&(e.geometry.dispose(),Array.isArray(e.material)?e.material.forEach(e=>e.dispose()):e.material.dispose())}),m.current=[],g.current.clear(),_.current=null;let i=t.clientWidth,n=t.clientHeight,s=new su({antialias:!0,alpha:!1});s.setSize(i,n),s.setPixelRatio(Math.min(window.devicePixelRatio,2)),s.setClearColor(657930,1),s.shadowMap.enabled=!0,s.shadowMap.type=2,s.toneMapping=4,s.toneMappingExposure=1.2,t.appendChild(s.domElement),a.current=s;let o=new tt;o.fog=new te(657930,.018),l.current=o;let p=new ih(new i2(200,32,32),new i6({side:1,depthWrite:!1,uniforms:{colorTop:{value:new e9("#1a0533")},colorBottom:{value:new e9("#0a0a0a")}},vertexShader:`
546
+ varying vec3 vWorldPos;
547
+ void main() {
548
+ vec4 worldPos = modelMatrix * vec4(position, 1.0);
549
+ vWorldPos = worldPos.xyz;
550
+ gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
551
+ }
552
+ `,fragmentShader:`
553
+ uniform vec3 colorTop;
554
+ uniform vec3 colorBottom;
555
+ varying vec3 vWorldPos;
556
+ void main() {
557
+ float t = clamp((vWorldPos.y + 50.0) / 150.0, 0.0, 1.0);
558
+ gl_FragColor = vec4(mix(colorBottom, colorTop, t), 1.0);
559
+ }
560
+ `}));o.add(p);let f=new nE(50,i/n,.1,500);f.position.set(25,18,30),f.lookAt(0,0,0),h.current=f;let E=new sy(f,s.domElement);E.enableDamping=!0,E.dampingFactor=.05,E.minDistance=8,E.maxDistance=80,E.maxPolarAngle=Math.PI/2.1,E.target.set(0,2,0),E.autoRotate=!0,E.autoRotateSpeed=.4,u.current=E,E.addEventListener("start",()=>{b.current=!0,S.current=!1,E.autoRotate=!1,T.current&&clearTimeout(T.current)}),E.addEventListener("end",()=>{T.current&&clearTimeout(T.current),T.current=setTimeout(()=>{S.current=!0,E.autoRotate=!0},5e3)});let A=new nL(3359846,.6);o.add(A);let R=new nP(0xeef4ff,1.4);R.position.set(15,30,10),R.castShadow=!0,R.shadow.mapSize.set(1024,1024),R.shadow.camera.near=1,R.shadow.camera.far=80,R.shadow.camera.left=-30,R.shadow.camera.right=30,R.shadow.camera.top=30,R.shadow.camera.bottom=-30,o.add(R);let C=new nP(6514417,.5);C.position.set(-10,8,-15),o.add(C);let P=new nA(2282478,.6,60);P.position.set(0,15,0),o.add(P);let L=new nK(60,40,3718648,3718648);L.position.y=-.05,L.material.opacity=.07,L.material.transparent=!0,o.add(L);let N=new ih(new i0(60,60),new i9({color:988970,roughness:.9,metalness:.1}));N.rotation.x=-Math.PI/2,N.position.y=-.1,N.receiveShadow=!0,o.add(N);let D=e.projects;if(0===D.length)return;let I=[],U=0;for(let e of D)for(let t of e.dataPoints){let e=new Date(t.timestamp).getTime();I.push(e),t.totalTokens>U&&(U=t.totalTokens)}0===U&&(U=1);let O=Math.min(...I),F=Math.max(...I)-O||1,B=new i0(30,20,128,Math.max(8*D.length,32));B.rotateX(-Math.PI/2);let k=B.getAttribute("position"),z=k.count,V=new Float32Array(z),H=new Float32Array(3*z);for(let e=0;e<z;e++){var G;let t=k.getX(e),i=k.getZ(e),n=(t+15)/30,r=(i+10)/20,a=0;for(let e=0;e<D.length;e++){let t=D[e],i=(e+.5)/D.length;for(let e of t.dataPoints){let t=(new Date(e.timestamp).getTime()-O)/F,s=e.totalTokens/U*10,o=n-t,l=r-i,h=.6/D.length;a+=s*Math.exp(-(o*o)/.0018-l*l/(2*h*h))}}let s=Math.min(a,12);V[e]=s,k.setY(e,0);let o=(G=Math.min(s/10,1))<.25?sW.clone().lerp(sX,G/.25):G<.5?sX.clone().lerp(sY,(G-.25)/.25):G<.75?sY.clone().lerp(sq,(G-.5)/.25):sq.clone().lerp(sK,(G-.75)/.25);H[3*e]=o.r,H[3*e+1]=o.g,H[3*e+2]=o.b}B.setAttribute("color",new tI(H,3)),B.computeVertexNormals(),M.current=V;let j=new ih(B,new i7({vertexColors:!0,shininess:40,specular:new e9(1981023),side:2,transparent:!0,opacity:.92}));j.castShadow=!0,j.receiveShadow=!0,o.add(j),y.current=j;let W=new ih(B.clone(),new t6({color:3718648,wireframe:!0,transparent:!0,opacity:.08}));W.position.y=.01,o.add(W);let X=new i2(.18,16,16),Y=new i9({color:3718648,emissive:3718648,emissiveIntensity:.6,roughness:.3,metalness:.5});for(let e=0;e<D.length;e++){let t=D[e],i=(e+.5)/D.length;for(let e of t.dataPoints){let n=(new Date(e.timestamp).getTime()-O)/F,r=e.totalTokens/U*10,a=(n-.5)*30,s=(i-.5)*20,l=new ih(X,Y.clone());l.position.set(a,0,s),l.userData.targetY=r,l.userData.baseScale=1,l.castShadow=!1,o.add(l),m.current.push(l),g.current.set(l,{...e,projectId:t.id,projectName:t.name})}}let q=new i1(.22,.35,24),K=new t6({color:3718648,transparent:!0,opacity:.25,side:2});for(let e of m.current){let t=new ih(q,K.clone());t.rotation.x=-Math.PI/2,t.position.y=-.15,e.add(t)}let Z=new sV(s),J=new sH(o,f);Z.addPass(J);let $=new sj(new er(i,n),.6,.4,.85);Z.addPass($),c.current=Z,v.current=0,x.current=performance.now();let Q=new nY,ee=()=>{d.current=requestAnimationFrame(ee);let e=Q.getElapsedTime(),t=Math.min((performance.now()-x.current)/2e3,1),i=1-Math.pow(1-t,3);if(y.current&&M.current){let e=y.current.geometry.getAttribute("position"),n=W.geometry.getAttribute("position");for(let t=0;t<e.count;t++){let r=M.current[t]*i;e.setY(t,r),n.setY(t,r+.01)}e.needsUpdate=!0,n.needsUpdate=!0,t<1&&(y.current.geometry.computeVertexNormals(),W.geometry.computeVertexNormals())}for(let n of m.current){let r=n.userData.targetY;if(n.position.y=r*i,t>=1){let t=.05*Math.sin(1.5*e+.5*n.position.x+.3*n.position.z);n.position.y=r+t}}for(let e of m.current)if(e===_.current){e.scale.lerp(new es(1.6,1.6,1.6),.15);let t=e.material;t.emissive.lerp(new e9(0xfbbf24),.15),t.emissiveIntensity=et(t.emissiveIntensity,1.2,.15)}else{e.scale.lerp(new es(1,1,1),.1);let t=e.material;t.emissive.lerp(new e9(3718648),.1),t.emissiveIntensity=et(t.emissiveIntensity,.6,.1)}E.update(),Z.render()};ee();let ei=setInterval(()=>{if(!h.current||!a.current)return;let e=h.current,t=new er;a.current.getSize(t);let i=[];for(let n=0;n<D.length;n++){let r=new es(-16.5,.5,((n+.5)/D.length-.5)*20);r.project(e);let a=(r.x+1)/2*t.x,s=(-r.y+1)/2*t.y;r.z<1&&i.push({text:D[n].name,x:a,y:s,type:"project"})}for(let n=0;n<=6;n++){let r=n/6,a=new es((r-.5)*30,-.3,11.5);a.project(e);let s=(a.x+1)/2*t.x,o=(-a.y+1)/2*t.y;if(a.z<1){let e=new Date(O+r*F),t=e.toLocaleDateString("en-US",{month:"short",day:"numeric"})+"\n"+e.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"});i.push({text:t,x:s,y:o,type:"time"})}}w(i)},100);s.domElement.dataset.labelInterval=String(ei)},[e]),R=(0,o.useCallback)(e=>{let t=r.current;if(!t||!h.current||!l.current)return;let n=t.getBoundingClientRect();f.current.x=(e.clientX-n.left)/n.width*2-1,f.current.y=-(2*((e.clientY-n.top)/n.height))+1,p.current.setFromCamera(f.current,h.current);let a=p.current.intersectObjects(m.current,!1);if(a.length>0){let e=a[0].object;_.current!==e&&(_.current=e,i(g.current.get(e)||null),t&&(t.style.cursor="pointer"))}else null!==_.current&&(_.current=null,i(null),t&&(t.style.cursor="grab"))},[i]),C=(0,o.useCallback)(e=>{if(0!==e.button)return;let i=r.current;if(!i||!h.current)return;let n=i.getBoundingClientRect(),a=(e.clientX-n.left)/n.width*2-1,s=-(2*((e.clientY-n.top)/n.height))+1;p.current.setFromCamera(new er(a,s),h.current);let o=p.current.intersectObjects(m.current,!1);if(o.length>0){let e=o[0].object,i=g.current.get(e);i&&t(i)}},[t]);return(0,o.useEffect)(()=>{A();let e=()=>{let e=r.current;if(!e||!a.current||!h.current||!c.current)return;let t=e.clientWidth,i=e.clientHeight;a.current.setSize(t,i),c.current.setSize(t,i),h.current.aspect=t/i,h.current.updateProjectionMatrix()};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e),cancelAnimationFrame(d.current),T.current&&clearTimeout(T.current),a.current?.domElement.dataset.labelInterval&&clearInterval(Number(a.current.domElement.dataset.labelInterval)),l.current&&l.current.traverse(e=>{e instanceof ih&&(e.geometry.dispose(),Array.isArray(e.material)?e.material.forEach(e=>e.dispose()):e.material.dispose())}),a.current&&(a.current.dispose(),a.current.domElement.remove()),c.current&&c.current.dispose(),u.current?.dispose()}},[A]),(0,s.jsx)("div",{ref:r,className:n,style:{position:"relative",width:"100%",height:"100%",minHeight:400,background:"#0a0a0a",overflow:"hidden",cursor:"grab",borderRadius:"8px"},onPointerMove:R,onPointerUp:C,children:E.map((e,t)=>(0,s.jsx)("div",{style:{position:"absolute",left:e.x,top:e.y,transform:"translate(-50%, -50%)",pointerEvents:"none",userSelect:"none",whiteSpace:"pre-line",textAlign:"center",fontSize:"project"===e.type?"11px":"9px",fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace',fontWeight:"project"===e.type?600:400,color:"project"===e.type?"#94a3b8":"#64748b",textShadow:"0 0 8px rgba(0,0,0,0.8)",letterSpacing:"0.02em",lineHeight:1.3,opacity:.9},children:e.text},`${e.type}-${t}`))})},sJ=[{title:"Cost & Value Analysis",description:"Track spending across models with estimated cost breakdowns and ROI metrics",icon:(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-6 h-6",children:(0,s.jsx)("path",{d:"M12 2v20M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6",strokeLinecap:"round",strokeLinejoin:"round"})})},{title:"Daily Activity Trend",description:"Visualize your coding patterns with daily token usage and session frequency",icon:(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-6 h-6",children:(0,s.jsx)("path",{d:"M3 17l6-6 4 4 8-8M14 7h7v7",strokeLinecap:"round",strokeLinejoin:"round"})})},{title:"Model Usage Breakdown",description:"Compare token distribution across Claude models over time",icon:(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-6 h-6",children:(0,s.jsx)("path",{d:"M21 12a9 9 0 11-6.219-8.56M21 3v6h-6",strokeLinecap:"round",strokeLinejoin:"round"})})},{title:"Activity Heatmap",description:"Discover peak productivity hours with a weekly time-of-day heatmap",icon:(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-6 h-6",children:[(0,s.jsx)("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1",strokeLinecap:"round"}),(0,s.jsx)("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1",strokeLinecap:"round"}),(0,s.jsx)("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1",strokeLinecap:"round"}),(0,s.jsx)("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1",strokeLinecap:"round"})]})},{title:"Context Window Utilization",description:"Monitor how much of the context window each session consumes",icon:(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-6 h-6",children:(0,s.jsx)("path",{d:"M4 4h16v16H4zM9 4v16M4 9h16M4 15h16",strokeLinecap:"round",strokeLinejoin:"round"})})},{title:"Cache Efficiency",description:"Analyze cache hit rates and savings from prompt caching across projects",icon:(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-6 h-6",children:(0,s.jsx)("path",{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",strokeLinecap:"round",strokeLinejoin:"round"})})},{title:"Top Projects",description:"Rank projects by token usage, sessions, and engagement metrics",icon:(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-6 h-6",children:(0,s.jsx)("path",{d:"M8 21V11M12 21V3M16 21v-6M4 21h16",strokeLinecap:"round",strokeLinejoin:"round"})})},{title:"Session Duration Distribution",description:"Understand session length patterns and identify your longest workflows",icon:(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-6 h-6",children:[(0,s.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,s.jsx)("path",{d:"M12 6v6l4 2",strokeLinecap:"round",strokeLinejoin:"round"})]})}];function s$({onActivate:e,validateKey:t}){let[i,n]=(0,o.useState)(""),[r,a]=(0,o.useState)(""),[l,h]=(0,o.useState)(!1),[c,u]=(0,o.useState)(!1);(0,o.useEffect)(()=>{r&&a("")},[i]);let d=()=>{let n=i.trim();n?t&&t(n)?(h(!0),setTimeout(()=>{e(n)},1200)):a("invalid license key"):a("please enter a license key")};return l?(0,s.jsx)("div",{className:"h-full flex items-center justify-center",children:(0,s.jsxs)("div",{className:"text-center animate-fade-in",children:[(0,s.jsx)("div",{className:"w-20 h-20 mx-auto mb-6 rounded-full bg-emerald-500/20 border border-emerald-500/40 flex items-center justify-center",children:(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-10 h-10 text-emerald-400",children:(0,s.jsx)("path",{d:"M5 13l4 4L19 7",strokeLinecap:"round",strokeLinejoin:"round"})})}),(0,s.jsx)("h2",{className:"text-2xl font-bold text-white mb-2",children:"License Activated"}),(0,s.jsx)("p",{className:"text-slate-400",children:"loading analytics dashboard..."})]})}):(0,s.jsx)("div",{className:"h-full overflow-y-auto",children:(0,s.jsxs)("div",{className:"max-w-4xl mx-auto px-6 py-12",children:[(0,s.jsxs)("div",{className:"text-center mb-12",children:[(0,s.jsxs)("div",{className:"inline-flex items-center gap-2 px-3 py-1 rounded-full bg-cyan-500/10 border border-cyan-500/20 text-cyan-400 text-xs font-medium mb-6",children:[(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3.5 h-3.5",children:(0,s.jsx)("path",{d:"M12 15V3m0 12l-4-4m4 4l4-4M2 17l.621 2.485A2 2 0 004.561 21h14.878a2 2 0 001.94-1.515L22 17",strokeLinecap:"round",strokeLinejoin:"round"})}),"PRO FEATURE"]}),(0,s.jsx)("h1",{className:"text-4xl sm:text-5xl font-bold mb-4",children:(0,s.jsx)("span",{className:"bg-gradient-to-r from-cyan-400 via-blue-400 to-purple-400 bg-clip-text text-transparent",children:"Unlock Analytics"})}),(0,s.jsx)("p",{className:"text-slate-400 text-lg max-w-2xl mx-auto leading-relaxed",children:"Deep insights into your Claude Code usage. Track costs, discover patterns, and optimize your AI-assisted development workflow."})]}),(0,s.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 mb-12",children:sJ.map(e=>(0,s.jsx)("div",{className:"group relative rounded-xl border border-white/[0.06] bg-white/[0.02] backdrop-blur-sm p-5 hover:bg-white/[0.04] hover:border-white/[0.1] transition-all duration-300",children:(0,s.jsxs)("div",{className:"flex items-start gap-4",children:[(0,s.jsx)("div",{className:"flex-shrink-0 w-10 h-10 rounded-lg bg-gradient-to-br from-cyan-500/20 to-blue-500/20 border border-cyan-500/10 flex items-center justify-center text-cyan-400 group-hover:text-cyan-300 transition-colors",children:e.icon}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-white mb-1",children:e.title}),(0,s.jsx)("p",{className:"text-xs text-slate-500 leading-relaxed",children:e.description})]})]})},e.title))}),(0,s.jsx)("div",{className:"text-center mb-8",children:(0,s.jsxs)("a",{href:"https://yalladevrel.lemonsqueezy.com/checkout/buy/62004d70-13c5-4fd2-849e-66adf2215509",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 px-8 py-3 rounded-xl bg-gradient-to-r from-cyan-500 to-blue-500 text-white font-semibold text-sm hover:from-cyan-400 hover:to-blue-400 transition-all duration-200 shadow-lg shadow-cyan-500/20 hover:shadow-cyan-500/30 hover:-translate-y-0.5",children:[(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:(0,s.jsx)("path",{d:"M12 15V3m0 12l-4-4m4 4l4-4M2 17l.621 2.485A2 2 0 004.561 21h14.878a2 2 0 001.94-1.515L22 17",strokeLinecap:"round",strokeLinejoin:"round"})}),"Get a License Key"]})}),(0,s.jsx)("div",{className:"max-w-md mx-auto",children:c?(0,s.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-white/[0.02] backdrop-blur-sm p-6 animate-fade-in",children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-slate-300 mb-3",children:"Enter your license key"}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("input",{type:"text",value:i,onChange:e=>n(e.target.value),onKeyDown:e=>{"Enter"===e.key&&d()},placeholder:"CCI-PRO-...",className:"flex-1 px-4 py-2.5 rounded-lg bg-black/40 border border-white/[0.08] text-white font-mono text-sm placeholder-slate-600 focus:outline-none focus:ring-2 focus:ring-cyan-500/40 focus:border-cyan-500/30 transition-all",autoFocus:!0}),(0,s.jsx)("button",{onClick:d,className:"px-5 py-2.5 rounded-lg bg-cyan-500/20 border border-cyan-500/30 text-cyan-400 text-sm font-medium hover:bg-cyan-500/30 hover:text-cyan-300 transition-all",children:"Activate"})]}),r&&(0,s.jsx)("p",{className:"mt-2 text-sm text-red-400 animate-fade-in",children:r})]}):(0,s.jsx)("button",{onClick:()=>u(!0),className:"w-full text-center text-sm text-slate-500 hover:text-slate-300 transition-colors cursor-pointer py-2",children:"Already have a key? Click to activate"})})]})})}async function sQ(){try{return(await e.A(85186)).default}catch{return null}}e.s(["default",0,function(){let[e,t]=(0,o.useState)([]),[i,n]=(0,o.useState)(null),[r,a]=(0,o.useState)(null),[h,c]=(0,o.useState)(null),[u,d]=(0,o.useState)(!1),[p,f]=(0,o.useState)(!0),[m,_]=(0,o.useState)(!1),[v,x]=(0,o.useState)("terrain"),[y,M]=(0,o.useState)(!1),[S,b]=(0,o.useState)(null);(0,o.useEffect)(()=>{sQ().then(e=>{if(!e)return;b(e);let t=e.getStoredLicense();t&&e.validateLicense(t).valid&&M(!0)})},[]);let T=(0,o.useCallback)(e=>{S&&S.storeLicense(e),M(!0)},[S]);(0,o.useEffect)(()=>{fetch("/api/projects").then(e=>e.json()).then(e=>{t(e.projects||[]),f(!1)}).catch(()=>f(!1))},[]);let E=(0,o.useCallback)(async e=>{n(e),_(!0),x("detail");try{let t=await fetch(`/api/projects/${encodeURIComponent(e)}`),i=await t.json();a(i)}catch{a(null)}_(!1)},[]),A=(0,o.useCallback)(async e=>{if(r)try{let t=await fetch(`/api/projects/${encodeURIComponent(r.id)}/sessions/${encodeURIComponent(e)}`),i=await t.json();c({projectName:r.name,sessionId:i.id,model:i.model,firstPrompt:i.firstPrompt,lastPrompt:i.lastPrompt,firstTimestamp:i.firstTimestamp,lastTimestamp:i.lastTimestamp,messageCount:i.messageCount,totalInputTokens:i.totalInputTokens,totalOutputTokens:i.totalOutputTokens,totalCacheCreationTokens:i.totalCacheCreationTokens,totalCacheReadTokens:i.totalCacheReadTokens,totalTokens:i.totalTokens,contextSnapshots:i.contextWindowSnapshots||[]}),d(!0)}catch{}},[r]),R=(0,o.useCallback)(t=>{let i=t.projectId,n=e.find(e=>e.id===i);if(!n)return;let r=n.sessions?.find(e=>e.id===t.sessionId);r?(c({projectName:n.name,sessionId:r.id,model:r.model,firstPrompt:r.firstPrompt,lastPrompt:r.lastPrompt,firstTimestamp:r.firstTimestamp,lastTimestamp:r.lastTimestamp,messageCount:r.messageCount,totalInputTokens:r.totalInputTokens,totalOutputTokens:r.totalOutputTokens,totalCacheCreationTokens:r.totalCacheCreationTokens,totalCacheReadTokens:r.totalCacheReadTokens,totalTokens:r.totalTokens,contextSnapshots:r.contextWindowSnapshots||[]}),d(!0)):fetch(`/api/projects/${encodeURIComponent(n.id)}/sessions/${encodeURIComponent(t.sessionId)}`).then(e=>e.json()).then(e=>{c({projectName:n.name,sessionId:e.id,model:e.model,firstPrompt:e.firstPrompt,lastPrompt:e.lastPrompt,firstTimestamp:e.firstTimestamp,lastTimestamp:e.lastTimestamp,messageCount:e.messageCount,totalInputTokens:e.totalInputTokens,totalOutputTokens:e.totalOutputTokens,totalCacheCreationTokens:e.totalCacheCreationTokens,totalCacheReadTokens:e.totalCacheReadTokens,totalTokens:e.totalTokens,contextSnapshots:e.contextWindowSnapshots||[]}),d(!0)})},[e]),C={projects:e.map(e=>{let t=(e.sessions||[]).flatMap(t=>(t.contextWindowSnapshots||[]).map(i=>({timestamp:i.timestamp,totalTokens:i.totalTokens,inputTokens:i.inputTokens,outputTokens:i.outputTokens,sessionId:t.id,messageIndex:i.messageIndex,projectId:e.id,projectName:e.name}))),i=(e.sessions||[]).map(t=>({timestamp:t.firstTimestamp||t.lastTimestamp||new Date().toISOString(),totalTokens:t.totalTokens,inputTokens:t.totalInputTokens,outputTokens:t.totalOutputTokens,sessionId:t.id,messageIndex:0,projectId:e.id,projectName:e.name}));return{id:e.id,name:e.name,dataPoints:t.length>0?t:i}}).filter(e=>e.dataPoints.length>0)},P=e.reduce((e,t)=>e+t.sessionCount,0),L=e.reduce((e,t)=>e+t.totalTokens,0),N=e.reduce((e,t)=>e+(t.sessions||[]).reduce((e,t)=>e+t.messageCount,0),0),D=e.length>0&&[...e].sort((e,t)=>t.totalTokens-e.totalTokens)[0]?.name||"";return p?(0,s.jsx)("div",{className:"h-full flex items-center justify-center",children:(0,s.jsxs)("div",{className:"text-center",children:[(0,s.jsx)("div",{className:"w-16 h-16 mx-auto mb-4 rounded-full border-2 border-cyan-400/30 border-t-cyan-400 animate-spin"}),(0,s.jsx)("p",{className:"text-slate-400 text-sm",children:"Loading Claude Code projects..."})]})}):(0,s.jsxs)("div",{className:"h-full flex flex-col",children:[(0,s.jsx)(U,{totalProjects:e.length,totalSessions:P,totalTokens:L,totalMessages:N,mostActiveProject:D,avgTokensPerSession:P>0?Math.round(L/P):0}),(0,s.jsxs)("div",{className:"flex-1 flex overflow-hidden",children:[(0,s.jsx)(l,{projects:e,selectedId:i,onSelect:E,onShowTerrain:()=>{x("terrain"),n(null)},onShowAnalytics:()=>{x("analytics"),n(null)}}),(0,s.jsxs)("main",{className:"flex-1 overflow-hidden relative",children:["terrain"===v&&(0,s.jsx)("div",{className:"h-full animate-fade-in",children:(0,s.jsx)(sZ,{data:C,onPointClick:R,onPointHover:()=>{},className:"h-full"})}),"detail"===v&&r&&!m&&(0,s.jsx)("div",{className:"h-full overflow-y-auto p-6 animate-slide-in-right",children:(0,s.jsx)(g,{project:r,onSessionClick:A})}),"detail"===v&&m&&(0,s.jsx)("div",{className:"h-full flex items-center justify-center",children:(0,s.jsx)("div",{className:"w-10 h-10 rounded-full border-2 border-cyan-400/30 border-t-cyan-400 animate-spin"})}),"detail"===v&&!r&&!m&&(0,s.jsx)("div",{className:"h-full flex items-center justify-center text-slate-500",children:(0,s.jsx)("p",{children:"Select a project from the sidebar"})}),"analytics"===v&&S&&y&&(0,s.jsx)("div",{className:"h-full overflow-y-auto animate-fade-in",children:(0,s.jsx)(S.AnalyticsDashboard,{projects:e})}),"analytics"===v&&(!S||!y)&&(0,s.jsx)("div",{className:"h-full animate-fade-in",children:(0,s.jsx)(s$,{onActivate:T,validateKey:S?e=>S.validateLicense(e).valid:void 0})})]})]}),(0,s.jsx)(w,{isOpen:u,onClose:()=>d(!1),data:h})]})}],52683)}]);