@roomle/web-sdk 2.63.0 → 2.64.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. package/lib/{TextGeometry-d25f1fa4.js → TextGeometry-d7dcb1a8.js} +2 -2
  2. package/lib/{TextGeometry-d25f1fa4.js.map → TextGeometry-d7dcb1a8.js.map} +1 -1
  3. package/lib/{TextGeometry-f2fc57a2.nomodule.js → TextGeometry-df6eed60.nomodule.js} +2 -2
  4. package/lib/{TextGeometry-f2fc57a2.nomodule.js.map → TextGeometry-df6eed60.nomodule.js.map} +1 -1
  5. package/lib/{banana-for-scale-e7fb6c04.nomodule.js → banana-for-scale-29b25ea9.nomodule.js} +2 -2
  6. package/lib/{banana-for-scale-e7fb6c04.nomodule.js.map → banana-for-scale-29b25ea9.nomodule.js.map} +1 -1
  7. package/lib/{banana-for-scale-d5ee3dda.js → banana-for-scale-55632ac0.js} +2 -2
  8. package/lib/{banana-for-scale-d5ee3dda.js.map → banana-for-scale-55632ac0.js.map} +1 -1
  9. package/lib/{budgeteer-measure-f229f761.js → budgeteer-measure-41916468.js} +2 -2
  10. package/lib/{budgeteer-measure-f229f761.js.map → budgeteer-measure-41916468.js.map} +1 -1
  11. package/lib/budgeteer-measure.nomodule.js +1 -1
  12. package/lib/{component-dimensioning-63c673fb.nomodule.js → component-dimensioning-2c3f8e73.nomodule.js} +2 -2
  13. package/lib/component-dimensioning-2c3f8e73.nomodule.js.map +1 -0
  14. package/lib/{component-dimensioning-75e9fdfd.js → component-dimensioning-2cadd6d1.js} +2 -2
  15. package/lib/component-dimensioning-2cadd6d1.js.map +1 -0
  16. package/lib/{component-raycast-helper-6961b8e3.nomodule.js → component-raycast-helper-ee5ee90e.nomodule.js} +2 -2
  17. package/lib/component-raycast-helper-ee5ee90e.nomodule.js.map +1 -0
  18. package/lib/{component-raycast-helper-b637a254.js → component-raycast-helper-f43e9296.js} +2 -2
  19. package/lib/component-raycast-helper-f43e9296.js.map +1 -0
  20. package/lib/{configurator-640c722b.nomodule.js → configurator-41306664.nomodule.js} +2 -2
  21. package/lib/configurator-41306664.nomodule.js.map +1 -0
  22. package/lib/{configurator-74093f32.js → configurator-a643d14a.js} +2 -2
  23. package/lib/configurator-a643d14a.js.map +1 -0
  24. package/lib/configurator-main-2696b142.js +2 -0
  25. package/lib/configurator-main-2696b142.js.map +1 -0
  26. package/lib/configurator-main.nomodule.js +1 -1
  27. package/lib/{continuous-drawing-helper-bdad4f4e.nomodule.js → continuous-drawing-helper-5d3a8a98.nomodule.js} +2 -2
  28. package/lib/continuous-drawing-helper-5d3a8a98.nomodule.js.map +1 -0
  29. package/lib/{continuous-drawing-helper-38e8cce0.js → continuous-drawing-helper-c6d36132.js} +2 -2
  30. package/lib/continuous-drawing-helper-c6d36132.js.map +1 -0
  31. package/lib/{default-light-setting-8951625e.nomodule.js → default-light-setting-6ef7ed3d.nomodule.js} +2 -2
  32. package/lib/default-light-setting-6ef7ed3d.nomodule.js.map +1 -0
  33. package/lib/{default-light-setting-74881f94.js → default-light-setting-a5166832.js} +2 -2
  34. package/lib/default-light-setting-a5166832.js.map +1 -0
  35. package/lib/definitions/common-core/__tests__/image-renderer.d.ts +2 -0
  36. package/lib/definitions/common-core/src/utils/threejs-utils.d.ts +3 -1
  37. package/lib/definitions/common-core/src/webgl/image-renderer.d.ts +1 -1
  38. package/lib/definitions/common-core/src/webgl/renderer/environment-definition.d.ts +16 -2
  39. package/lib/definitions/common-core/src/webgl/renderer/light-source-detection.d.ts +2 -1
  40. package/lib/definitions/common-core/src/webgl/roomle-webgl-renderer.d.ts +1 -0
  41. package/lib/definitions/configurator-core/src/utils/test-helpers/utils.d.ts +2 -0
  42. package/lib/definitions/configurator-core/src/webgl/configurator-scene-manager.d.ts +2 -2
  43. package/lib/definitions/planner-core/src/roomle-planner.d.ts +7 -0
  44. package/lib/definitions/planner-core/src/webgl/planner-scene-manager.d.ts +6 -1
  45. package/lib/{dimensioning-helper-2614e50c.js → dimensioning-helper-57d93bbb.js} +2 -2
  46. package/lib/{dimensioning-helper-2614e50c.js.map → dimensioning-helper-57d93bbb.js.map} +1 -1
  47. package/lib/{dimensioning-helper-771563fa.nomodule.js → dimensioning-helper-f65c90f1.nomodule.js} +2 -2
  48. package/lib/{dimensioning-helper-771563fa.nomodule.js.map → dimensioning-helper-f65c90f1.nomodule.js.map} +1 -1
  49. package/lib/{glb-viewer-f11f3cb7.js → glb-viewer-5e349648.js} +2 -2
  50. package/lib/{glb-viewer-f11f3cb7.js.map → glb-viewer-5e349648.js.map} +1 -1
  51. package/lib/{glb-viewer-75d2e09c.nomodule.js → glb-viewer-b8dfe219.nomodule.js} +2 -2
  52. package/lib/{glb-viewer-75d2e09c.nomodule.js.map → glb-viewer-b8dfe219.nomodule.js.map} +1 -1
  53. package/lib/glb-viewer-main-9dcb6ebb.js +2 -0
  54. package/lib/glb-viewer-main-9dcb6ebb.js.map +1 -0
  55. package/lib/glb-viewer-main.nomodule.js +1 -1
  56. package/lib/legacy/{TextGeometry-6ea1a7a3.legacy.js → TextGeometry-f37411bb.legacy.js} +2 -2
  57. package/lib/legacy/{TextGeometry-6ea1a7a3.legacy.js.map → TextGeometry-f37411bb.legacy.js.map} +1 -1
  58. package/lib/legacy/{banana-for-scale-d3481724.legacy.js → banana-for-scale-eb176575.legacy.js} +2 -2
  59. package/lib/legacy/{banana-for-scale-d3481724.legacy.js.map → banana-for-scale-eb176575.legacy.js.map} +1 -1
  60. package/lib/legacy/budgeteer-measure.legacy.js +1 -1
  61. package/lib/legacy/{component-dimensioning-24a4c3cd.legacy.js → component-dimensioning-c0100b50.legacy.js} +2 -2
  62. package/lib/legacy/component-dimensioning-c0100b50.legacy.js.map +1 -0
  63. package/lib/legacy/{component-raycast-helper-401e69ee.legacy.js → component-raycast-helper-aa680c21.legacy.js} +2 -2
  64. package/lib/legacy/component-raycast-helper-aa680c21.legacy.js.map +1 -0
  65. package/lib/legacy/{configurator-72334374.legacy.js → configurator-7a114290.legacy.js} +2 -2
  66. package/lib/legacy/configurator-7a114290.legacy.js.map +1 -0
  67. package/lib/legacy/configurator-main.legacy.js +1 -1
  68. package/lib/legacy/{continuous-drawing-helper-959c9230.legacy.js → continuous-drawing-helper-25ae9853.legacy.js} +2 -2
  69. package/lib/legacy/continuous-drawing-helper-25ae9853.legacy.js.map +1 -0
  70. package/lib/legacy/{default-light-setting-5155e3b7.legacy.js → default-light-setting-7d35c4b0.legacy.js} +2 -2
  71. package/lib/legacy/default-light-setting-7d35c4b0.legacy.js.map +1 -0
  72. package/lib/legacy/{dimensioning-helper-39d0ac36.legacy.js → dimensioning-helper-9d505a2f.legacy.js} +2 -2
  73. package/lib/legacy/{dimensioning-helper-39d0ac36.legacy.js.map → dimensioning-helper-9d505a2f.legacy.js.map} +1 -1
  74. package/lib/legacy/{glb-viewer-21343679.legacy.js → glb-viewer-fcfde056.legacy.js} +2 -2
  75. package/lib/legacy/{glb-viewer-21343679.legacy.js.map → glb-viewer-fcfde056.legacy.js.map} +1 -1
  76. package/lib/legacy/glb-viewer-main.legacy.js +1 -1
  77. package/lib/legacy/{main-thread-to-worker-334452db.legacy.js → main-thread-to-worker-88746ef2.legacy.js} +2 -2
  78. package/lib/legacy/{main-thread-to-worker-334452db.legacy.js.map → main-thread-to-worker-88746ef2.legacy.js.map} +1 -1
  79. package/lib/legacy/{material-viewer-76e17b0e.legacy.js → material-viewer-6ecbbede.legacy.js} +2 -2
  80. package/lib/legacy/material-viewer-6ecbbede.legacy.js.map +1 -0
  81. package/lib/legacy/material-viewer-main.legacy.js +1 -1
  82. package/lib/legacy/planner-5417772c.legacy.js +2 -0
  83. package/lib/legacy/{planner-118a3c2a.legacy.js.map → planner-5417772c.legacy.js.map} +1 -1
  84. package/lib/legacy/planner-main.legacy.js +1 -1
  85. package/lib/legacy/roomle-configurator-b17ee31c.legacy.js +2 -0
  86. package/lib/legacy/roomle-configurator-b17ee31c.legacy.js.map +1 -0
  87. package/lib/legacy/{roomle-dependency-injection-39c6c926.legacy.js → roomle-dependency-injection-ef0888c0.legacy.js} +3 -3
  88. package/lib/legacy/{roomle-dependency-injection-39c6c926.legacy.js.map → roomle-dependency-injection-ef0888c0.legacy.js.map} +1 -1
  89. package/lib/legacy/roomle-sdk.legacy.js +1 -1
  90. package/lib/legacy/scene-manager-0f7a3505.legacy.js +2 -0
  91. package/lib/legacy/{scene-manager-4c49ffd2.legacy.js.map → scene-manager-0f7a3505.legacy.js.map} +1 -1
  92. package/lib/legacy/{script-loader-ac6bc6eb.legacy.js → script-loader-87105926.legacy.js} +2 -2
  93. package/lib/legacy/script-loader-87105926.legacy.js.map +1 -0
  94. package/lib/legacy/{stats-helper-c027c078.legacy.js → stats-helper-8c73c389.legacy.js} +2 -2
  95. package/lib/legacy/stats-helper-8c73c389.legacy.js.map +1 -0
  96. package/lib/legacy/{tools-core-5f513877.legacy.js → tools-core-1eb152d6.legacy.js} +2 -2
  97. package/lib/legacy/tools-core-1eb152d6.legacy.js.map +1 -0
  98. package/lib/{main-thread-to-worker-d5d5841d.js → main-thread-to-worker-a765ee2b.js} +2 -2
  99. package/lib/{main-thread-to-worker-d5d5841d.js.map → main-thread-to-worker-a765ee2b.js.map} +1 -1
  100. package/lib/{main-thread-to-worker-cce716d1.nomodule.js → main-thread-to-worker-e5396037.nomodule.js} +2 -2
  101. package/lib/{main-thread-to-worker-cce716d1.nomodule.js.map → main-thread-to-worker-e5396037.nomodule.js.map} +1 -1
  102. package/lib/{material-viewer-54c1dd62.js → material-viewer-1f1beabd.js} +2 -2
  103. package/lib/material-viewer-1f1beabd.js.map +1 -0
  104. package/lib/{material-viewer-d25178c4.nomodule.js → material-viewer-753a33c9.nomodule.js} +2 -2
  105. package/lib/material-viewer-753a33c9.nomodule.js.map +1 -0
  106. package/lib/material-viewer-main-42a973a6.js +2 -0
  107. package/lib/material-viewer-main-42a973a6.js.map +1 -0
  108. package/lib/material-viewer-main.nomodule.js +1 -1
  109. package/lib/planner-4b991932.nomodule.js +2 -0
  110. package/lib/{planner-3f3c77fa.nomodule.js.map → planner-4b991932.nomodule.js.map} +1 -1
  111. package/lib/planner-dummy-app.js +1 -1
  112. package/lib/planner-dummy-app.js.map +1 -1
  113. package/lib/planner-dummy.html +3 -0
  114. package/lib/planner-f2c9e2a7.js +2 -0
  115. package/lib/{planner-27f02e36.js.map → planner-f2c9e2a7.js.map} +1 -1
  116. package/lib/planner-main-5bf48972.js +2 -0
  117. package/lib/planner-main-5bf48972.js.map +1 -0
  118. package/lib/planner-main.nomodule.js +1 -1
  119. package/lib/roomle-configurator-1f74db84.js +2 -0
  120. package/lib/roomle-configurator-1f74db84.js.map +1 -0
  121. package/lib/roomle-configurator-73e36fea.nomodule.js +2 -0
  122. package/lib/roomle-configurator-73e36fea.nomodule.js.map +1 -0
  123. package/lib/{roomle-dependency-injection-9b7e9b99.nomodule.js → roomle-dependency-injection-a3d0213f.nomodule.js} +3 -3
  124. package/lib/{roomle-dependency-injection-9b7e9b99.nomodule.js.map → roomle-dependency-injection-a3d0213f.nomodule.js.map} +1 -1
  125. package/lib/{roomle-dependency-injection-597b90a7.js → roomle-dependency-injection-feeade2a.js} +3 -3
  126. package/lib/{roomle-dependency-injection-597b90a7.js.map → roomle-dependency-injection-feeade2a.js.map} +1 -1
  127. package/lib/{roomle-sdk-e89b8e36.js → roomle-sdk-6a954004.js} +2 -2
  128. package/lib/roomle-sdk-6a954004.js.map +1 -0
  129. package/lib/roomle-sdk.nomodule.js +1 -1
  130. package/lib/scene-manager-0c37a0a4.nomodule.js +2 -0
  131. package/lib/{scene-manager-61f9a10a.nomodule.js.map → scene-manager-0c37a0a4.nomodule.js.map} +1 -1
  132. package/lib/scene-manager-3569dc7c.js +2 -0
  133. package/lib/{scene-manager-805fb8e3.js.map → scene-manager-3569dc7c.js.map} +1 -1
  134. package/lib/{script-loader-94abc8b8.nomodule.js → script-loader-39fb0119.nomodule.js} +2 -2
  135. package/lib/script-loader-39fb0119.nomodule.js.map +1 -0
  136. package/lib/{script-loader-0175c371.js → script-loader-f6d3bde6.js} +2 -2
  137. package/lib/script-loader-f6d3bde6.js.map +1 -0
  138. package/lib/{stats-helper-208e0d5c.nomodule.js → stats-helper-c7e0d6e7.nomodule.js} +2 -2
  139. package/lib/stats-helper-c7e0d6e7.nomodule.js.map +1 -0
  140. package/lib/{stats-helper-b87f9b7a.js → stats-helper-dca14fc4.js} +2 -2
  141. package/lib/stats-helper-dca14fc4.js.map +1 -0
  142. package/lib/{tools-core-20199721.nomodule.js → tools-core-39a8e28d.nomodule.js} +2 -2
  143. package/lib/tools-core-39a8e28d.nomodule.js.map +1 -0
  144. package/lib/{tools-core-ef85325b.js → tools-core-cf5f452a.js} +2 -2
  145. package/lib/tools-core-cf5f452a.js.map +1 -0
  146. package/package.json +2 -2
  147. package/lib/component-dimensioning-63c673fb.nomodule.js.map +0 -1
  148. package/lib/component-dimensioning-75e9fdfd.js.map +0 -1
  149. package/lib/component-raycast-helper-6961b8e3.nomodule.js.map +0 -1
  150. package/lib/component-raycast-helper-b637a254.js.map +0 -1
  151. package/lib/configurator-640c722b.nomodule.js.map +0 -1
  152. package/lib/configurator-74093f32.js.map +0 -1
  153. package/lib/configurator-main-55c8e327.js +0 -2
  154. package/lib/configurator-main-55c8e327.js.map +0 -1
  155. package/lib/continuous-drawing-helper-38e8cce0.js.map +0 -1
  156. package/lib/continuous-drawing-helper-bdad4f4e.nomodule.js.map +0 -1
  157. package/lib/default-light-setting-74881f94.js.map +0 -1
  158. package/lib/default-light-setting-8951625e.nomodule.js.map +0 -1
  159. package/lib/glb-viewer-main-2dbf8c41.js +0 -2
  160. package/lib/glb-viewer-main-2dbf8c41.js.map +0 -1
  161. package/lib/legacy/component-dimensioning-24a4c3cd.legacy.js.map +0 -1
  162. package/lib/legacy/component-raycast-helper-401e69ee.legacy.js.map +0 -1
  163. package/lib/legacy/configurator-72334374.legacy.js.map +0 -1
  164. package/lib/legacy/continuous-drawing-helper-959c9230.legacy.js.map +0 -1
  165. package/lib/legacy/default-light-setting-5155e3b7.legacy.js.map +0 -1
  166. package/lib/legacy/material-viewer-76e17b0e.legacy.js.map +0 -1
  167. package/lib/legacy/planner-118a3c2a.legacy.js +0 -2
  168. package/lib/legacy/roomle-configurator-7291a081.legacy.js +0 -2
  169. package/lib/legacy/roomle-configurator-7291a081.legacy.js.map +0 -1
  170. package/lib/legacy/scene-manager-4c49ffd2.legacy.js +0 -2
  171. package/lib/legacy/script-loader-ac6bc6eb.legacy.js.map +0 -1
  172. package/lib/legacy/stats-helper-c027c078.legacy.js.map +0 -1
  173. package/lib/legacy/tools-core-5f513877.legacy.js.map +0 -1
  174. package/lib/material-viewer-54c1dd62.js.map +0 -1
  175. package/lib/material-viewer-d25178c4.nomodule.js.map +0 -1
  176. package/lib/material-viewer-main-65a30660.js +0 -2
  177. package/lib/material-viewer-main-65a30660.js.map +0 -1
  178. package/lib/planner-27f02e36.js +0 -2
  179. package/lib/planner-3f3c77fa.nomodule.js +0 -2
  180. package/lib/planner-main-fc563f29.js +0 -2
  181. package/lib/planner-main-fc563f29.js.map +0 -1
  182. package/lib/roomle-configurator-4d92e806.js +0 -2
  183. package/lib/roomle-configurator-4d92e806.js.map +0 -1
  184. package/lib/roomle-configurator-b3473d62.nomodule.js +0 -2
  185. package/lib/roomle-configurator-b3473d62.nomodule.js.map +0 -1
  186. package/lib/roomle-sdk-e89b8e36.js.map +0 -1
  187. package/lib/scene-manager-61f9a10a.nomodule.js +0 -2
  188. package/lib/scene-manager-805fb8e3.js +0 -2
  189. package/lib/script-loader-0175c371.js.map +0 -1
  190. package/lib/script-loader-94abc8b8.nomodule.js.map +0 -1
  191. package/lib/stats-helper-208e0d5c.nomodule.js.map +0 -1
  192. package/lib/stats-helper-b87f9b7a.js.map +0 -1
  193. package/lib/tools-core-20199721.nomodule.js.map +0 -1
  194. package/lib/tools-core-ef85325b.js.map +0 -1
@@ -3,5 +3,5 @@ System.register([],(function(e){return{execute:function(){function t(e,t){var n=
3
3
  * @license
4
4
  * Copyright 2010-2023 Three.js Authors
5
5
  * SPDX-License-Identifier: MIT
6
- */e({_:u,aB:M,ac:x,ak:_,al:c,b_:m,bt:l,bu:v,bv:function(e){for(var n=1;n<arguments.length;n++){var i=null!=arguments[n]?arguments[n]:{};n%2?t(Object(i),!0).forEach((function(t){l(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):t(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e},e:g,f:a,h:s,m:E,o:i}),e("bp",0);var R=e("bo",1),C=e("bq",2),L=e("br",3),P=e("a9",0),k=e("bk",1),U=e("y",2),I=e("b4",0),N=e("bj",2),D=e("bw",5),O=e("b7",100),F=e("bx",103),z=e("b6",200),B=e("by",201),H=e("b8",206),V=e("b5",208),G=e("bA",0),W=e("bB",1),X=e("bC",2),j=e("bD",3),Y=e("bE",4),q=e("a$",303),Z=e("t",1e3),J=e("a6",1001),K=e("a7",1002),Q=e("a2",1003),$=e("a3",1004),ee=e("a5",1005),te=e("r",1006),ne=e("a4",1007),ie=e("s",1008),re=e("aX",1015),ae=e("aV",1016),oe=e("be",1020),se=e("ap",1023),le=e("bd",1027),ue=e("aY",1028),ce=e("bz",1030),he=e("a8",2300),de=e("a1",2301),fe=(e("T",0),e("d",1),e("c",2),e("bi",3201)),pe=e("aZ",""),ve=e("k","srgb"),me=e("am","srgb-linear"),ge=function(){function e(){a(this,e)}return s(e,[{key:"addEventListener",value:function(e,t){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)}},{key:"hasEventListener",value:function(e,t){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)}},{key:"removeEventListener",value:function(e,t){if(void 0!==this._listeners){var n=this._listeners[e];if(void 0!==n){var i=n.indexOf(t);-1!==i&&n.splice(i,1)}}}},{key:"dispatchEvent",value:function(e){if(void 0!==this._listeners){var t=this._listeners[e.type];if(void 0!==t){e.target=this;for(var n=t.slice(0),i=0,r=n.length;i<r;i++)n[i].call(this,e);e.target=null}}}}]),e}(),ye=["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"],_e=1234567,xe=Math.PI/180,Me=180/Math.PI;function Se(){var e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(ye[255&e]+ye[e>>8&255]+ye[e>>16&255]+ye[e>>24&255]+"-"+ye[255&t]+ye[t>>8&255]+"-"+ye[t>>16&15|64]+ye[t>>24&255]+"-"+ye[63&n|128]+ye[n>>8&255]+"-"+ye[n>>16&255]+ye[n>>24&255]+ye[255&i]+ye[i>>8&255]+ye[i>>16&255]+ye[i>>24&255]).toLowerCase()}function be(e,t,n){return Math.max(t,Math.min(n,e))}function Ee(e,t){return(e%t+t)%t}function Te(e,t,n){return(1-n)*e+n*t}function we(e){return 0==(e&e-1)&&0!==e}function Ae(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function Re(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}function Ce(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}function Le(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(4294967295*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(2147483647*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw new Error("Invalid component type.")}}e("X",{DEG2RAD:xe,RAD2DEG:Me,generateUUID:Se,clamp:be,euclideanModulo:Ee,mapLinear:function(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)},inverseLerp:function(e,t,n){return e!==t?(n-e)/(t-e):0},lerp:Te,damp:function(e,t,n,i){return Te(e,t,1-Math.exp(-n*i))},pingpong:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return t-Math.abs(Ee(e,2*t)-t)},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){void 0!==e&&(_e=e);var t=_e+=1831565813;return t=Math.imul(t^t>>>15,1|t),(((t^=t+Math.imul(t^t>>>7,61|t))^t>>>14)>>>0)/4294967296},degToRad:function(e){return e*xe},radToDeg:function(e){return e*Me},isPowerOfTwo:we,ceilPowerOfTwo:Ae,floorPowerOfTwo:Re,setQuaternionFromProperEuler:function(e,t,n,i,r){var a=Math.cos,o=Math.sin,s=a(n/2),l=o(n/2),u=a((t+i)/2),c=o((t+i)/2),h=a((t-i)/2),d=o((t-i)/2),f=a((i-t)/2),p=o((i-t)/2);switch(r){case"XYX":e.set(s*c,l*h,l*d,s*u);break;case"YZY":e.set(l*d,s*c,l*h,s*u);break;case"ZXZ":e.set(l*h,l*d,s*c,s*u);break;case"XZX":e.set(s*c,l*p,l*f,s*u);break;case"YXY":e.set(l*f,s*c,l*p,s*u);break;case"ZYZ":e.set(l*p,l*f,s*c,s*u);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}},normalize:Le,denormalize:Ce});var Pe=e("V",function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;a(this,t),t.prototype.isVector2=!0,this.x=e,this.y=n}return s(t,[{key:"width",get:function(){return this.x},set:function(e){this.x=e}},{key:"height",get:function(){return this.y},set:function(e){this.y=e}},{key:"set",value:function(e,t){return this.x=e,this.y=t,this}},{key:"setScalar",value:function(e){return this.x=e,this.y=e,this}},{key:"setX",value:function(e){return this.x=e,this}},{key:"setY",value:function(e){return this.y=e,this}},{key:"setComponent",value:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}},{key:"getComponent",value:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}},{key:"clone",value:function(){return new this.constructor(this.x,this.y)}},{key:"copy",value:function(e){return this.x=e.x,this.y=e.y,this}},{key:"add",value:function(e){return this.x+=e.x,this.y+=e.y,this}},{key:"addScalar",value:function(e){return this.x+=e,this.y+=e,this}},{key:"addVectors",value:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}},{key:"addScaledVector",value:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}},{key:"sub",value:function(e){return this.x-=e.x,this.y-=e.y,this}},{key:"subScalar",value:function(e){return this.x-=e,this.y-=e,this}},{key:"subVectors",value:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}},{key:"multiply",value:function(e){return this.x*=e.x,this.y*=e.y,this}},{key:"multiplyScalar",value:function(e){return this.x*=e,this.y*=e,this}},{key:"divide",value:function(e){return this.x/=e.x,this.y/=e.y,this}},{key:"divideScalar",value:function(e){return this.multiplyScalar(1/e)}},{key:"applyMatrix3",value:function(e){var t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}},{key:"min",value:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}},{key:"max",value:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}},{key:"clamp",value:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}},{key:"clampScalar",value:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}},{key:"clampLength",value:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}},{key:"floor",value:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}},{key:"ceil",value:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}},{key:"round",value:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},{key:"roundToZero",value:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this}},{key:"dot",value:function(e){return this.x*e.x+this.y*e.y}},{key:"cross",value:function(e){return this.x*e.y-this.y*e.x}},{key:"lengthSq",value:function(){return this.x*this.x+this.y*this.y}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y)}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)}},{key:"normalize",value:function(){return this.divideScalar(this.length()||1)}},{key:"angle",value:function(){return Math.atan2(-this.y,-this.x)+Math.PI}},{key:"angleTo",value:function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;var n=this.dot(e)/t;return Math.acos(be(n,-1,1))}},{key:"distanceTo",value:function(e){return Math.sqrt(this.distanceToSquared(e))}},{key:"distanceToSquared",value:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n}},{key:"manhattanDistanceTo",value:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}},{key:"setLength",value:function(e){return this.normalize().multiplyScalar(e)}},{key:"lerp",value:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}},{key:"lerpVectors",value:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}},{key:"equals",value:function(e){return e.x===this.x&&e.y===this.y}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e}},{key:"fromBufferAttribute",value:function(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}},{key:"rotateAround",value:function(e,t){var n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*n-a*i+e.x,this.y=r*i+a*n+e.y,this}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this}},{key:Symbol.iterator,value:n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.x;case 2:return e.next=4,this.y;case 4:case"end":return e.stop()}}),e,this)}))}]),t}()),ke=e("b1",function(){function e(t,n,i,r,o,s,l,u,c){a(this,e),e.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,n,i,r,o,s,l,u,c)}return s(e,[{key:"set",value:function(e,t,n,i,r,a,o,s,l){var u=this.elements;return u[0]=e,u[1]=i,u[2]=o,u[3]=t,u[4]=r,u[5]=s,u[6]=n,u[7]=a,u[8]=l,this}},{key:"identity",value:function(){return this.set(1,0,0,0,1,0,0,0,1),this}},{key:"copy",value:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}},{key:"extractBasis",value:function(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}},{key:"setFromMatrix4",value:function(e){var 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}},{key:"multiply",value:function(e){return this.multiplyMatrices(this,e)}},{key:"premultiply",value:function(e){return this.multiplyMatrices(e,this)}},{key:"multiplyMatrices",value:function(e,t){var n=e.elements,i=t.elements,r=this.elements,a=n[0],o=n[3],s=n[6],l=n[1],u=n[4],c=n[7],h=n[2],d=n[5],f=n[8],p=i[0],v=i[3],m=i[6],g=i[1],y=i[4],_=i[7],x=i[2],M=i[5],S=i[8];return r[0]=a*p+o*g+s*x,r[3]=a*v+o*y+s*M,r[6]=a*m+o*_+s*S,r[1]=l*p+u*g+c*x,r[4]=l*v+u*y+c*M,r[7]=l*m+u*_+c*S,r[2]=h*p+d*g+f*x,r[5]=h*v+d*y+f*M,r[8]=h*m+d*_+f*S,this}},{key:"multiplyScalar",value:function(e){var 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}},{key:"determinant",value:function(){var e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],s=e[6],l=e[7],u=e[8];return t*a*u-t*o*l-n*r*u+n*o*s+i*r*l-i*a*s}},{key:"invert",value:function(){var e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],s=e[6],l=e[7],u=e[8],c=u*a-o*l,h=o*s-u*r,d=l*r-a*s,f=t*c+n*h+i*d;if(0===f)return this.set(0,0,0,0,0,0,0,0,0);var p=1/f;return e[0]=c*p,e[1]=(i*l-u*n)*p,e[2]=(o*n-i*a)*p,e[3]=h*p,e[4]=(u*t-i*s)*p,e[5]=(i*r-o*t)*p,e[6]=d*p,e[7]=(n*s-l*t)*p,e[8]=(a*t-n*r)*p,this}},{key:"transpose",value:function(){var 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}},{key:"getNormalMatrix",value:function(e){return this.setFromMatrix4(e).invert().transpose()}},{key:"transposeIntoArray",value:function(e){var 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}},{key:"setUvTransform",value:function(e,t,n,i,r,a,o){var s=Math.cos(r),l=Math.sin(r);return this.set(n*s,n*l,-n*(s*a+l*o)+a+e,-i*l,i*s,-i*(-l*a+s*o)+o+t,0,0,1),this}},{key:"scale",value:function(e,t){return this.premultiply(Ue.makeScale(e,t)),this}},{key:"rotate",value:function(e){return this.premultiply(Ue.makeRotation(-e)),this}},{key:"translate",value:function(e,t){return this.premultiply(Ue.makeTranslation(e,t)),this}},{key:"makeTranslation",value:function(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}},{key:"makeRotation",value:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}},{key:"makeScale",value:function(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}},{key:"equals",value:function(e){for(var t=this.elements,n=e.elements,i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}},{key:"fromArray",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=0;n<9;n++)this.elements[n]=e[n+t];return this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}},{key:"clone",value:function(){return(new this.constructor).fromArray(this.elements)}}]),e}()),Ue=new ke;function Ie(e){for(var t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function Ne(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}var De={};function Oe(e){e in De||(De[e]=!0,console.warn(e))}function Fe(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function ze(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}var Be,He=(new ke).fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-1e-7,1e-7,.9105199]),Ve=(new ke).fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]),Ge=(l(w={},me,(function(e){return e})),l(w,ve,(function(e){return e.convertSRGBToLinear()})),l(w,"display-p3",(function(e){return e.convertSRGBToLinear().applyMatrix3(Ve)})),w),We=(l(A={},me,(function(e){return e})),l(A,ve,(function(e){return e.convertLinearToSRGB()})),l(A,"display-p3",(function(e){return e.applyMatrix3(He).convertLinearToSRGB()})),A),Xe={enabled:!0,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(e){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!e},get workingColorSpace(){return me},set workingColorSpace(e){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(e,t,n){if(!1===this.enabled||t===n||!t||!n)return e;var i=Ge[t],r=We[n];if(void 0===i||void 0===r)throw new Error('Unsupported color space conversion, "'.concat(t,'" to "').concat(n,'".'));return r(i(e))},fromWorkingColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this.workingColorSpace)}},je=function(){function e(){a(this,e)}return s(e,null,[{key:"getDataURL",value:function(e){if(/^data:/i.test(e.src))return e.src;if("undefined"==typeof HTMLCanvasElement)return e.src;var t;if(e instanceof HTMLCanvasElement)t=e;else{void 0===Be&&(Be=Ne("canvas")),Be.width=e.width,Be.height=e.height;var n=Be.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Be}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}},{key:"sRGBToLinear",value:function(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){var t=Ne("canvas");t.width=e.width,t.height=e.height;var n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);for(var i=n.getImageData(0,0,e.width,e.height),r=i.data,a=0;a<r.length;a++)r[a]=255*Fe(r[a]/255);return n.putImageData(i,0,0),t}if(e.data){for(var o=e.data.slice(0),s=0;s<o.length;s++)o instanceof Uint8Array||o instanceof Uint8ClampedArray?o[s]=Math.floor(255*Fe(o[s]/255)):o[s]=Fe(o[s]);return{data:o,width:e.width,height:e.height}}return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}]),e}(),Ye=0,qe=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;a(this,e),this.isSource=!0,Object.defineProperty(this,"id",{value:Ye++}),this.uuid=Se(),this.data=t,this.version=0}return s(e,[{key:"needsUpdate",set:function(e){!0===e&&this.version++}},{key:"toJSON",value:function(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];var n={uuid:this.uuid,url:""},i=this.data;if(null!==i){var r;if(Array.isArray(i)){r=[];for(var a=0,o=i.length;a<o;a++)i[a].isDataTexture?r.push(Ze(i[a].image)):r.push(Ze(i[a]))}else r=Ze(i);n.url=r}return t||(e.images[this.uuid]=n),n}}]),e}();function Ze(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?je.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var Je=0,Ke=e("ad",function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n.DEFAULT_IMAGE,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.DEFAULT_MAPPING,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:J,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:J,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:te,u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:ie,c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:se,h=arguments.length>7&&void 0!==arguments[7]?arguments[7]:1009,d=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n.DEFAULT_ANISOTROPY,f=arguments.length>9&&void 0!==arguments[9]?arguments[9]:pe;return a(this,n),(e=t.call(this)).isTexture=!0,Object.defineProperty(v(e),"id",{value:Je++}),e.uuid=Se(),e.name="",e.source=new qe(i),e.mipmaps=[],e.mapping=r,e.channel=0,e.wrapS=o,e.wrapT=s,e.magFilter=l,e.minFilter=u,e.anisotropy=d,e.format=c,e.internalFormat=null,e.type=h,e.offset=new Pe(0,0),e.repeat=new Pe(1,1),e.center=new Pe(0,0),e.rotation=0,e.matrixAutoUpdate=!0,e.matrix=new ke,e.generateMipmaps=!0,e.premultiplyAlpha=!1,e.flipY=!0,e.unpackAlignment=4,"string"==typeof f?e.colorSpace=f:(Oe("THREE.Texture: Property .encoding has been replaced by .colorSpace."),e.colorSpace=3001===f?ve:pe),e.userData={},e.version=0,e.onUpdate=null,e.isRenderTargetTexture=!1,e.needsPMREMUpdate=!1,e}return s(n,[{key:"image",get:function(){return this.source.data},set:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.source.data=e}},{key:"updateMatrix",value:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(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.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}},{key:"toJSON",value:function(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];var n={metadata:{version:4.6,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&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}},{key:"transformUv",value:function(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Z:e.x=e.x-Math.floor(e.x);break;case J:e.x=e.x<0?0:1;break;case K: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 Z:e.y=e.y-Math.floor(e.y);break;case J:e.y=e.y<0?0:1;break;case K: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}},{key:"needsUpdate",set:function(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}},{key:"encoding",get:function(){return Oe("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===ve?3001:3e3},set:function(e){Oe("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=3001===e?ve:pe}}]),n}(ge));Ke.DEFAULT_IMAGE=null,Ke.DEFAULT_MAPPING=300,Ke.DEFAULT_ANISOTROPY=1;var Qe=e("b0",function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;a(this,t),t.prototype.isVector4=!0,this.x=e,this.y=n,this.z=i,this.w=r}return s(t,[{key:"width",get:function(){return this.z},set:function(e){this.z=e}},{key:"height",get:function(){return this.w},set:function(e){this.w=e}},{key:"set",value:function(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}},{key:"setScalar",value:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}},{key:"setX",value:function(e){return this.x=e,this}},{key:"setY",value:function(e){return this.y=e,this}},{key:"setZ",value:function(e){return this.z=e,this}},{key:"setW",value:function(e){return this.w=e,this}},{key:"setComponent",value:function(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 new Error("index is out of range: "+e)}return this}},{key:"getComponent",value:function(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 new Error("index is out of range: "+e)}}},{key:"clone",value:function(){return new this.constructor(this.x,this.y,this.z,this.w)}},{key:"copy",value:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}},{key:"add",value:function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}},{key:"addScalar",value:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}},{key:"addVectors",value:function(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}},{key:"addScaledVector",value:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}},{key:"sub",value:function(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}},{key:"subScalar",value:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}},{key:"subVectors",value:function(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}},{key:"multiply",value:function(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}},{key:"multiplyScalar",value:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}},{key:"applyMatrix4",value:function(e){var t=this.x,n=this.y,i=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*r,this}},{key:"divideScalar",value:function(e){return this.multiplyScalar(1/e)}},{key:"setAxisAngleFromQuaternion",value:function(e){this.w=2*Math.acos(e.w);var 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}},{key:"setAxisAngleFromRotationMatrix",value:function(e){var t,n,i,r,a=e.elements,o=a[0],s=a[4],l=a[8],u=a[1],c=a[5],h=a[9],d=a[2],f=a[6],p=a[10];if(Math.abs(s-u)<.01&&Math.abs(l-d)<.01&&Math.abs(h-f)<.01){if(Math.abs(s+u)<.1&&Math.abs(l+d)<.1&&Math.abs(h+f)<.1&&Math.abs(o+c+p-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;var v=(o+1)/2,m=(c+1)/2,g=(p+1)/2,y=(s+u)/4,_=(l+d)/4,x=(h+f)/4;return v>m&&v>g?v<.01?(n=0,i=.707106781,r=.707106781):(i=y/(n=Math.sqrt(v)),r=_/n):m>g?m<.01?(n=.707106781,i=0,r=.707106781):(n=y/(i=Math.sqrt(m)),r=x/i):g<.01?(n=.707106781,i=.707106781,r=0):(n=_/(r=Math.sqrt(g)),i=x/r),this.set(n,i,r,t),this}var M=Math.sqrt((f-h)*(f-h)+(l-d)*(l-d)+(u-s)*(u-s));return Math.abs(M)<.001&&(M=1),this.x=(f-h)/M,this.y=(l-d)/M,this.z=(u-s)/M,this.w=Math.acos((o+c+p-1)/2),this}},{key:"min",value:function(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}},{key:"max",value:function(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}},{key:"clamp",value:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}},{key:"clampScalar",value:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}},{key:"clampLength",value:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}},{key:"floor",value:function(){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}},{key:"ceil",value:function(){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}},{key:"round",value:function(){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}},{key:"roundToZero",value:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}},{key:"dot",value:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}},{key:"lengthSq",value:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}},{key:"normalize",value:function(){return this.divideScalar(this.length()||1)}},{key:"setLength",value:function(e){return this.normalize().multiplyScalar(e)}},{key:"lerp",value:function(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}},{key:"lerpVectors",value:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}},{key:"equals",value:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}},{key:"fromBufferAttribute",value:function(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}},{key:Symbol.iterator,value:n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.x;case 2:return e.next=4,this.y;case 4:return e.next=6,this.z;case 6:return e.next=8,this.w;case 8:case"end":return e.stop()}}),e,this)}))}]),t}()),$e=e("bb",function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return a(this,n),(e=t.call(this,i,r,o)).isWebGLRenderTarget=!0,e}return s(n)}(function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};a(this,n),(e=t.call(this)).isRenderTarget=!0,e.width=i,e.height=r,e.depth=1,e.scissor=new Qe(0,0,i,r),e.scissorTest=!1,e.viewport=new Qe(0,0,i,r);var s={width:i,height:r,depth:1};return void 0!==o.encoding&&(Oe("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),o.colorSpace=3001===o.encoding?ve:pe),e.texture=new Ke(s,o.mapping,o.wrapS,o.wrapT,o.magFilter,o.minFilter,o.format,o.type,o.anisotropy,o.colorSpace),e.texture.isRenderTargetTexture=!0,e.texture.flipY=!1,e.texture.generateMipmaps=void 0!==o.generateMipmaps&&o.generateMipmaps,e.texture.internalFormat=void 0!==o.internalFormat?o.internalFormat:null,e.texture.minFilter=void 0!==o.minFilter?o.minFilter:te,e.depthBuffer=void 0===o.depthBuffer||o.depthBuffer,e.stencilBuffer=void 0!==o.stencilBuffer&&o.stencilBuffer,e.depthTexture=void 0!==o.depthTexture?o.depthTexture:null,e.samples=void 0!==o.samples?o.samples:0,e}return s(n,[{key:"setSize",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;this.width===e&&this.height===t&&this.depth===n||(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(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.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;var t=Object.assign({},e.texture.image);return this.texture.source=new qe(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}}]),n}(ge))),et=function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return a(this,n),(e=t.call(this,null)).isDataArrayTexture=!0,e.image={data:i,width:r,height:o,depth:s},e.magFilter=Q,e.minFilter=Q,e.wrapR=J,e.generateMipmaps=!1,e.flipY=!1,e.unpackAlignment=1,e}return s(n)}(Ke),tt=function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return a(this,n),(e=t.call(this,null)).isData3DTexture=!0,e.image={data:i,width:r,height:o,depth:s},e.magFilter=Q,e.minFilter=Q,e.wrapR=J,e.generateMipmaps=!1,e.flipY=!1,e.unpackAlignment=1,e}return s(n)}(Ke),nt=e("Q",function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;a(this,t),this.isQuaternion=!0,this._x=e,this._y=n,this._z=i,this._w=r}return s(t,[{key:"x",get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},{key:"w",get:function(){return this._w},set:function(e){this._w=e,this._onChangeCallback()}},{key:"set",value:function(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}},{key:"clone",value:function(){return new this.constructor(this._x,this._y,this._z,this._w)}},{key:"copy",value:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}},{key:"setFromEuler",value:function(e,t){var n=e._x,i=e._y,r=e._z,a=e._order,o=Math.cos,s=Math.sin,l=o(n/2),u=o(i/2),c=o(r/2),h=s(n/2),d=s(i/2),f=s(r/2);switch(a){case"XYZ":this._x=h*u*c+l*d*f,this._y=l*d*c-h*u*f,this._z=l*u*f+h*d*c,this._w=l*u*c-h*d*f;break;case"YXZ":this._x=h*u*c+l*d*f,this._y=l*d*c-h*u*f,this._z=l*u*f-h*d*c,this._w=l*u*c+h*d*f;break;case"ZXY":this._x=h*u*c-l*d*f,this._y=l*d*c+h*u*f,this._z=l*u*f+h*d*c,this._w=l*u*c-h*d*f;break;case"ZYX":this._x=h*u*c-l*d*f,this._y=l*d*c+h*u*f,this._z=l*u*f-h*d*c,this._w=l*u*c+h*d*f;break;case"YZX":this._x=h*u*c+l*d*f,this._y=l*d*c+h*u*f,this._z=l*u*f-h*d*c,this._w=l*u*c-h*d*f;break;case"XZY":this._x=h*u*c-l*d*f,this._y=l*d*c-h*u*f,this._z=l*u*f+h*d*c,this._w=l*u*c+h*d*f;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==t&&this._onChangeCallback(),this}},{key:"setFromAxisAngle",value:function(e,t){var n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}},{key:"setFromRotationMatrix",value:function(e){var t=e.elements,n=t[0],i=t[4],r=t[8],a=t[1],o=t[5],s=t[9],l=t[2],u=t[6],c=t[10],h=n+o+c;if(h>0){var d=.5/Math.sqrt(h+1);this._w=.25/d,this._x=(u-s)*d,this._y=(r-l)*d,this._z=(a-i)*d}else if(n>o&&n>c){var f=2*Math.sqrt(1+n-o-c);this._w=(u-s)/f,this._x=.25*f,this._y=(i+a)/f,this._z=(r+l)/f}else if(o>c){var p=2*Math.sqrt(1+o-n-c);this._w=(r-l)/p,this._x=(i+a)/p,this._y=.25*p,this._z=(s+u)/p}else{var v=2*Math.sqrt(1+c-n-o);this._w=(a-i)/v,this._x=(r+l)/v,this._y=(s+u)/v,this._z=.25*v}return this._onChangeCallback(),this}},{key:"setFromUnitVectors",value:function(e,t){var n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(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=n),this.normalize()}},{key:"angleTo",value:function(e){return 2*Math.acos(Math.abs(be(this.dot(e),-1,1)))}},{key:"rotateTowards",value:function(e,t){var n=this.angleTo(e);if(0===n)return this;var i=Math.min(1,t/n);return this.slerp(e,i),this}},{key:"identity",value:function(){return this.set(0,0,0,1)}},{key:"invert",value:function(){return this.conjugate()}},{key:"conjugate",value:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}},{key:"dot",value:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}},{key:"lengthSq",value:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}},{key:"length",value:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}},{key:"normalize",value:function(){var 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}},{key:"multiply",value:function(e){return this.multiplyQuaternions(this,e)}},{key:"premultiply",value:function(e){return this.multiplyQuaternions(e,this)}},{key:"multiplyQuaternions",value:function(e,t){var n=e._x,i=e._y,r=e._z,a=e._w,o=t._x,s=t._y,l=t._z,u=t._w;return this._x=n*u+a*o+i*l-r*s,this._y=i*u+a*s+r*o-n*l,this._z=r*u+a*l+n*s-i*o,this._w=a*u-n*o-i*s-r*l,this._onChangeCallback(),this}},{key:"slerp",value:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var n=this._x,i=this._y,r=this._z,a=this._w,o=a*e._w+n*e._x+i*e._y+r*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=i,this._z=r,this;var s=1-o*o;if(s<=Number.EPSILON){var l=1-t;return this._w=l*a+t*this._w,this._x=l*n+t*this._x,this._y=l*i+t*this._y,this._z=l*r+t*this._z,this.normalize(),this._onChangeCallback(),this}var u=Math.sqrt(s),c=Math.atan2(u,o),h=Math.sin((1-t)*c)/u,d=Math.sin(t*c)/u;return this._w=a*h+this._w*d,this._x=n*h+this._x*d,this._y=i*h+this._y*d,this._z=r*h+this._z*d,this._onChangeCallback(),this}},{key:"slerpQuaternions",value:function(e,t,n){return this.copy(e).slerp(t,n)}},{key:"random",value:function(){var e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),i=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(t*Math.cos(i),n*Math.sin(r),n*Math.cos(r),t*Math.sin(i))}},{key:"equals",value:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}},{key:"fromBufferAttribute",value:function(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}},{key:"toJSON",value:function(){return this.toArray()}},{key:"_onChange",value:function(e){return this._onChangeCallback=e,this}},{key:"_onChangeCallback",value:function(){}},{key:Symbol.iterator,value:n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._x;case 2:return e.next=4,this._y;case 4:return e.next=6,this._z;case 6:return e.next=8,this._w;case 8:case"end":return e.stop()}}),e,this)}))}],[{key:"slerpFlat",value:function(e,t,n,i,r,a,o){var s=n[i+0],l=n[i+1],u=n[i+2],c=n[i+3],h=r[a+0],d=r[a+1],f=r[a+2],p=r[a+3];if(0===o)return e[t+0]=s,e[t+1]=l,e[t+2]=u,void(e[t+3]=c);if(1===o)return e[t+0]=h,e[t+1]=d,e[t+2]=f,void(e[t+3]=p);if(c!==p||s!==h||l!==d||u!==f){var v=1-o,m=s*h+l*d+u*f+c*p,g=m>=0?1:-1,y=1-m*m;if(y>Number.EPSILON){var _=Math.sqrt(y),x=Math.atan2(_,m*g);v=Math.sin(v*x)/_,o=Math.sin(o*x)/_}var M=o*g;if(s=s*v+h*M,l=l*v+d*M,u=u*v+f*M,c=c*v+p*M,v===1-o){var S=1/Math.sqrt(s*s+l*l+u*u+c*c);s*=S,l*=S,u*=S,c*=S}}e[t]=s,e[t+1]=l,e[t+2]=u,e[t+3]=c}},{key:"multiplyQuaternionsFlat",value:function(e,t,n,i,r,a){var o=n[i],s=n[i+1],l=n[i+2],u=n[i+3],c=r[a],h=r[a+1],d=r[a+2],f=r[a+3];return e[t]=o*f+u*c+s*d-l*h,e[t+1]=s*f+u*h+l*c-o*d,e[t+2]=l*f+u*d+o*h-s*c,e[t+3]=u*f-o*c-s*h-l*d,e}}]),t}()),it=e("a",function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;a(this,t),t.prototype.isVector3=!0,this.x=e,this.y=n,this.z=i}return s(t,[{key:"set",value:function(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}},{key:"setScalar",value:function(e){return this.x=e,this.y=e,this.z=e,this}},{key:"setX",value:function(e){return this.x=e,this}},{key:"setY",value:function(e){return this.y=e,this}},{key:"setZ",value:function(e){return this.z=e,this}},{key:"setComponent",value:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}},{key:"getComponent",value:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}},{key:"clone",value:function(){return new this.constructor(this.x,this.y,this.z)}},{key:"copy",value:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}},{key:"add",value:function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}},{key:"addScalar",value:function(e){return this.x+=e,this.y+=e,this.z+=e,this}},{key:"addVectors",value:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}},{key:"addScaledVector",value:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}},{key:"sub",value:function(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}},{key:"subScalar",value:function(e){return this.x-=e,this.y-=e,this.z-=e,this}},{key:"subVectors",value:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}},{key:"multiply",value:function(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}},{key:"multiplyScalar",value:function(e){return this.x*=e,this.y*=e,this.z*=e,this}},{key:"multiplyVectors",value:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}},{key:"applyEuler",value:function(e){return this.applyQuaternion(at.setFromEuler(e))}},{key:"applyAxisAngle",value:function(e,t){return this.applyQuaternion(at.setFromAxisAngle(e,t))}},{key:"applyMatrix3",value:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}},{key:"applyNormalMatrix",value:function(e){return this.applyMatrix3(e).normalize()}},{key:"applyMatrix4",value:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements,a=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*a,this}},{key:"applyQuaternion",value:function(e){var t=this.x,n=this.y,i=this.z,r=e.x,a=e.y,o=e.z,s=e.w,l=s*t+a*i-o*n,u=s*n+o*t-r*i,c=s*i+r*n-a*t,h=-r*t-a*n-o*i;return this.x=l*s+h*-r+u*-o-c*-a,this.y=u*s+h*-a+c*-r-l*-o,this.z=c*s+h*-o+l*-a-u*-r,this}},{key:"project",value:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}},{key:"unproject",value:function(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}},{key:"transformDirection",value:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()}},{key:"divide",value:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}},{key:"divideScalar",value:function(e){return this.multiplyScalar(1/e)}},{key:"min",value:function(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}},{key:"max",value:function(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}},{key:"clamp",value:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}},{key:"clampScalar",value:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}},{key:"clampLength",value:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}},{key:"floor",value:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}},{key:"ceil",value:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}},{key:"round",value:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}},{key:"roundToZero",value:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}},{key:"dot",value:function(e){return this.x*e.x+this.y*e.y+this.z*e.z}},{key:"lengthSq",value:function(){return this.x*this.x+this.y*this.y+this.z*this.z}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}},{key:"normalize",value:function(){return this.divideScalar(this.length()||1)}},{key:"setLength",value:function(e){return this.normalize().multiplyScalar(e)}},{key:"lerp",value:function(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}},{key:"lerpVectors",value:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}},{key:"cross",value:function(e){return this.crossVectors(this,e)}},{key:"crossVectors",value:function(e,t){var n=e.x,i=e.y,r=e.z,a=t.x,o=t.y,s=t.z;return this.x=i*s-r*o,this.y=r*a-n*s,this.z=n*o-i*a,this}},{key:"projectOnVector",value:function(e){var t=e.lengthSq();if(0===t)return this.set(0,0,0);var n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}},{key:"projectOnPlane",value:function(e){return rt.copy(this).projectOnVector(e),this.sub(rt)}},{key:"reflect",value:function(e){return this.sub(rt.copy(e).multiplyScalar(2*this.dot(e)))}},{key:"angleTo",value:function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;var n=this.dot(e)/t;return Math.acos(be(n,-1,1))}},{key:"distanceTo",value:function(e){return Math.sqrt(this.distanceToSquared(e))}},{key:"distanceToSquared",value:function(e){var t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}},{key:"manhattanDistanceTo",value:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}},{key:"setFromSpherical",value:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}},{key:"setFromSphericalCoords",value:function(e,t,n){var i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}},{key:"setFromCylindrical",value:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}},{key:"setFromCylindricalCoords",value:function(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}},{key:"setFromMatrixPosition",value:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}},{key:"setFromMatrixScale",value:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}},{key:"setFromMatrixColumn",value:function(e,t){return this.fromArray(e.elements,4*t)}},{key:"setFromMatrix3Column",value:function(e,t){return this.fromArray(e.elements,3*t)}},{key:"setFromEuler",value:function(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}},{key:"setFromColor",value:function(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}},{key:"equals",value:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}},{key:"fromBufferAttribute",value:function(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}},{key:"randomDirection",value:function(){var e=2*(Math.random()-.5),t=Math.random()*Math.PI*2,n=Math.sqrt(1-Math.pow(e,2));return this.x=n*Math.cos(t),this.y=n*Math.sin(t),this.z=e,this}},{key:Symbol.iterator,value:n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.x;case 2:return e.next=4,this.y;case 4:return e.next=6,this.z;case 6:case"end":return e.stop()}}),e,this)}))}]),t}()),rt=new it,at=new nt,ot=e("ah",function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new it(1/0,1/0,1/0),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new it(-1/0,-1/0,-1/0);a(this,e),this.isBox3=!0,this.min=t,this.max=n}return s(e,[{key:"set",value:function(e,t){return this.min.copy(e),this.max.copy(t),this}},{key:"setFromArray",value:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t+=3)this.expandByPoint(lt.fromArray(e,t));return this}},{key:"setFromBufferAttribute",value:function(e){this.makeEmpty();for(var t=0,n=e.count;t<n;t++)this.expandByPoint(lt.fromBufferAttribute(e,t));return this}},{key:"setFromPoints",value:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}},{key:"setFromCenterAndSize",value:function(e,t){var n=lt.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}},{key:"setFromObject",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.makeEmpty(),this.expandByObject(e,t)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.min.copy(e.min),this.max.copy(e.max),this}},{key:"makeEmpty",value:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}},{key:"isEmpty",value:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}},{key:"getCenter",value:function(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}},{key:"getSize",value:function(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}},{key:"expandByPoint",value:function(e){return this.min.min(e),this.max.max(e),this}},{key:"expandByVector",value:function(e){return this.min.sub(e),this.max.add(e),this}},{key:"expandByScalar",value:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this}},{key:"expandByObject",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e.updateWorldMatrix(!1,!1),void 0!==e.boundingBox)null===e.boundingBox&&e.computeBoundingBox(),ut.copy(e.boundingBox),ut.applyMatrix4(e.matrixWorld),this.union(ut);else{var n=e.geometry;if(void 0!==n)if(t&&void 0!==n.attributes&&void 0!==n.attributes.position)for(var i=n.attributes.position,r=0,a=i.count;r<a;r++)lt.fromBufferAttribute(i,r).applyMatrix4(e.matrixWorld),this.expandByPoint(lt);else null===n.boundingBox&&n.computeBoundingBox(),ut.copy(n.boundingBox),ut.applyMatrix4(e.matrixWorld),this.union(ut)}for(var o=e.children,s=0,l=o.length;s<l;s++)this.expandByObject(o[s],t);return this}},{key:"containsPoint",value:function(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)}},{key:"containsBox",value:function(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}},{key:"getParameter",value:function(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))}},{key:"intersectsBox",value:function(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)}},{key:"intersectsSphere",value:function(e){return this.clampPoint(e.center,lt),lt.distanceToSquared(e.center)<=e.radius*e.radius}},{key:"intersectsPlane",value:function(e){var t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}},{key:"intersectsTriangle",value:function(e){if(this.isEmpty())return!1;this.getCenter(mt),gt.subVectors(this.max,mt),ct.subVectors(e.a,mt),ht.subVectors(e.b,mt),dt.subVectors(e.c,mt),ft.subVectors(ht,ct),pt.subVectors(dt,ht),vt.subVectors(ct,dt);var t=[0,-ft.z,ft.y,0,-pt.z,pt.y,0,-vt.z,vt.y,ft.z,0,-ft.x,pt.z,0,-pt.x,vt.z,0,-vt.x,-ft.y,ft.x,0,-pt.y,pt.x,0,-vt.y,vt.x,0];return!!xt(t,ct,ht,dt,gt)&&!!xt(t=[1,0,0,0,1,0,0,0,1],ct,ht,dt,gt)&&(yt.crossVectors(ft,pt),xt(t=[yt.x,yt.y,yt.z],ct,ht,dt,gt))}},{key:"clampPoint",value:function(e,t){return t.copy(e).clamp(this.min,this.max)}},{key:"distanceToPoint",value:function(e){return this.clampPoint(e,lt).distanceTo(e)}},{key:"getBoundingSphere",value:function(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(lt).length()),e}},{key:"intersect",value:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}},{key:"union",value:function(e){return this.min.min(e.min),this.max.max(e.max),this}},{key:"applyMatrix4",value:function(e){return this.isEmpty()||(st[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),st[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),st[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),st[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),st[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),st[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),st[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),st[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(st)),this}},{key:"translate",value:function(e){return this.min.add(e),this.max.add(e),this}},{key:"equals",value:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}]),e}()),st=[new it,new it,new it,new it,new it,new it,new it,new it],lt=new it,ut=new ot,ct=new it,ht=new it,dt=new it,ft=new it,pt=new it,vt=new it,mt=new it,gt=new it,yt=new it,_t=new it;function xt(e,t,n,i,r){for(var a=0,o=e.length-3;a<=o;a+=3){_t.fromArray(e,a);var s=r.x*Math.abs(_t.x)+r.y*Math.abs(_t.y)+r.z*Math.abs(_t.z),l=t.dot(_t),u=n.dot(_t),c=i.dot(_t);if(Math.max(-Math.max(l,u,c),Math.min(l,u,c))>s)return!1}return!0}var Mt=new ot,St=new it,bt=new it,Et=e("ai",function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new it,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;a(this,e),this.center=t,this.radius=n}return s(e,[{key:"set",value:function(e,t){return this.center.copy(e),this.radius=t,this}},{key:"setFromPoints",value:function(e,t){var n=this.center;void 0!==t?n.copy(t):Mt.setFromPoints(e).getCenter(n);for(var i=0,r=0,a=e.length;r<a;r++)i=Math.max(i,n.distanceToSquared(e[r]));return this.radius=Math.sqrt(i),this}},{key:"copy",value:function(e){return this.center.copy(e.center),this.radius=e.radius,this}},{key:"isEmpty",value:function(){return this.radius<0}},{key:"makeEmpty",value:function(){return this.center.set(0,0,0),this.radius=-1,this}},{key:"containsPoint",value:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}},{key:"distanceToPoint",value:function(e){return e.distanceTo(this.center)-this.radius}},{key:"intersectsSphere",value:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}},{key:"intersectsBox",value:function(e){return e.intersectsSphere(this)}},{key:"intersectsPlane",value:function(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}},{key:"clampPoint",value:function(e,t){var n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}},{key:"getBoundingBox",value:function(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}},{key:"applyMatrix4",value:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}},{key:"translate",value:function(e){return this.center.add(e),this}},{key:"expandByPoint",value:function(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;St.subVectors(e,this.center);var t=St.lengthSq();if(t>this.radius*this.radius){var n=Math.sqrt(t),i=.5*(n-this.radius);this.center.addScaledVector(St,i/n),this.radius+=i}return this}},{key:"union",value:function(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(bt.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(St.copy(e.center).add(bt)),this.expandByPoint(St.copy(e.center).sub(bt))),this)}},{key:"equals",value:function(e){return e.center.equals(this.center)&&e.radius===this.radius}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}()),Tt=new it,wt=new it,At=new it,Rt=new it,Ct=new it,Lt=new it,Pt=new it,kt=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new it,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new it(0,0,-1);a(this,e),this.origin=t,this.direction=n}return s(e,[{key:"set",value:function(e,t){return this.origin.copy(e),this.direction.copy(t),this}},{key:"copy",value:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}},{key:"at",value:function(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}},{key:"lookAt",value:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this}},{key:"recast",value:function(e){return this.origin.copy(this.at(e,Tt)),this}},{key:"closestPointToPoint",value:function(e,t){t.subVectors(e,this.origin);var n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}},{key:"distanceToPoint",value:function(e){return Math.sqrt(this.distanceSqToPoint(e))}},{key:"distanceSqToPoint",value:function(e){var t=Tt.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Tt.copy(this.origin).addScaledVector(this.direction,t),Tt.distanceToSquared(e))}},{key:"distanceSqToSegment",value:function(e,t,n,i){wt.copy(e).add(t).multiplyScalar(.5),At.copy(t).sub(e).normalize(),Rt.copy(this.origin).sub(wt);var r,a,o,s,l=.5*e.distanceTo(t),u=-this.direction.dot(At),c=Rt.dot(this.direction),h=-Rt.dot(At),d=Rt.lengthSq(),f=Math.abs(1-u*u);if(f>0)if(a=u*c-h,s=l*f,(r=u*h-c)>=0)if(a>=-s)if(a<=s){var p=1/f;o=(r*=p)*(r+u*(a*=p)+2*c)+a*(u*r+a+2*h)+d}else a=l,o=-(r=Math.max(0,-(u*a+c)))*r+a*(a+2*h)+d;else a=-l,o=-(r=Math.max(0,-(u*a+c)))*r+a*(a+2*h)+d;else a<=-s?o=-(r=Math.max(0,-(-u*l+c)))*r+(a=r>0?-l:Math.min(Math.max(-l,-h),l))*(a+2*h)+d:a<=s?(r=0,o=(a=Math.min(Math.max(-l,-h),l))*(a+2*h)+d):o=-(r=Math.max(0,-(u*l+c)))*r+(a=r>0?l:Math.min(Math.max(-l,-h),l))*(a+2*h)+d;else a=u>0?-l:l,o=-(r=Math.max(0,-(u*a+c)))*r+a*(a+2*h)+d;return n&&n.copy(this.origin).addScaledVector(this.direction,r),i&&i.copy(wt).addScaledVector(At,a),o}},{key:"intersectSphere",value:function(e,t){Tt.subVectors(e.center,this.origin);var n=Tt.dot(this.direction),i=Tt.dot(Tt)-n*n,r=e.radius*e.radius;if(i>r)return null;var a=Math.sqrt(r-i),o=n-a,s=n+a;return s<0?null:o<0?this.at(s,t):this.at(o,t)}},{key:"intersectsSphere",value:function(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}},{key:"distanceToPlane",value:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}},{key:"intersectPlane",value:function(e,t){var n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}},{key:"intersectsPlane",value:function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0}},{key:"intersectBox",value:function(e,t){var n,i,r,a,o,s,l=1/this.direction.x,u=1/this.direction.y,c=1/this.direction.z,h=this.origin;return l>=0?(n=(e.min.x-h.x)*l,i=(e.max.x-h.x)*l):(n=(e.max.x-h.x)*l,i=(e.min.x-h.x)*l),u>=0?(r=(e.min.y-h.y)*u,a=(e.max.y-h.y)*u):(r=(e.max.y-h.y)*u,a=(e.min.y-h.y)*u),n>a||r>i?null:((r>n||isNaN(n))&&(n=r),(a<i||isNaN(i))&&(i=a),c>=0?(o=(e.min.z-h.z)*c,s=(e.max.z-h.z)*c):(o=(e.max.z-h.z)*c,s=(e.min.z-h.z)*c),n>s||o>i?null:((o>n||n!=n)&&(n=o),(s<i||i!=i)&&(i=s),i<0?null:this.at(n>=0?n:i,t)))}},{key:"intersectsBox",value:function(e){return null!==this.intersectBox(e,Tt)}},{key:"intersectTriangle",value:function(e,t,n,i,r){Ct.subVectors(t,e),Lt.subVectors(n,e),Pt.crossVectors(Ct,Lt);var a,o=this.direction.dot(Pt);if(o>0){if(i)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}Rt.subVectors(this.origin,e);var s=a*this.direction.dot(Lt.crossVectors(Rt,Lt));if(s<0)return null;var l=a*this.direction.dot(Ct.cross(Rt));if(l<0)return null;if(s+l>o)return null;var u=-a*Rt.dot(Pt);return u<0?null:this.at(u/o,r)}},{key:"applyMatrix4",value:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}},{key:"equals",value:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),Ut=e("n",function(){function e(t,n,i,r,o,s,l,u,c,h,d,f,p,v,m,g){a(this,e),e.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,n,i,r,o,s,l,u,c,h,d,f,p,v,m,g)}return s(e,[{key:"set",value:function(e,t,n,i,r,a,o,s,l,u,c,h,d,f,p,v){var m=this.elements;return m[0]=e,m[4]=t,m[8]=n,m[12]=i,m[1]=r,m[5]=a,m[9]=o,m[13]=s,m[2]=l,m[6]=u,m[10]=c,m[14]=h,m[3]=d,m[7]=f,m[11]=p,m[15]=v,this}},{key:"identity",value:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}},{key:"clone",value:function(){return(new e).fromArray(this.elements)}},{key:"copy",value:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}},{key:"copyPosition",value:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}},{key:"setFromMatrix3",value:function(e){var 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}},{key:"extractBasis",value:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}},{key:"makeBasis",value:function(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}},{key:"extractRotation",value:function(e){var t=this.elements,n=e.elements,i=1/It.setFromMatrixColumn(e,0).length(),r=1/It.setFromMatrixColumn(e,1).length(),a=1/It.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}},{key:"makeRotationFromEuler",value:function(e){var t=this.elements,n=e.x,i=e.y,r=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(i),l=Math.sin(i),u=Math.cos(r),c=Math.sin(r);if("XYZ"===e.order){var h=a*u,d=a*c,f=o*u,p=o*c;t[0]=s*u,t[4]=-s*c,t[8]=l,t[1]=d+f*l,t[5]=h-p*l,t[9]=-o*s,t[2]=p-h*l,t[6]=f+d*l,t[10]=a*s}else if("YXZ"===e.order){var v=s*u,m=s*c,g=l*u,y=l*c;t[0]=v+y*o,t[4]=g*o-m,t[8]=a*l,t[1]=a*c,t[5]=a*u,t[9]=-o,t[2]=m*o-g,t[6]=y+v*o,t[10]=a*s}else if("ZXY"===e.order){var _=s*u,x=s*c,M=l*u,S=l*c;t[0]=_-S*o,t[4]=-a*c,t[8]=M+x*o,t[1]=x+M*o,t[5]=a*u,t[9]=S-_*o,t[2]=-a*l,t[6]=o,t[10]=a*s}else if("ZYX"===e.order){var b=a*u,E=a*c,T=o*u,w=o*c;t[0]=s*u,t[4]=T*l-E,t[8]=b*l+w,t[1]=s*c,t[5]=w*l+b,t[9]=E*l-T,t[2]=-l,t[6]=o*s,t[10]=a*s}else if("YZX"===e.order){var A=a*s,R=a*l,C=o*s,L=o*l;t[0]=s*u,t[4]=L-A*c,t[8]=C*c+R,t[1]=c,t[5]=a*u,t[9]=-o*u,t[2]=-l*u,t[6]=R*c+C,t[10]=A-L*c}else if("XZY"===e.order){var P=a*s,k=a*l,U=o*s,I=o*l;t[0]=s*u,t[4]=-c,t[8]=l*u,t[1]=P*c+I,t[5]=a*u,t[9]=k*c-U,t[2]=U*c-k,t[6]=o*u,t[10]=I*c+P}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}},{key:"makeRotationFromQuaternion",value:function(e){return this.compose(Dt,e,Ot)}},{key:"lookAt",value:function(e,t,n){var i=this.elements;return Bt.subVectors(e,t),0===Bt.lengthSq()&&(Bt.z=1),Bt.normalize(),Ft.crossVectors(n,Bt),0===Ft.lengthSq()&&(1===Math.abs(n.z)?Bt.x+=1e-4:Bt.z+=1e-4,Bt.normalize(),Ft.crossVectors(n,Bt)),Ft.normalize(),zt.crossVectors(Bt,Ft),i[0]=Ft.x,i[4]=zt.x,i[8]=Bt.x,i[1]=Ft.y,i[5]=zt.y,i[9]=Bt.y,i[2]=Ft.z,i[6]=zt.z,i[10]=Bt.z,this}},{key:"multiply",value:function(e){return this.multiplyMatrices(this,e)}},{key:"premultiply",value:function(e){return this.multiplyMatrices(e,this)}},{key:"multiplyMatrices",value:function(e,t){var n=e.elements,i=t.elements,r=this.elements,a=n[0],o=n[4],s=n[8],l=n[12],u=n[1],c=n[5],h=n[9],d=n[13],f=n[2],p=n[6],v=n[10],m=n[14],g=n[3],y=n[7],_=n[11],x=n[15],M=i[0],S=i[4],b=i[8],E=i[12],T=i[1],w=i[5],A=i[9],R=i[13],C=i[2],L=i[6],P=i[10],k=i[14],U=i[3],I=i[7],N=i[11],D=i[15];return r[0]=a*M+o*T+s*C+l*U,r[4]=a*S+o*w+s*L+l*I,r[8]=a*b+o*A+s*P+l*N,r[12]=a*E+o*R+s*k+l*D,r[1]=u*M+c*T+h*C+d*U,r[5]=u*S+c*w+h*L+d*I,r[9]=u*b+c*A+h*P+d*N,r[13]=u*E+c*R+h*k+d*D,r[2]=f*M+p*T+v*C+m*U,r[6]=f*S+p*w+v*L+m*I,r[10]=f*b+p*A+v*P+m*N,r[14]=f*E+p*R+v*k+m*D,r[3]=g*M+y*T+_*C+x*U,r[7]=g*S+y*w+_*L+x*I,r[11]=g*b+y*A+_*P+x*N,r[15]=g*E+y*R+_*k+x*D,this}},{key:"multiplyScalar",value:function(e){var 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}},{key:"determinant",value:function(){var e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],a=e[1],o=e[5],s=e[9],l=e[13],u=e[2],c=e[6],h=e[10],d=e[14];return e[3]*(+r*s*c-i*l*c-r*o*h+n*l*h+i*o*d-n*s*d)+e[7]*(+t*s*d-t*l*h+r*a*h-i*a*d+i*l*u-r*s*u)+e[11]*(+t*l*c-t*o*d-r*a*c+n*a*d+r*o*u-n*l*u)+e[15]*(-i*o*u-t*s*c+t*o*h+i*a*c-n*a*h+n*s*u)}},{key:"transpose",value:function(){var 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}},{key:"setPosition",value:function(e,t,n){var i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}},{key:"invert",value:function(){var e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],s=e[6],l=e[7],u=e[8],c=e[9],h=e[10],d=e[11],f=e[12],p=e[13],v=e[14],m=e[15],g=c*v*l-p*h*l+p*s*d-o*v*d-c*s*m+o*h*m,y=f*h*l-u*v*l-f*s*d+a*v*d+u*s*m-a*h*m,_=u*p*l-f*c*l+f*o*d-a*p*d-u*o*m+a*c*m,x=f*c*s-u*p*s-f*o*h+a*p*h+u*o*v-a*c*v,M=t*g+n*y+i*_+r*x;if(0===M)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var S=1/M;return e[0]=g*S,e[1]=(p*h*r-c*v*r-p*i*d+n*v*d+c*i*m-n*h*m)*S,e[2]=(o*v*r-p*s*r+p*i*l-n*v*l-o*i*m+n*s*m)*S,e[3]=(c*s*r-o*h*r-c*i*l+n*h*l+o*i*d-n*s*d)*S,e[4]=y*S,e[5]=(u*v*r-f*h*r+f*i*d-t*v*d-u*i*m+t*h*m)*S,e[6]=(f*s*r-a*v*r-f*i*l+t*v*l+a*i*m-t*s*m)*S,e[7]=(a*h*r-u*s*r+u*i*l-t*h*l-a*i*d+t*s*d)*S,e[8]=_*S,e[9]=(f*c*r-u*p*r-f*n*d+t*p*d+u*n*m-t*c*m)*S,e[10]=(a*p*r-f*o*r+f*n*l-t*p*l-a*n*m+t*o*m)*S,e[11]=(u*o*r-a*c*r-u*n*l+t*c*l+a*n*d-t*o*d)*S,e[12]=x*S,e[13]=(u*p*i-f*c*i+f*n*h-t*p*h-u*n*v+t*c*v)*S,e[14]=(f*o*i-a*p*i-f*n*s+t*p*s+a*n*v-t*o*v)*S,e[15]=(a*c*i-u*o*i+u*n*s-t*c*s-a*n*h+t*o*h)*S,this}},{key:"scale",value:function(e){var t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}},{key:"getMaxScaleOnAxis",value:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}},{key:"makeTranslation",value:function(e,t,n){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,n,0,0,0,1),this}},{key:"makeRotationX",value:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}},{key:"makeRotationY",value:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}},{key:"makeRotationZ",value:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}},{key:"makeRotationAxis",value:function(e,t){var n=Math.cos(t),i=Math.sin(t),r=1-n,a=e.x,o=e.y,s=e.z,l=r*a,u=r*o;return this.set(l*a+n,l*o-i*s,l*s+i*o,0,l*o+i*s,u*o+n,u*s-i*a,0,l*s-i*o,u*s+i*a,r*s*s+n,0,0,0,0,1),this}},{key:"makeScale",value:function(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}},{key:"makeShear",value:function(e,t,n,i,r,a){return this.set(1,n,r,0,e,1,a,0,t,i,1,0,0,0,0,1),this}},{key:"compose",value:function(e,t,n){var i=this.elements,r=t._x,a=t._y,o=t._z,s=t._w,l=r+r,u=a+a,c=o+o,h=r*l,d=r*u,f=r*c,p=a*u,v=a*c,m=o*c,g=s*l,y=s*u,_=s*c,x=n.x,M=n.y,S=n.z;return i[0]=(1-(p+m))*x,i[1]=(d+_)*x,i[2]=(f-y)*x,i[3]=0,i[4]=(d-_)*M,i[5]=(1-(h+m))*M,i[6]=(v+g)*M,i[7]=0,i[8]=(f+y)*S,i[9]=(v-g)*S,i[10]=(1-(h+p))*S,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}},{key:"decompose",value:function(e,t,n){var i=this.elements,r=It.set(i[0],i[1],i[2]).length(),a=It.set(i[4],i[5],i[6]).length(),o=It.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),e.x=i[12],e.y=i[13],e.z=i[14],Nt.copy(this);var s=1/r,l=1/a,u=1/o;return Nt.elements[0]*=s,Nt.elements[1]*=s,Nt.elements[2]*=s,Nt.elements[4]*=l,Nt.elements[5]*=l,Nt.elements[6]*=l,Nt.elements[8]*=u,Nt.elements[9]*=u,Nt.elements[10]*=u,t.setFromRotationMatrix(Nt),n.x=r,n.y=a,n.z=o,this}},{key:"makePerspective",value:function(e,t,n,i,r,a){var o,s,l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:2e3,u=this.elements,c=2*r/(t-e),h=2*r/(n-i),d=(t+e)/(t-e),f=(n+i)/(n-i);if(2e3===l)o=-(a+r)/(a-r),s=-2*a*r/(a-r);else{if(2001!==l)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+l);o=-a/(a-r),s=-a*r/(a-r)}return u[0]=c,u[4]=0,u[8]=d,u[12]=0,u[1]=0,u[5]=h,u[9]=f,u[13]=0,u[2]=0,u[6]=0,u[10]=o,u[14]=s,u[3]=0,u[7]=0,u[11]=-1,u[15]=0,this}},{key:"makeOrthographic",value:function(e,t,n,i,r,a){var o,s,l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:2e3,u=this.elements,c=1/(t-e),h=1/(n-i),d=1/(a-r),f=(t+e)*c,p=(n+i)*h;if(2e3===l)o=(a+r)*d,s=-2*d;else{if(2001!==l)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+l);o=r*d,s=-1*d}return u[0]=2*c,u[4]=0,u[8]=0,u[12]=-f,u[1]=0,u[5]=2*h,u[9]=0,u[13]=-p,u[2]=0,u[6]=0,u[10]=s,u[14]=-o,u[3]=0,u[7]=0,u[11]=0,u[15]=1,this}},{key:"equals",value:function(e){for(var t=this.elements,n=e.elements,i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}},{key:"fromArray",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=0;n<16;n++)this.elements[n]=e[n+t];return this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}]),e}()),It=new it,Nt=new Ut,Dt=new it(0,0,0),Ot=new it(1,1,1),Ft=new it,zt=new it,Bt=new it,Ht=new Ut,Vt=new nt,Gt=e("an",function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.DEFAULT_ORDER;a(this,t),this.isEuler=!0,this._x=e,this._y=n,this._z=i,this._order=r}return s(t,[{key:"x",get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},{key:"order",get:function(){return this._order},set:function(e){this._order=e,this._onChangeCallback()}},{key:"set",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this._order;return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}},{key:"clone",value:function(){return new this.constructor(this._x,this._y,this._z,this._order)}},{key:"copy",value:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}},{key:"setFromRotationMatrix",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=e.elements,r=i[0],a=i[4],o=i[8],s=i[1],l=i[5],u=i[9],c=i[2],h=i[6],d=i[10];switch(t){case"XYZ":this._y=Math.asin(be(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(h,l),this._z=0);break;case"YXZ":this._x=Math.asin(-be(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(s,l)):(this._y=Math.atan2(-c,r),this._z=0);break;case"ZXY":this._x=Math.asin(be(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-c,d),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(s,r));break;case"ZYX":this._y=Math.asin(-be(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(h,d),this._z=Math.atan2(s,r)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(be(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-c,r)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-be(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(h,l),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-u,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}},{key:"setFromQuaternion",value:function(e,t,n){return Ht.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Ht,t,n)}},{key:"setFromVector3",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order;return this.set(e.x,e.y,e.z,t)}},{key:"reorder",value:function(e){return Vt.setFromEuler(this),this.setFromQuaternion(Vt,e)}},{key:"equals",value:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}},{key:"fromArray",value:function(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}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}},{key:"_onChange",value:function(e){return this._onChangeCallback=e,this}},{key:"_onChangeCallback",value:function(){}},{key:Symbol.iterator,value:n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._x;case 2:return e.next=4,this._y;case 4:return e.next=6,this._z;case 6:return e.next=8,this._order;case 8:case"end":return e.stop()}}),e,this)}))}]),t}());Gt.DEFAULT_ORDER="XYZ";var Wt=e("bF",function(){function e(){a(this,e),this.mask=1}return s(e,[{key:"set",value:function(e){this.mask=(1<<e|0)>>>0}},{key:"enable",value:function(e){this.mask|=1<<e|0}},{key:"enableAll",value:function(){this.mask=-1}},{key:"toggle",value:function(e){this.mask^=1<<e|0}},{key:"disable",value:function(e){this.mask&=~(1<<e|0)}},{key:"disableAll",value:function(){this.mask=0}},{key:"test",value:function(e){return 0!=(this.mask&e.mask)}},{key:"isEnabled",value:function(e){return 0!=(this.mask&(1<<e|0))}}]),e}()),Xt=0,jt=new it,Yt=new nt,qt=new Ut,Zt=new it,Jt=new it,Kt=new it,Qt=new nt,$t=new it(1,0,0),en=new it(0,1,0),tn=new it(0,0,1),nn={type:"added"},rn={type:"removed"},an=e("O",function(e){u(n,e);var t=g(n);function n(){var e;a(this,n),(e=t.call(this)).isObject3D=!0,Object.defineProperty(v(e),"id",{value:Xt++}),e.uuid=Se(),e.name="",e.type="Object3D",e.parent=null,e.children=[],e.up=n.DEFAULT_UP.clone();var i=new it,r=new Gt,o=new nt,s=new it(1,1,1);return r._onChange((function(){o.setFromEuler(r,!1)})),o._onChange((function(){r.setFromQuaternion(o,void 0,!1)})),Object.defineProperties(v(e),{position:{configurable:!0,enumerable:!0,value:i},rotation:{configurable:!0,enumerable:!0,value:r},quaternion:{configurable:!0,enumerable:!0,value:o},scale:{configurable:!0,enumerable:!0,value:s},modelViewMatrix:{value:new Ut},normalMatrix:{value:new ke}}),e.matrix=new Ut,e.matrixWorld=new Ut,e.matrixAutoUpdate=n.DEFAULT_MATRIX_AUTO_UPDATE,e.matrixWorldNeedsUpdate=!1,e.matrixWorldAutoUpdate=n.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,e.layers=new Wt,e.visible=!0,e.castShadow=!1,e.receiveShadow=!1,e.frustumCulled=!0,e.renderOrder=0,e.animations=[],e.userData={},e}return s(n,[{key:"onBeforeRender",value:function(){}},{key:"onAfterRender",value:function(){}},{key:"applyMatrix4",value:function(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}},{key:"applyQuaternion",value:function(e){return this.quaternion.premultiply(e),this}},{key:"setRotationFromAxisAngle",value:function(e,t){this.quaternion.setFromAxisAngle(e,t)}},{key:"setRotationFromEuler",value:function(e){this.quaternion.setFromEuler(e,!0)}},{key:"setRotationFromMatrix",value:function(e){this.quaternion.setFromRotationMatrix(e)}},{key:"setRotationFromQuaternion",value:function(e){this.quaternion.copy(e)}},{key:"rotateOnAxis",value:function(e,t){return Yt.setFromAxisAngle(e,t),this.quaternion.multiply(Yt),this}},{key:"rotateOnWorldAxis",value:function(e,t){return Yt.setFromAxisAngle(e,t),this.quaternion.premultiply(Yt),this}},{key:"rotateX",value:function(e){return this.rotateOnAxis($t,e)}},{key:"rotateY",value:function(e){return this.rotateOnAxis(en,e)}},{key:"rotateZ",value:function(e){return this.rotateOnAxis(tn,e)}},{key:"translateOnAxis",value:function(e,t){return jt.copy(e).applyQuaternion(this.quaternion),this.position.add(jt.multiplyScalar(t)),this}},{key:"translateX",value:function(e){return this.translateOnAxis($t,e)}},{key:"translateY",value:function(e){return this.translateOnAxis(en,e)}},{key:"translateZ",value:function(e){return this.translateOnAxis(tn,e)}},{key:"localToWorld",value:function(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}},{key:"worldToLocal",value:function(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(qt.copy(this.matrixWorld).invert())}},{key:"lookAt",value:function(e,t,n){e.isVector3?Zt.copy(e):Zt.set(e,t,n);var i=this.parent;this.updateWorldMatrix(!0,!1),Jt.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?qt.lookAt(Jt,Zt,this.up):qt.lookAt(Zt,Jt,this.up),this.quaternion.setFromRotationMatrix(qt),i&&(qt.extractRotation(i.matrixWorld),Yt.setFromRotationMatrix(qt),this.quaternion.premultiply(Yt.invert()))}},{key:"add",value:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(nn)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}},{key:"remove",value:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}var n=this.children.indexOf(e);return-1!==n&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(rn)),this}},{key:"removeFromParent",value:function(){var e=this.parent;return null!==e&&e.remove(this),this}},{key:"clear",value:function(){for(var e=0;e<this.children.length;e++){var t=this.children[e];t.parent=null,t.dispatchEvent(rn)}return this.children.length=0,this}},{key:"attach",value:function(e){return this.updateWorldMatrix(!0,!1),qt.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),qt.multiply(e.parent.matrixWorld)),e.applyMatrix4(qt),this.add(e),e.updateWorldMatrix(!1,!0),this}},{key:"getObjectById",value:function(e){return this.getObjectByProperty("id",e)}},{key:"getObjectByName",value:function(e){return this.getObjectByProperty("name",e)}},{key:"getObjectByProperty",value:function(e,t){if(this[e]===t)return this;for(var n=0,i=this.children.length;n<i;n++){var r=this.children[n].getObjectByProperty(e,t);if(void 0!==r)return r}}},{key:"getObjectsByProperty",value:function(e,t){var n=[];this[e]===t&&n.push(this);for(var i=0,r=this.children.length;i<r;i++){var a=this.children[i].getObjectsByProperty(e,t);a.length>0&&(n=n.concat(a))}return n}},{key:"getWorldPosition",value:function(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}},{key:"getWorldQuaternion",value:function(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Jt,e,Kt),e}},{key:"getWorldScale",value:function(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Jt,Qt,e),e}},{key:"getWorldDirection",value:function(e){this.updateWorldMatrix(!0,!1);var t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}},{key:"raycast",value:function(){}},{key:"traverse",value:function(e){e(this);for(var t=this.children,n=0,i=t.length;n<i;n++)t[n].traverse(e)}},{key:"traverseVisible",value:function(e){if(!1!==this.visible){e(this);for(var t=this.children,n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}}},{key:"traverseAncestors",value:function(e){var t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))}},{key:"updateMatrix",value:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}},{key:"updateMatrixWorld",value:function(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(var t=this.children,n=0,i=t.length;n<i;n++){var r=t[n];!0!==r.matrixWorldAutoUpdate&&!0!==e||r.updateMatrixWorld(e)}}},{key:"updateWorldMatrix",value:function(e,t){var n=this.parent;if(!0===e&&null!==n&&!0===n.matrixWorldAutoUpdate&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===t)for(var i=this.children,r=0,a=i.length;r<a;r++){var o=i[r];!0===o.matrixWorldAutoUpdate&&o.updateWorldMatrix(!1,!0)}}},{key:"toJSON",value:function(e){var t=void 0===e||"string"==typeof e,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});var i={};function r(t,n){return void 0===t[n.uuid]&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),!1===this.frustumCulled&&(i.frustumCulled=!1),0!==this.renderOrder&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);var a=this.geometry.parameters;if(void 0!==a&&void 0!==a.shapes){var o=a.shapes;if(Array.isArray(o))for(var s=0,l=o.length;s<l;s++){var u=o[s];r(e.shapes,u)}else r(e.shapes,o)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){for(var c=[],h=0,d=this.material.length;h<d;h++)c.push(r(e.materials,this.material[h]));i.material=c}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(var f=0;f<this.children.length;f++)i.children.push(this.children[f].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(var p=0;p<this.animations.length;p++){var v=this.animations[p];i.animations.push(r(e.animations,v))}}if(t){var m=E(e.geometries),g=E(e.materials),y=E(e.textures),_=E(e.images),x=E(e.shapes),M=E(e.skeletons),S=E(e.animations),b=E(e.nodes);m.length>0&&(n.geometries=m),g.length>0&&(n.materials=g),y.length>0&&(n.textures=y),_.length>0&&(n.images=_),x.length>0&&(n.shapes=x),M.length>0&&(n.skeletons=M),S.length>0&&(n.animations=S),b.length>0&&(n.nodes=b)}return n.object=i,n;function E(e){var t=[];for(var n in e){var i=e[n];delete i.metadata,t.push(i)}return t}}},{key:"clone",value:function(e){return(new this.constructor).copy(this,e)}},{key:"copy",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];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),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,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.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(var n=0;n<e.children.length;n++){var i=e.children[n];this.add(i.clone())}return this}}]),n}(ge));an.DEFAULT_UP=new it(0,1,0),an.DEFAULT_MATRIX_AUTO_UPDATE=!0,an.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var on=new it,sn=new it,ln=new it,un=new it,cn=new it,hn=new it,dn=new it,fn=new it,pn=new it,vn=new it,mn=!1,gn=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new it,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new it,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new it;a(this,e),this.a=t,this.b=n,this.c=i}return s(e,[{key:"set",value:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}},{key:"setFromPointsAndIndices",value:function(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}},{key:"setFromAttributeAndIndices",value:function(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}},{key:"getArea",value:function(){return on.subVectors(this.c,this.b),sn.subVectors(this.a,this.b),.5*on.cross(sn).length()}},{key:"getMidpoint",value:function(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}},{key:"getNormal",value:function(t){return e.getNormal(this.a,this.b,this.c,t)}},{key:"getPlane",value:function(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}},{key:"getBarycoord",value:function(t,n){return e.getBarycoord(t,this.a,this.b,this.c,n)}},{key:"getUV",value:function(t,n,i,r,a){return!1===mn&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),mn=!0),e.getInterpolation(t,this.a,this.b,this.c,n,i,r,a)}},{key:"getInterpolation",value:function(t,n,i,r,a){return e.getInterpolation(t,this.a,this.b,this.c,n,i,r,a)}},{key:"containsPoint",value:function(t){return e.containsPoint(t,this.a,this.b,this.c)}},{key:"isFrontFacing",value:function(t){return e.isFrontFacing(this.a,this.b,this.c,t)}},{key:"intersectsBox",value:function(e){return e.intersectsTriangle(this)}},{key:"closestPointToPoint",value:function(e,t){var n,i,r=this.a,a=this.b,o=this.c;cn.subVectors(a,r),hn.subVectors(o,r),fn.subVectors(e,r);var s=cn.dot(fn),l=hn.dot(fn);if(s<=0&&l<=0)return t.copy(r);pn.subVectors(e,a);var u=cn.dot(pn),c=hn.dot(pn);if(u>=0&&c<=u)return t.copy(a);var h=s*c-u*l;if(h<=0&&s>=0&&u<=0)return n=s/(s-u),t.copy(r).addScaledVector(cn,n);vn.subVectors(e,o);var d=cn.dot(vn),f=hn.dot(vn);if(f>=0&&d<=f)return t.copy(o);var p=d*l-s*f;if(p<=0&&l>=0&&f<=0)return i=l/(l-f),t.copy(r).addScaledVector(hn,i);var v=u*f-d*c;if(v<=0&&c-u>=0&&d-f>=0)return dn.subVectors(o,a),i=(c-u)/(c-u+(d-f)),t.copy(a).addScaledVector(dn,i);var m=1/(v+p+h);return n=p*m,i=h*m,t.copy(r).addScaledVector(cn,n).addScaledVector(hn,i)}},{key:"equals",value:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}],[{key:"getNormal",value:function(e,t,n,i){i.subVectors(n,t),on.subVectors(e,t),i.cross(on);var r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}},{key:"getBarycoord",value:function(e,t,n,i,r){on.subVectors(i,t),sn.subVectors(n,t),ln.subVectors(e,t);var a=on.dot(on),o=on.dot(sn),s=on.dot(ln),l=sn.dot(sn),u=sn.dot(ln),c=a*l-o*o;if(0===c)return r.set(-2,-1,-1);var h=1/c,d=(l*s-o*u)*h,f=(a*u-o*s)*h;return r.set(1-d-f,f,d)}},{key:"containsPoint",value:function(e,t,n,i){return this.getBarycoord(e,t,n,i,un),un.x>=0&&un.y>=0&&un.x+un.y<=1}},{key:"getUV",value:function(e,t,n,i,r,a,o,s){return!1===mn&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),mn=!0),this.getInterpolation(e,t,n,i,r,a,o,s)}},{key:"getInterpolation",value:function(e,t,n,i,r,a,o,s){return this.getBarycoord(e,t,n,i,un),s.setScalar(0),s.addScaledVector(r,un.x),s.addScaledVector(a,un.y),s.addScaledVector(o,un.z),s}},{key:"isFrontFacing",value:function(e,t,n,i){return on.subVectors(n,t),sn.subVectors(e,t),on.cross(sn).dot(i)<0}}]),e}(),yn=0,_n=e("v",function(e){u(n,e);var t=g(n);function n(){var e;return a(this,n),(e=t.call(this)).isMaterial=!0,Object.defineProperty(v(e),"id",{value:yn++}),e.uuid=Se(),e.name="",e.type="Material",e.blending=1,e.side=P,e.vertexColors=!1,e.opacity=1,e.transparent=!1,e.alphaHash=!1,e.blendSrc=204,e.blendDst=205,e.blendEquation=O,e.blendSrcAlpha=null,e.blendDstAlpha=null,e.blendEquationAlpha=null,e.depthFunc=3,e.depthTest=!0,e.depthWrite=!0,e.stencilWriteMask=255,e.stencilFunc=519,e.stencilRef=0,e.stencilFuncMask=255,e.stencilFail=7680,e.stencilZFail=7680,e.stencilZPass=7680,e.stencilWrite=!1,e.clippingPlanes=null,e.clipIntersection=!1,e.clipShadows=!1,e.shadowSide=null,e.colorWrite=!0,e.precision=null,e.polygonOffset=!1,e.polygonOffsetFactor=0,e.polygonOffsetUnits=0,e.dithering=!1,e.alphaToCoverage=!1,e.premultipliedAlpha=!1,e.forceSinglePass=!1,e.visible=!0,e.toneMapped=!0,e.userData={},e.version=0,e._alphaTest=0,e}return s(n,[{key:"alphaTest",get:function(){return this._alphaTest},set:function(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}},{key:"onBuild",value:function(){}},{key:"onBeforeRender",value:function(){}},{key:"onBeforeCompile",value:function(){}},{key:"customProgramCacheKey",value:function(){return this.onBeforeCompile.toString()}},{key:"setValues",value:function(e){if(void 0!==e)for(var t in e){var n=e[t];if(void 0!==n){var i=this[t];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n:console.warn("THREE.Material: '".concat(t,"' is not a property of THREE.").concat(this.type,"."))}else console.warn("THREE.Material: parameter '".concat(t,"' has value of undefined."))}}},{key:"toJSON",value:function(e){var t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});var n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function i(e){var t=[];for(var n in e){var i=e[n];delete i.metadata,t.push(i)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),this.side!==P&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaHash&&(n.alphaHash=this.alphaHash),!0===this.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.forceSinglePass&&(n.forceSinglePass=this.forceSinglePass),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),t){var r=i(e.textures),a=i(e.images);r.length>0&&(n.textures=r),a.length>0&&(n.images=a)}return n}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(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.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;var t=e.clippingPlanes,n=null;if(null!==t){var i=t.length;n=new Array(i);for(var r=0;r!==i;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,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.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}},{key:"needsUpdate",set:function(e){!0===e&&this.version++}}]),n}(ge)),xn={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Mn={h:0,s:0,l:0},Sn={h:0,s:0,l:0};function bn(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}var En=e("C",function(e){function t(e,n,i){return a(this,t),this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,n,i)}return s(t,[{key:"set",value:function(e,t,n){if(void 0===t&&void 0===n){var i=e;i&&i.isColor?this.copy(i):"number"==typeof i?this.setHex(i):"string"==typeof i&&this.setStyle(i)}else this.setRGB(e,t,n);return this}},{key:"setScalar",value:function(e){return this.r=e,this.g=e,this.b=e,this}},{key:"setHex",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ve;return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,Xe.toWorkingColorSpace(this,t),this}},{key:"setRGB",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Xe.workingColorSpace;return this.r=e,this.g=t,this.b=n,Xe.toWorkingColorSpace(this,i),this}},{key:"setHSL",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Xe.workingColorSpace;if(e=Ee(e,1),t=be(t,0,1),n=be(n,0,1),0===t)this.r=this.g=this.b=n;else{var r=n<=.5?n*(1+t):n+t-n*t,a=2*n-r;this.r=bn(a,r,e+1/3),this.g=bn(a,r,e),this.b=bn(a,r,e-1/3)}return Xe.toWorkingColorSpace(this,i),this}},{key:"setStyle",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ve;function i(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}if(t=/^(\w+)\(([^\)]*)\)/.exec(e)){var r,a=t[1],o=t[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(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,n);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(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,n);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,n);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(t=/^\#([A-Fa-f\d]+)$/.exec(e)){var s=t[1],l=s.length;if(3===l)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,n);if(6===l)return this.setHex(parseInt(s,16),n);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}},{key:"setColorName",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ve,n=xn[e.toLowerCase()];return void 0!==n?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}},{key:"clone",value:function(){return new this.constructor(this.r,this.g,this.b)}},{key:"copy",value:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}},{key:"copySRGBToLinear",value:function(e){return this.r=Fe(e.r),this.g=Fe(e.g),this.b=Fe(e.b),this}},{key:"copyLinearToSRGB",value:function(e){return this.r=ze(e.r),this.g=ze(e.g),this.b=ze(e.b),this}},{key:"convertSRGBToLinear",value:function(){return this.copySRGBToLinear(this),this}},{key:"convertLinearToSRGB",value:function(){return this.copyLinearToSRGB(this),this}},{key:"getHex",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ve;return Xe.fromWorkingColorSpace(Tn.copy(this),e),65536*Math.round(be(255*Tn.r,0,255))+256*Math.round(be(255*Tn.g,0,255))+Math.round(be(255*Tn.b,0,255))}},{key:"getHexString",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ve;return("000000"+this.getHex(e).toString(16)).slice(-6)}},{key:"getHSL",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Xe.workingColorSpace;Xe.fromWorkingColorSpace(Tn.copy(this),t);var n,i,r=Tn.r,a=Tn.g,o=Tn.b,s=Math.max(r,a,o),l=Math.min(r,a,o),u=(l+s)/2;if(l===s)n=0,i=0;else{var c=s-l;switch(i=u<=.5?c/(s+l):c/(2-s-l),s){case r:n=(a-o)/c+(a<o?6:0);break;case a:n=(o-r)/c+2;break;case o:n=(r-a)/c+4}n/=6}return e.h=n,e.s=i,e.l=u,e}},{key:"getRGB",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Xe.workingColorSpace;return Xe.fromWorkingColorSpace(Tn.copy(this),t),e.r=Tn.r,e.g=Tn.g,e.b=Tn.b,e}},{key:"getStyle",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ve;Xe.fromWorkingColorSpace(Tn.copy(this),e);var t=Tn.r,n=Tn.g,i=Tn.b;return e!==ve?"color(".concat(e," ").concat(t.toFixed(3)," ").concat(n.toFixed(3)," ").concat(i.toFixed(3),")"):"rgb(".concat(Math.round(255*t),",").concat(Math.round(255*n),",").concat(Math.round(255*i),")")}},{key:"offsetHSL",value:function(e,t,n){return this.getHSL(Mn),Mn.h+=e,Mn.s+=t,Mn.l+=n,this.setHSL(Mn.h,Mn.s,Mn.l),this}},{key:"add",value:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}},{key:"addColors",value:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}},{key:"addScalar",value:function(e){return this.r+=e,this.g+=e,this.b+=e,this}},{key:"sub",value:function(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}},{key:"multiply",value:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}},{key:"multiplyScalar",value:function(e){return this.r*=e,this.g*=e,this.b*=e,this}},{key:"lerp",value:function(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}},{key:"lerpColors",value:function(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}},{key:"lerpHSL",value:function(e,t){this.getHSL(Mn),e.getHSL(Sn);var n=Te(Mn.h,Sn.h,t),i=Te(Mn.s,Sn.s,t),r=Te(Mn.l,Sn.l,t);return this.setHSL(n,i,r),this}},{key:"setFromVector3",value:function(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}},{key:"applyMatrix3",value:function(e){var t=this.r,n=this.g,i=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*i,this.g=r[1]*t+r[4]*n+r[7]*i,this.b=r[2]*t+r[5]*n+r[8]*i,this}},{key:"equals",value:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}},{key:"fromBufferAttribute",value:function(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}},{key:"toJSON",value:function(){return this.getHex()}},{key:Symbol.iterator,value:n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.r;case 2:return e.next=4,this.g;case 4:return e.next=6,this.b;case 6:case"end":return e.stop()}}),e,this)}))}]),t}()),Tn=new En;En.NAMES=xn;var wn=e("j",function(e){u(n,e);var t=g(n);function n(e){var i;return a(this,n),(i=t.call(this)).isMeshBasicMaterial=!0,i.type="MeshBasicMaterial",i.color=new En(16777215),i.map=null,i.lightMap=null,i.lightMapIntensity=1,i.aoMap=null,i.aoMapIntensity=1,i.specularMap=null,i.alphaMap=null,i.envMap=null,i.combine=0,i.reflectivity=1,i.refractionRatio=.98,i.wireframe=!1,i.wireframeLinewidth=1,i.wireframeLinecap="round",i.wireframeLinejoin="round",i.fog=!0,i.setValues(e),i}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,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.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}}]),n}(_n)),An=Rn();function Rn(){for(var e=new ArrayBuffer(4),t=new Float32Array(e),n=new Uint32Array(e),i=new Uint32Array(512),r=new Uint32Array(512),a=0;a<256;++a){var o=a-127;o<-27?(i[a]=0,i[256|a]=32768,r[a]=24,r[256|a]=24):o<-14?(i[a]=1024>>-o-14,i[256|a]=1024>>-o-14|32768,r[a]=-o-1,r[256|a]=-o-1):o<=15?(i[a]=o+15<<10,i[256|a]=o+15<<10|32768,r[a]=13,r[256|a]=13):o<128?(i[a]=31744,i[256|a]=64512,r[a]=24,r[256|a]=24):(i[a]=31744,i[256|a]=64512,r[a]=13,r[256|a]=13)}for(var s=new Uint32Array(2048),l=new Uint32Array(64),u=new Uint32Array(64),c=1;c<1024;++c){for(var h=c<<13,d=0;0==(8388608&h);)h<<=1,d-=8388608;h&=-8388609,d+=947912704,s[c]=h|d}for(var f=1024;f<2048;++f)s[f]=939524096+(f-1024<<13);for(var p=1;p<31;++p)l[p]=p<<23;l[31]=1199570944,l[32]=2147483648;for(var v=33;v<63;++v)l[v]=2147483648+(v-32<<23);l[63]=3347054592;for(var m=1;m<64;++m)32!==m&&(u[m]=1024);return{floatView:t,uint32View:n,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:l,offsetTable:u}}e("a_",{toHalfFloat:function(e){Math.abs(e)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=be(e,-65504,65504),An.floatView[0]=e;var t=An.uint32View[0],n=t>>23&511;return An.baseTable[n]+((8388607&t)>>An.shiftTable[n])},fromHalfFloat:function(e){var t=e>>10;return An.uint32View[0]=An.mantissaTable[An.offsetTable[t]+(1023&e)]+An.exponentTable[t],An.floatView[0]}});var Cn=new it,Ln=new Pe,Pn=e("b",function(){function e(t,n){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(a(this,e),Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=n,this.count=void 0!==t?t.length/n:0,this.normalized=i,this.usage=35044,this.updateRange={offset:0,count:-1},this.gpuType=re,this.version=0}return s(e,[{key:"onUploadCallback",value:function(){}},{key:"needsUpdate",set:function(e){!0===e&&this.version++}},{key:"setUsage",value:function(e){return this.usage=e,this}},{key:"copy",value:function(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}},{key:"copyAt",value:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(var i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this}},{key:"copyArray",value:function(e){return this.array.set(e),this}},{key:"applyMatrix3",value:function(e){if(2===this.itemSize)for(var t=0,n=this.count;t<n;t++)Ln.fromBufferAttribute(this,t),Ln.applyMatrix3(e),this.setXY(t,Ln.x,Ln.y);else if(3===this.itemSize)for(var i=0,r=this.count;i<r;i++)Cn.fromBufferAttribute(this,i),Cn.applyMatrix3(e),this.setXYZ(i,Cn.x,Cn.y,Cn.z);return this}},{key:"applyMatrix4",value:function(e){for(var t=0,n=this.count;t<n;t++)Cn.fromBufferAttribute(this,t),Cn.applyMatrix4(e),this.setXYZ(t,Cn.x,Cn.y,Cn.z);return this}},{key:"applyNormalMatrix",value:function(e){for(var t=0,n=this.count;t<n;t++)Cn.fromBufferAttribute(this,t),Cn.applyNormalMatrix(e),this.setXYZ(t,Cn.x,Cn.y,Cn.z);return this}},{key:"transformDirection",value:function(e){for(var t=0,n=this.count;t<n;t++)Cn.fromBufferAttribute(this,t),Cn.transformDirection(e),this.setXYZ(t,Cn.x,Cn.y,Cn.z);return this}},{key:"set",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(e,t),this}},{key:"getComponent",value:function(e,t){var n=this.array[e*this.itemSize+t];return this.normalized&&(n=Ce(n,this.array)),n}},{key:"setComponent",value:function(e,t,n){return this.normalized&&(n=Le(n,this.array)),this.array[e*this.itemSize+t]=n,this}},{key:"getX",value:function(e){var t=this.array[e*this.itemSize];return this.normalized&&(t=Ce(t,this.array)),t}},{key:"setX",value:function(e,t){return this.normalized&&(t=Le(t,this.array)),this.array[e*this.itemSize]=t,this}},{key:"getY",value:function(e){var t=this.array[e*this.itemSize+1];return this.normalized&&(t=Ce(t,this.array)),t}},{key:"setY",value:function(e,t){return this.normalized&&(t=Le(t,this.array)),this.array[e*this.itemSize+1]=t,this}},{key:"getZ",value:function(e){var t=this.array[e*this.itemSize+2];return this.normalized&&(t=Ce(t,this.array)),t}},{key:"setZ",value:function(e,t){return this.normalized&&(t=Le(t,this.array)),this.array[e*this.itemSize+2]=t,this}},{key:"getW",value:function(e){var t=this.array[e*this.itemSize+3];return this.normalized&&(t=Ce(t,this.array)),t}},{key:"setW",value:function(e,t){return this.normalized&&(t=Le(t,this.array)),this.array[e*this.itemSize+3]=t,this}},{key:"setXY",value:function(e,t,n){return e*=this.itemSize,this.normalized&&(t=Le(t,this.array),n=Le(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}},{key:"setXYZ",value:function(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=Le(t,this.array),n=Le(n,this.array),i=Le(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}},{key:"setXYZW",value:function(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=Le(t,this.array),n=Le(n,this.array),i=Le(i,this.array),r=Le(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this}},{key:"onUpload",value:function(e){return this.onUploadCallback=e,this}},{key:"clone",value:function(){return new this.constructor(this.array,this.itemSize).copy(this)}},{key:"toJSON",value:function(){var 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),0===this.updateRange.offset&&-1===this.updateRange.count||(e.updateRange=this.updateRange),e}}]),e}()),kn=function(e){u(n,e);var t=g(n);function n(e,i,r){return a(this,n),t.call(this,new Uint16Array(e),i,r)}return s(n)}(Pn),Un=e("ax",function(e){u(n,e);var t=g(n);function n(e,i,r){return a(this,n),t.call(this,new Uint32Array(e),i,r)}return s(n)}(Pn)),In=e("ay",function(e){u(n,e);var t=g(n);function n(e,i,r){return a(this,n),t.call(this,new Float32Array(e),i,r)}return s(n)}(Pn)),Nn=0,Dn=new Ut,On=new an,Fn=new it,zn=new ot,Bn=new ot,Hn=new it,Vn=e("B",function(e){u(n,e);var t=g(n);function n(){var e;return a(this,n),(e=t.call(this)).isBufferGeometry=!0,Object.defineProperty(v(e),"id",{value:Nn++}),e.uuid=Se(),e.name="",e.type="BufferGeometry",e.index=null,e.attributes={},e.morphAttributes={},e.morphTargetsRelative=!1,e.groups=[],e.boundingBox=null,e.boundingSphere=null,e.drawRange={start:0,count:1/0},e.userData={},e}return s(n,[{key:"getIndex",value:function(){return this.index}},{key:"setIndex",value:function(e){return Array.isArray(e)?this.index=new(Ie(e)?Un:kn)(e,1):this.index=e,this}},{key:"getAttribute",value:function(e){return this.attributes[e]}},{key:"setAttribute",value:function(e,t){return this.attributes[e]=t,this}},{key:"deleteAttribute",value:function(e){return delete this.attributes[e],this}},{key:"hasAttribute",value:function(e){return void 0!==this.attributes[e]}},{key:"addGroup",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.groups.push({start:e,count:t,materialIndex:n})}},{key:"clearGroups",value:function(){this.groups=[]}},{key:"setDrawRange",value:function(e,t){this.drawRange.start=e,this.drawRange.count=t}},{key:"applyMatrix4",value:function(e){var t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);var n=this.attributes.normal;if(void 0!==n){var i=(new ke).getNormalMatrix(e);n.applyNormalMatrix(i),n.needsUpdate=!0}var r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(e),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}},{key:"applyQuaternion",value:function(e){return Dn.makeRotationFromQuaternion(e),this.applyMatrix4(Dn),this}},{key:"rotateX",value:function(e){return Dn.makeRotationX(e),this.applyMatrix4(Dn),this}},{key:"rotateY",value:function(e){return Dn.makeRotationY(e),this.applyMatrix4(Dn),this}},{key:"rotateZ",value:function(e){return Dn.makeRotationZ(e),this.applyMatrix4(Dn),this}},{key:"translate",value:function(e,t,n){return Dn.makeTranslation(e,t,n),this.applyMatrix4(Dn),this}},{key:"scale",value:function(e,t,n){return Dn.makeScale(e,t,n),this.applyMatrix4(Dn),this}},{key:"lookAt",value:function(e){return On.lookAt(e),On.updateMatrix(),this.applyMatrix4(On.matrix),this}},{key:"center",value:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(Fn).negate(),this.translate(Fn.x,Fn.y,Fn.z),this}},{key:"setFromPoints",value:function(e){for(var t=[],n=0,i=e.length;n<i;n++){var r=e[n];t.push(r.x,r.y,r.z||0)}return this.setAttribute("position",new In(t,3)),this}},{key:"computeBoundingBox",value:function(){null===this.boundingBox&&(this.boundingBox=new ot);var e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingBox.set(new it(-1/0,-1/0,-1/0),new it(1/0,1/0,1/0));if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(var n=0,i=t.length;n<i;n++){var r=t[n];zn.setFromBufferAttribute(r),this.morphTargetsRelative?(Hn.addVectors(this.boundingBox.min,zn.min),this.boundingBox.expandByPoint(Hn),Hn.addVectors(this.boundingBox.max,zn.max),this.boundingBox.expandByPoint(Hn)):(this.boundingBox.expandByPoint(zn.min),this.boundingBox.expandByPoint(zn.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}},{key:"computeBoundingSphere",value:function(){null===this.boundingSphere&&(this.boundingSphere=new Et);var e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingSphere.set(new it,1/0);if(e){var n=this.boundingSphere.center;if(zn.setFromBufferAttribute(e),t)for(var i=0,r=t.length;i<r;i++){var a=t[i];Bn.setFromBufferAttribute(a),this.morphTargetsRelative?(Hn.addVectors(zn.min,Bn.min),zn.expandByPoint(Hn),Hn.addVectors(zn.max,Bn.max),zn.expandByPoint(Hn)):(zn.expandByPoint(Bn.min),zn.expandByPoint(Bn.max))}zn.getCenter(n);for(var o=0,s=0,l=e.count;s<l;s++)Hn.fromBufferAttribute(e,s),o=Math.max(o,n.distanceToSquared(Hn));if(t)for(var u=0,c=t.length;u<c;u++)for(var h=t[u],d=this.morphTargetsRelative,f=0,p=h.count;f<p;f++)Hn.fromBufferAttribute(h,f),d&&(Fn.fromBufferAttribute(e,f),Hn.add(Fn)),o=Math.max(o,n.distanceToSquared(Hn));this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}},{key:"computeTangents",value:function(){var e=this.index,t=this.attributes;if(null!==e&&void 0!==t.position&&void 0!==t.normal&&void 0!==t.uv){var n=e.array,i=t.position.array,r=t.normal.array,a=t.uv.array,o=i.length/3;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new Pn(new Float32Array(4*o),4));for(var s=this.getAttribute("tangent").array,l=[],u=[],c=0;c<o;c++)l[c]=new it,u[c]=new it;var h=new it,d=new it,f=new it,p=new Pe,v=new Pe,m=new Pe,g=new it,y=new it,_=this.groups;0===_.length&&(_=[{start:0,count:n.length}]);for(var x=0,M=_.length;x<M;++x)for(var S=_[x],b=S.start,E=b,T=b+S.count;E<T;E+=3)D(n[E+0],n[E+1],n[E+2]);for(var w=new it,A=new it,R=new it,C=new it,L=0,P=_.length;L<P;++L)for(var k=_[L],U=k.start,I=U,N=U+k.count;I<N;I+=3)O(n[I+0]),O(n[I+1]),O(n[I+2])}else console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");function D(e,t,n){h.fromArray(i,3*e),d.fromArray(i,3*t),f.fromArray(i,3*n),p.fromArray(a,2*e),v.fromArray(a,2*t),m.fromArray(a,2*n),d.sub(h),f.sub(h),v.sub(p),m.sub(p);var r=1/(v.x*m.y-m.x*v.y);isFinite(r)&&(g.copy(d).multiplyScalar(m.y).addScaledVector(f,-v.y).multiplyScalar(r),y.copy(f).multiplyScalar(v.x).addScaledVector(d,-m.x).multiplyScalar(r),l[e].add(g),l[t].add(g),l[n].add(g),u[e].add(y),u[t].add(y),u[n].add(y))}function O(e){R.fromArray(r,3*e),C.copy(R);var t=l[e];w.copy(t),w.sub(R.multiplyScalar(R.dot(t))).normalize(),A.crossVectors(C,t);var n=A.dot(u[e])<0?-1:1;s[4*e]=w.x,s[4*e+1]=w.y,s[4*e+2]=w.z,s[4*e+3]=n}}},{key:"computeVertexNormals",value:function(){var e=this.index,t=this.getAttribute("position");if(void 0!==t){var n=this.getAttribute("normal");if(void 0===n)n=new Pn(new Float32Array(3*t.count),3),this.setAttribute("normal",n);else for(var i=0,r=n.count;i<r;i++)n.setXYZ(i,0,0,0);var a=new it,o=new it,s=new it,l=new it,u=new it,c=new it,h=new it,d=new it;if(e)for(var f=0,p=e.count;f<p;f+=3){var v=e.getX(f+0),m=e.getX(f+1),g=e.getX(f+2);a.fromBufferAttribute(t,v),o.fromBufferAttribute(t,m),s.fromBufferAttribute(t,g),h.subVectors(s,o),d.subVectors(a,o),h.cross(d),l.fromBufferAttribute(n,v),u.fromBufferAttribute(n,m),c.fromBufferAttribute(n,g),l.add(h),u.add(h),c.add(h),n.setXYZ(v,l.x,l.y,l.z),n.setXYZ(m,u.x,u.y,u.z),n.setXYZ(g,c.x,c.y,c.z)}else for(var y=0,_=t.count;y<_;y+=3)a.fromBufferAttribute(t,y+0),o.fromBufferAttribute(t,y+1),s.fromBufferAttribute(t,y+2),h.subVectors(s,o),d.subVectors(a,o),h.cross(d),n.setXYZ(y+0,h.x,h.y,h.z),n.setXYZ(y+1,h.x,h.y,h.z),n.setXYZ(y+2,h.x,h.y,h.z);this.normalizeNormals(),n.needsUpdate=!0}}},{key:"normalizeNormals",value:function(){for(var e=this.attributes.normal,t=0,n=e.count;t<n;t++)Hn.fromBufferAttribute(e,t),Hn.normalize(),e.setXYZ(t,Hn.x,Hn.y,Hn.z)}},{key:"toNonIndexed",value:function(){function e(e,t){for(var n=e.array,i=e.itemSize,r=e.normalized,a=new n.constructor(t.length*i),o=0,s=0,l=0,u=t.length;l<u;l++){o=e.isInterleavedBufferAttribute?t[l]*e.data.stride+e.offset:t[l]*i;for(var c=0;c<i;c++)a[s++]=n[o++]}return new Pn(a,i,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;var t=new n,i=this.index.array,r=this.attributes;for(var a in r){var o=e(r[a],i);t.setAttribute(a,o)}var s=this.morphAttributes;for(var l in s){for(var u=[],c=s[l],h=0,d=c.length;h<d;h++){var f=e(c[h],i);u.push(f)}t.morphAttributes[l]=u}t.morphTargetsRelative=this.morphTargetsRelative;for(var p=this.groups,v=0,m=p.length;v<m;v++){var g=p[v];t.addGroup(g.start,g.count,g.materialIndex)}return t}},{key:"toJSON",value:function(){var e={metadata:{version:4.6,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){var t=this.parameters;for(var n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};var i=this.index;null!==i&&(e.data.index={type:i.array.constructor.name,array:Array.prototype.slice.call(i.array)});var r=this.attributes;for(var a in r){var o=r[a];e.data.attributes[a]=o.toJSON(e.data)}var s={},l=!1;for(var u in this.morphAttributes){for(var c=this.morphAttributes[u],h=[],d=0,f=c.length;d<f;d++){var p=c[d];h.push(p.toJSON(e.data))}h.length>0&&(s[u]=h,l=!0)}l&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);var v=this.groups;v.length>0&&(e.data.groups=JSON.parse(JSON.stringify(v)));var m=this.boundingSphere;return null!==m&&(e.data.boundingSphere={center:m.center.toArray(),radius:m.radius}),e}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;var t={};this.name=e.name;var n=e.index;null!==n&&this.setIndex(n.clone(t));var i=e.attributes;for(var r in i){var a=i[r];this.setAttribute(r,a.clone(t))}var o=e.morphAttributes;for(var s in o){for(var l=[],u=o[s],c=0,h=u.length;c<h;c++)l.push(u[c].clone(t));this.morphAttributes[s]=l}this.morphTargetsRelative=e.morphTargetsRelative;for(var d=e.groups,f=0,p=d.length;f<p;f++){var v=d[f];this.addGroup(v.start,v.count,v.materialIndex)}var m=e.boundingBox;null!==m&&(this.boundingBox=m.clone());var g=e.boundingSphere;return null!==g&&(this.boundingSphere=g.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}}]),n}(ge)),Gn=new Ut,Wn=new kt,Xn=new Et,jn=new it,Yn=new it,qn=new it,Zn=new it,Jn=new it,Kn=new it,Qn=new Pe,$n=new Pe,ei=new Pe,ti=new it,ni=new it,ii=new it,ri=new it,ai=new it,oi=e("G",function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Vn,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new wn;return a(this,n),(e=t.call(this)).isMesh=!0,e.type="Mesh",e.geometry=i,e.material=r,e.updateMorphTargets(),e}return s(n,[{key:"copy",value:function(e,t){return _(c(n.prototype),"copy",this).call(this,e,t),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=e.material,this.geometry=e.geometry,this}},{key:"updateMorphTargets",value:function(){var e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){var n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var i=0,r=n.length;i<r;i++){var a=n[i].name||String(i);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=i}}}}},{key:"getVertexPosition",value:function(e,t){var n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(i,e);var o=this.morphTargetInfluences;if(r&&o){Kn.set(0,0,0);for(var s=0,l=r.length;s<l;s++){var u=o[s],c=r[s];0!==u&&(Jn.fromBufferAttribute(c,e),a?Kn.addScaledVector(Jn,u):Kn.addScaledVector(Jn.sub(t),u))}t.add(Kn)}return t}},{key:"raycast",value:function(e,t){var n=this.geometry,i=this.material,r=this.matrixWorld;if(void 0!==i){if(null===n.boundingSphere&&n.computeBoundingSphere(),Xn.copy(n.boundingSphere),Xn.applyMatrix4(r),Wn.copy(e.ray).recast(e.near),!1===Xn.containsPoint(Wn.origin)){if(null===Wn.intersectSphere(Xn,jn))return;if(Wn.origin.distanceToSquared(jn)>Math.pow(e.far-e.near,2))return}Gn.copy(r).invert(),Wn.copy(e.ray).applyMatrix4(Gn),null!==n.boundingBox&&!1===Wn.intersectsBox(n.boundingBox)||this._computeIntersections(e,t,Wn)}}},{key:"_computeIntersections",value:function(e,t,n){var i,r=this.geometry,a=this.material,o=r.index,s=r.attributes.position,l=r.attributes.uv,u=r.attributes.uv1,c=r.attributes.normal,h=r.groups,d=r.drawRange;if(null!==o)if(Array.isArray(a))for(var f=0,p=h.length;f<p;f++)for(var v=h[f],m=a[v.materialIndex],g=Math.max(v.start,d.start),y=Math.min(o.count,Math.min(v.start+v.count,d.start+d.count));g<y;g+=3)(i=si(this,m,e,n,l,u,c,o.getX(g),o.getX(g+1),o.getX(g+2)))&&(i.faceIndex=Math.floor(g/3),i.face.materialIndex=v.materialIndex,t.push(i));else for(var _=Math.max(0,d.start),x=Math.min(o.count,d.start+d.count);_<x;_+=3)(i=si(this,a,e,n,l,u,c,o.getX(_),o.getX(_+1),o.getX(_+2)))&&(i.faceIndex=Math.floor(_/3),t.push(i));else if(void 0!==s)if(Array.isArray(a))for(var M=0,S=h.length;M<S;M++)for(var b=h[M],E=a[b.materialIndex],T=Math.max(b.start,d.start),w=Math.min(s.count,Math.min(b.start+b.count,d.start+d.count));T<w;T+=3)(i=si(this,E,e,n,l,u,c,T,T+1,T+2))&&(i.faceIndex=Math.floor(T/3),i.face.materialIndex=b.materialIndex,t.push(i));else for(var A=Math.max(0,d.start),R=Math.min(s.count,d.start+d.count);A<R;A+=3)(i=si(this,a,e,n,l,u,c,A,A+1,A+2))&&(i.faceIndex=Math.floor(A/3),t.push(i))}}]),n}(an));function si(e,t,n,i,r,a,o,s,l,u){e.getVertexPosition(s,Yn),e.getVertexPosition(l,qn),e.getVertexPosition(u,Zn);var c=function(e,t,n,i,r,a,o,s){if(null===(t.side===k?i.intersectTriangle(o,a,r,!0,s):i.intersectTriangle(r,a,o,t.side===P,s)))return null;ai.copy(s),ai.applyMatrix4(e.matrixWorld);var l=n.ray.origin.distanceTo(ai);return l<n.near||l>n.far?null:{distance:l,point:ai.clone(),object:e}}(e,t,n,i,Yn,qn,Zn,ri);if(c){r&&(Qn.fromBufferAttribute(r,s),$n.fromBufferAttribute(r,l),ei.fromBufferAttribute(r,u),c.uv=gn.getInterpolation(ri,Yn,qn,Zn,Qn,$n,ei,new Pe)),a&&(Qn.fromBufferAttribute(a,s),$n.fromBufferAttribute(a,l),ei.fromBufferAttribute(a,u),c.uv1=gn.getInterpolation(ri,Yn,qn,Zn,Qn,$n,ei,new Pe),c.uv2=c.uv1),o&&(ti.fromBufferAttribute(o,s),ni.fromBufferAttribute(o,l),ii.fromBufferAttribute(o,u),c.normal=gn.getInterpolation(ri,Yn,qn,Zn,ti,ni,ii,new it),c.normal.dot(i.direction)>0&&c.normal.multiplyScalar(-1));var h={a:s,b:l,c:u,normal:new it,materialIndex:0};gn.getNormal(Yn,qn,Zn,h.normal),c.face=h}return c}var li=e("aE",function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1;a(this,n),(e=t.call(this)).type="BoxGeometry",e.parameters={width:i,height:r,depth:o,widthSegments:s,heightSegments:l,depthSegments:u};var c=v(e);s=Math.floor(s),l=Math.floor(l),u=Math.floor(u);var h=[],d=[],f=[],p=[],m=0,g=0;function y(e,t,n,i,r,a,o,s,l,u,v){for(var y=a/l,_=o/u,x=a/2,M=o/2,S=s/2,b=l+1,E=u+1,T=0,w=0,A=new it,R=0;R<E;R++)for(var C=R*_-M,L=0;L<b;L++){var P=L*y-x;A[e]=P*i,A[t]=C*r,A[n]=S,d.push(A.x,A.y,A.z),A[e]=0,A[t]=0,A[n]=s>0?1:-1,f.push(A.x,A.y,A.z),p.push(L/l),p.push(1-R/u),T+=1}for(var k=0;k<u;k++)for(var U=0;U<l;U++){var I=m+U+b*k,N=m+U+b*(k+1),D=m+(U+1)+b*(k+1),O=m+(U+1)+b*k;h.push(I,N,O),h.push(N,D,O),w+=6}c.addGroup(g,w,v),g+=w,m+=T}return y("z","y","x",-1,-1,o,r,i,u,l,0),y("z","y","x",1,-1,o,r,-i,u,l,1),y("x","z","y",1,1,i,o,r,s,u,2),y("x","z","y",1,-1,i,o,-r,s,u,3),y("x","y","z",1,-1,i,r,o,s,l,4),y("x","y","z",-1,-1,i,r,-o,s,l,5),e.setIndex(h),e.setAttribute("position",new In(d,3)),e.setAttribute("normal",new In(f,3)),e.setAttribute("uv",new In(p,2)),e}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}}],[{key:"fromJSON",value:function(e){return new n(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}]),n}(Vn));function ui(e){var t={};for(var n in e)for(var i in t[n]={},e[n]){var r=e[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[n][i]=null):t[n][i]=r.clone():Array.isArray(r)?t[n][i]=r.slice():t[n][i]=r}return t}function ci(e){for(var t={},n=0;n<e.length;n++){var i=ui(e[n]);for(var r in i)t[r]=i[r]}return t}function hi(e){return null===e.getRenderTarget()?e.outputColorSpace:me}var di=e("b3",{clone:ui,merge:ci}),fi=e("b2",function(e){u(n,e);var t=g(n);function n(e){var i;return a(this,n),(i=t.call(this)).isShaderMaterial=!0,i.type="ShaderMaterial",i.defines={},i.uniforms={},i.uniformsGroups=[],i.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",i.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",i.linewidth=1,i.wireframe=!1,i.wireframeLinewidth=1,i.fog=!1,i.lights=!1,i.clipping=!1,i.forceSinglePass=!0,i.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},i.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},i.index0AttributeName=void 0,i.uniformsNeedUpdate=!1,i.glslVersion=null,void 0!==e&&i.setValues(e),i}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=ui(e.uniforms),this.uniformsGroups=function(e){for(var t=[],n=0;n<e.length;n++)t.push(e[n].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}},{key:"toJSON",value:function(e){var t=_(c(n.prototype),"toJSON",this).call(this,e);for(var i in t.glslVersion=this.glslVersion,t.uniforms={},this.uniforms){var r=this.uniforms[i].value;r&&r.isTexture?t.uniforms[i]={type:"t",value:r.toJSON(e).uuid}:r&&r.isColor?t.uniforms[i]={type:"c",value:r.getHex()}:r&&r.isVector2?t.uniforms[i]={type:"v2",value:r.toArray()}:r&&r.isVector3?t.uniforms[i]={type:"v3",value:r.toArray()}:r&&r.isVector4?t.uniforms[i]={type:"v4",value:r.toArray()}:r&&r.isMatrix3?t.uniforms[i]={type:"m3",value:r.toArray()}:r&&r.isMatrix4?t.uniforms[i]={type:"m4",value:r.toArray()}:t.uniforms[i]={value:r}}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;var a={};for(var o in this.extensions)!0===this.extensions[o]&&(a[o]=!0);return Object.keys(a).length>0&&(t.extensions=a),t}}]),n}(_n)),pi=e("bs",function(e){u(n,e);var t=g(n);function n(){var e;return a(this,n),(e=t.call(this)).isCamera=!0,e.type="Camera",e.matrixWorldInverse=new Ut,e.projectionMatrix=new Ut,e.projectionMatrixInverse=new Ut,e.coordinateSystem=2e3,e}return s(n,[{key:"copy",value:function(e,t){return _(c(n.prototype),"copy",this).call(this,e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}},{key:"getWorldDirection",value:function(e){this.updateWorldMatrix(!0,!1);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}},{key:"updateMatrixWorld",value:function(e){_(c(n.prototype),"updateMatrixWorld",this).call(this,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}},{key:"updateWorldMatrix",value:function(e,t){_(c(n.prototype),"updateWorldMatrix",this).call(this,e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),n}(an)),vi=e("W",function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2e3;return a(this,n),(e=t.call(this)).isPerspectiveCamera=!0,e.type="PerspectiveCamera",e.fov=i,e.zoom=1,e.near=o,e.far=s,e.focus=10,e.aspect=r,e.view=null,e.filmGauge=35,e.filmOffset=0,e.updateProjectionMatrix(),e}return s(n,[{key:"copy",value:function(e,t){return _(c(n.prototype),"copy",this).call(this,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}},{key:"setFocalLength",value:function(e){var t=.5*this.getFilmHeight()/e;this.fov=2*Me*Math.atan(t),this.updateProjectionMatrix()}},{key:"getFocalLength",value:function(){var e=Math.tan(.5*xe*this.fov);return.5*this.getFilmHeight()/e}},{key:"getEffectiveFOV",value:function(){return 2*Me*Math.atan(Math.tan(.5*xe*this.fov)/this.zoom)}},{key:"getFilmWidth",value:function(){return this.filmGauge*Math.min(this.aspect,1)}},{key:"getFilmHeight",value:function(){return this.filmGauge/Math.max(this.aspect,1)}},{key:"setViewOffset",value:function(e,t,n,i,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=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}},{key:"clearViewOffset",value:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}},{key:"updateProjectionMatrix",value:function(){var e=this.near,t=e*Math.tan(.5*xe*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i,a=this.view;if(null!==this.view&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;r+=a.offsetX*i/o,t-=a.offsetY*n/s,i*=a.width/o,n*=a.height/s}var l=this.filmOffset;0!==l&&(r+=e*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}},{key:"toJSON",value:function(e){var t=_(c(n.prototype),"toJSON",this).call(this,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}}]),n}(pi)),mi=function(e){u(n,e);var t=g(n);function n(e,i,r){var o;a(this,n),(o=t.call(this)).type="CubeCamera",o.renderTarget=r,o.coordinateSystem=null;var s=new vi(-90,1,e,i);s.layers=o.layers,o.add(s);var l=new vi(-90,1,e,i);l.layers=o.layers,o.add(l);var u=new vi(-90,1,e,i);u.layers=o.layers,o.add(u);var c=new vi(-90,1,e,i);c.layers=o.layers,o.add(c);var h=new vi(-90,1,e,i);h.layers=o.layers,o.add(h);var d=new vi(-90,1,e,i);return d.layers=o.layers,o.add(d),o}return s(n,[{key:"updateCoordinateSystem",value:function(){var e,t=this.coordinateSystem,n=this.children.concat(),i=x(n,6),r=i[0],a=i[1],o=i[2],s=i[3],l=i[4],u=i[5],c=E(n);try{for(c.s();!(e=c.n()).done;){var h=e.value;this.remove(h)}}catch(e){c.e(e)}finally{c.f()}if(2e3===t)r.up.set(0,1,0),r.lookAt(1,0,0),a.up.set(0,1,0),a.lookAt(-1,0,0),o.up.set(0,0,-1),o.lookAt(0,1,0),s.up.set(0,0,1),s.lookAt(0,-1,0),l.up.set(0,1,0),l.lookAt(0,0,1),u.up.set(0,1,0),u.lookAt(0,0,-1);else{if(2001!==t)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);r.up.set(0,-1,0),r.lookAt(-1,0,0),a.up.set(0,-1,0),a.lookAt(1,0,0),o.up.set(0,0,1),o.lookAt(0,1,0),s.up.set(0,0,-1),s.lookAt(0,-1,0),l.up.set(0,-1,0),l.lookAt(0,0,1),u.up.set(0,-1,0),u.lookAt(0,0,-1)}var d,f=E(n);try{for(f.s();!(d=f.n()).done;){var p=d.value;this.add(p),p.updateMatrixWorld()}}catch(e){f.e(e)}finally{f.f()}}},{key:"update",value:function(e,t){null===this.parent&&this.updateMatrixWorld();var n=this.renderTarget;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());var i=x(this.children,6),r=i[0],a=i[1],o=i[2],s=i[3],l=i[4],u=i[5],c=e.getRenderTarget(),h=e.xr.enabled;e.xr.enabled=!1;var d=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,r),e.setRenderTarget(n,1),e.render(t,a),e.setRenderTarget(n,2),e.render(t,o),e.setRenderTarget(n,3),e.render(t,s),e.setRenderTarget(n,4),e.render(t,l),n.texture.generateMipmaps=d,e.setRenderTarget(n,5),e.render(t,u),e.setRenderTarget(c),e.xr.enabled=h,n.texture.needsPMREMUpdate=!0}}]),n}(an),gi=e("ao",function(e){u(n,e);var t=g(n);function n(e,i,r,o,s,l,u,c,h,d){var f;return a(this,n),e=void 0!==e?e:[],i=void 0!==i?i:301,(f=t.call(this,e,i,r,o,s,l,u,c,h,d)).isCubeTexture=!0,f.flipY=!1,f}return s(n,[{key:"images",get:function(){return this.image},set:function(e){this.image=e}}]),n}(Ke)),yi=function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};a(this,n),(e=t.call(this,i,i,r)).isWebGLCubeRenderTarget=!0;var o={width:i,height:i,depth:1},s=[o,o,o,o,o,o];return void 0!==r.encoding&&(Oe("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),r.colorSpace=3001===r.encoding?ve:pe),e.texture=new gi(s,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.colorSpace),e.texture.isRenderTargetTexture=!0,e.texture.generateMipmaps=void 0!==r.generateMipmaps&&r.generateMipmaps,e.texture.minFilter=void 0!==r.minFilter?r.minFilter:te,e}return s(n,[{key:"fromEquirectangularTexture",value:function(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;var n=new li(5,5,5),i=new fi({name:"CubemapFromEquirect",uniforms:ui({tEquirect:{value:null}}),vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",side:k,blending:I});i.uniforms.tEquirect.value=t;var r=new oi(n,i),a=t.minFilter;return t.minFilter===ie&&(t.minFilter=te),new mi(1,10,this).update(e,r),t.minFilter=a,r.geometry.dispose(),r.material.dispose(),this}},{key:"clear",value:function(e,t,n,i){for(var r=e.getRenderTarget(),a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,i);e.setRenderTarget(r)}}]),n}($e),_i=new it,xi=new it,Mi=new ke,Si=e("bI",function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new it(1,0,0),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;a(this,e),this.isPlane=!0,this.normal=t,this.constant=n}return s(e,[{key:"set",value:function(e,t){return this.normal.copy(e),this.constant=t,this}},{key:"setComponents",value:function(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}},{key:"setFromNormalAndCoplanarPoint",value:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}},{key:"setFromCoplanarPoints",value:function(e,t,n){var i=_i.subVectors(n,t).cross(xi.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}},{key:"copy",value:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this}},{key:"normalize",value:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}},{key:"negate",value:function(){return this.constant*=-1,this.normal.negate(),this}},{key:"distanceToPoint",value:function(e){return this.normal.dot(e)+this.constant}},{key:"distanceToSphere",value:function(e){return this.distanceToPoint(e.center)-e.radius}},{key:"projectPoint",value:function(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}},{key:"intersectLine",value:function(e,t){var n=e.delta(_i),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;var r=-(e.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:t.copy(e.start).addScaledVector(n,r)}},{key:"intersectsLine",value:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}},{key:"intersectsBox",value:function(e){return e.intersectsPlane(this)}},{key:"intersectsSphere",value:function(e){return e.intersectsPlane(this)}},{key:"coplanarPoint",value:function(e){return e.copy(this.normal).multiplyScalar(-this.constant)}},{key:"applyMatrix4",value:function(e,t){var n=t||Mi.getNormalMatrix(e),i=this.coplanarPoint(_i).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}},{key:"translate",value:function(e){return this.constant-=e.dot(this.normal),this}},{key:"equals",value:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}()),bi=new Et,Ei=new it,Ti=e("bX",function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Si,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Si,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Si,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Si,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:new Si,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:new Si;a(this,e),this.planes=[t,n,i,r,o,s]}return s(e,[{key:"set",value:function(e,t,n,i,r,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(a),this}},{key:"copy",value:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this}},{key:"setFromProjectionMatrix",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2e3,n=this.planes,i=e.elements,r=i[0],a=i[1],o=i[2],s=i[3],l=i[4],u=i[5],c=i[6],h=i[7],d=i[8],f=i[9],p=i[10],v=i[11],m=i[12],g=i[13],y=i[14],_=i[15];if(n[0].setComponents(s-r,h-l,v-d,_-m).normalize(),n[1].setComponents(s+r,h+l,v+d,_+m).normalize(),n[2].setComponents(s+a,h+u,v+f,_+g).normalize(),n[3].setComponents(s-a,h-u,v-f,_-g).normalize(),n[4].setComponents(s-o,h-c,v-p,_-y).normalize(),2e3===t)n[5].setComponents(s+o,h+c,v+p,_+y).normalize();else{if(2001!==t)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);n[5].setComponents(o,c,p,y).normalize()}return this}},{key:"intersectsObject",value:function(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),bi.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{var t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),bi.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(bi)}},{key:"intersectsSprite",value:function(e){return bi.center.set(0,0,0),bi.radius=.7071067811865476,bi.applyMatrix4(e.matrixWorld),this.intersectsSphere(bi)}},{key:"intersectsSphere",value:function(e){for(var t=this.planes,n=e.center,i=-e.radius,r=0;r<6;r++)if(t[r].distanceToPoint(n)<i)return!1;return!0}},{key:"intersectsBox",value:function(e){for(var t=this.planes,n=0;n<6;n++){var i=t[n];if(Ei.x=i.normal.x>0?e.max.x:e.min.x,Ei.y=i.normal.y>0?e.max.y:e.min.y,Ei.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Ei)<0)return!1}return!0}},{key:"containsPoint",value:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}());function wi(){var e=null,t=!1,n=null,i=null;function r(t,a){n(t,a),i=e.requestAnimationFrame(r)}return{start:function(){!0!==t&&null!==n&&(i=e.requestAnimationFrame(r),t=!0)},stop:function(){e.cancelAnimationFrame(i),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function Ai(e,t){var n=t.isWebGL2,i=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),i.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);var n=i.get(t);n&&(e.deleteBuffer(n.buffer),i.delete(t))},update:function(t,r){if(t.isGLBufferAttribute){var a=i.get(t);(!a||a.version<t.version)&&i.set(t,{buffer:t.buffer,type:t.type,bytesPerElement:t.elementSize,version:t.version})}else{t.isInterleavedBufferAttribute&&(t=t.data);var o=i.get(t);void 0===o?i.set(t,function(t,i){var r,a=t.array,o=t.usage,s=e.createBuffer();if(e.bindBuffer(i,s),e.bufferData(i,a,o),t.onUploadCallback(),a instanceof Float32Array)r=e.FLOAT;else if(a instanceof Uint16Array)if(t.isFloat16BufferAttribute){if(!n)throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");r=e.HALF_FLOAT}else r=e.UNSIGNED_SHORT;else if(a instanceof Int16Array)r=e.SHORT;else if(a instanceof Uint32Array)r=e.UNSIGNED_INT;else if(a instanceof Int32Array)r=e.INT;else if(a instanceof Int8Array)r=e.BYTE;else if(a instanceof Uint8Array)r=e.UNSIGNED_BYTE;else{if(!(a instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+a);r=e.UNSIGNED_BYTE}return{buffer:s,type:r,bytesPerElement:a.BYTES_PER_ELEMENT,version:t.version}}(t,r)):o.version<t.version&&(function(t,i,r){var a=i.array,o=i.updateRange;e.bindBuffer(r,t),-1===o.count?e.bufferSubData(r,0,a):(n?e.bufferSubData(r,o.offset*a.BYTES_PER_ELEMENT,a,o.offset,o.count):e.bufferSubData(r,o.offset*a.BYTES_PER_ELEMENT,a.subarray(o.offset,o.offset+o.count)),o.count=-1),i.onUploadCallback()}(o.buffer,t,r),o.version=t.version)}}}}var Ri=e("bf",function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;a(this,n),(e=t.call(this)).type="PlaneGeometry",e.parameters={width:i,height:r,widthSegments:o,heightSegments:s};for(var l=i/2,u=r/2,c=Math.floor(o),h=Math.floor(s),d=c+1,f=h+1,p=i/c,v=r/h,m=[],g=[],y=[],_=[],x=0;x<f;x++)for(var M=x*v-u,S=0;S<d;S++){var b=S*p-l;g.push(b,-M,0),y.push(0,0,1),_.push(S/c),_.push(1-x/h)}for(var E=0;E<h;E++)for(var T=0;T<c;T++){var w=T+d*E,A=T+d*(E+1),R=T+1+d*(E+1),C=T+1+d*E;m.push(w,A,C),m.push(A,R,C)}return e.setIndex(m),e.setAttribute("position",new In(g,3)),e.setAttribute("normal",new In(y,3)),e.setAttribute("uv",new In(_,2)),e}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}}],[{key:"fromJSON",value:function(e){return new n(e.width,e.height,e.widthSegments,e.heightSegments)}}]),n}(Vn)),Ci={alphahash_fragment:"#ifdef USE_ALPHAHASH\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n\tconst float ALPHA_HASH_SCALE = 0.05;\n\tfloat hash2D( vec2 value ) {\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n\t}\n\tfloat hash3D( vec3 value ) {\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\n\t}\n\tfloat getAlphaHashThreshold( vec3 position ) {\n\t\tfloat maxDeriv = max(\n\t\t\tlength( dFdx( position.xyz ) ),\n\t\t\tlength( dFdy( position.xyz ) )\n\t\t);\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n\t\tvec2 pixScales = vec2(\n\t\t\texp2( floor( log2( pixScale ) ) ),\n\t\t\texp2( ceil( log2( pixScale ) ) )\n\t\t);\n\t\tvec2 alpha = vec2(\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\n\t\t);\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\n\t\tvec3 cases = vec3(\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n\t\t);\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\n\t\t\t: cases.z;\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\n\t}\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\tif ( diffuseColor.a < alphaTest ) discard;\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn 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\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.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\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\treturn vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = dFdx( surf_pos.xyz );\n\t\tvec3 vSigmaY = dFdy( surf_pos.xyz );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\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\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n\treturn dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_v0 0.339\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_v1 0.276\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_v4 0.046\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_v5 0.016\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_v6 0.0038\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"vec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn 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\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform 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\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( LEGACY_LIGHTS )\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#else\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_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\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\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\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tanisotropyV /= material.anisotropy;\n\tmaterial.anisotropy = saturate( material.anisotropy );\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x - tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x + tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = 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\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat 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\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn 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\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn 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\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn 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\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometry.viewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometry.normal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometry.viewDir, geometry.normal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, vMapUv );\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform ivec2 morphTargetsTextureSize;\n\t\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform 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\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec2 packDepthToRG( in highp float v ) {\n\treturn packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n\treturn unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn 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\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#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\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tuniform int boneTextureSize;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tfloat j = i * 4.0;\n\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\ty = dy * ( y + 0.5 );\n\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\treturn bone;\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_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\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( 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\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",depth_vert:"#include <common>\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\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform 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\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\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\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\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 <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#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\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#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\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\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\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying 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\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\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\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\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 <envmap_common_pars_fragment>\n#include <envmap_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\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\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\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - 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\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\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\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - 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\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\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\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\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\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#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 <packing>\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 <envmap_common_pars_fragment>\n#include <envmap_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\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\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\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\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\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\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\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\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\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#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\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#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\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\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\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\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\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_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\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#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\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}"},Li={common:{diffuse:{value:new En(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new ke},alphaMap:{value:null},alphaMapTransform:{value:new ke},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new ke}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new ke}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new ke}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new ke},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new ke},normalScale:{value:new Pe(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new ke},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new ke}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new ke}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new ke}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new En(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},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 En(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new ke},alphaTest:{value:0},uvTransform:{value:new ke}},sprite:{diffuse:{value:new En(16777215)},opacity:{value:1},center:{value:new Pe(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new ke},alphaMap:{value:null},alphaMapTransform:{value:new ke},alphaTest:{value:0}}},Pi={basic:{uniforms:ci([Li.common,Li.specularmap,Li.envmap,Li.aomap,Li.lightmap,Li.fog]),vertexShader:Ci.meshbasic_vert,fragmentShader:Ci.meshbasic_frag},lambert:{uniforms:ci([Li.common,Li.specularmap,Li.envmap,Li.aomap,Li.lightmap,Li.emissivemap,Li.bumpmap,Li.normalmap,Li.displacementmap,Li.fog,Li.lights,{emissive:{value:new En(0)}}]),vertexShader:Ci.meshlambert_vert,fragmentShader:Ci.meshlambert_frag},phong:{uniforms:ci([Li.common,Li.specularmap,Li.envmap,Li.aomap,Li.lightmap,Li.emissivemap,Li.bumpmap,Li.normalmap,Li.displacementmap,Li.fog,Li.lights,{emissive:{value:new En(0)},specular:{value:new En(1118481)},shininess:{value:30}}]),vertexShader:Ci.meshphong_vert,fragmentShader:Ci.meshphong_frag},standard:{uniforms:ci([Li.common,Li.envmap,Li.aomap,Li.lightmap,Li.emissivemap,Li.bumpmap,Li.normalmap,Li.displacementmap,Li.roughnessmap,Li.metalnessmap,Li.fog,Li.lights,{emissive:{value:new En(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ci.meshphysical_vert,fragmentShader:Ci.meshphysical_frag},toon:{uniforms:ci([Li.common,Li.aomap,Li.lightmap,Li.emissivemap,Li.bumpmap,Li.normalmap,Li.displacementmap,Li.gradientmap,Li.fog,Li.lights,{emissive:{value:new En(0)}}]),vertexShader:Ci.meshtoon_vert,fragmentShader:Ci.meshtoon_frag},matcap:{uniforms:ci([Li.common,Li.bumpmap,Li.normalmap,Li.displacementmap,Li.fog,{matcap:{value:null}}]),vertexShader:Ci.meshmatcap_vert,fragmentShader:Ci.meshmatcap_frag},points:{uniforms:ci([Li.points,Li.fog]),vertexShader:Ci.points_vert,fragmentShader:Ci.points_frag},dashed:{uniforms:ci([Li.common,Li.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ci.linedashed_vert,fragmentShader:Ci.linedashed_frag},depth:{uniforms:ci([Li.common,Li.displacementmap]),vertexShader:Ci.depth_vert,fragmentShader:Ci.depth_frag},normal:{uniforms:ci([Li.common,Li.bumpmap,Li.normalmap,Li.displacementmap,{opacity:{value:1}}]),vertexShader:Ci.meshnormal_vert,fragmentShader:Ci.meshnormal_frag},sprite:{uniforms:ci([Li.sprite,Li.fog]),vertexShader:Ci.sprite_vert,fragmentShader:Ci.sprite_frag},background:{uniforms:{uvTransform:{value:new ke},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Ci.background_vert,fragmentShader:Ci.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:Ci.backgroundCube_vert,fragmentShader:Ci.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ci.cube_vert,fragmentShader:Ci.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ci.equirect_vert,fragmentShader:Ci.equirect_frag},distanceRGBA:{uniforms:ci([Li.common,Li.displacementmap,{referencePosition:{value:new it},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ci.distanceRGBA_vert,fragmentShader:Ci.distanceRGBA_frag},shadow:{uniforms:ci([Li.lights,Li.fog,{color:{value:new En(0)},opacity:{value:1}}]),vertexShader:Ci.shadow_vert,fragmentShader:Ci.shadow_frag}};Pi.physical={uniforms:ci([Pi.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new ke},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new ke},clearcoatNormalScale:{value:new Pe(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new ke},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new ke},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new ke},sheen:{value:0},sheenColor:{value:new En(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new ke},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new ke},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new ke},transmissionSamplerSize:{value:new Pe},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new ke},attenuationDistance:{value:0},attenuationColor:{value:new En(0)},specularColor:{value:new En(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new ke},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new ke},anisotropyVector:{value:new Pe},anisotropyMap:{value:null},anisotropyMapTransform:{value:new ke}}]),vertexShader:Ci.meshphysical_vert,fragmentShader:Ci.meshphysical_frag};var ki={r:0,b:0,g:0};function Ui(e,t,n,i,r,a,o){var s,l,u=new En(0),c=!0===a?0:1,h=null,d=0,f=null;function p(t,n){t.getRGB(ki,hi(e)),i.buffers.color.setClear(ki.r,ki.g,ki.b,n,o)}return{getClearColor:function(){return u},setClearColor:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;u.set(e),p(u,c=t)},getClearAlpha:function(){return c},setClearAlpha:function(e){p(u,c=e)},render:function(a,v){var m=!1,g=!0===v.isScene?v.background:null;switch(g&&g.isTexture&&(g=(v.backgroundBlurriness>0?n:t).get(g)),null===g?p(u,c):g&&g.isColor&&(p(g,1),m=!0),e.xr.getEnvironmentBlendMode()){case"opaque":m=!0;break;case"additive":i.buffers.color.setClear(0,0,0,1,o),m=!0;break;case"alpha-blend":i.buffers.color.setClear(0,0,0,0,o),m=!0}(e.autoClear||m)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),g&&(g.isCubeTexture||306===g.mapping)?(void 0===l&&((l=new oi(new li(1,1,1),new fi({name:"BackgroundCubeMaterial",uniforms:ui(Pi.backgroundCube.uniforms),vertexShader:Pi.backgroundCube.vertexShader,fragmentShader:Pi.backgroundCube.fragmentShader,side:k,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(l)),l.material.uniforms.envMap.value=g,l.material.uniforms.flipEnvMap.value=g.isCubeTexture&&!1===g.isRenderTargetTexture?-1:1,l.material.uniforms.backgroundBlurriness.value=v.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,l.material.toneMapped=g.colorSpace!==ve,h===g&&d===g.version&&f===e.toneMapping||(l.material.needsUpdate=!0,h=g,d=g.version,f=e.toneMapping),l.layers.enableAll(),a.unshift(l,l.geometry,l.material,0,0,null)):g&&g.isTexture&&(void 0===s&&((s=new oi(new Ri(2,2),new fi({name:"BackgroundMaterial",uniforms:ui(Pi.background.uniforms),vertexShader:Pi.background.vertexShader,fragmentShader:Pi.background.fragmentShader,side:P,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(s.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(s)),s.material.uniforms.t2D.value=g,s.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,s.material.toneMapped=g.colorSpace!==ve,!0===g.matrixAutoUpdate&&g.updateMatrix(),s.material.uniforms.uvTransform.value.copy(g.matrix),h===g&&d===g.version&&f===e.toneMapping||(s.material.needsUpdate=!0,h=g,d=g.version,f=e.toneMapping),s.layers.enableAll(),a.unshift(s,s.geometry,s.material,0,0,null))}}}function Ii(e,t,n,i){var r=e.getParameter(e.MAX_VERTEX_ATTRIBS),a=i.isWebGL2?null:t.get("OES_vertex_array_object"),o=i.isWebGL2||null!==a,s={},l=f(null),u=l,c=!1;function h(t){return i.isWebGL2?e.bindVertexArray(t):a.bindVertexArrayOES(t)}function d(t){return i.isWebGL2?e.deleteVertexArray(t):a.deleteVertexArrayOES(t)}function f(e){for(var t=[],n=[],i=[],a=0;a<r;a++)t[a]=0,n[a]=0,i[a]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:n,attributeDivisors:i,object:e,attributes:{},index:null}}function p(){for(var e=u.newAttributes,t=0,n=e.length;t<n;t++)e[t]=0}function v(e){m(e,0)}function m(n,r){var a=u.newAttributes,o=u.enabledAttributes,s=u.attributeDivisors;a[n]=1,0===o[n]&&(e.enableVertexAttribArray(n),o[n]=1),s[n]!==r&&((i.isWebGL2?e:t.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](n,r),s[n]=r)}function g(){for(var t=u.newAttributes,n=u.enabledAttributes,i=0,r=n.length;i<r;i++)n[i]!==t[i]&&(e.disableVertexAttribArray(i),n[i]=0)}function y(t,n,i,r,a,o,s){!0===s?e.vertexAttribIPointer(t,n,i,a,o):e.vertexAttribPointer(t,n,i,r,a,o)}function _(){x(),c=!0,u!==l&&h((u=l).object)}function x(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:function(r,l,d,_,x){var M=!1;if(o){var S=function(t,n,r){var o=!0===r.wireframe,l=s[t.id];void 0===l&&(l={},s[t.id]=l);var u=l[n.id];void 0===u&&(u={},l[n.id]=u);var c=u[o];return void 0===c&&(c=f(i.isWebGL2?e.createVertexArray():a.createVertexArrayOES()),u[o]=c),c}(_,d,l);u!==S&&h((u=S).object),(M=function(e,t,n,i){var r=u.attributes,a=t.attributes,o=0,s=n.getAttributes();for(var l in s)if(s[l].location>=0){var c=r[l],h=a[l];if(void 0===h&&("instanceMatrix"===l&&e.instanceMatrix&&(h=e.instanceMatrix),"instanceColor"===l&&e.instanceColor&&(h=e.instanceColor)),void 0===c)return!0;if(c.attribute!==h)return!0;if(h&&c.data!==h.data)return!0;o++}return u.attributesNum!==o||u.index!==i}(r,_,d,x))&&function(e,t,n,i){var r={},a=t.attributes,o=0,s=n.getAttributes();for(var l in s)if(s[l].location>=0){var c=a[l];void 0===c&&("instanceMatrix"===l&&e.instanceMatrix&&(c=e.instanceMatrix),"instanceColor"===l&&e.instanceColor&&(c=e.instanceColor));var h={};h.attribute=c,c&&c.data&&(h.data=c.data),r[l]=h,o++}u.attributes=r,u.attributesNum=o,u.index=i}(r,_,d,x)}else{var b=!0===l.wireframe;u.geometry===_.id&&u.program===d.id&&u.wireframe===b||(u.geometry=_.id,u.program=d.id,u.wireframe=b,M=!0)}null!==x&&n.update(x,e.ELEMENT_ARRAY_BUFFER),(M||c)&&(c=!1,function(r,a,o,s){if(!1!==i.isWebGL2||!r.isInstancedMesh&&!s.isInstancedBufferGeometry||null!==t.get("ANGLE_instanced_arrays")){p();var l=s.attributes,u=o.getAttributes(),c=a.defaultAttributeValues;for(var h in u){var d=u[h];if(d.location>=0){var f=l[h];if(void 0===f&&("instanceMatrix"===h&&r.instanceMatrix&&(f=r.instanceMatrix),"instanceColor"===h&&r.instanceColor&&(f=r.instanceColor)),void 0!==f){var _=f.normalized,x=f.itemSize,M=n.get(f);if(void 0===M)continue;var S=M.buffer,b=M.type,E=M.bytesPerElement,T=!0===i.isWebGL2&&(b===e.INT||b===e.UNSIGNED_INT||1013===f.gpuType);if(f.isInterleavedBufferAttribute){var w=f.data,A=w.stride,R=f.offset;if(w.isInstancedInterleavedBuffer){for(var C=0;C<d.locationSize;C++)m(d.location+C,w.meshPerAttribute);!0!==r.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=w.meshPerAttribute*w.count)}else for(var L=0;L<d.locationSize;L++)v(d.location+L);e.bindBuffer(e.ARRAY_BUFFER,S);for(var P=0;P<d.locationSize;P++)y(d.location+P,x/d.locationSize,b,_,A*E,(R+x/d.locationSize*P)*E,T)}else{if(f.isInstancedBufferAttribute){for(var k=0;k<d.locationSize;k++)m(d.location+k,f.meshPerAttribute);!0!==r.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=f.meshPerAttribute*f.count)}else for(var U=0;U<d.locationSize;U++)v(d.location+U);e.bindBuffer(e.ARRAY_BUFFER,S);for(var I=0;I<d.locationSize;I++)y(d.location+I,x/d.locationSize,b,_,x*E,x/d.locationSize*I*E,T)}}else if(void 0!==c){var N=c[h];if(void 0!==N)switch(N.length){case 2:e.vertexAttrib2fv(d.location,N);break;case 3:e.vertexAttrib3fv(d.location,N);break;case 4:e.vertexAttrib4fv(d.location,N);break;default:e.vertexAttrib1fv(d.location,N)}}}}g()}}(r,l,d,_),null!==x&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.get(x).buffer))},reset:_,resetDefaultState:x,dispose:function(){for(var e in _(),s){var t=s[e];for(var n in t){var i=t[n];for(var r in i)d(i[r].object),delete i[r];delete t[n]}delete s[e]}},releaseStatesOfGeometry:function(e){if(void 0!==s[e.id]){var t=s[e.id];for(var n in t){var i=t[n];for(var r in i)d(i[r].object),delete i[r];delete t[n]}delete s[e.id]}},releaseStatesOfProgram:function(e){for(var t in s){var n=s[t];if(void 0!==n[e.id]){var i=n[e.id];for(var r in i)d(i[r].object),delete i[r];delete n[e.id]}}},initAttributes:p,enableAttribute:v,disableUnusedAttributes:g}}function Ni(e,t,n,i){var r,a=i.isWebGL2;this.setMode=function(e){r=e},this.render=function(t,i){e.drawArrays(r,t,i),n.update(i,r,1)},this.renderInstances=function(i,o,s){if(0!==s){var l,u;if(a)l=e,u="drawArraysInstanced";else if(u="drawArraysInstancedANGLE",null===(l=t.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[u](r,i,o,s),n.update(o,r,s)}}}function Di(e,t,n){var i;function r(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"}var a="undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===e.constructor.name,o=void 0!==n.precision?n.precision:"highp",s=r(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var l=a||t.has("WEBGL_draw_buffers"),u=!0===n.logarithmicDepthBuffer,c=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),d=e.getParameter(e.MAX_TEXTURE_SIZE),f=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),p=e.getParameter(e.MAX_VERTEX_ATTRIBS),v=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),m=e.getParameter(e.MAX_VARYING_VECTORS),g=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),y=h>0,_=a||t.has("OES_texture_float");return{isWebGL2:a,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==i)return i;if(!0===t.has("EXT_texture_filter_anisotropic")){var n=t.get("EXT_texture_filter_anisotropic");i=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i},getMaxPrecision:r,precision:o,logarithmicDepthBuffer:u,maxTextures:c,maxVertexTextures:h,maxTextureSize:d,maxCubemapSize:f,maxAttributes:p,maxVertexUniforms:v,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:y,floatFragmentTextures:_,floatVertexTextures:y&&_,maxSamples:a?e.getParameter(e.MAX_SAMPLES):0}}function Oi(e){var t=this,n=null,i=0,r=!1,a=!1,o=new Si,s=new ke,l={value:null,needsUpdate:!1};function u(e,n,i,r){var a=null!==e?e.length:0,u=null;if(0!==a){if(u=l.value,!0!==r||null===u){var c=i+4*a,h=n.matrixWorldInverse;s.getNormalMatrix(h),(null===u||u.length<c)&&(u=new Float32Array(c));for(var d=0,f=i;d!==a;++d,f+=4)o.copy(e[d]).applyMatrix4(h,s),o.normal.toArray(u,f),u[f+3]=o.constant}l.value=u,l.needsUpdate=!0}return t.numPlanes=a,t.numIntersection=0,u}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){var n=0!==e.length||t||0!==i||r;return r=t,i=e.length,n},this.beginShadows=function(){a=!0,u(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(e,t){n=u(e,t,0)},this.setState=function(o,s,c){var h=o.clippingPlanes,d=o.clipIntersection,f=o.clipShadows,p=e.get(o);if(!r||null===h||0===h.length||a&&!f)a?u(null):(l.value!==n&&(l.value=n,l.needsUpdate=i>0),t.numPlanes=i,t.numIntersection=0);else{var v=a?0:i,m=4*v,g=p.clippingState||null;l.value=g,g=u(h,s,m,c);for(var y=0;y!==m;++y)g[y]=n[y];p.clippingState=g,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=v}}}function Fi(e){var t=new WeakMap;function n(e,t){return t===q?e.mapping=301:304===t&&(e.mapping=302),e}function i(e){var n=e.target;n.removeEventListener("dispose",i);var r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture&&!1===r.isRenderTargetTexture){var a=r.mapping;if(a===q||304===a){if(t.has(r))return n(t.get(r).texture,r.mapping);var o=r.image;if(o&&o.height>0){var s=new yi(o.height/2);return s.fromEquirectangularTexture(e,r),t.set(r,s),r.addEventListener("dispose",i),n(s.texture,r.mapping)}return null}}return r},dispose:function(){t=new WeakMap}}}var zi=e("Y",function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.1,u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2e3;return a(this,n),(e=t.call(this)).isOrthographicCamera=!0,e.type="OrthographicCamera",e.zoom=1,e.view=null,e.left=i,e.right=r,e.top=o,e.bottom=s,e.near=l,e.far=u,e.updateProjectionMatrix(),e}return s(n,[{key:"copy",value:function(e,t){return _(c(n.prototype),"copy",this).call(this,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}},{key:"setViewOffset",value:function(e,t,n,i,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=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}},{key:"clearViewOffset",value:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}},{key:"updateProjectionMatrix",value:function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2,r=n-e,a=n+e,o=i+t,s=i-t;if(null!==this.view&&this.view.enabled){var l=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;a=(r+=l*this.view.offsetX)+l*this.view.width,s=(o-=u*this.view.offsetY)-u*this.view.height}this.projectionMatrix.makeOrthographic(r,a,o,s,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}},{key:"toJSON",value:function(e){var t=_(c(n.prototype),"toJSON",this).call(this,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}}]),n}(pi)),Bi=[.125,.215,.35,.446,.526,.582],Hi=new zi,Vi=new En,Gi=null,Wi=(1+Math.sqrt(5))/2,Xi=1/Wi,ji=[new it(1,1,1),new it(-1,1,1),new it(1,1,-1),new it(-1,1,-1),new it(0,Wi,Xi),new it(0,Wi,-Xi),new it(Xi,0,Wi),new it(-Xi,0,Wi),new it(Wi,Xi,0),new it(-Wi,Xi,0)],Yi=e("bT",function(){function e(t){a(this,e),this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}return s(e,[{key:"fromScene",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100;Gi=this._renderer.getRenderTarget(),this._setSize(256);var r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,n,i,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}},{key:"fromEquirectangular",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(e,t)}},{key:"fromCubemap",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(e,t)}},{key:"compileCubemapShader",value:function(){null===this._cubemapMaterial&&(this._cubemapMaterial=Ki(),this._compileMaterial(this._cubemapMaterial))}},{key:"compileEquirectangularShader",value:function(){null===this._equirectMaterial&&(this._equirectMaterial=Ji(),this._compileMaterial(this._equirectMaterial))}},{key:"dispose",value:function(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}},{key:"_setSize",value:function(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}},{key:"_dispose",value:function(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(var e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}},{key:"_cleanup",value:function(e){this._renderer.setRenderTarget(Gi),e.scissorTest=!1,Zi(e,0,0,e.width,e.height)}},{key:"_fromTexture",value:function(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),Gi=this._renderer.getRenderTarget();var n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}},{key:"_allocateTargets",value:function(){var e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:te,minFilter:te,generateMipmaps:!1,type:ae,format:se,colorSpace:me,depthBuffer:!1},i=qi(e,t,n);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=qi(e,t,n);var r=this._lodMax,a=function(e){for(var t=[],n=[],i=[],r=e,a=e-4+1+Bi.length,o=0;o<a;o++){var s=Math.pow(2,r);n.push(s);var l=1/s;o>e-4?l=Bi[o-e+4-1]:0===o&&(l=0),i.push(l);for(var u=1/(s-2),c=-u,h=1+u,d=[c,c,h,c,h,h,c,c,h,h,c,h],f=new Float32Array(108),p=new Float32Array(72),v=new Float32Array(36),m=0;m<6;m++){var g=m%3*2/3-1,y=m>2?0:-1,_=[g,y,0,g+2/3,y,0,g+2/3,y+1,0,g,y,0,g+2/3,y+1,0,g,y+1,0];f.set(_,18*m),p.set(d,12*m);var x=[m,m,m,m,m,m];v.set(x,6*m)}var M=new Vn;M.setAttribute("position",new Pn(f,3)),M.setAttribute("uv",new Pn(p,2)),M.setAttribute("faceIndex",new Pn(v,1)),t.push(M),r>4&&r--}return{lodPlanes:t,sizeLods:n,sigmas:i}}(r);this._sizeLods=a.sizeLods,this._lodPlanes=a.lodPlanes,this._sigmas=a.sigmas,this._blurMaterial=function(e,t,n){var i=new Float32Array(20),r=new it(0,1,0);return new fi({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:"".concat(e,".0")},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:I,depthTest:!1,depthWrite:!1})}(r,e,t)}return i}},{key:"_compileMaterial",value:function(e){var t=new oi(this._lodPlanes[0],e);this._renderer.compile(t,Hi)}},{key:"_sceneToCubeUV",value:function(e,t,n,i){var r=new vi(90,1,t,n),a=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],s=this._renderer,l=s.autoClear,u=s.toneMapping;s.getClearColor(Vi),s.toneMapping=G,s.autoClear=!1;var c=new wn({name:"PMREM.Background",side:k,depthWrite:!1,depthTest:!1}),h=new oi(new li,c),d=!1,f=e.background;f?f.isColor&&(c.color.copy(f),e.background=null,d=!0):(c.color.copy(Vi),d=!0);for(var p=0;p<6;p++){var v=p%3;0===v?(r.up.set(0,a[p],0),r.lookAt(o[p],0,0)):1===v?(r.up.set(0,0,a[p]),r.lookAt(0,o[p],0)):(r.up.set(0,a[p],0),r.lookAt(0,0,o[p]));var m=this._cubeSize;Zi(i,v*m,p>2?m:0,m,m),s.setRenderTarget(i),d&&s.render(h,r),s.render(e,r)}h.geometry.dispose(),h.material.dispose(),s.toneMapping=u,s.autoClear=l,e.background=f}},{key:"_textureToCubeUV",value:function(e,t){var n=this._renderer,i=301===e.mapping||302===e.mapping;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=Ki()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=Ji());var r=i?this._cubemapMaterial:this._equirectMaterial,a=new oi(this._lodPlanes[0],r);r.uniforms.envMap.value=e;var o=this._cubeSize;Zi(t,0,0,3*o,2*o),n.setRenderTarget(t),n.render(a,Hi)}},{key:"_applyPMREM",value:function(e){var t=this._renderer,n=t.autoClear;t.autoClear=!1;for(var i=1;i<this._lodPlanes.length;i++){var r=Math.sqrt(this._sigmas[i]*this._sigmas[i]-this._sigmas[i-1]*this._sigmas[i-1]),a=ji[(i-1)%ji.length];this._blur(e,i-1,i,r,a)}t.autoClear=n}},{key:"_blur",value:function(e,t,n,i,r){var a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,i,"latitudinal",r),this._halfBlur(a,e,n,n,i,"longitudinal",r)}},{key:"_halfBlur",value:function(e,t,n,i,r,a,o){var s=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");var u=new oi(this._lodPlanes[i],l),c=l.uniforms,h=this._sizeLods[n]-1,d=isFinite(r)?Math.PI/(2*h):2*Math.PI/39,f=r/d,p=isFinite(r)?1+Math.floor(3*f):20;p>20&&console.warn("sigmaRadians, ".concat(r,", is too large and will clip, as it requested ").concat(p," samples when the maximum is set to ").concat(20));for(var v=[],m=0,g=0;g<20;++g){var y=g/f,_=Math.exp(-y*y/2);v.push(_),0===g?m+=_:g<p&&(m+=2*_)}for(var x=0;x<v.length;x++)v[x]=v[x]/m;c.envMap.value=e.texture,c.samples.value=p,c.weights.value=v,c.latitudinal.value="latitudinal"===a,o&&(c.poleAxis.value=o);var M=this._lodMax;c.dTheta.value=d,c.mipInt.value=M-n;var S=this._sizeLods[i];Zi(t,3*S*(i>M-4?i-M+4:0),4*(this._cubeSize-S),3*S,2*S),s.setRenderTarget(t),s.render(u,Hi)}}]),e}());function qi(e,t,n){var i=new $e(e,t,n);return i.texture.mapping=306,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Zi(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function Ji(){return new fi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:I,depthTest:!1,depthWrite:!1})}function Ki(){return new fi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:I,depthTest:!1,depthWrite:!1})}function Qi(e){var t=new WeakMap,n=null;function i(e){var n=e.target;n.removeEventListener("dispose",i);var r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){var a=r.mapping,o=a===q||304===a,s=301===a||302===a;if(o||s){if(r.isRenderTargetTexture&&!0===r.needsPMREMUpdate){r.needsPMREMUpdate=!1;var l=t.get(r);return null===n&&(n=new Yi(e)),l=o?n.fromEquirectangular(r,l):n.fromCubemap(r,l),t.set(r,l),l.texture}if(t.has(r))return t.get(r).texture;var u=r.image;if(o&&u&&u.height>0||s&&u&&function(e){for(var t=0,n=0;n<6;n++)void 0!==e[n]&&t++;return 6===t}(u)){null===n&&(n=new Yi(e));var c=o?n.fromEquirectangular(r):n.fromCubemap(r);return t.set(r,c),r.addEventListener("dispose",i),c.texture}return null}}return r},dispose:function(){t=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function $i(e){var t={};function n(n){if(void 0!==t[n])return t[n];var i;switch(n){case"WEBGL_depth_texture":i=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=e.getExtension(n)}return t[n]=i,i}return{has:function(e){return null!==n(e)},init:function(e){e.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture")},get:function(e){var t=n(e);return null===t&&console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function er(e,t,n,i){var r={},a=new WeakMap;function o(e){var s=e.target;for(var l in null!==s.index&&t.remove(s.index),s.attributes)t.remove(s.attributes[l]);for(var u in s.morphAttributes)for(var c=s.morphAttributes[u],h=0,d=c.length;h<d;h++)t.remove(c[h]);s.removeEventListener("dispose",o),delete r[s.id];var f=a.get(s);f&&(t.remove(f),a.delete(s)),i.releaseStatesOfGeometry(s),!0===s.isInstancedBufferGeometry&&delete s._maxInstanceCount,n.memory.geometries--}function s(e){var n=[],i=e.index,r=e.attributes.position,o=0;if(null!==i){var s=i.array;o=i.version;for(var l=0,u=s.length;l<u;l+=3){var c=s[l+0],h=s[l+1],d=s[l+2];n.push(c,h,h,d,d,c)}}else{if(void 0===r)return;var f=r.array;o=r.version;for(var p=0,v=f.length/3-1;p<v;p+=3){var m=p+0,g=p+1,y=p+2;n.push(m,g,g,y,y,m)}}var _=new(Ie(n)?Un:kn)(n,1);_.version=o;var x=a.get(e);x&&t.remove(x),a.set(e,_)}return{get:function(e,t){return!0===r[t.id]||(t.addEventListener("dispose",o),r[t.id]=!0,n.memory.geometries++),t},update:function(n){var i=n.attributes;for(var r in i)t.update(i[r],e.ARRAY_BUFFER);var a=n.morphAttributes;for(var o in a)for(var s=a[o],l=0,u=s.length;l<u;l++)t.update(s[l],e.ARRAY_BUFFER)},getWireframeAttribute:function(e){var t=a.get(e);if(t){var n=e.index;null!==n&&t.version<n.version&&s(e)}else s(e);return a.get(e)}}}function tr(e,t,n,i){var r,a,o,s=i.isWebGL2;this.setMode=function(e){r=e},this.setIndex=function(e){a=e.type,o=e.bytesPerElement},this.render=function(t,i){e.drawElements(r,i,a,t*o),n.update(i,r,1)},this.renderInstances=function(i,l,u){if(0!==u){var c,h;if(s)c=e,h="drawElementsInstanced";else if(h="drawElementsInstancedANGLE",null===(c=t.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");c[h](r,l,a,i*o,u),n.update(l,r,u)}}}function nr(e){var 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(n,i,r){switch(t.calls++,i){case e.TRIANGLES:t.triangles+=r*(n/3);break;case e.LINES:t.lines+=r*(n/2);break;case e.LINE_STRIP:t.lines+=r*(n-1);break;case e.LINE_LOOP:t.lines+=r*n;break;case e.POINTS:t.points+=r*n;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",i)}}}}function ir(e,t){return e[0]-t[0]}function rr(e,t){return Math.abs(t[1])-Math.abs(e[1])}function ar(e,t,n){for(var i={},r=new Float32Array(8),a=new WeakMap,o=new Qe,s=[],l=0;l<8;l++)s[l]=[l,0];return{update:function(l,u,c){var h=l.morphTargetInfluences;if(!0===t.isWebGL2){var d=u.morphAttributes.position||u.morphAttributes.normal||u.morphAttributes.color,f=void 0!==d?d.length:0,p=a.get(u);if(void 0===p||p.count!==f){void 0!==p&&p.texture.dispose();var v=void 0!==u.morphAttributes.position,m=void 0!==u.morphAttributes.normal,g=void 0!==u.morphAttributes.color,y=u.morphAttributes.position||[],_=u.morphAttributes.normal||[],x=u.morphAttributes.color||[],M=0;!0===v&&(M=1),!0===m&&(M=2),!0===g&&(M=3);var S=u.attributes.position.count*M,b=1;S>t.maxTextureSize&&(b=Math.ceil(S/t.maxTextureSize),S=t.maxTextureSize);var E=new Float32Array(S*b*4*f),T=new et(E,S,b,f);T.type=re,T.needsUpdate=!0;for(var w=4*M,A=0;A<f;A++)for(var R=y[A],C=_[A],L=x[A],P=S*b*4*A,k=0;k<R.count;k++){var U=k*w;!0===v&&(o.fromBufferAttribute(R,k),E[P+U+0]=o.x,E[P+U+1]=o.y,E[P+U+2]=o.z,E[P+U+3]=0),!0===m&&(o.fromBufferAttribute(C,k),E[P+U+4]=o.x,E[P+U+5]=o.y,E[P+U+6]=o.z,E[P+U+7]=0),!0===g&&(o.fromBufferAttribute(L,k),E[P+U+8]=o.x,E[P+U+9]=o.y,E[P+U+10]=o.z,E[P+U+11]=4===L.itemSize?o.w:1)}p={count:f,texture:T,size:new Pe(S,b)},a.set(u,p),u.addEventListener("dispose",(function e(){T.dispose(),a.delete(u),u.removeEventListener("dispose",e)}))}for(var I=0,N=0;N<h.length;N++)I+=h[N];var D=u.morphTargetsRelative?1:1-I;c.getUniforms().setValue(e,"morphTargetBaseInfluence",D),c.getUniforms().setValue(e,"morphTargetInfluences",h),c.getUniforms().setValue(e,"morphTargetsTexture",p.texture,n),c.getUniforms().setValue(e,"morphTargetsTextureSize",p.size)}else{var O=void 0===h?0:h.length,F=i[u.id];if(void 0===F||F.length!==O){F=[];for(var z=0;z<O;z++)F[z]=[z,0];i[u.id]=F}for(var B=0;B<O;B++){var H=F[B];H[0]=B,H[1]=h[B]}F.sort(rr);for(var V=0;V<8;V++)V<O&&F[V][1]?(s[V][0]=F[V][0],s[V][1]=F[V][1]):(s[V][0]=Number.MAX_SAFE_INTEGER,s[V][1]=0);s.sort(ir);for(var G=u.morphAttributes.position,W=u.morphAttributes.normal,X=0,j=0;j<8;j++){var Y=s[j],q=Y[0],Z=Y[1];q!==Number.MAX_SAFE_INTEGER&&Z?(G&&u.getAttribute("morphTarget"+j)!==G[q]&&u.setAttribute("morphTarget"+j,G[q]),W&&u.getAttribute("morphNormal"+j)!==W[q]&&u.setAttribute("morphNormal"+j,W[q]),r[j]=Z,X+=Z):(G&&!0===u.hasAttribute("morphTarget"+j)&&u.deleteAttribute("morphTarget"+j),W&&!0===u.hasAttribute("morphNormal"+j)&&u.deleteAttribute("morphNormal"+j),r[j]=0)}var J=u.morphTargetsRelative?1:1-X;c.getUniforms().setValue(e,"morphTargetBaseInfluence",J),c.getUniforms().setValue(e,"morphTargetInfluences",r)}}}}function or(e,t,n,i){var r=new WeakMap;function a(e){var t=e.target;t.removeEventListener("dispose",a),n.remove(t.instanceMatrix),null!==t.instanceColor&&n.remove(t.instanceColor)}return{update:function(o){var s=i.render.frame,l=o.geometry,u=t.get(o,l);if(r.get(u)!==s&&(t.update(u),r.set(u,s)),o.isInstancedMesh&&(!1===o.hasEventListener("dispose",a)&&o.addEventListener("dispose",a),r.get(o)!==s&&(n.update(o.instanceMatrix,e.ARRAY_BUFFER),null!==o.instanceColor&&n.update(o.instanceColor,e.ARRAY_BUFFER),r.set(o,s))),o.isSkinnedMesh){var c=o.skeleton;r.get(c)!==s&&(c.update(),r.set(c,s))}return u},dispose:function(){r=new WeakMap}}}var sr=new Ke,lr=new et,ur=new tt,cr=new gi,hr=[],dr=[],fr=new Float32Array(16),pr=new Float32Array(9),vr=new Float32Array(4);function mr(e,t,n){var i=e[0];if(i<=0||i>0)return e;var r=t*n,a=hr[r];if(void 0===a&&(a=new Float32Array(r),hr[r]=a),0!==t){i.toArray(a,0);for(var o=1,s=0;o!==t;++o)s+=n,e[o].toArray(a,s)}return a}function gr(e,t){if(e.length!==t.length)return!1;for(var n=0,i=e.length;n<i;n++)if(e[n]!==t[n])return!1;return!0}function yr(e,t){for(var n=0,i=t.length;n<i;n++)e[n]=t[n]}function _r(e,t){var n=dr[t];void 0===n&&(n=new Int32Array(t),dr[t]=n);for(var i=0;i!==t;++i)n[i]=e.allocateTextureUnit();return n}function xr(e,t){var n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function Mr(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(gr(n,t))return;e.uniform2fv(this.addr,t),yr(n,t)}}function Sr(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(void 0!==t.r)n[0]===t.r&&n[1]===t.g&&n[2]===t.b||(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if(gr(n,t))return;e.uniform3fv(this.addr,t),yr(n,t)}}function br(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(gr(n,t))return;e.uniform4fv(this.addr,t),yr(n,t)}}function Er(e,t){var n=this.cache,i=t.elements;if(void 0===i){if(gr(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),yr(n,t)}else{if(gr(n,i))return;vr.set(i),e.uniformMatrix2fv(this.addr,!1,vr),yr(n,i)}}function Tr(e,t){var n=this.cache,i=t.elements;if(void 0===i){if(gr(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),yr(n,t)}else{if(gr(n,i))return;pr.set(i),e.uniformMatrix3fv(this.addr,!1,pr),yr(n,i)}}function wr(e,t){var n=this.cache,i=t.elements;if(void 0===i){if(gr(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),yr(n,t)}else{if(gr(n,i))return;fr.set(i),e.uniformMatrix4fv(this.addr,!1,fr),yr(n,i)}}function Ar(e,t){var n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function Rr(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2i(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(gr(n,t))return;e.uniform2iv(this.addr,t),yr(n,t)}}function Cr(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3i(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(gr(n,t))return;e.uniform3iv(this.addr,t),yr(n,t)}}function Lr(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4i(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(gr(n,t))return;e.uniform4iv(this.addr,t),yr(n,t)}}function Pr(e,t){var n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function kr(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2ui(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(gr(n,t))return;e.uniform2uiv(this.addr,t),yr(n,t)}}function Ur(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3ui(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(gr(n,t))return;e.uniform3uiv(this.addr,t),yr(n,t)}}function Ir(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(gr(n,t))return;e.uniform4uiv(this.addr,t),yr(n,t)}}function Nr(e,t,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture2D(t||sr,r)}function Dr(e,t,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(t||ur,r)}function Or(e,t,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTextureCube(t||cr,r)}function Fr(e,t,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(t||lr,r)}function zr(e,t){e.uniform1fv(this.addr,t)}function Br(e,t){var n=mr(t,this.size,2);e.uniform2fv(this.addr,n)}function Hr(e,t){var n=mr(t,this.size,3);e.uniform3fv(this.addr,n)}function Vr(e,t){var n=mr(t,this.size,4);e.uniform4fv(this.addr,n)}function Gr(e,t){var n=mr(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function Wr(e,t){var n=mr(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function Xr(e,t){var n=mr(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function jr(e,t){e.uniform1iv(this.addr,t)}function Yr(e,t){e.uniform2iv(this.addr,t)}function qr(e,t){e.uniform3iv(this.addr,t)}function Zr(e,t){e.uniform4iv(this.addr,t)}function Jr(e,t){e.uniform1uiv(this.addr,t)}function Kr(e,t){e.uniform2uiv(this.addr,t)}function Qr(e,t){e.uniform3uiv(this.addr,t)}function $r(e,t){e.uniform4uiv(this.addr,t)}function ea(e,t,n){var i=this.cache,r=t.length,a=_r(n,r);gr(i,a)||(e.uniform1iv(this.addr,a),yr(i,a));for(var o=0;o!==r;++o)n.setTexture2D(t[o]||sr,a[o])}function ta(e,t,n){var i=this.cache,r=t.length,a=_r(n,r);gr(i,a)||(e.uniform1iv(this.addr,a),yr(i,a));for(var o=0;o!==r;++o)n.setTexture3D(t[o]||ur,a[o])}function na(e,t,n){var i=this.cache,r=t.length,a=_r(n,r);gr(i,a)||(e.uniform1iv(this.addr,a),yr(i,a));for(var o=0;o!==r;++o)n.setTextureCube(t[o]||cr,a[o])}function ia(e,t,n){var i=this.cache,r=t.length,a=_r(n,r);gr(i,a)||(e.uniform1iv(this.addr,a),yr(i,a));for(var o=0;o!==r;++o)n.setTexture2DArray(t[o]||lr,a[o])}var ra=s((function e(t,n,i){a(this,e),this.id=t,this.addr=i,this.cache=[],this.setValue=function(e){switch(e){case 5126:return xr;case 35664:return Mr;case 35665:return Sr;case 35666:return br;case 35674:return Er;case 35675:return Tr;case 35676:return wr;case 5124:case 35670:return Ar;case 35667:case 35671:return Rr;case 35668:case 35672:return Cr;case 35669:case 35673:return Lr;case 5125:return Pr;case 36294:return kr;case 36295:return Ur;case 36296:return Ir;case 35678:case 36198:case 36298:case 36306:case 35682:return Nr;case 35679:case 36299:case 36307:return Dr;case 35680:case 36300:case 36308:case 36293:return Or;case 36289:case 36303:case 36311:case 36292:return Fr}}(n.type)})),aa=s((function e(t,n,i){a(this,e),this.id=t,this.addr=i,this.cache=[],this.size=n.size,this.setValue=function(e){switch(e){case 5126:return zr;case 35664:return Br;case 35665:return Hr;case 35666:return Vr;case 35674:return Gr;case 35675:return Wr;case 35676:return Xr;case 5124:case 35670:return jr;case 35667:case 35671:return Yr;case 35668:case 35672:return qr;case 35669:case 35673:return Zr;case 5125:return Jr;case 36294:return Kr;case 36295:return Qr;case 36296:return $r;case 35678:case 36198:case 36298:case 36306:case 35682:return ea;case 35679:case 36299:case 36307:return ta;case 35680:case 36300:case 36308:case 36293:return na;case 36289:case 36303:case 36311:case 36292:return ia}}(n.type)})),oa=function(){function e(t){a(this,e),this.id=t,this.seq=[],this.map={}}return s(e,[{key:"setValue",value:function(e,t,n){for(var i=this.seq,r=0,a=i.length;r!==a;++r){var o=i[r];o.setValue(e,t[o.id],n)}}}]),e}(),sa=/(\w+)(\])?(\[|\.)?/g;function la(e,t){e.seq.push(t),e.map[t.id]=t}function ua(e,t,n){var i=e.name,r=i.length;for(sa.lastIndex=0;;){var a=sa.exec(i),o=sa.lastIndex,s=a[1],l="]"===a[2],u=a[3];if(l&&(s|=0),void 0===u||"["===u&&o+2===r){la(n,void 0===u?new ra(s,e,t):new aa(s,e,t));break}var c=n.map[s];void 0===c&&la(n,c=new oa(s)),n=c}}var ca=function(){function e(t,n){a(this,e),this.seq=[],this.map={};for(var i=t.getProgramParameter(n,t.ACTIVE_UNIFORMS),r=0;r<i;++r){var o=t.getActiveUniform(n,r);ua(o,t.getUniformLocation(n,o.name),this)}}return s(e,[{key:"setValue",value:function(e,t,n,i){var r=this.map[t];void 0!==r&&r.setValue(e,n,i)}},{key:"setOptional",value:function(e,t,n){var i=t[n];void 0!==i&&this.setValue(e,n,i)}}],[{key:"upload",value:function(e,t,n,i){for(var r=0,a=t.length;r!==a;++r){var o=t[r],s=n[o.id];!1!==s.needsUpdate&&o.setValue(e,s.value,i)}}},{key:"seqWithValue",value:function(e,t){for(var n=[],i=0,r=e.length;i!==r;++i){var a=e[i];a.id in t&&n.push(a)}return n}}]),e}();function ha(e,t,n){var i=e.createShader(t);return e.shaderSource(i,n),e.compileShader(i),i}var da=0;function fa(e,t,n){var i=e.getShaderParameter(t,e.COMPILE_STATUS),r=e.getShaderInfoLog(t).trim();if(i&&""===r)return"";var a=/ERROR: 0:(\d+)/.exec(r);if(a){var o=parseInt(a[1]);return n.toUpperCase()+"\n\n"+r+"\n\n"+function(e,t){for(var n=e.split("\n"),i=[],r=Math.max(t-6,0),a=Math.min(t+6,n.length),o=r;o<a;o++){var s=o+1;i.push("".concat(s===t?">":" "," ").concat(s,": ").concat(n[o]))}return i.join("\n")}(e.getShaderSource(t),o)}return r}function pa(e,t){var n;switch(t){case W:n="Linear";break;case X:n="Reinhard";break;case j:n="OptimizedCineon";break;case Y:n="ACESFilmic";break;case 5:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),n="Linear"}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function va(e){return""!==e}function ma(e,t){var n=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,n).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 ga(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var ya=/^[ \t]*#include +<([\w\d./]+)>/gm;function _a(e){return e.replace(ya,Ma)}var xa=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function Ma(e,t){var n=Ci[t];if(void 0===n){var i=xa.get(t);if(void 0===i)throw new Error("Can not resolve #include <"+t+">");n=Ci[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,i)}return _a(n)}var Sa=/#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 ba(e){return e.replace(Sa,Ea)}function Ea(e,t,n,i){for(var r="",a=parseInt(t);a<parseInt(n);a++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return r}function Ta(e){var t="precision "+e.precision+" float;\nprecision "+e.precision+" int;";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}function wa(e,t,n,i){var r,a,o,s,l=e.getContext(),u=n.defines,c=n.vertexShader,h=n.fragmentShader,d=function(e){var t="SHADOWMAP_TYPE_BASIC";return e.shadowMapType===R?t="SHADOWMAP_TYPE_PCF":e.shadowMapType===C?t="SHADOWMAP_TYPE_PCF_SOFT":e.shadowMapType===L&&(t="SHADOWMAP_TYPE_VSM"),t}(n),f=function(e){var t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case 301:case 302:t="ENVMAP_TYPE_CUBE";break;case 306:t="ENVMAP_TYPE_CUBE_UV"}return t}(n),p=function(e){var t="ENVMAP_MODE_REFLECTION";if(e.envMap)switch(e.envMapMode){case 302:t="ENVMAP_MODE_REFRACTION"}return t}(n),v=function(e){var t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case 0:t="ENVMAP_BLENDING_MULTIPLY";break;case 1:t="ENVMAP_BLENDING_MIX";break;case 2:t="ENVMAP_BLENDING_ADD"}return t}(n),m=function(e){var t=e.envMapCubeUVHeight;if(null===t)return null;var n=Math.log2(t)-2,i=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:i,maxMip:n}}(n),g=n.isWebGL2?"":function(e){return[e.extensionDerivatives||e.envMapCubeUVHeight||e.bumpMap||e.normalMapTangentSpace||e.clearcoatNormalMap||e.flatShading||"physical"===e.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(e.extensionFragDepth||e.logarithmicDepthBuffer)&&e.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",e.extensionDrawBuffers&&e.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(e.extensionShaderTextureLOD||e.envMap||e.transmission)&&e.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(va).join("\n")}(n),y=function(e){var t=[];for(var n in e){var i=e[n];!1!==i&&t.push("#define "+n+" "+i)}return t.join("\n")}(u),_=l.createProgram(),x=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?((r=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,y].filter(va).join("\n")).length>0&&(r+="\n"),(a=[g,"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,y].filter(va).join("\n")).length>0&&(a+="\n")):(r=[Ta(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,y,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+p:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors&&n.isWebGL2?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+d:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.useLegacyLights?"#define LEGACY_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(va).join("\n"),a=[g,Ta(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,y,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+f:"",n.envMap?"#define "+p:"",n.envMap?"#define "+v:"",m?"#define CUBEUV_TEXEL_WIDTH "+m.texelWidth:"",m?"#define CUBEUV_TEXEL_HEIGHT "+m.texelHeight:"",m?"#define CUBEUV_MAX_MIP "+m.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+d:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.useLegacyLights?"#define LEGACY_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==G?"#define TONE_MAPPING":"",n.toneMapping!==G?Ci.tonemapping_pars_fragment:"",n.toneMapping!==G?pa("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Ci.colorspace_pars_fragment,(o=n.outputColorSpace,s=function(e){switch(e){case me:return["Linear","( value )"];case ve:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",e),["Linear","( value )"]}}(o),"vec4 linearToOutputTexel( vec4 value ) { return LinearTo"+s[0]+s[1]+"; }"),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(va).join("\n")),c=ga(c=ma(c=_a(c),n),n),h=ga(h=ma(h=_a(h),n),n),c=ba(c),h=ba(h),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(x="#version 300 es\n",r=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+r,a=["#define varying in","300 es"===n.glslVersion?"":"layout(location = 0) out highp vec4 pc_fragColor;","300 es"===n.glslVersion?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+a);var M,S,b=x+r+c,E=x+a+h,T=ha(l,l.VERTEX_SHADER,b),w=ha(l,l.FRAGMENT_SHADER,E);if(l.attachShader(_,T),l.attachShader(_,w),void 0!==n.index0AttributeName?l.bindAttribLocation(_,0,n.index0AttributeName):!0===n.morphTargets&&l.bindAttribLocation(_,0,"position"),l.linkProgram(_),e.debug.checkShaderErrors){var A=l.getProgramInfoLog(_).trim(),P=l.getShaderInfoLog(T).trim(),k=l.getShaderInfoLog(w).trim(),U=!0,I=!0;if(!1===l.getProgramParameter(_,l.LINK_STATUS))if(U=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(l,_,T,w);else{var N=fa(l,T,"vertex"),D=fa(l,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+l.getError()+" - VALIDATE_STATUS "+l.getProgramParameter(_,l.VALIDATE_STATUS)+"\n\nProgram Info Log: "+A+"\n"+N+"\n"+D)}else""!==A?console.warn("THREE.WebGLProgram: Program Info Log:",A):""!==P&&""!==k||(I=!1);I&&(this.diagnostics={runnable:U,programLog:A,vertexShader:{log:P,prefix:r},fragmentShader:{log:k,prefix:a}})}return l.deleteShader(T),l.deleteShader(w),this.getUniforms=function(){return void 0===M&&(M=new ca(l,_)),M},this.getAttributes=function(){return void 0===S&&(S=function(e,t){for(var n={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES),r=0;r<i;r++){var a=e.getActiveAttrib(t,r),o=a.name,s=1;a.type===e.FLOAT_MAT2&&(s=2),a.type===e.FLOAT_MAT3&&(s=3),a.type===e.FLOAT_MAT4&&(s=4),n[o]={type:a.type,location:e.getAttribLocation(t,o),locationSize:s}}return n}(l,_)),S},this.destroy=function(){i.releaseStatesOfProgram(this),l.deleteProgram(_),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=da++,this.cacheKey=t,this.usedTimes=1,this.program=_,this.vertexShader=T,this.fragmentShader=w,this}var Aa=0,Ra=function(){function e(){a(this,e),this.shaderCache=new Map,this.materialCache=new Map}return s(e,[{key:"update",value:function(e){var t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),r=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return!1===a.has(i)&&(a.add(i),i.usedTimes++),!1===a.has(r)&&(a.add(r),r.usedTimes++),this}},{key:"remove",value:function(e){var t,n=E(this.materialCache.get(e));try{for(n.s();!(t=n.n()).done;){var i=t.value;i.usedTimes--,0===i.usedTimes&&this.shaderCache.delete(i.code)}}catch(e){n.e(e)}finally{n.f()}return this.materialCache.delete(e),this}},{key:"getVertexShaderID",value:function(e){return this._getShaderStage(e.vertexShader).id}},{key:"getFragmentShaderID",value:function(e){return this._getShaderStage(e.fragmentShader).id}},{key:"dispose",value:function(){this.shaderCache.clear(),this.materialCache.clear()}},{key:"_getShaderCacheForMaterial",value:function(e){var t=this.materialCache,n=t.get(e);return void 0===n&&(n=new Set,t.set(e,n)),n}},{key:"_getShaderStage",value:function(e){var t=this.shaderCache,n=t.get(e);return void 0===n&&(n=new Ca(e),t.set(e,n)),n}}]),e}(),Ca=s((function e(t){a(this,e),this.id=Aa++,this.code=t,this.usedTimes=0}));function La(e,t,n,i,r,a,o){var s=new Wt,l=new Ra,u=[],c=r.isWebGL2,h=r.logarithmicDepthBuffer,d=r.vertexTextures,f=r.precision,p={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",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 v(e){return 0===e?"uv":"uv".concat(e)}return{getParameters:function(a,s,u,m,g){var y=m.fog,_=g.geometry,x=a.isMeshStandardMaterial?m.environment:null,M=(a.isMeshStandardMaterial?n:t).get(a.envMap||x),S=M&&306===M.mapping?M.image.height:null,b=p[a.type];null!==a.precision&&(f=r.getMaxPrecision(a.precision))!==a.precision&&console.warn("THREE.WebGLProgram.getParameters:",a.precision,"not supported, using",f,"instead.");var E,T,w,A,R=_.morphAttributes.position||_.morphAttributes.normal||_.morphAttributes.color,C=void 0!==R?R.length:0,L=0;if(void 0!==_.morphAttributes.position&&(L=1),void 0!==_.morphAttributes.normal&&(L=2),void 0!==_.morphAttributes.color&&(L=3),b){var P=Pi[b];E=P.vertexShader,T=P.fragmentShader}else E=a.vertexShader,T=a.fragmentShader,l.update(a),w=l.getVertexShaderID(a),A=l.getFragmentShaderID(a);var I=e.getRenderTarget(),N=!0===g.isInstancedMesh,D=!!a.map,O=!!a.matcap,F=!!M,z=!!a.aoMap,B=!!a.lightMap,H=!!a.bumpMap,V=!!a.normalMap,W=!!a.displacementMap,X=!!a.emissiveMap,j=!!a.metalnessMap,Y=!!a.roughnessMap,q=a.anisotropy>0,Z=a.clearcoat>0,J=a.iridescence>0,K=a.sheen>0,Q=a.transmission>0,$=q&&!!a.anisotropyMap,ee=Z&&!!a.clearcoatMap,te=Z&&!!a.clearcoatNormalMap,ne=Z&&!!a.clearcoatRoughnessMap,ie=J&&!!a.iridescenceMap,re=J&&!!a.iridescenceThicknessMap,ae=K&&!!a.sheenColorMap,oe=K&&!!a.sheenRoughnessMap,se=!!a.specularMap,le=!!a.specularColorMap,ue=!!a.specularIntensityMap,ce=Q&&!!a.transmissionMap,he=Q&&!!a.thicknessMap,de=!!a.gradientMap,fe=!!a.alphaMap,pe=a.alphaTest>0,ve=!!a.alphaHash,ge=!!a.extensions,ye=!!_.attributes.uv1,_e=!!_.attributes.uv2,xe=!!_.attributes.uv3,Me=G;return a.toneMapped&&(null!==I&&!0!==I.isXRRenderTarget||(Me=e.toneMapping)),{isWebGL2:c,shaderID:b,shaderType:a.type,shaderName:a.name,vertexShader:E,fragmentShader:T,defines:a.defines,customVertexShaderID:w,customFragmentShaderID:A,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:f,instancing:N,instancingColor:N&&null!==g.instanceColor,supportsVertexTextures:d,outputColorSpace:null===I?e.outputColorSpace:!0===I.isXRRenderTarget?I.texture.colorSpace:me,map:D,matcap:O,envMap:F,envMapMode:F&&M.mapping,envMapCubeUVHeight:S,aoMap:z,lightMap:B,bumpMap:H,normalMap:V,displacementMap:d&&W,emissiveMap:X,normalMapObjectSpace:V&&1===a.normalMapType,normalMapTangentSpace:V&&0===a.normalMapType,metalnessMap:j,roughnessMap:Y,anisotropy:q,anisotropyMap:$,clearcoat:Z,clearcoatMap:ee,clearcoatNormalMap:te,clearcoatRoughnessMap:ne,iridescence:J,iridescenceMap:ie,iridescenceThicknessMap:re,sheen:K,sheenColorMap:ae,sheenRoughnessMap:oe,specularMap:se,specularColorMap:le,specularIntensityMap:ue,transmission:Q,transmissionMap:ce,thicknessMap:he,gradientMap:de,opaque:!1===a.transparent&&1===a.blending,alphaMap:fe,alphaTest:pe,alphaHash:ve,combine:a.combine,mapUv:D&&v(a.map.channel),aoMapUv:z&&v(a.aoMap.channel),lightMapUv:B&&v(a.lightMap.channel),bumpMapUv:H&&v(a.bumpMap.channel),normalMapUv:V&&v(a.normalMap.channel),displacementMapUv:W&&v(a.displacementMap.channel),emissiveMapUv:X&&v(a.emissiveMap.channel),metalnessMapUv:j&&v(a.metalnessMap.channel),roughnessMapUv:Y&&v(a.roughnessMap.channel),anisotropyMapUv:$&&v(a.anisotropyMap.channel),clearcoatMapUv:ee&&v(a.clearcoatMap.channel),clearcoatNormalMapUv:te&&v(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ne&&v(a.clearcoatRoughnessMap.channel),iridescenceMapUv:ie&&v(a.iridescenceMap.channel),iridescenceThicknessMapUv:re&&v(a.iridescenceThicknessMap.channel),sheenColorMapUv:ae&&v(a.sheenColorMap.channel),sheenRoughnessMapUv:oe&&v(a.sheenRoughnessMap.channel),specularMapUv:se&&v(a.specularMap.channel),specularColorMapUv:le&&v(a.specularColorMap.channel),specularIntensityMapUv:ue&&v(a.specularIntensityMap.channel),transmissionMapUv:ce&&v(a.transmissionMap.channel),thicknessMapUv:he&&v(a.thicknessMap.channel),alphaMapUv:fe&&v(a.alphaMap.channel),vertexTangents:!!_.attributes.tangent&&(V||q),vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!_.attributes.color&&4===_.attributes.color.itemSize,vertexUv1s:ye,vertexUv2s:_e,vertexUv3s:xe,pointsUvs:!0===g.isPoints&&!!_.attributes.uv&&(D||fe),fog:!!y,useFog:!0===a.fog,fogExp2:y&&y.isFogExp2,flatShading:!0===a.flatShading,sizeAttenuation:!0===a.sizeAttenuation,logarithmicDepthBuffer:h,skinning:!0===g.isSkinnedMesh,morphTargets:void 0!==_.morphAttributes.position,morphNormals:void 0!==_.morphAttributes.normal,morphColors:void 0!==_.morphAttributes.color,morphTargetsCount:C,morphTextureStride:L,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,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:a.dithering,shadowMapEnabled:e.shadowMap.enabled&&u.length>0,shadowMapType:e.shadowMap.type,toneMapping:Me,useLegacyLights:e._useLegacyLights,premultipliedAlpha:a.premultipliedAlpha,doubleSided:a.side===U,flipSided:a.side===k,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionDerivatives:ge&&!0===a.extensions.derivatives,extensionFragDepth:ge&&!0===a.extensions.fragDepth,extensionDrawBuffers:ge&&!0===a.extensions.drawBuffers,extensionShaderTextureLOD:ge&&!0===a.extensions.shaderTextureLOD,rendererExtensionFragDepth:c||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:c||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:c||i.has("EXT_shader_texture_lod"),customProgramCacheKey:a.customProgramCacheKey()}},getProgramCacheKey:function(t){var n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),void 0!==t.defines)for(var i in t.defines)n.push(i),n.push(t.defines[i]);return!1===t.isRawShaderMaterial&&(function(e,t){e.push(t.precision),e.push(t.outputColorSpace),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.mapUv),e.push(t.alphaMapUv),e.push(t.lightMapUv),e.push(t.aoMapUv),e.push(t.bumpMapUv),e.push(t.normalMapUv),e.push(t.displacementMapUv),e.push(t.emissiveMapUv),e.push(t.metalnessMapUv),e.push(t.roughnessMapUv),e.push(t.anisotropyMapUv),e.push(t.clearcoatMapUv),e.push(t.clearcoatNormalMapUv),e.push(t.clearcoatRoughnessMapUv),e.push(t.iridescenceMapUv),e.push(t.iridescenceThicknessMapUv),e.push(t.sheenColorMapUv),e.push(t.sheenRoughnessMapUv),e.push(t.specularMapUv),e.push(t.specularColorMapUv),e.push(t.specularIntensityMapUv),e.push(t.transmissionMapUv),e.push(t.thicknessMapUv),e.push(t.combine),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numSpotLightMaps),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.numSpotLightShadowsWithMaps),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}(n,t),function(e,t){s.disableAll(),t.isWebGL2&&s.enable(0),t.supportsVertexTextures&&s.enable(1),t.instancing&&s.enable(2),t.instancingColor&&s.enable(3),t.matcap&&s.enable(4),t.envMap&&s.enable(5),t.normalMapObjectSpace&&s.enable(6),t.normalMapTangentSpace&&s.enable(7),t.clearcoat&&s.enable(8),t.iridescence&&s.enable(9),t.alphaTest&&s.enable(10),t.vertexColors&&s.enable(11),t.vertexAlphas&&s.enable(12),t.vertexUv1s&&s.enable(13),t.vertexUv2s&&s.enable(14),t.vertexUv3s&&s.enable(15),t.vertexTangents&&s.enable(16),t.anisotropy&&s.enable(17),e.push(s.mask),s.disableAll(),t.fog&&s.enable(0),t.useFog&&s.enable(1),t.flatShading&&s.enable(2),t.logarithmicDepthBuffer&&s.enable(3),t.skinning&&s.enable(4),t.morphTargets&&s.enable(5),t.morphNormals&&s.enable(6),t.morphColors&&s.enable(7),t.premultipliedAlpha&&s.enable(8),t.shadowMapEnabled&&s.enable(9),t.useLegacyLights&&s.enable(10),t.doubleSided&&s.enable(11),t.flipSided&&s.enable(12),t.useDepthPacking&&s.enable(13),t.dithering&&s.enable(14),t.transmission&&s.enable(15),t.sheen&&s.enable(16),t.opaque&&s.enable(17),t.pointsUvs&&s.enable(18),e.push(s.mask)}(n,t),n.push(e.outputColorSpace)),n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){var t,n=p[e.type];if(n){var i=Pi[n];t=di.clone(i.uniforms)}else t=e.uniforms;return t},acquireProgram:function(t,n){for(var i,r=0,o=u.length;r<o;r++){var s=u[r];if(s.cacheKey===n){++(i=s).usedTimes;break}}return void 0===i&&(i=new wa(e,n,t,a),u.push(i)),i},releaseProgram:function(e){if(0==--e.usedTimes){var t=u.indexOf(e);u[t]=u[u.length-1],u.pop(),e.destroy()}},releaseShaderCache:function(e){l.remove(e)},programs:u,dispose:function(){l.dispose()}}}function Pa(){var e=new WeakMap;return{get:function(t){var n=e.get(t);return void 0===n&&(n={},e.set(t,n)),n},remove:function(t){e.delete(t)},update:function(t,n,i){e.get(t)[n]=i},dispose:function(){e=new WeakMap}}}function ka(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function Ua(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 Ia(){var e=[],t=0,n=[],i=[],r=[];function a(n,i,r,a,o,s){var l=e[t];return void 0===l?(l={id:n.id,object:n,geometry:i,material:r,groupOrder:a,renderOrder:n.renderOrder,z:o,group:s},e[t]=l):(l.id=n.id,l.object=n,l.geometry=i,l.material=r,l.groupOrder=a,l.renderOrder=n.renderOrder,l.z=o,l.group=s),t++,l}return{opaque:n,transmissive:i,transparent:r,init:function(){t=0,n.length=0,i.length=0,r.length=0},push:function(e,t,o,s,l,u){var c=a(e,t,o,s,l,u);o.transmission>0?i.push(c):!0===o.transparent?r.push(c):n.push(c)},unshift:function(e,t,o,s,l,u){var c=a(e,t,o,s,l,u);o.transmission>0?i.unshift(c):!0===o.transparent?r.unshift(c):n.unshift(c)},finish:function(){for(var n=t,i=e.length;n<i;n++){var r=e[n];if(null===r.id)break;r.id=null,r.object=null,r.geometry=null,r.material=null,r.group=null}},sort:function(e,t){n.length>1&&n.sort(e||ka),i.length>1&&i.sort(t||Ua),r.length>1&&r.sort(t||Ua)}}}function Na(){var e=new WeakMap;return{get:function(t,n){var i,r=e.get(t);return void 0===r?(i=new Ia,e.set(t,[i])):n>=r.length?(i=new Ia,r.push(i)):i=r[n],i},dispose:function(){e=new WeakMap}}}function Da(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var n;switch(t.type){case"DirectionalLight":n={direction:new it,color:new En};break;case"SpotLight":n={position:new it,direction:new it,color:new En,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new it,color:new En,distance:0,decay:0};break;case"HemisphereLight":n={direction:new it,skyColor:new En,groundColor:new En};break;case"RectAreaLight":n={color:new En,position:new it,halfWidth:new it,halfHeight:new it}}return e[t.id]=n,n}}}var Oa=0;function Fa(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function za(e,t){for(var n,i=new Da,r=(n={},{get:function(e){if(void 0!==n[e.id])return n[e.id];var t;switch(e.type){case"DirectionalLight":case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Pe};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Pe,shadowCameraNear:1,shadowCameraFar:1e3}}return n[e.id]=t,t}}),a={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-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},o=0;o<9;o++)a.probe.push(new it);var s=new it,l=new Ut,u=new Ut;return{setup:function(n,o){for(var s=0,l=0,u=0,c=0;c<9;c++)a.probe[c].set(0,0,0);var h=0,d=0,f=0,p=0,v=0,m=0,g=0,y=0,_=0,x=0;n.sort(Fa);for(var M=!0===o?Math.PI:1,S=0,b=n.length;S<b;S++){var E=n[S],T=E.color,w=E.intensity,A=E.distance,R=E.shadow&&E.shadow.map?E.shadow.map.texture:null;if(E.isAmbientLight)s+=T.r*w*M,l+=T.g*w*M,u+=T.b*w*M;else if(E.isLightProbe)for(var C=0;C<9;C++)a.probe[C].addScaledVector(E.sh.coefficients[C],w);else if(E.isDirectionalLight){var L=i.get(E);if(L.color.copy(E.color).multiplyScalar(E.intensity*M),E.castShadow){var P=E.shadow,k=r.get(E);k.shadowBias=P.bias,k.shadowNormalBias=P.normalBias,k.shadowRadius=P.radius,k.shadowMapSize=P.mapSize,a.directionalShadow[h]=k,a.directionalShadowMap[h]=R,a.directionalShadowMatrix[h]=E.shadow.matrix,m++}a.directional[h]=L,h++}else if(E.isSpotLight){var U=i.get(E);U.position.setFromMatrixPosition(E.matrixWorld),U.color.copy(T).multiplyScalar(w*M),U.distance=A,U.coneCos=Math.cos(E.angle),U.penumbraCos=Math.cos(E.angle*(1-E.penumbra)),U.decay=E.decay,a.spot[f]=U;var I=E.shadow;if(E.map&&(a.spotLightMap[_]=E.map,_++,I.updateMatrices(E),E.castShadow&&x++),a.spotLightMatrix[f]=I.matrix,E.castShadow){var N=r.get(E);N.shadowBias=I.bias,N.shadowNormalBias=I.normalBias,N.shadowRadius=I.radius,N.shadowMapSize=I.mapSize,a.spotShadow[f]=N,a.spotShadowMap[f]=R,y++}f++}else if(E.isRectAreaLight){var D=i.get(E);D.color.copy(T).multiplyScalar(w),D.halfWidth.set(.5*E.width,0,0),D.halfHeight.set(0,.5*E.height,0),a.rectArea[p]=D,p++}else if(E.isPointLight){var O=i.get(E);if(O.color.copy(E.color).multiplyScalar(E.intensity*M),O.distance=E.distance,O.decay=E.decay,E.castShadow){var F=E.shadow,z=r.get(E);z.shadowBias=F.bias,z.shadowNormalBias=F.normalBias,z.shadowRadius=F.radius,z.shadowMapSize=F.mapSize,z.shadowCameraNear=F.camera.near,z.shadowCameraFar=F.camera.far,a.pointShadow[d]=z,a.pointShadowMap[d]=R,a.pointShadowMatrix[d]=E.shadow.matrix,g++}a.point[d]=O,d++}else if(E.isHemisphereLight){var B=i.get(E);B.skyColor.copy(E.color).multiplyScalar(w*M),B.groundColor.copy(E.groundColor).multiplyScalar(w*M),a.hemi[v]=B,v++}}p>0&&(t.isWebGL2||!0===e.has("OES_texture_float_linear")?(a.rectAreaLTC1=Li.LTC_FLOAT_1,a.rectAreaLTC2=Li.LTC_FLOAT_2):!0===e.has("OES_texture_half_float_linear")?(a.rectAreaLTC1=Li.LTC_HALF_1,a.rectAreaLTC2=Li.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),a.ambient[0]=s,a.ambient[1]=l,a.ambient[2]=u;var H=a.hash;H.directionalLength===h&&H.pointLength===d&&H.spotLength===f&&H.rectAreaLength===p&&H.hemiLength===v&&H.numDirectionalShadows===m&&H.numPointShadows===g&&H.numSpotShadows===y&&H.numSpotMaps===_||(a.directional.length=h,a.spot.length=f,a.rectArea.length=p,a.point.length=d,a.hemi.length=v,a.directionalShadow.length=m,a.directionalShadowMap.length=m,a.pointShadow.length=g,a.pointShadowMap.length=g,a.spotShadow.length=y,a.spotShadowMap.length=y,a.directionalShadowMatrix.length=m,a.pointShadowMatrix.length=g,a.spotLightMatrix.length=y+_-x,a.spotLightMap.length=_,a.numSpotLightShadowsWithMaps=x,H.directionalLength=h,H.pointLength=d,H.spotLength=f,H.rectAreaLength=p,H.hemiLength=v,H.numDirectionalShadows=m,H.numPointShadows=g,H.numSpotShadows=y,H.numSpotMaps=_,a.version=Oa++)},setupView:function(e,t){for(var n=0,i=0,r=0,o=0,c=0,h=t.matrixWorldInverse,d=0,f=e.length;d<f;d++){var p=e[d];if(p.isDirectionalLight){var v=a.directional[n];v.direction.setFromMatrixPosition(p.matrixWorld),s.setFromMatrixPosition(p.target.matrixWorld),v.direction.sub(s),v.direction.transformDirection(h),n++}else if(p.isSpotLight){var m=a.spot[r];m.position.setFromMatrixPosition(p.matrixWorld),m.position.applyMatrix4(h),m.direction.setFromMatrixPosition(p.matrixWorld),s.setFromMatrixPosition(p.target.matrixWorld),m.direction.sub(s),m.direction.transformDirection(h),r++}else if(p.isRectAreaLight){var g=a.rectArea[o];g.position.setFromMatrixPosition(p.matrixWorld),g.position.applyMatrix4(h),u.identity(),l.copy(p.matrixWorld),l.premultiply(h),u.extractRotation(l),g.halfWidth.set(.5*p.width,0,0),g.halfHeight.set(0,.5*p.height,0),g.halfWidth.applyMatrix4(u),g.halfHeight.applyMatrix4(u),o++}else if(p.isPointLight){var y=a.point[i];y.position.setFromMatrixPosition(p.matrixWorld),y.position.applyMatrix4(h),i++}else if(p.isHemisphereLight){var _=a.hemi[c];_.direction.setFromMatrixPosition(p.matrixWorld),_.direction.transformDirection(h),c++}}},state:a}}function Ba(e,t){var n=new za(e,t),i=[],r=[];return{init:function(){i.length=0,r.length=0},state:{lightsArray:i,shadowsArray:r,lights:n},setupLights:function(e){n.setup(i,e)},setupLightsView:function(e){n.setupView(i,e)},pushLight:function(e){i.push(e)},pushShadow:function(e){r.push(e)}}}function Ha(e,t){var n=new WeakMap;return{get:function(i){var r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=n.get(i);return void 0===o?(r=new Ba(e,t),n.set(i,[r])):a>=o.length?(r=new Ba(e,t),o.push(r)):r=o[a],r},dispose:function(){n=new WeakMap}}}var Va=e("bg",function(e){u(n,e);var t=g(n);function n(e){var i;return a(this,n),(i=t.call(this)).isMeshDepthMaterial=!0,i.type="MeshDepthMaterial",i.depthPacking=3200,i.map=null,i.alphaMap=null,i.displacementMap=null,i.displacementScale=1,i.displacementBias=0,i.wireframe=!1,i.wireframeLinewidth=1,i.setValues(e),i}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,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}}]),n}(_n)),Ga=function(e){u(n,e);var t=g(n);function n(e){var i;return a(this,n),(i=t.call(this)).isMeshDistanceMaterial=!0,i.type="MeshDistanceMaterial",i.map=null,i.alphaMap=null,i.displacementMap=null,i.displacementScale=1,i.displacementBias=0,i.setValues(e),i}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}]),n}(_n);function Wa(e,t,n){var i,r=new Ti,a=new Pe,o=new Pe,s=new Qe,u=new Va({depthPacking:fe}),c=new Ga,h={},d=n.maxTextureSize,f=(l(i={},P,k),l(i,k,P),l(i,U,U),i),p=new fi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Pe},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),v=p.clone();v.defines.HORIZONTAL_PASS=1;var m=new Vn;m.setAttribute("position",new Pn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var g=new oi(m,p),y=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=R;var _=this.type;function x(n,i){var r=t.update(g);p.defines.VSM_SAMPLES!==n.blurSamples&&(p.defines.VSM_SAMPLES=n.blurSamples,v.defines.VSM_SAMPLES=n.blurSamples,p.needsUpdate=!0,v.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new $e(a.x,a.y)),p.uniforms.shadow_pass.value=n.map.texture,p.uniforms.resolution.value=n.mapSize,p.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(i,null,r,p,g,null),v.uniforms.shadow_pass.value=n.mapPass.texture,v.uniforms.resolution.value=n.mapSize,v.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(i,null,r,v,g,null)}function M(t,n,i,r){var a=null,o=!0===i.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==o)a=o;else if(a=!0===i.isPointLight?c:u,e.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0){var s=a.uuid,l=n.uuid,d=h[s];void 0===d&&(d={},h[s]=d);var p=d[l];void 0===p&&(p=a.clone(),d[l]=p),a=p}return a.visible=n.visible,a.wireframe=n.wireframe,a.side=r===L?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:f[n.side],a.alphaMap=n.alphaMap,a.alphaTest=n.alphaTest,a.map=n.map,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.clipIntersection=n.clipIntersection,a.displacementMap=n.displacementMap,a.displacementScale=n.displacementScale,a.displacementBias=n.displacementBias,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,!0===i.isPointLight&&!0===a.isMeshDistanceMaterial&&(e.properties.get(a).light=i),a}function S(n,i,a,o,s){if(!1!==n.visible){if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&s===L)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);var l=t.update(n),u=n.material;if(Array.isArray(u))for(var c=l.groups,h=0,d=c.length;h<d;h++){var f=c[h],p=u[f.materialIndex];if(p&&p.visible){var v=M(n,p,o,s);e.renderBufferDirect(a,null,l,v,n,f)}}else if(u.visible){var m=M(n,u,o,s);e.renderBufferDirect(a,null,l,m,n,null)}}for(var g=n.children,y=0,_=g.length;y<_;y++)S(g[y],i,a,o,s)}}this.render=function(t,n,i){if(!1!==y.enabled&&(!1!==y.autoUpdate||!1!==y.needsUpdate)&&0!==t.length){var l=e.getRenderTarget(),u=e.getActiveCubeFace(),c=e.getActiveMipmapLevel(),h=e.state;h.setBlending(I),h.buffers.color.setClear(1,1,1,1),h.buffers.depth.setTest(!0),h.setScissorTest(!1);for(var f=_!==L&&this.type===L,p=_===L&&this.type!==L,v=0,m=t.length;v<m;v++){var g=t[v],M=g.shadow;if(void 0!==M){if(!1!==M.autoUpdate||!1!==M.needsUpdate){a.copy(M.mapSize);var b=M.getFrameExtents();if(a.multiply(b),o.copy(M.mapSize),(a.x>d||a.y>d)&&(a.x>d&&(o.x=Math.floor(d/b.x),a.x=o.x*b.x,M.mapSize.x=o.x),a.y>d&&(o.y=Math.floor(d/b.y),a.y=o.y*b.y,M.mapSize.y=o.y)),null===M.map||!0===f||!0===p){var E=this.type!==L?{minFilter:Q,magFilter:Q}:{};null!==M.map&&M.map.dispose(),M.map=new $e(a.x,a.y,E),M.map.texture.name=g.name+".shadowMap",M.camera.updateProjectionMatrix()}e.setRenderTarget(M.map),e.clear();for(var T=M.getViewportCount(),w=0;w<T;w++){var A=M.getViewport(w);s.set(o.x*A.x,o.y*A.y,o.x*A.z,o.y*A.w),h.viewport(s),M.updateMatrices(g,w),r=M.getFrustum(),S(n,i,M.camera,g,this.type)}!0!==M.isPointLightShadow&&this.type===L&&x(M,i),M.needsUpdate=!1}}else console.warn("THREE.WebGLShadowMap:",g,"has no shadow.")}_=this.type,y.needsUpdate=!1,e.setRenderTarget(l,u,c)}}}function Xa(e,t,n){var i,r,a=n.isWebGL2,o=new function(){var t=!1,n=new Qe,i=null,r=new Qe(0,0,0,0);return{setMask:function(n){i===n||t||(e.colorMask(n,n,n,n),i=n)},setLocked:function(e){t=e},setClear:function(t,i,a,o,s){!0===s&&(t*=o,i*=o,a*=o),n.set(t,i,a,o),!1===r.equals(n)&&(e.clearColor(t,i,a,o),r.copy(n))},reset:function(){t=!1,i=null,r.set(-1,0,0,0)}}},s=new function(){var t=!1,n=null,i=null,r=null;return{setTest:function(t){t?ee(e.DEPTH_TEST):te(e.DEPTH_TEST)},setMask:function(i){n===i||t||(e.depthMask(i),n=i)},setFunc:function(t){if(i!==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: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);break;default:e.depthFunc(e.LEQUAL)}i=t}},setLocked:function(e){t=e},setClear:function(t){r!==t&&(e.clearDepth(t),r=t)},reset:function(){t=!1,n=null,i=null,r=null}}},u=new function(){var t=!1,n=null,i=null,r=null,a=null,o=null,s=null,l=null,u=null;return{setTest:function(n){t||(n?ee(e.STENCIL_TEST):te(e.STENCIL_TEST))},setMask:function(i){n===i||t||(e.stencilMask(i),n=i)},setFunc:function(t,n,o){i===t&&r===n&&a===o||(e.stencilFunc(t,n,o),i=t,r=n,a=o)},setOp:function(t,n,i){o===t&&s===n&&l===i||(e.stencilOp(t,n,i),o=t,s=n,l=i)},setLocked:function(e){t=e},setClear:function(t){u!==t&&(e.clearStencil(t),u=t)},reset:function(){t=!1,n=null,i=null,r=null,a=null,o=null,s=null,l=null,u=null}}},c=new WeakMap,h=new WeakMap,d={},f={},p=new WeakMap,v=[],m=null,g=!1,y=null,_=null,x=null,M=null,S=null,b=null,E=null,T=!1,w=null,A=null,R=null,C=null,L=null,P=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),G=!1,W=0,X=e.getParameter(e.VERSION);-1!==X.indexOf("WebGL")?(W=parseFloat(/^WebGL (\d)/.exec(X)[1]),G=W>=1):-1!==X.indexOf("OpenGL ES")&&(W=parseFloat(/^OpenGL ES (\d)/.exec(X)[1]),G=W>=2);var j=null,Y={},q=e.getParameter(e.SCISSOR_BOX),Z=e.getParameter(e.VIEWPORT),J=(new Qe).fromArray(q),K=(new Qe).fromArray(Z);function Q(t,n,i,r){var o=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(var l=0;l<i;l++)!a||t!==e.TEXTURE_3D&&t!==e.TEXTURE_2D_ARRAY?e.texImage2D(n+l,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,o):e.texImage3D(n,0,e.RGBA,1,1,r,0,e.RGBA,e.UNSIGNED_BYTE,o);return s}var $={};function ee(t){!0!==d[t]&&(e.enable(t),d[t]=!0)}function te(t){!1!==d[t]&&(e.disable(t),d[t]=!1)}$[e.TEXTURE_2D]=Q(e.TEXTURE_2D,e.TEXTURE_2D,1),$[e.TEXTURE_CUBE_MAP]=Q(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),a&&($[e.TEXTURE_2D_ARRAY]=Q(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),$[e.TEXTURE_3D]=Q(e.TEXTURE_3D,e.TEXTURE_3D,1,1)),o.setClear(0,0,0,1),s.setClear(1),u.setClear(0),ee(e.DEPTH_TEST),s.setFunc(3),oe(!1),se(1),ee(e.CULL_FACE),ae(I);var ne=(l(i={},O,e.FUNC_ADD),l(i,101,e.FUNC_SUBTRACT),l(i,102,e.FUNC_REVERSE_SUBTRACT),i);if(a)ne[F]=e.MIN,ne[104]=e.MAX;else{var ie=t.get("EXT_blend_minmax");null!==ie&&(ne[F]=ie.MIN_EXT,ne[104]=ie.MAX_EXT)}var re=(l(r={},z,e.ZERO),l(r,B,e.ONE),l(r,202,e.SRC_COLOR),l(r,204,e.SRC_ALPHA),l(r,210,e.SRC_ALPHA_SATURATE),l(r,V,e.DST_COLOR),l(r,H,e.DST_ALPHA),l(r,203,e.ONE_MINUS_SRC_COLOR),l(r,205,e.ONE_MINUS_SRC_ALPHA),l(r,209,e.ONE_MINUS_DST_COLOR),l(r,207,e.ONE_MINUS_DST_ALPHA),r);function ae(t,n,i,r,a,o,s,l){if(t!==I){if(!1===g&&(ee(e.BLEND),g=!0),t===D)a=a||n,o=o||i,s=s||r,n===_&&a===S||(e.blendEquationSeparate(ne[n],ne[a]),_=n,S=a),i===x&&r===M&&o===b&&s===E||(e.blendFuncSeparate(re[i],re[r],re[o],re[s]),x=i,M=r,b=o,E=s),y=t,T=!1;else if(t!==y||l!==T){if(_===O&&S===O||(e.blendEquation(e.FUNC_ADD),_=O,S=O),l)switch(t){case 1:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case N: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.ZERO,e.SRC_COLOR,e.ZERO,e.SRC_ALPHA);break;default:console.error("THREE.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 N:e.blendFunc(e.SRC_ALPHA,e.ONE);break;case 3:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case 4:e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}x=null,M=null,b=null,E=null,y=t,T=l}}else!0===g&&(te(e.BLEND),g=!1)}function oe(t){w!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),w=t)}function se(t){0!==t?(ee(e.CULL_FACE),t!==A&&(1===t?e.cullFace(e.BACK):2===t?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))):te(e.CULL_FACE),A=t}function le(t,n,i){t?(ee(e.POLYGON_OFFSET_FILL),C===n&&L===i||(e.polygonOffset(n,i),C=n,L=i)):te(e.POLYGON_OFFSET_FILL)}return{buffers:{color:o,depth:s,stencil:u},enable:ee,disable:te,bindFramebuffer:function(t,n){return f[t]!==n&&(e.bindFramebuffer(t,n),f[t]=n,a&&(t===e.DRAW_FRAMEBUFFER&&(f[e.FRAMEBUFFER]=n),t===e.FRAMEBUFFER&&(f[e.DRAW_FRAMEBUFFER]=n)),!0)},drawBuffers:function(i,r){var a=v,o=!1;if(i)if(void 0===(a=p.get(r))&&(a=[],p.set(r,a)),i.isWebGLMultipleRenderTargets){var s=i.texture;if(a.length!==s.length||a[0]!==e.COLOR_ATTACHMENT0){for(var l=0,u=s.length;l<u;l++)a[l]=e.COLOR_ATTACHMENT0+l;a.length=s.length,o=!0}}else a[0]!==e.COLOR_ATTACHMENT0&&(a[0]=e.COLOR_ATTACHMENT0,o=!0);else a[0]!==e.BACK&&(a[0]=e.BACK,o=!0);o&&(n.isWebGL2?e.drawBuffers(a):t.get("WEBGL_draw_buffers").drawBuffersWEBGL(a))},useProgram:function(t){return m!==t&&(e.useProgram(t),m=t,!0)},setBlending:ae,setMaterial:function(t,n){t.side===U?te(e.CULL_FACE):ee(e.CULL_FACE);var i=t.side===k;n&&(i=!i),oe(i),1===t.blending&&!1===t.transparent?ae(I):ae(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha),s.setFunc(t.depthFunc),s.setTest(t.depthTest),s.setMask(t.depthWrite),o.setMask(t.colorWrite);var r=t.stencilWrite;u.setTest(r),r&&(u.setMask(t.stencilWriteMask),u.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),u.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),le(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),!0===t.alphaToCoverage?ee(e.SAMPLE_ALPHA_TO_COVERAGE):te(e.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:oe,setCullFace:se,setLineWidth:function(t){t!==R&&(G&&e.lineWidth(t),R=t)},setPolygonOffset:le,setScissorTest:function(t){t?ee(e.SCISSOR_TEST):te(e.SCISSOR_TEST)},activeTexture:function(t){void 0===t&&(t=e.TEXTURE0+P-1),j!==t&&(e.activeTexture(t),j=t)},bindTexture:function(t,n,i){void 0===i&&(i=null===j?e.TEXTURE0+P-1:j);var r=Y[i];void 0===r&&(r={type:void 0,texture:void 0},Y[i]=r),r.type===t&&r.texture===n||(j!==i&&(e.activeTexture(i),j=i),e.bindTexture(t,n||$[t]),r.type=t,r.texture=n)},unbindTexture:function(){var t=Y[j];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.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexImage3D:function(){try{e.compressedTexImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{e.texImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{e.texImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},updateUBOMapping:function(t,n){var i=h.get(n);void 0===i&&(i=new WeakMap,h.set(n,i));var r=i.get(t);void 0===r&&(r=e.getUniformBlockIndex(n,t.name),i.set(t,r))},uniformBlockBinding:function(t,n){var i=h.get(n).get(t);c.get(n)!==i&&(e.uniformBlockBinding(n,i,t.__bindingPointIndex),c.set(n,i))},texStorage2D:function(){try{e.texStorage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texStorage3D:function(){try{e.texStorage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage2D:function(){try{e.texSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage3D:function(){try{e.texSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage2D:function(){try{e.compressedTexSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage3D:function(){try{e.compressedTexSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(t){!1===J.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),J.copy(t))},viewport:function(t){!1===K.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),K.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.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(e.ALWAYS,0,4294967295),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),!0===a&&(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),d={},j=null,Y={},f={},p=new WeakMap,v=[],m=null,g=!1,y=null,_=null,x=null,M=null,S=null,b=null,E=null,T=!1,w=null,A=null,R=null,C=null,L=null,J.set(0,0,e.canvas.width,e.canvas.height),K.set(0,0,e.canvas.width,e.canvas.height),o.reset(),s.reset(),u.reset()}}}function ja(e,t,n,i,r,a,o){var s,u,c,h,d=r.isWebGL2,f=r.maxTextures,p=r.maxCubemapSize,v=r.maxTextureSize,m=r.maxSamples,g=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,y="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),_=new WeakMap,x=new WeakMap,M=!1;try{M="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function S(e,t){return M?new OffscreenCanvas(e,t):Ne("canvas")}function b(e,t,n,i){var r=1;if((e.width>i||e.height>i)&&(r=i/Math.max(e.width,e.height)),r<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){var a=t?Re:Math.floor,o=a(r*e.width),s=a(r*e.height);void 0===h&&(h=S(o,s));var l=n?S(o,s):h;return l.width=o,l.height=s,l.getContext("2d").drawImage(e,0,0,o,s),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+o+"x"+s+")."),l}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function E(e){return we(e.width)&&we(e.height)}function T(e,t){return e.generateMipmaps&&t&&e.minFilter!==Q&&e.minFilter!==te}function w(t){e.generateMipmap(t)}function A(n,i,r,a){var o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(!1===d)return i;if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}var s=i;return i===e.RED&&(r===e.FLOAT&&(s=e.R32F),r===e.HALF_FLOAT&&(s=e.R16F),r===e.UNSIGNED_BYTE&&(s=e.R8)),i===e.RED_INTEGER&&(r===e.UNSIGNED_BYTE&&(s=e.R8UI),r===e.UNSIGNED_SHORT&&(s=e.R16UI),r===e.UNSIGNED_INT&&(s=e.R32UI),r===e.BYTE&&(s=e.R8I),r===e.SHORT&&(s=e.R16I),r===e.INT&&(s=e.R32I)),i===e.RG&&(r===e.FLOAT&&(s=e.RG32F),r===e.HALF_FLOAT&&(s=e.RG16F),r===e.UNSIGNED_BYTE&&(s=e.RG8)),i===e.RGBA&&(r===e.FLOAT&&(s=e.RGBA32F),r===e.HALF_FLOAT&&(s=e.RGBA16F),r===e.UNSIGNED_BYTE&&(s=a===ve&&!1===o?e.SRGB8_ALPHA8:e.RGBA8),r===e.UNSIGNED_SHORT_4_4_4_4&&(s=e.RGBA4),r===e.UNSIGNED_SHORT_5_5_5_1&&(s=e.RGB5_A1)),s!==e.R16F&&s!==e.R32F&&s!==e.RG16F&&s!==e.RG32F&&s!==e.RGBA16F&&s!==e.RGBA32F||t.get("EXT_color_buffer_float"),s}function R(e,t,n){return!0===T(e,n)||e.isFramebufferTexture&&e.minFilter!==Q&&e.minFilter!==te?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 C(t){return t===Q||t===$||t===ee?e.NEAREST:e.LINEAR}function L(e){var t=e.target;t.removeEventListener("dispose",L),function(e){var t=i.get(e);if(void 0!==t.__webglInit){var n=e.source,r=x.get(n);if(r){var a=r[t.__cacheKey];a.usedTimes--,0===a.usedTimes&&k(e),0===Object.keys(r).length&&x.delete(n)}i.remove(e)}}(t),t.isVideoTexture&&_.delete(t)}function P(t){var n=t.target;n.removeEventListener("dispose",P),function(t){var n=t.texture,r=i.get(t),a=i.get(n);if(void 0!==a.__webglTexture&&(e.deleteTexture(a.__webglTexture),o.memory.textures--),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(var s=0;s<6;s++){if(Array.isArray(r.__webglFramebuffer[s]))for(var l=0;l<r.__webglFramebuffer[s].length;l++)e.deleteFramebuffer(r.__webglFramebuffer[s][l]);else e.deleteFramebuffer(r.__webglFramebuffer[s]);r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer[s])}else{if(Array.isArray(r.__webglFramebuffer))for(var u=0;u<r.__webglFramebuffer.length;u++)e.deleteFramebuffer(r.__webglFramebuffer[u]);else e.deleteFramebuffer(r.__webglFramebuffer);if(r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&e.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer)for(var c=0;c<r.__webglColorRenderbuffer.length;c++)r.__webglColorRenderbuffer[c]&&e.deleteRenderbuffer(r.__webglColorRenderbuffer[c]);r.__webglDepthRenderbuffer&&e.deleteRenderbuffer(r.__webglDepthRenderbuffer)}if(t.isWebGLMultipleRenderTargets)for(var h=0,d=n.length;h<d;h++){var f=i.get(n[h]);f.__webglTexture&&(e.deleteTexture(f.__webglTexture),o.memory.textures--),i.remove(n[h])}i.remove(n),i.remove(t)}(n)}function k(t){var n=i.get(t);e.deleteTexture(n.__webglTexture);var r=t.source;delete x.get(r)[n.__cacheKey],o.memory.textures--}var U=0;function I(t,r){var a=i.get(t);if(t.isVideoTexture&&function(e){var t=o.render.frame;_.get(e)!==t&&(_.set(e,t),e.update())}(t),!1===t.isRenderTargetTexture&&t.version>0&&a.__version!==t.version){var s=t.image;if(null===s)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==s.complete)return void B(a,t,r);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.bindTexture(e.TEXTURE_2D,a.__webglTexture,e.TEXTURE0+r)}var N=(l(s={},Z,e.REPEAT),l(s,J,e.CLAMP_TO_EDGE),l(s,K,e.MIRRORED_REPEAT),s),D=(l(u={},Q,e.NEAREST),l(u,$,e.NEAREST_MIPMAP_NEAREST),l(u,ee,e.NEAREST_MIPMAP_LINEAR),l(u,te,e.LINEAR),l(u,ne,e.LINEAR_MIPMAP_NEAREST),l(u,ie,e.LINEAR_MIPMAP_LINEAR),u),O=(l(c={},512,e.NEVER),l(c,519,e.ALWAYS),l(c,513,e.LESS),l(c,515,e.LEQUAL),l(c,514,e.EQUAL),l(c,518,e.GEQUAL),l(c,516,e.GREATER),l(c,517,e.NOTEQUAL),c);function F(n,a,o){if(o?(e.texParameteri(n,e.TEXTURE_WRAP_S,N[a.wrapS]),e.texParameteri(n,e.TEXTURE_WRAP_T,N[a.wrapT]),n!==e.TEXTURE_3D&&n!==e.TEXTURE_2D_ARRAY||e.texParameteri(n,e.TEXTURE_WRAP_R,N[a.wrapR]),e.texParameteri(n,e.TEXTURE_MAG_FILTER,D[a.magFilter]),e.texParameteri(n,e.TEXTURE_MIN_FILTER,D[a.minFilter])):(e.texParameteri(n,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(n,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),n!==e.TEXTURE_3D&&n!==e.TEXTURE_2D_ARRAY||e.texParameteri(n,e.TEXTURE_WRAP_R,e.CLAMP_TO_EDGE),a.wrapS===J&&a.wrapT===J||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(n,e.TEXTURE_MAG_FILTER,C(a.magFilter)),e.texParameteri(n,e.TEXTURE_MIN_FILTER,C(a.minFilter)),a.minFilter!==Q&&a.minFilter!==te&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),a.compareFunction&&(e.texParameteri(n,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,O[a.compareFunction])),!0===t.has("EXT_texture_filter_anisotropic")){var s=t.get("EXT_texture_filter_anisotropic");if(a.magFilter===Q)return;if(a.minFilter!==ee&&a.minFilter!==ie)return;if(a.type===re&&!1===t.has("OES_texture_float_linear"))return;if(!1===d&&a.type===ae&&!1===t.has("OES_texture_half_float_linear"))return;(a.anisotropy>1||i.get(a).__currentAnisotropy)&&(e.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy)}}function z(t,n){var i=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",L));var r=n.source,a=x.get(r);void 0===a&&(a={},x.set(r,a));var s=function(e){var t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.colorSpace),t.join()}(n);if(s!==t.__cacheKey){void 0===a[s]&&(a[s]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,i=!0),a[s].usedTimes++;var l=a[t.__cacheKey];void 0!==l&&(a[t.__cacheKey].usedTimes--,0===l.usedTimes&&k(n)),t.__cacheKey=s,t.__webglTexture=a[s].texture}return i}function B(t,r,o){var s=e.TEXTURE_2D;(r.isDataArrayTexture||r.isCompressedArrayTexture)&&(s=e.TEXTURE_2D_ARRAY),r.isData3DTexture&&(s=e.TEXTURE_3D);var l=z(t,r),u=r.source;n.bindTexture(s,t.__webglTexture,e.TEXTURE0+o);var c=i.get(u);if(u.version!==c.__version||!0===l){n.activeTexture(e.TEXTURE0+o),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,r.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,r.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE);var h,f=function(e){return!d&&(e.wrapS!==J||e.wrapT!==J||e.minFilter!==Q&&e.minFilter!==te)}(r)&&!1===E(r.image),p=b(r.image,f,!1,v),m=E(p=j(r,p))||d,g=a.convert(r.format,r.colorSpace),y=a.convert(r.type),_=A(r.internalFormat,g,y,r.colorSpace);F(s,r,m);var x=r.mipmaps,M=d&&!0!==r.isVideoTexture,S=void 0===c.__version||!0===l,C=R(r,p,m);if(r.isDepthTexture)_=e.DEPTH_COMPONENT,d?_=r.type===re?e.DEPTH_COMPONENT32F:1014===r.type?e.DEPTH_COMPONENT24:r.type===oe?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT16:r.type===re&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),1026===r.format&&_===e.DEPTH_COMPONENT&&1012!==r.type&&1014!==r.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=1014,y=a.convert(r.type)),r.format===le&&_===e.DEPTH_COMPONENT&&(_=e.DEPTH_STENCIL,r.type!==oe&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=oe,y=a.convert(r.type))),S&&(M?n.texStorage2D(e.TEXTURE_2D,1,_,p.width,p.height):n.texImage2D(e.TEXTURE_2D,0,_,p.width,p.height,0,g,y,null));else if(r.isDataTexture)if(x.length>0&&m){M&&S&&n.texStorage2D(e.TEXTURE_2D,C,_,x[0].width,x[0].height);for(var L=0,P=x.length;L<P;L++)h=x[L],M?n.texSubImage2D(e.TEXTURE_2D,L,0,0,h.width,h.height,g,y,h.data):n.texImage2D(e.TEXTURE_2D,L,_,h.width,h.height,0,g,y,h.data);r.generateMipmaps=!1}else M?(S&&n.texStorage2D(e.TEXTURE_2D,C,_,p.width,p.height),n.texSubImage2D(e.TEXTURE_2D,0,0,0,p.width,p.height,g,y,p.data)):n.texImage2D(e.TEXTURE_2D,0,_,p.width,p.height,0,g,y,p.data);else if(r.isCompressedTexture)if(r.isCompressedArrayTexture){M&&S&&n.texStorage3D(e.TEXTURE_2D_ARRAY,C,_,x[0].width,x[0].height,p.depth);for(var k=0,U=x.length;k<U;k++)h=x[k],r.format!==se?null!==g?M?n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,k,0,0,0,h.width,h.height,p.depth,g,h.data,0,0):n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,k,_,h.width,h.height,p.depth,0,h.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):M?n.texSubImage3D(e.TEXTURE_2D_ARRAY,k,0,0,0,h.width,h.height,p.depth,g,y,h.data):n.texImage3D(e.TEXTURE_2D_ARRAY,k,_,h.width,h.height,p.depth,0,g,y,h.data)}else{M&&S&&n.texStorage2D(e.TEXTURE_2D,C,_,x[0].width,x[0].height);for(var I=0,N=x.length;I<N;I++)h=x[I],r.format!==se?null!==g?M?n.compressedTexSubImage2D(e.TEXTURE_2D,I,0,0,h.width,h.height,g,h.data):n.compressedTexImage2D(e.TEXTURE_2D,I,_,h.width,h.height,0,h.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):M?n.texSubImage2D(e.TEXTURE_2D,I,0,0,h.width,h.height,g,y,h.data):n.texImage2D(e.TEXTURE_2D,I,_,h.width,h.height,0,g,y,h.data)}else if(r.isDataArrayTexture)M?(S&&n.texStorage3D(e.TEXTURE_2D_ARRAY,C,_,p.width,p.height,p.depth),n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,p.width,p.height,p.depth,g,y,p.data)):n.texImage3D(e.TEXTURE_2D_ARRAY,0,_,p.width,p.height,p.depth,0,g,y,p.data);else if(r.isData3DTexture)M?(S&&n.texStorage3D(e.TEXTURE_3D,C,_,p.width,p.height,p.depth),n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,p.width,p.height,p.depth,g,y,p.data)):n.texImage3D(e.TEXTURE_3D,0,_,p.width,p.height,p.depth,0,g,y,p.data);else if(r.isFramebufferTexture){if(S)if(M)n.texStorage2D(e.TEXTURE_2D,C,_,p.width,p.height);else for(var D=p.width,O=p.height,B=0;B<C;B++)n.texImage2D(e.TEXTURE_2D,B,_,D,O,0,g,y,null),D>>=1,O>>=1}else if(x.length>0&&m){M&&S&&n.texStorage2D(e.TEXTURE_2D,C,_,x[0].width,x[0].height);for(var H=0,V=x.length;H<V;H++)h=x[H],M?n.texSubImage2D(e.TEXTURE_2D,H,0,0,g,y,h):n.texImage2D(e.TEXTURE_2D,H,_,g,y,h);r.generateMipmaps=!1}else M?(S&&n.texStorage2D(e.TEXTURE_2D,C,_,p.width,p.height),n.texSubImage2D(e.TEXTURE_2D,0,0,0,g,y,p)):n.texImage2D(e.TEXTURE_2D,0,_,g,y,p);T(r,m)&&w(s),c.__version=u.version,r.onUpdate&&r.onUpdate(r)}t.__version=r.version}function H(t,r,o,s,l,u){var c=a.convert(o.format,o.colorSpace),h=a.convert(o.type),d=A(o.internalFormat,c,h,o.colorSpace);if(!i.get(r).__hasExternalTextures){var f=Math.max(1,r.width>>u),p=Math.max(1,r.height>>u);l===e.TEXTURE_3D||l===e.TEXTURE_2D_ARRAY?n.texImage3D(l,u,d,f,p,r.depth,0,c,h,null):n.texImage2D(l,u,d,f,p,0,c,h,null)}n.bindFramebuffer(e.FRAMEBUFFER,t),X(r)?g.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,s,l,i.get(o).__webglTexture,0,W(r)):(l===e.TEXTURE_2D||l>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&l<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,s,l,i.get(o).__webglTexture,u),n.bindFramebuffer(e.FRAMEBUFFER,null)}function V(t,n,i){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer&&!n.stencilBuffer){var r=e.DEPTH_COMPONENT16;if(i||X(n)){var o=n.depthTexture;o&&o.isDepthTexture&&(o.type===re?r=e.DEPTH_COMPONENT32F:1014===o.type&&(r=e.DEPTH_COMPONENT24));var s=W(n);X(n)?g.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,s,r,n.width,n.height):e.renderbufferStorageMultisample(e.RENDERBUFFER,s,r,n.width,n.height)}else e.renderbufferStorage(e.RENDERBUFFER,r,n.width,n.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t)}else if(n.depthBuffer&&n.stencilBuffer){var l=W(n);i&&!1===X(n)?e.renderbufferStorageMultisample(e.RENDERBUFFER,l,e.DEPTH24_STENCIL8,n.width,n.height):X(n)?g.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,l,e.DEPTH24_STENCIL8,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t)}else for(var u=!0===n.isWebGLMultipleRenderTargets?n.texture:[n.texture],c=0;c<u.length;c++){var h=u[c],d=a.convert(h.format,h.colorSpace),f=a.convert(h.type),p=A(h.internalFormat,d,f,h.colorSpace),v=W(n);i&&!1===X(n)?e.renderbufferStorageMultisample(e.RENDERBUFFER,v,p,n.width,n.height):X(n)?g.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,v,p,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,p,n.width,n.height)}e.bindRenderbuffer(e.RENDERBUFFER,null)}function G(t){var r=i.get(t),a=!0===t.isWebGLCubeRenderTarget;if(t.depthTexture&&!r.__autoAllocateDepthBuffer){if(a)throw new Error("target.depthTexture not supported in Cube render targets");!function(t,r){if(r&&r.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(e.FRAMEBUFFER,t),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");i.get(r.depthTexture).__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),I(r.depthTexture,0);var a=i.get(r.depthTexture).__webglTexture,o=W(r);if(1026===r.depthTexture.format)X(r)?g.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,a,0,o):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,a,0);else{if(r.depthTexture.format!==le)throw new Error("Unknown depthTexture format");X(r)?g.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,a,0,o):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,a,0)}}(r.__webglFramebuffer,t)}else if(a){r.__webglDepthbuffer=[];for(var o=0;o<6;o++)n.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer[o]),r.__webglDepthbuffer[o]=e.createRenderbuffer(),V(r.__webglDepthbuffer[o],t,!1)}else n.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer),r.__webglDepthbuffer=e.createRenderbuffer(),V(r.__webglDepthbuffer,t,!1);n.bindFramebuffer(e.FRAMEBUFFER,null)}function W(e){return Math.min(m,e.samples)}function X(e){var n=i.get(e);return d&&e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function j(e,n){var i=e.colorSpace,r=e.format,a=e.type;return!0===e.isCompressedTexture||1035===e.format||i!==me&&i!==pe&&(i===ve?!1===d?!0===t.has("EXT_sRGB")&&r===se?(e.format=1035,e.minFilter=te,e.generateMipmaps=!1):n=je.sRGBToLinear(n):r===se&&1009===a||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",i)),n}this.allocateTextureUnit=function(){var e=U;return e>=f&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+f),U+=1,e},this.resetTextureUnits=function(){U=0},this.setTexture2D=I,this.setTexture2DArray=function(t,r){var a=i.get(t);t.version>0&&a.__version!==t.version?B(a,t,r):n.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+r)},this.setTexture3D=function(t,r){var a=i.get(t);t.version>0&&a.__version!==t.version?B(a,t,r):n.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+r)},this.setTextureCube=function(t,r){var o=i.get(t);t.version>0&&o.__version!==t.version?function(t,r,o){if(6===r.image.length){var s=z(t,r),l=r.source;n.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+o);var u=i.get(l);if(l.version!==u.__version||!0===s){n.activeTexture(e.TEXTURE0+o),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,r.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,r.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE);for(var c=r.isCompressedTexture||r.image[0].isCompressedTexture,h=r.image[0]&&r.image[0].isDataTexture,f=[],v=0;v<6;v++)f[v]=c||h?h?r.image[v].image:r.image[v]:b(r.image[v],!1,!0,p),f[v]=j(r,f[v]);var m,g=f[0],y=E(g)||d,_=a.convert(r.format,r.colorSpace),x=a.convert(r.type),M=A(r.internalFormat,_,x,r.colorSpace),S=d&&!0!==r.isVideoTexture,C=void 0===u.__version||!0===s,L=R(r,g,y);if(F(e.TEXTURE_CUBE_MAP,r,y),c){S&&C&&n.texStorage2D(e.TEXTURE_CUBE_MAP,L,M,g.width,g.height);for(var P=0;P<6;P++){m=f[P].mipmaps;for(var k=0;k<m.length;k++){var U=m[k];r.format!==se?null!==_?S?n.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+P,k,0,0,U.width,U.height,_,U.data):n.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+P,k,M,U.width,U.height,0,U.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):S?n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+P,k,0,0,U.width,U.height,_,x,U.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+P,k,M,U.width,U.height,0,_,x,U.data)}}}else{m=r.mipmaps,S&&C&&(m.length>0&&L++,n.texStorage2D(e.TEXTURE_CUBE_MAP,L,M,f[0].width,f[0].height));for(var I=0;I<6;I++)if(h){S?n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+I,0,0,0,f[I].width,f[I].height,_,x,f[I].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+I,0,M,f[I].width,f[I].height,0,_,x,f[I].data);for(var N=0;N<m.length;N++){var D=m[N].image[I].image;S?n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+I,N+1,0,0,D.width,D.height,_,x,D.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+I,N+1,M,D.width,D.height,0,_,x,D.data)}}else{S?n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+I,0,0,0,_,x,f[I]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+I,0,M,_,x,f[I]);for(var O=0;O<m.length;O++){var B=m[O];S?n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+I,O+1,0,0,_,x,B.image[I]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+I,O+1,M,_,x,B.image[I])}}}T(r,y)&&w(e.TEXTURE_CUBE_MAP),u.__version=l.version,r.onUpdate&&r.onUpdate(r)}t.__version=r.version}}(o,t,r):n.bindTexture(e.TEXTURE_CUBE_MAP,o.__webglTexture,e.TEXTURE0+r)},this.rebindTextures=function(t,n,r){var a=i.get(t);void 0!==n&&H(a.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),void 0!==r&&G(t)},this.setupRenderTarget=function(t){var s=t.texture,l=i.get(t),u=i.get(s);t.addEventListener("dispose",P),!0!==t.isWebGLMultipleRenderTargets&&(void 0===u.__webglTexture&&(u.__webglTexture=e.createTexture()),u.__version=s.version,o.memory.textures++);var c=!0===t.isWebGLCubeRenderTarget,h=!0===t.isWebGLMultipleRenderTargets,f=E(t)||d;if(c){l.__webglFramebuffer=[];for(var p=0;p<6;p++)if(d&&s.mipmaps&&s.mipmaps.length>0){l.__webglFramebuffer[p]=[];for(var v=0;v<s.mipmaps.length;v++)l.__webglFramebuffer[p][v]=e.createFramebuffer()}else l.__webglFramebuffer[p]=e.createFramebuffer()}else{if(d&&s.mipmaps&&s.mipmaps.length>0){l.__webglFramebuffer=[];for(var m=0;m<s.mipmaps.length;m++)l.__webglFramebuffer[m]=e.createFramebuffer()}else l.__webglFramebuffer=e.createFramebuffer();if(h)if(r.drawBuffers)for(var g=t.texture,y=0,_=g.length;y<_;y++){var x=i.get(g[y]);void 0===x.__webglTexture&&(x.__webglTexture=e.createTexture(),o.memory.textures++)}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(d&&t.samples>0&&!1===X(t)){var M=h?s:[s];l.__webglMultisampledFramebuffer=e.createFramebuffer(),l.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,l.__webglMultisampledFramebuffer);for(var S=0;S<M.length;S++){var b=M[S];l.__webglColorRenderbuffer[S]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,l.__webglColorRenderbuffer[S]);var R=a.convert(b.format,b.colorSpace),C=a.convert(b.type),L=A(b.internalFormat,R,C,b.colorSpace,!0===t.isXRRenderTarget),k=W(t);e.renderbufferStorageMultisample(e.RENDERBUFFER,k,L,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+S,e.RENDERBUFFER,l.__webglColorRenderbuffer[S])}e.bindRenderbuffer(e.RENDERBUFFER,null),t.depthBuffer&&(l.__webglDepthRenderbuffer=e.createRenderbuffer(),V(l.__webglDepthRenderbuffer,t,!0)),n.bindFramebuffer(e.FRAMEBUFFER,null)}}if(c){n.bindTexture(e.TEXTURE_CUBE_MAP,u.__webglTexture),F(e.TEXTURE_CUBE_MAP,s,f);for(var U=0;U<6;U++)if(d&&s.mipmaps&&s.mipmaps.length>0)for(var I=0;I<s.mipmaps.length;I++)H(l.__webglFramebuffer[U][I],t,s,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+U,I);else H(l.__webglFramebuffer[U],t,s,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+U,0);T(s,f)&&w(e.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(h){for(var N=t.texture,D=0,O=N.length;D<O;D++){var z=N[D],B=i.get(z);n.bindTexture(e.TEXTURE_2D,B.__webglTexture),F(e.TEXTURE_2D,z,f),H(l.__webglFramebuffer,t,z,e.COLOR_ATTACHMENT0+D,e.TEXTURE_2D,0),T(z,f)&&w(e.TEXTURE_2D)}n.unbindTexture()}else{var j=e.TEXTURE_2D;if((t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(d?j=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),n.bindTexture(j,u.__webglTexture),F(j,s,f),d&&s.mipmaps&&s.mipmaps.length>0)for(var Y=0;Y<s.mipmaps.length;Y++)H(l.__webglFramebuffer[Y],t,s,e.COLOR_ATTACHMENT0,j,Y);else H(l.__webglFramebuffer,t,s,e.COLOR_ATTACHMENT0,j,0);T(s,f)&&w(j),n.unbindTexture()}t.depthBuffer&&G(t)},this.updateRenderTargetMipmap=function(t){for(var r=E(t)||d,a=!0===t.isWebGLMultipleRenderTargets?t.texture:[t.texture],o=0,s=a.length;o<s;o++){var l=a[o];if(T(l,r)){var u=t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:e.TEXTURE_2D,c=i.get(l).__webglTexture;n.bindTexture(u,c),w(u),n.unbindTexture()}}},this.updateMultisampleRenderTarget=function(t){if(d&&t.samples>0&&!1===X(t)){var r=t.isWebGLMultipleRenderTargets?t.texture:[t.texture],a=t.width,o=t.height,s=e.COLOR_BUFFER_BIT,l=[],u=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,c=i.get(t),h=!0===t.isWebGLMultipleRenderTargets;if(h)for(var f=0;f<r.length;f++)n.bindFramebuffer(e.FRAMEBUFFER,c.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+f,e.RENDERBUFFER,null),n.bindFramebuffer(e.FRAMEBUFFER,c.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+f,e.TEXTURE_2D,null,0);n.bindFramebuffer(e.READ_FRAMEBUFFER,c.__webglMultisampledFramebuffer),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglFramebuffer);for(var p=0;p<r.length;p++){l.push(e.COLOR_ATTACHMENT0+p),t.depthBuffer&&l.push(u);var v=void 0!==c.__ignoreDepthValues&&c.__ignoreDepthValues;if(!1===v&&(t.depthBuffer&&(s|=e.DEPTH_BUFFER_BIT),t.stencilBuffer&&(s|=e.STENCIL_BUFFER_BIT)),h&&e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,c.__webglColorRenderbuffer[p]),!0===v&&(e.invalidateFramebuffer(e.READ_FRAMEBUFFER,[u]),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[u])),h){var m=i.get(r[p]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,m,0)}e.blitFramebuffer(0,0,a,o,0,0,a,o,s,e.NEAREST),y&&e.invalidateFramebuffer(e.READ_FRAMEBUFFER,l)}if(n.bindFramebuffer(e.READ_FRAMEBUFFER,null),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),h)for(var g=0;g<r.length;g++){n.bindFramebuffer(e.FRAMEBUFFER,c.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+g,e.RENDERBUFFER,c.__webglColorRenderbuffer[g]);var _=i.get(r[g]).__webglTexture;n.bindFramebuffer(e.FRAMEBUFFER,c.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+g,e.TEXTURE_2D,_,0)}n.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=G,this.setupFrameBufferTexture=H,this.useMultisampledRTT=X}function Ya(e,t,n){var i=n.isWebGL2;return{convert:function(n){var r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:pe;if(1009===n)return e.UNSIGNED_BYTE;if(1017===n)return e.UNSIGNED_SHORT_4_4_4_4;if(1018===n)return e.UNSIGNED_SHORT_5_5_5_1;if(1010===n)return e.BYTE;if(1011===n)return e.SHORT;if(1012===n)return e.UNSIGNED_SHORT;if(1013===n)return e.INT;if(1014===n)return e.UNSIGNED_INT;if(n===re)return e.FLOAT;if(n===ae)return i?e.HALF_FLOAT:null!==(r=t.get("OES_texture_half_float"))?r.HALF_FLOAT_OES:null;if(1021===n)return e.ALPHA;if(n===se)return e.RGBA;if(1024===n)return e.LUMINANCE;if(1025===n)return e.LUMINANCE_ALPHA;if(1026===n)return e.DEPTH_COMPONENT;if(n===le)return e.DEPTH_STENCIL;if(1035===n)return null!==(r=t.get("EXT_sRGB"))?r.SRGB_ALPHA_EXT:null;if(n===ue)return e.RED;if(1029===n)return e.RED_INTEGER;if(n===ce)return e.RG;if(1031===n)return e.RG_INTEGER;if(1033===n)return e.RGBA_INTEGER;if(33776===n||33777===n||33778===n||33779===n)if(a===ve){if(null===(r=t.get("WEBGL_compressed_texture_s3tc_srgb")))return null;if(33776===n)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(33777===n)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(33778===n)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(33779===n)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(null===(r=t.get("WEBGL_compressed_texture_s3tc")))return null;if(33776===n)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===n)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===n)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===n)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===n||35841===n||35842===n||35843===n){if(null===(r=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(35840===n)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===n)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===n)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===n)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===n)return null!==(r=t.get("WEBGL_compressed_texture_etc1"))?r.COMPRESSED_RGB_ETC1_WEBGL:null;if(37492===n||37496===n){if(null===(r=t.get("WEBGL_compressed_texture_etc")))return null;if(37492===n)return a===ve?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(37496===n)return a===ve?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}if(37808===n||37809===n||37810===n||37811===n||37812===n||37813===n||37814===n||37815===n||37816===n||37817===n||37818===n||37819===n||37820===n||37821===n){if(null===(r=t.get("WEBGL_compressed_texture_astc")))return null;if(37808===n)return a===ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(37809===n)return a===ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(37810===n)return a===ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(37811===n)return a===ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(37812===n)return a===ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(37813===n)return a===ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(37814===n)return a===ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(37815===n)return a===ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(37816===n)return a===ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(37817===n)return a===ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(37818===n)return a===ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(37819===n)return a===ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(37820===n)return a===ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(37821===n)return a===ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}if(36492===n){if(null===(r=t.get("EXT_texture_compression_bptc")))return null;if(36492===n)return a===ve?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT}if(36283===n||36284===n||36285===n||36286===n){if(null===(r=t.get("EXT_texture_compression_rgtc")))return null;if(36492===n)return r.COMPRESSED_RED_RGTC1_EXT;if(36284===n)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(36285===n)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(36286===n)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return n===oe?i?e.UNSIGNED_INT_24_8:null!==(r=t.get("WEBGL_depth_texture"))?r.UNSIGNED_INT_24_8_WEBGL:null:void 0!==e[n]?e[n]:null}}}var qa=function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return a(this,n),(e=t.call(this)).isArrayCamera=!0,e.cameras=i,e}return s(n)}(vi),Za=e("U",function(e){u(n,e);var t=g(n);function n(){var e;return a(this,n),(e=t.call(this)).isGroup=!0,e.type="Group",e}return s(n)}(an)),Ja={type:"move"},Ka=function(){function e(){a(this,e),this._targetRay=null,this._grip=null,this._hand=null}return s(e,[{key:"getHandSpace",value:function(){return null===this._hand&&(this._hand=new Za,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}},{key:"getTargetRaySpace",value:function(){return null===this._targetRay&&(this._targetRay=new Za,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new it,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new it),this._targetRay}},{key:"getGripSpace",value:function(){return null===this._grip&&(this._grip=new Za,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new it,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new it),this._grip}},{key:"dispatchEvent",value:function(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}},{key:"connect",value:function(e){if(e&&e.hand){var t=this._hand;if(t){var n,i=E(e.hand.values());try{for(i.s();!(n=i.n()).done;){var r=n.value;this._getHandJoint(t,r)}}catch(e){i.e(e)}finally{i.f()}}}return this.dispatchEvent({type:"connected",data:e}),this}},{key:"disconnect",value:function(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}},{key:"update",value:function(e,t,n){var i=null,r=null,a=null,o=this._targetRay,s=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(l&&e.hand){a=!0;var u,c=E(e.hand.values());try{for(c.s();!(u=c.n()).done;){var h=u.value,d=t.getJointPose(h,n),f=this._getHandJoint(l,h);null!==d&&(f.matrix.fromArray(d.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,f.jointRadius=d.radius),f.visible=null!==d}}catch(e){c.e(e)}finally{c.f()}var p=l.joints["index-finger-tip"],v=l.joints["thumb-tip"],m=p.position.distanceTo(v.position);l.inputState.pinching&&m>.025?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&m<=.015&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==s&&e.gripSpace&&null!==(r=t.getPose(e.gripSpace,n))&&(s.matrix.fromArray(r.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,r.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(r.linearVelocity)):s.hasLinearVelocity=!1,r.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(r.angularVelocity)):s.hasAngularVelocity=!1);null!==o&&(null===(i=t.getPose(e.targetRaySpace,n))&&null!==r&&(i=r),null!==i&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Ja)))}return null!==o&&(o.visible=null!==i),null!==s&&(s.visible=null!==r),null!==l&&(l.visible=null!==a),this}},{key:"_getHandJoint",value:function(e,t){if(void 0===e.joints[t.jointName]){var n=new Za;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}]),e}(),Qa=e("bc",function(e){u(n,e);var t=g(n);function n(e,i,r,o,s,l,u,c,h,d){var f;if(a(this,n),1026!==(d=void 0!==d?d:1026)&&d!==le)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");return void 0===r&&1026===d&&(r=1014),void 0===r&&d===le&&(r=oe),(f=t.call(this,null,o,s,l,u,c,d,r,h)).isDepthTexture=!0,f.image={width:e,height:i},f.magFilter=void 0!==u?u:Q,f.minFilter=void 0!==c?c:Q,f.flipY=!1,f.generateMipmaps=!1,f.compareFunction=null,f}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.compareFunction=e.compareFunction,this}},{key:"toJSON",value:function(e){var t=_(c(n.prototype),"toJSON",this).call(this,e);return null!==this.compareFunction&&(t.compareFunction=this.compareFunction),t}}]),n}(Ke)),$a=function(e){u(i,e);var t=g(i);function i(e,o){var s;a(this,i);var l=v(s=t.call(this)),u=null,c=1,h=null,d="local-floor",f=1,p=null,m=null,g=null,y=null,_=null,x=null,M=o.getContextAttributes(),S=null,b=null,E=[],T=[],w=new vi;w.layers.enable(1),w.viewport=new Qe;var A=new vi;A.layers.enable(2),A.viewport=new Qe;var R=[w,A],C=new qa;C.layers.enable(1),C.layers.enable(2);var L=null,P=null;function k(e){var t=T.indexOf(e.inputSource);if(-1!==t){var n=E[t];void 0!==n&&(n.update(e.inputSource,e.frame,p||h),n.dispatchEvent({type:e.type,data:e.inputSource}))}}function U(){u.removeEventListener("select",k),u.removeEventListener("selectstart",k),u.removeEventListener("selectend",k),u.removeEventListener("squeeze",k),u.removeEventListener("squeezestart",k),u.removeEventListener("squeezeend",k),u.removeEventListener("end",U),u.removeEventListener("inputsourceschange",I);for(var t=0;t<E.length;t++){var n=T[t];null!==n&&(T[t]=null,E[t].disconnect(n))}L=null,P=null,e.setRenderTarget(S),_=null,y=null,g=null,u=null,b=null,z.stop(),l.isPresenting=!1,l.dispatchEvent({type:"sessionend"})}function I(e){for(var t=0;t<e.removed.length;t++){var n=e.removed[t],i=T.indexOf(n);i>=0&&(T[i]=null,E[i].disconnect(n))}for(var r=0;r<e.added.length;r++){var a=e.added[r],o=T.indexOf(a);if(-1===o){for(var s=0;s<E.length;s++){if(s>=T.length){T.push(a),o=s;break}if(null===T[s]){T[s]=a,o=s;break}}if(-1===o)break}var l=E[o];l&&l.connect(a)}}s.cameraAutoUpdate=!0,s.enabled=!1,s.isPresenting=!1,s.getController=function(e){var t=E[e];return void 0===t&&(t=new Ka,E[e]=t),t.getTargetRaySpace()},s.getControllerGrip=function(e){var t=E[e];return void 0===t&&(t=new Ka,E[e]=t),t.getGripSpace()},s.getHand=function(e){var t=E[e];return void 0===t&&(t=new Ka,E[e]=t),t.getHandSpace()},s.setFramebufferScaleFactor=function(e){c=e,!0===l.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},s.setReferenceSpaceType=function(e){d=e,!0===l.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},s.getReferenceSpace=function(){return p||h},s.setReferenceSpace=function(e){p=e},s.getBaseLayer=function(){return null!==y?y:_},s.getBinding=function(){return g},s.getFrame=function(){return x},s.getSession=function(){return u},s.setSession=function(){var t,i=(t=n().mark((function t(i){var r,a,s,v,m;return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null===(u=i)){t.next=25;break}if(S=e.getRenderTarget(),u.addEventListener("select",k),u.addEventListener("selectstart",k),u.addEventListener("selectend",k),u.addEventListener("squeeze",k),u.addEventListener("squeezestart",k),u.addEventListener("squeezeend",k),u.addEventListener("end",U),u.addEventListener("inputsourceschange",I),!0===M.xrCompatible){t.next=14;break}return t.next=14,o.makeXRCompatible();case 14:return void 0===u.renderState.layers||!1===e.capabilities.isWebGL2?(r={antialias:void 0!==u.renderState.layers||M.antialias,alpha:!0,depth:M.depth,stencil:M.stencil,framebufferScaleFactor:c},_=new XRWebGLLayer(u,o,r),u.updateRenderState({baseLayer:_}),b=new $e(_.framebufferWidth,_.framebufferHeight,{format:se,type:1009,colorSpace:e.outputColorSpace,stencilBuffer:M.stencil})):(a=null,s=null,v=null,M.depth&&(v=M.stencil?o.DEPTH24_STENCIL8:o.DEPTH_COMPONENT24,a=M.stencil?le:1026,s=M.stencil?oe:1014),m={colorFormat:o.RGBA8,depthFormat:v,scaleFactor:c},g=new XRWebGLBinding(u,o),y=g.createProjectionLayer(m),u.updateRenderState({layers:[y]}),b=new $e(y.textureWidth,y.textureHeight,{format:se,type:1009,depthTexture:new Qa(y.textureWidth,y.textureHeight,s,void 0,void 0,void 0,void 0,void 0,void 0,a),stencilBuffer:M.stencil,colorSpace:e.outputColorSpace,samples:M.antialias?4:0}),e.properties.get(b).__ignoreDepthValues=y.ignoreDepthValues),b.isXRRenderTarget=!0,this.setFoveation(f),p=null,t.next=20,u.requestReferenceSpace(d);case 20:h=t.sent,z.setContext(u),z.start(),l.isPresenting=!0,l.dispatchEvent({type:"sessionstart"});case 25:case"end":return t.stop()}}),t,this)})),function(){var e=this,n=arguments;return new Promise((function(i,a){var o=t.apply(e,n);function s(e){r(o,i,a,s,l,"next",e)}function l(e){r(o,i,a,s,l,"throw",e)}s(void 0)}))});return function(e){return i.apply(this,arguments)}}(),s.getEnvironmentBlendMode=function(){if(null!==u)return u.environmentBlendMode};var N=new it,D=new it;function O(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}s.updateCamera=function(e){if(null!==u){C.near=A.near=w.near=e.near,C.far=A.far=w.far=e.far,L===C.near&&P===C.far||(u.updateRenderState({depthNear:C.near,depthFar:C.far}),L=C.near,P=C.far);var t=e.parent,n=C.cameras;O(C,t);for(var i=0;i<n.length;i++)O(n[i],t);2===n.length?function(e,t,n){N.setFromMatrixPosition(t.matrixWorld),D.setFromMatrixPosition(n.matrixWorld);var i=N.distanceTo(D),r=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=r[14]/(r[10]-1),s=r[14]/(r[10]+1),l=(r[9]+1)/r[5],u=(r[9]-1)/r[5],c=(r[8]-1)/r[0],h=(a[8]+1)/a[0],d=o*c,f=o*h,p=i/(-c+h),v=p*-c;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(v),e.translateZ(p),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert();var m=o+p,g=s+p,y=d-v,_=f+(i-v),x=l*s/g*m,M=u*s/g*m;e.projectionMatrix.makePerspective(y,_,x,M,m,g),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}(C,w,A):C.projectionMatrix.copy(w.projectionMatrix),function(e,t,n){null===n?e.matrix.copy(t.matrixWorld):(e.matrix.copy(n.matrixWorld),e.matrix.invert(),e.matrix.multiply(t.matrixWorld)),e.matrix.decompose(e.position,e.quaternion,e.scale),e.updateMatrixWorld(!0);for(var i=e.children,r=0,a=i.length;r<a;r++)i[r].updateMatrixWorld(!0);e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse),e.isPerspectiveCamera&&(e.fov=2*Me*Math.atan(1/e.projectionMatrix.elements[5]),e.zoom=1)}(e,C,t)}},s.getCamera=function(){return C},s.getFoveation=function(){if(null!==y||null!==_)return f},s.setFoveation=function(e){f=e,null!==y&&(y.fixedFoveation=e),null!==_&&void 0!==_.fixedFoveation&&(_.fixedFoveation=e)};var F=null,z=new wi;return z.setAnimationLoop((function(t,n){if(m=n.getViewerPose(p||h),x=n,null!==m){var i=m.views;null!==_&&(e.setRenderTargetFramebuffer(b,_.framebuffer),e.setRenderTarget(b));var r=!1;i.length!==C.cameras.length&&(C.cameras.length=0,r=!0);for(var a=0;a<i.length;a++){var o=i[a],s=null;if(null!==_)s=_.getViewport(o);else{var u=g.getViewSubImage(y,o);s=u.viewport,0===a&&(e.setRenderTargetTextures(b,u.colorTexture,y.ignoreDepthValues?void 0:u.depthStencilTexture),e.setRenderTarget(b))}var c=R[a];void 0===c&&((c=new vi).layers.enable(a),c.viewport=new Qe,R[a]=c),c.matrix.fromArray(o.transform.matrix),c.matrix.decompose(c.position,c.quaternion,c.scale),c.projectionMatrix.fromArray(o.projectionMatrix),c.projectionMatrixInverse.copy(c.projectionMatrix).invert(),c.viewport.set(s.x,s.y,s.width,s.height),0===a&&(C.matrix.copy(c.matrix),C.matrix.decompose(C.position,C.quaternion,C.scale)),!0===r&&C.cameras.push(c)}}for(var d=0;d<E.length;d++){var f=T[d],v=E[d];null!==f&&void 0!==v&&v.update(f,n,p||h)}F&&F(t,n),n.detectedPlanes&&l.dispatchEvent({type:"planesdetected",data:n}),x=null})),s.setAnimationLoop=function(e){F=e},s.dispose=function(){},s}return s(i)}(ge);function eo(e,t){function n(e,t){!0===e.matrixAutoUpdate&&e.updateMatrix(),t.value.copy(e.matrix)}function i(i,r){i.opacity.value=r.opacity,r.color&&i.diffuse.value.copy(r.color),r.emissive&&i.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),r.map&&(i.map.value=r.map,n(r.map,i.mapTransform)),r.alphaMap&&(i.alphaMap.value=r.alphaMap,n(r.alphaMap,i.alphaMapTransform)),r.bumpMap&&(i.bumpMap.value=r.bumpMap,n(r.bumpMap,i.bumpMapTransform),i.bumpScale.value=r.bumpScale,r.side===k&&(i.bumpScale.value*=-1)),r.normalMap&&(i.normalMap.value=r.normalMap,n(r.normalMap,i.normalMapTransform),i.normalScale.value.copy(r.normalScale),r.side===k&&i.normalScale.value.negate()),r.displacementMap&&(i.displacementMap.value=r.displacementMap,n(r.displacementMap,i.displacementMapTransform),i.displacementScale.value=r.displacementScale,i.displacementBias.value=r.displacementBias),r.emissiveMap&&(i.emissiveMap.value=r.emissiveMap,n(r.emissiveMap,i.emissiveMapTransform)),r.specularMap&&(i.specularMap.value=r.specularMap,n(r.specularMap,i.specularMapTransform)),r.alphaTest>0&&(i.alphaTest.value=r.alphaTest);var a=t.get(r).envMap;if(a&&(i.envMap.value=a,i.flipEnvMap.value=a.isCubeTexture&&!1===a.isRenderTargetTexture?-1:1,i.reflectivity.value=r.reflectivity,i.ior.value=r.ior,i.refractionRatio.value=r.refractionRatio),r.lightMap){i.lightMap.value=r.lightMap;var o=!0===e._useLegacyLights?Math.PI:1;i.lightMapIntensity.value=r.lightMapIntensity*o,n(r.lightMap,i.lightMapTransform)}r.aoMap&&(i.aoMap.value=r.aoMap,i.aoMapIntensity.value=r.aoMapIntensity,n(r.aoMap,i.aoMapTransform))}return{refreshFogUniforms:function(t,n){n.color.getRGB(t.fogColor.value,hi(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)},refreshMaterialUniforms:function(e,r,a,o,s){r.isMeshBasicMaterial||r.isMeshLambertMaterial?i(e,r):r.isMeshToonMaterial?(i(e,r),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(e,r)):r.isMeshPhongMaterial?(i(e,r),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}(e,r)):r.isMeshStandardMaterial?(i(e,r),function(e,i){e.metalness.value=i.metalness,i.metalnessMap&&(e.metalnessMap.value=i.metalnessMap,n(i.metalnessMap,e.metalnessMapTransform)),e.roughness.value=i.roughness,i.roughnessMap&&(e.roughnessMap.value=i.roughnessMap,n(i.roughnessMap,e.roughnessMapTransform)),t.get(i).envMap&&(e.envMapIntensity.value=i.envMapIntensity)}(e,r),r.isMeshPhysicalMaterial&&function(e,t,i){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,n(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform))),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,n(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),t.side===k&&e.clearcoatNormalScale.value.negate())),t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,n(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform))),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=i.texture,e.transmissionSamplerSize.value.set(i.width,i.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,n(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,n(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,n(t.anisotropyMap,e.anisotropyMapTransform))),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,n(t.specularColorMap,e.specularColorMapTransform)),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,n(t.specularIntensityMap,e.specularIntensityMapTransform))}(e,r,s)):r.isMeshMatcapMaterial?(i(e,r),function(e,t){t.matcap&&(e.matcap.value=t.matcap)}(e,r)):r.isMeshDepthMaterial?i(e,r):r.isMeshDistanceMaterial?(i(e,r),function(e,n){var i=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(i.matrixWorld),e.nearDistance.value=i.shadow.camera.near,e.farDistance.value=i.shadow.camera.far}(e,r)):r.isMeshNormalMaterial?i(e,r):r.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform))}(e,r),r.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,r)):r.isPointsMaterial?function(e,t,i,r){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*i,e.scale.value=.5*r,t.map&&(e.map.value=t.map,n(t.map,e.uvTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,r,a,o):r.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,r):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function to(e,t,n,i){var r={},a={},o=[],s=n.isWebGL2?e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(e,t,n){var i=e.value;if(void 0===n[t]){if("number"==typeof i)n[t]=i;else{for(var r=Array.isArray(i)?i:[i],a=[],o=0;o<r.length;o++)a.push(r[o].clone());n[t]=a}return!0}if("number"==typeof i){if(n[t]!==i)return n[t]=i,!0}else for(var s=Array.isArray(n[t])?n[t]:[n[t]],l=Array.isArray(i)?i:[i],u=0;u<s.length;u++){var c=s[u];if(!1===c.equals(l[u]))return c.copy(l[u]),!0}return!1}function u(e){var t={boundary:0,storage:0};return"number"==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?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",e),t}function c(t){var n=t.target;n.removeEventListener("dispose",c);var i=o.indexOf(n.__bindingPointIndex);o.splice(i,1),e.deleteBuffer(r[n.id]),delete r[n.id],delete a[n.id]}return{bind:function(e,t){var n=t.program;i.uniformBlockBinding(e,n)},update:function(n,h){var d=r[n.id];void 0===d&&(function(e){for(var t=e.uniforms,n=0,i=0,r=0,a=t.length;r<a;r++){for(var o=t[r],s={boundary:0,storage:0},l=Array.isArray(o.value)?o.value:[o.value],c=0,h=l.length;c<h;c++){var d=u(l[c]);s.boundary+=d.boundary,s.storage+=d.storage}if(o.__data=new Float32Array(s.storage/Float32Array.BYTES_PER_ELEMENT),o.__offset=n,r>0){var f=16-(i=n%16);0!==i&&f-s.boundary<0&&(n+=16-i,o.__offset=n)}n+=s.storage}(i=n%16)>0&&(n+=16-i),e.__size=n,e.__cache={}}(n),d=function(t){var n=function(){for(var e=0;e<s;e++)if(-1===o.indexOf(e))return o.push(e),e;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();t.__bindingPointIndex=n;var i=e.createBuffer(),r=t.__size,a=t.usage;return e.bindBuffer(e.UNIFORM_BUFFER,i),e.bufferData(e.UNIFORM_BUFFER,r,a),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,n,i),i}(n),r[n.id]=d,n.addEventListener("dispose",c));var f=h.program;i.updateUBOMapping(n,f);var p=t.render.frame;a[n.id]!==p&&(function(t){var n=r[t.id],i=t.uniforms,a=t.__cache;e.bindBuffer(e.UNIFORM_BUFFER,n);for(var o=0,s=i.length;o<s;o++){var c=i[o];if(!0===l(c,o,a)){for(var h=c.__offset,d=Array.isArray(c.value)?c.value:[c.value],f=0,p=0;p<d.length;p++){var v=d[p],m=u(v);"number"==typeof v?(c.__data[0]=v,e.bufferSubData(e.UNIFORM_BUFFER,h+f,c.__data)):v.isMatrix3?(c.__data[0]=v.elements[0],c.__data[1]=v.elements[1],c.__data[2]=v.elements[2],c.__data[3]=v.elements[0],c.__data[4]=v.elements[3],c.__data[5]=v.elements[4],c.__data[6]=v.elements[5],c.__data[7]=v.elements[0],c.__data[8]=v.elements[6],c.__data[9]=v.elements[7],c.__data[10]=v.elements[8],c.__data[11]=v.elements[0]):(v.toArray(c.__data,f),f+=m.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(e.UNIFORM_BUFFER,h,c.__data)}}e.bindBuffer(e.UNIFORM_BUFFER,null)}(n),a[n.id]=p)},dispose:function(){for(var t in r)e.deleteBuffer(r[t]);o=[],r={},a={}}}}function no(){var e=Ne("canvas");return e.style.display="block",e}(function(e){u(n,e);var t=g(n);function n(){return a(this,n),t.apply(this,arguments)}return s(n)})(e("bG",function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a(this,e);var n,i=t.canvas,r=void 0===i?no():i,o=t.context,s=void 0===o?null:o,l=t.depth,u=void 0===l||l,c=t.stencil,h=void 0===c||c,d=t.alpha,f=void 0!==d&&d,p=t.antialias,v=void 0!==p&&p,m=t.premultipliedAlpha,g=void 0===m||m,y=t.preserveDrawingBuffer,_=void 0!==y&&y,x=t.powerPreference,M=void 0===x?"default":x,S=t.failIfMajorPerformanceCaveat,b=void 0!==S&&S;this.isWebGLRenderer=!0,n=null!==s?s.getContextAttributes().alpha:f;var E=new Uint32Array(4),T=new Int32Array(4),w=null,A=null,R=[],C=[];this.domElement=r,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.outputColorSpace=ve,this._useLegacyLights=!1,this.toneMapping=G,this.toneMappingExposure=1;var L=this,I=!1,N=0,D=0,O=null,F=-1,z=null,B=new Qe,H=new Qe,V=null,W=new En(0),X=0,j=r.width,Y=r.height,q=1,Z=null,J=null,K=new Qe(0,0,j,Y),Q=new Qe(0,0,j,Y),$=!1,ee=new Ti,te=!1,ne=!1,le=null,ue=new Ut,ce=new Pe,he=new it,de={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function fe(){return null===O?q:1}var pe,ge,ye,_e,xe,Me,Se,be,Ee,Te,we,Ae,Ce,Le,ke,Ue,Ie,Ne,De,Oe,Fe,ze,Be,He,Ve=s;function Ge(e,t){for(var n=0;n<e.length;n++){var i=e[n],a=r.getContext(i,t);if(null!==a)return a}return null}try{var We={alpha:!0,depth:u,stencil:h,antialias:v,premultipliedAlpha:g,preserveDrawingBuffer:_,powerPreference:M,failIfMajorPerformanceCaveat:b};if("setAttribute"in r&&r.setAttribute("data-engine","three.js r".concat("155")),r.addEventListener("webglcontextlost",qe,!1),r.addEventListener("webglcontextrestored",Ze,!1),r.addEventListener("webglcontextcreationerror",Je,!1),null===Ve){var Xe=["webgl2","webgl","experimental-webgl"];if(!0===L.isWebGL1Renderer&&Xe.shift(),null===(Ve=Ge(Xe,We)))throw Ge(Xe)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}"undefined"!=typeof WebGLRenderingContext&&Ve instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),void 0===Ve.getShaderPrecisionFormat&&(Ve.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}function je(){pe=new $i(Ve),ge=new Di(Ve,pe,t),pe.init(ge),ze=new Ya(Ve,pe,ge),ye=new Xa(Ve,pe,ge),_e=new nr(Ve),xe=new Pa,Me=new ja(Ve,pe,ye,xe,ge,ze,_e),Se=new Fi(L),be=new Qi(L),Ee=new Ai(Ve,ge),Be=new Ii(Ve,pe,Ee,ge),Te=new er(Ve,Ee,_e,Be),we=new or(Ve,Te,Ee,_e),De=new ar(Ve,ge,Me),Ue=new Oi(xe),Ae=new La(L,Se,be,pe,ge,Be,Ue),Ce=new eo(L,xe),Le=new Na,ke=new Ha(pe,ge),Ne=new Ui(L,Se,be,ye,we,n,g),Ie=new Wa(L,we,ge),He=new to(Ve,_e,ge,ye),Oe=new Ni(Ve,pe,_e,ge),Fe=new tr(Ve,pe,_e,ge),_e.programs=Ae.programs,L.capabilities=ge,L.extensions=pe,L.properties=xe,L.renderLists=Le,L.shadowMap=Ie,L.state=ye,L.info=_e}je();var Ye=new $a(L,Ve);function qe(e){e.preventDefault(),I=!0}function Ze(){I=!1;var e=_e.autoReset,t=Ie.enabled,n=Ie.autoUpdate,i=Ie.needsUpdate,r=Ie.type;je(),_e.autoReset=e,Ie.enabled=t,Ie.autoUpdate=n,Ie.needsUpdate=i,Ie.type=r}function Je(e){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function Ke(e){var t=e.target;t.removeEventListener("dispose",Ke),et(t)}function et(e){tt(e),xe.remove(e)}function tt(e){var t=xe.get(e).programs;void 0!==t&&(t.forEach((function(e){Ae.releaseProgram(e)})),e.isShaderMaterial&&Ae.releaseShaderCache(e))}this.xr=Ye,this.getContext=function(){return Ve},this.getContextAttributes=function(){return Ve.getContextAttributes()},this.forceContextLoss=function(){var e=pe.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){var e=pe.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return q},this.setPixelRatio=function(e){void 0!==e&&(q=e,this.setSize(j,Y,!1))},this.getSize=function(e){return e.set(j,Y)},this.setSize=function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];Ye.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(j=e,Y=t,r.width=Math.floor(e*q),r.height=Math.floor(t*q),!0===n&&(r.style.width=e+"px",r.style.height=t+"px"),this.setViewport(0,0,e,t))},this.getDrawingBufferSize=function(e){return e.set(j*q,Y*q).floor()},this.setDrawingBufferSize=function(e,t,n){j=e,Y=t,q=n,r.width=Math.floor(e*n),r.height=Math.floor(t*n),this.setViewport(0,0,e,t)},this.getCurrentViewport=function(e){return e.copy(B)},this.getViewport=function(e){return e.copy(K)},this.setViewport=function(e,t,n,i){e.isVector4?K.set(e.x,e.y,e.z,e.w):K.set(e,t,n,i),ye.viewport(B.copy(K).multiplyScalar(q).floor())},this.getScissor=function(e){return e.copy(Q)},this.setScissor=function(e,t,n,i){e.isVector4?Q.set(e.x,e.y,e.z,e.w):Q.set(e,t,n,i),ye.scissor(H.copy(Q).multiplyScalar(q).floor())},this.getScissorTest=function(){return $},this.setScissorTest=function(e){ye.setScissorTest($=e)},this.setOpaqueSort=function(e){Z=e},this.setTransparentSort=function(e){J=e},this.getClearColor=function(e){return e.copy(Ne.getClearColor())},this.setClearColor=function(){Ne.setClearColor.apply(Ne,arguments)},this.getClearAlpha=function(){return Ne.getClearAlpha()},this.setClearAlpha=function(){Ne.setClearAlpha.apply(Ne,arguments)},this.clear=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=0;if(e){var r=!1;if(null!==O){var a=O.texture.format;r=1033===a||1031===a||1029===a}if(r){var o=O.texture.type,s=1009===o||1014===o||1012===o||o===oe||1017===o||1018===o,l=Ne.getClearColor(),u=Ne.getClearAlpha(),c=l.r,h=l.g,d=l.b;s?(E[0]=c,E[1]=h,E[2]=d,E[3]=u,Ve.clearBufferuiv(Ve.COLOR,0,E)):(T[0]=c,T[1]=h,T[2]=d,T[3]=u,Ve.clearBufferiv(Ve.COLOR,0,T))}else i|=Ve.COLOR_BUFFER_BIT}t&&(i|=Ve.DEPTH_BUFFER_BIT),n&&(i|=Ve.STENCIL_BUFFER_BIT),Ve.clear(i)},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(){r.removeEventListener("webglcontextlost",qe,!1),r.removeEventListener("webglcontextrestored",Ze,!1),r.removeEventListener("webglcontextcreationerror",Je,!1),Le.dispose(),ke.dispose(),xe.dispose(),Se.dispose(),be.dispose(),we.dispose(),Be.dispose(),He.dispose(),Ae.dispose(),Ye.dispose(),Ye.removeEventListener("sessionstart",at),Ye.removeEventListener("sessionend",ot),le&&(le.dispose(),le=null),st.stop()},this.renderBufferDirect=function(e,t,n,i,r,a){null===t&&(t=de);var o=r.isMesh&&r.matrixWorld.determinant()<0,s=vt(e,t,n,i,r);ye.setMaterial(i,o);var l=n.index,u=1;if(!0===i.wireframe){if(void 0===(l=Te.getWireframeAttribute(n)))return;u=2}var c=n.drawRange,h=n.attributes.position,d=c.start*u,f=(c.start+c.count)*u;null!==a&&(d=Math.max(d,a.start*u),f=Math.min(f,(a.start+a.count)*u)),null!==l?(d=Math.max(d,0),f=Math.min(f,l.count)):null!=h&&(d=Math.max(d,0),f=Math.min(f,h.count));var p=f-d;if(!(p<0||p===1/0)){var v;Be.setup(r,i,s,n,l);var m=Oe;if(null!==l&&(v=Ee.get(l),(m=Fe).setIndex(v)),r.isMesh)!0===i.wireframe?(ye.setLineWidth(i.wireframeLinewidth*fe()),m.setMode(Ve.LINES)):m.setMode(Ve.TRIANGLES);else if(r.isLine){var g=i.linewidth;void 0===g&&(g=1),ye.setLineWidth(g*fe()),r.isLineSegments?m.setMode(Ve.LINES):r.isLineLoop?m.setMode(Ve.LINE_LOOP):m.setMode(Ve.LINE_STRIP)}else r.isPoints?m.setMode(Ve.POINTS):r.isSprite&&m.setMode(Ve.TRIANGLES);if(r.isInstancedMesh)m.renderInstances(d,p,r.count);else if(n.isInstancedBufferGeometry){var y=void 0!==n._maxInstanceCount?n._maxInstanceCount:1/0,_=Math.min(n.instanceCount,y);m.renderInstances(d,p,_)}else m.render(d,p)}},this.compile=function(e,t){function n(e,t,n){!0===e.transparent&&e.side===U&&!1===e.forceSinglePass?(e.side=k,e.needsUpdate=!0,ft(e,t,n),e.side=P,e.needsUpdate=!0,ft(e,t,n),e.side=U):ft(e,t,n)}(A=ke.get(e)).init(),C.push(A),e.traverseVisible((function(e){e.isLight&&e.layers.test(t.layers)&&(A.pushLight(e),e.castShadow&&A.pushShadow(e))})),A.setupLights(L._useLegacyLights),e.traverse((function(t){var i=t.material;if(i)if(Array.isArray(i))for(var r=0;r<i.length;r++)n(i[r],e,t);else n(i,e,t)})),C.pop(),A=null};var nt=null;function rt(e){nt&&nt(e)}function at(){st.stop()}function ot(){st.start()}var st=new wi;function lt(e,t,n,i){if(!1!==e.visible){if(e.layers.test(t.layers))if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)A.pushLight(e),e.castShadow&&A.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||ee.intersectsSprite(e)){i&&he.setFromMatrixPosition(e.matrixWorld).applyMatrix4(ue);var r=we.update(e),a=e.material;a.visible&&w.push(e,r,a,n,he.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||ee.intersectsObject(e))){var o=we.update(e),s=e.material;if(i&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),he.copy(e.boundingSphere.center)):(null===o.boundingSphere&&o.computeBoundingSphere(),he.copy(o.boundingSphere.center)),he.applyMatrix4(e.matrixWorld).applyMatrix4(ue)),Array.isArray(s))for(var l=o.groups,u=0,c=l.length;u<c;u++){var h=l[u],d=s[h.materialIndex];d&&d.visible&&w.push(e,o,d,n,he.z,h)}else s.visible&&w.push(e,o,s,n,he.z,null)}for(var f=e.children,p=0,v=f.length;p<v;p++)lt(f[p],t,n,i)}}function ut(e,t,n,i){var r=e.opaque,a=e.transmissive,o=e.transparent;A.setupLightsView(n),!0===te&&Ue.setGlobalState(L.clippingPlanes,n),a.length>0&&ct(r,a,t,n),i&&ye.viewport(B.copy(i)),r.length>0&&ht(r,t,n),a.length>0&&ht(a,t,n),o.length>0&&ht(o,t,n),ye.buffers.depth.setTest(!0),ye.buffers.depth.setMask(!0),ye.buffers.color.setMask(!0),ye.setPolygonOffset(!1)}function ct(e,t,n,i){var r=ge.isWebGL2;null===le&&(le=new $e(1,1,{generateMipmaps:!0,type:pe.has("EXT_color_buffer_half_float")?ae:1009,minFilter:ie,samples:r?4:0})),L.getDrawingBufferSize(ce),r?le.setSize(ce.x,ce.y):le.setSize(Re(ce.x),Re(ce.y));var a=L.getRenderTarget();L.setRenderTarget(le),L.getClearColor(W),(X=L.getClearAlpha())<1&&L.setClearColor(16777215,.5),L.clear();var o=L.toneMapping;L.toneMapping=G,ht(e,n,i),Me.updateMultisampleRenderTarget(le),Me.updateRenderTargetMipmap(le);for(var s=!1,l=0,u=t.length;l<u;l++){var c=t[l],h=c.object,d=c.geometry,f=c.material,p=c.group;if(f.side===U&&h.layers.test(i.layers)){var v=f.side;f.side=k,f.needsUpdate=!0,dt(h,n,i,d,f,p),f.side=v,f.needsUpdate=!0,s=!0}}!0===s&&(Me.updateMultisampleRenderTarget(le),Me.updateRenderTargetMipmap(le)),L.setRenderTarget(a),L.setClearColor(W,X),L.toneMapping=o}function ht(e,t,n){for(var i=!0===t.isScene?t.overrideMaterial:null,r=0,a=e.length;r<a;r++){var o=e[r],s=o.object,l=o.geometry,u=null===i?o.material:i,c=o.group;s.layers.test(n.layers)&&dt(s,t,n,l,u,c)}}function dt(e,t,n,i,r,a){e.onBeforeRender(L,t,n,i,r,a),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),r.onBeforeRender(L,t,n,i,e,a),!0===r.transparent&&r.side===U&&!1===r.forceSinglePass?(r.side=k,r.needsUpdate=!0,L.renderBufferDirect(n,t,i,r,e,a),r.side=P,r.needsUpdate=!0,L.renderBufferDirect(n,t,i,r,e,a),r.side=U):L.renderBufferDirect(n,t,i,r,e,a),e.onAfterRender(L,t,n,i,r,a)}function ft(e,t,n){!0!==t.isScene&&(t=de);var i=xe.get(e),r=A.state.lights,a=A.state.shadowsArray,o=r.state.version,s=Ae.getParameters(e,r.state,a,t,n),l=Ae.getProgramCacheKey(s),u=i.programs;i.environment=e.isMeshStandardMaterial?t.environment:null,i.fog=t.fog,i.envMap=(e.isMeshStandardMaterial?be:Se).get(e.envMap||i.environment),void 0===u&&(e.addEventListener("dispose",Ke),u=new Map,i.programs=u);var c=u.get(l);if(void 0!==c){if(i.currentProgram===c&&i.lightsStateVersion===o)return pt(e,s),c}else s.uniforms=Ae.getUniforms(e),e.onBuild(n,s,L),e.onBeforeCompile(s,L),c=Ae.acquireProgram(s,l),u.set(l,c),i.uniforms=s.uniforms;var h=i.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(h.clippingPlanes=Ue.uniform),pt(e,s),i.needsLights=gt(e),i.lightsStateVersion=o,i.needsLights&&(h.ambientLightColor.value=r.state.ambient,h.lightProbe.value=r.state.probe,h.directionalLights.value=r.state.directional,h.directionalLightShadows.value=r.state.directionalShadow,h.spotLights.value=r.state.spot,h.spotLightShadows.value=r.state.spotShadow,h.rectAreaLights.value=r.state.rectArea,h.ltc_1.value=r.state.rectAreaLTC1,h.ltc_2.value=r.state.rectAreaLTC2,h.pointLights.value=r.state.point,h.pointLightShadows.value=r.state.pointShadow,h.hemisphereLights.value=r.state.hemi,h.directionalShadowMap.value=r.state.directionalShadowMap,h.directionalShadowMatrix.value=r.state.directionalShadowMatrix,h.spotShadowMap.value=r.state.spotShadowMap,h.spotLightMatrix.value=r.state.spotLightMatrix,h.spotLightMap.value=r.state.spotLightMap,h.pointShadowMap.value=r.state.pointShadowMap,h.pointShadowMatrix.value=r.state.pointShadowMatrix);var d=c.getUniforms(),f=ca.seqWithValue(d.seq,h);return i.currentProgram=c,i.uniformsList=f,c}function pt(e,t){var n=xe.get(e);n.outputColorSpace=t.outputColorSpace,n.instancing=t.instancing,n.instancingColor=t.instancingColor,n.skinning=t.skinning,n.morphTargets=t.morphTargets,n.morphNormals=t.morphNormals,n.morphColors=t.morphColors,n.morphTargetsCount=t.morphTargetsCount,n.numClippingPlanes=t.numClippingPlanes,n.numIntersection=t.numClipIntersection,n.vertexAlphas=t.vertexAlphas,n.vertexTangents=t.vertexTangents,n.toneMapping=t.toneMapping}function vt(e,t,n,i,r){!0!==t.isScene&&(t=de),Me.resetTextureUnits();var a=t.fog,o=i.isMeshStandardMaterial?t.environment:null,s=null===O?L.outputColorSpace:!0===O.isXRRenderTarget?O.texture.colorSpace:me,l=(i.isMeshStandardMaterial?be:Se).get(i.envMap||o),u=!0===i.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,c=!!n.attributes.tangent&&(!!i.normalMap||i.anisotropy>0),h=!!n.morphAttributes.position,d=!!n.morphAttributes.normal,f=!!n.morphAttributes.color,p=G;i.toneMapped&&(null!==O&&!0!==O.isXRRenderTarget||(p=L.toneMapping));var v=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,m=void 0!==v?v.length:0,g=xe.get(i),y=A.state.lights;if(!0===te&&(!0===ne||e!==z)){var _=e===z&&i.id===F;Ue.setState(i,e,_)}var x=!1;i.version===g.__version?g.needsLights&&g.lightsStateVersion!==y.state.version||g.outputColorSpace!==s||r.isInstancedMesh&&!1===g.instancing?x=!0:r.isInstancedMesh||!0!==g.instancing?r.isSkinnedMesh&&!1===g.skinning?x=!0:r.isSkinnedMesh||!0!==g.skinning?r.isInstancedMesh&&!0===g.instancingColor&&null===r.instanceColor||r.isInstancedMesh&&!1===g.instancingColor&&null!==r.instanceColor||g.envMap!==l||!0===i.fog&&g.fog!==a?x=!0:void 0===g.numClippingPlanes||g.numClippingPlanes===Ue.numPlanes&&g.numIntersection===Ue.numIntersection?(g.vertexAlphas!==u||g.vertexTangents!==c||g.morphTargets!==h||g.morphNormals!==d||g.morphColors!==f||g.toneMapping!==p||!0===ge.isWebGL2&&g.morphTargetsCount!==m)&&(x=!0):x=!0:x=!0:x=!0:(x=!0,g.__version=i.version);var M=g.currentProgram;!0===x&&(M=ft(i,t,r));var S=!1,b=!1,E=!1,T=M.getUniforms(),w=g.uniforms;if(ye.useProgram(M.program)&&(S=!0,b=!0,E=!0),i.id!==F&&(F=i.id,b=!0),S||z!==e){if(T.setValue(Ve,"projectionMatrix",e.projectionMatrix),ge.logarithmicDepthBuffer&&T.setValue(Ve,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),z!==e&&(z=e,b=!0,E=!0),i.isShaderMaterial||i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshStandardMaterial||i.envMap){var R=T.map.cameraPosition;void 0!==R&&R.setValue(Ve,he.setFromMatrixPosition(e.matrixWorld))}(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&T.setValue(Ve,"isOrthographic",!0===e.isOrthographicCamera),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial||i.isShadowMaterial||r.isSkinnedMesh)&&T.setValue(Ve,"viewMatrix",e.matrixWorldInverse)}if(r.isSkinnedMesh){T.setOptional(Ve,r,"bindMatrix"),T.setOptional(Ve,r,"bindMatrixInverse");var C=r.skeleton;C&&(ge.floatVertexTextures?(null===C.boneTexture&&C.computeBoneTexture(),T.setValue(Ve,"boneTexture",C.boneTexture,Me),T.setValue(Ve,"boneTextureSize",C.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}var P=n.morphAttributes;if((void 0!==P.position||void 0!==P.normal||void 0!==P.color&&!0===ge.isWebGL2)&&De.update(r,n,M),(b||g.receiveShadow!==r.receiveShadow)&&(g.receiveShadow=r.receiveShadow,T.setValue(Ve,"receiveShadow",r.receiveShadow)),i.isMeshGouraudMaterial&&null!==i.envMap&&(w.envMap.value=l,w.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1),b&&(T.setValue(Ve,"toneMappingExposure",L.toneMappingExposure),g.needsLights&&mt(w,E),a&&!0===i.fog&&Ce.refreshFogUniforms(w,a),Ce.refreshMaterialUniforms(w,i,q,Y,le),ca.upload(Ve,g.uniformsList,w,Me)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(ca.upload(Ve,g.uniformsList,w,Me),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&T.setValue(Ve,"center",r.center),T.setValue(Ve,"modelViewMatrix",r.modelViewMatrix),T.setValue(Ve,"normalMatrix",r.normalMatrix),T.setValue(Ve,"modelMatrix",r.matrixWorld),i.isShaderMaterial||i.isRawShaderMaterial)for(var k=i.uniformsGroups,U=0,I=k.length;U<I;U++)if(ge.isWebGL2){var N=k[U];He.update(N,M),He.bind(N,M)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.");return M}function mt(e,t){e.ambientLightColor.needsUpdate=t,e.lightProbe.needsUpdate=t,e.directionalLights.needsUpdate=t,e.directionalLightShadows.needsUpdate=t,e.pointLights.needsUpdate=t,e.pointLightShadows.needsUpdate=t,e.spotLights.needsUpdate=t,e.spotLightShadows.needsUpdate=t,e.rectAreaLights.needsUpdate=t,e.hemisphereLights.needsUpdate=t}function gt(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights}st.setAnimationLoop(rt),"undefined"!=typeof self&&st.setContext(self),this.setAnimationLoop=function(e){nt=e,Ye.setAnimationLoop(e),null===e?st.stop():st.start()},Ye.addEventListener("sessionstart",at),Ye.addEventListener("sessionend",ot),this.render=function(e,t){if(void 0===t||!0===t.isCamera){if(!0!==I){!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0===Ye.enabled&&!0===Ye.isPresenting&&(!0===Ye.cameraAutoUpdate&&Ye.updateCamera(t),t=Ye.getCamera()),!0===e.isScene&&e.onBeforeRender(L,e,t,O),(A=ke.get(e,C.length)).init(),C.push(A),ue.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),ee.setFromProjectionMatrix(ue),ne=this.localClippingEnabled,te=Ue.init(this.clippingPlanes,ne),(w=Le.get(e,R.length)).init(),R.push(w),lt(e,t,0,L.sortObjects),w.finish(),!0===L.sortObjects&&w.sort(Z,J),this.info.render.frame++,!0===te&&Ue.beginShadows();var n=A.state.shadowsArray;if(Ie.render(n,e,t),!0===te&&Ue.endShadows(),!0===this.info.autoReset&&this.info.reset(),Ne.render(w,e),A.setupLights(L._useLegacyLights),t.isArrayCamera)for(var i=t.cameras,r=0,a=i.length;r<a;r++){var o=i[r];ut(w,e,o,o.viewport)}else ut(w,e,t);null!==O&&(Me.updateMultisampleRenderTarget(O),Me.updateRenderTargetMipmap(O)),!0===e.isScene&&e.onAfterRender(L,e,t),Be.resetDefaultState(),F=-1,z=null,C.pop(),A=C.length>0?C[C.length-1]:null,R.pop(),w=R.length>0?R[R.length-1]:null}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.getActiveCubeFace=function(){return N},this.getActiveMipmapLevel=function(){return D},this.getRenderTarget=function(){return O},this.setRenderTargetTextures=function(e,t,n){xe.get(e.texture).__webglTexture=t,xe.get(e.depthTexture).__webglTexture=n;var i=xe.get(e);i.__hasExternalTextures=!0,i.__hasExternalTextures&&(i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||!0===pe.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),i.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(e,t){var n=xe.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;O=e,N=t,D=n;var i=!0,r=null,a=!1,o=!1;if(e){var s=xe.get(e);void 0!==s.__useDefaultFramebuffer?(ye.bindFramebuffer(Ve.FRAMEBUFFER,null),i=!1):void 0===s.__webglFramebuffer?Me.setupRenderTarget(e):s.__hasExternalTextures&&Me.rebindTextures(e,xe.get(e.texture).__webglTexture,xe.get(e.depthTexture).__webglTexture);var l=e.texture;(l.isData3DTexture||l.isDataArrayTexture||l.isCompressedArrayTexture)&&(o=!0);var u=xe.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=Array.isArray(u[t])?u[t][n]:u[t],a=!0):r=ge.isWebGL2&&e.samples>0&&!1===Me.useMultisampledRTT(e)?xe.get(e).__webglMultisampledFramebuffer:Array.isArray(u)?u[n]:u,B.copy(e.viewport),H.copy(e.scissor),V=e.scissorTest}else B.copy(K).multiplyScalar(q).floor(),H.copy(Q).multiplyScalar(q).floor(),V=$;var c=ye.bindFramebuffer(Ve.FRAMEBUFFER,r);if(c&&ge.drawBuffers&&i&&ye.drawBuffers(e,r),ye.viewport(B),ye.scissor(H),ye.setScissorTest(V),a){var h=xe.get(e.texture);Ve.framebufferTexture2D(Ve.FRAMEBUFFER,Ve.COLOR_ATTACHMENT0,Ve.TEXTURE_CUBE_MAP_POSITIVE_X+t,h.__webglTexture,n)}else if(o){var d=xe.get(e.texture),f=t||0;Ve.framebufferTextureLayer(Ve.FRAMEBUFFER,Ve.COLOR_ATTACHMENT0,d.__webglTexture,n||0,f)}F=-1},this.readRenderTargetPixels=function(e,t,n,i,r,a,o){if(e&&e.isWebGLRenderTarget){var s=xe.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(s=s[o]),s){ye.bindFramebuffer(Ve.FRAMEBUFFER,s);try{var l=e.texture,u=l.format,c=l.type;if(u!==se&&ze.convert(u)!==Ve.getParameter(Ve.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");var h=c===ae&&(pe.has("EXT_color_buffer_half_float")||ge.isWebGL2&&pe.has("EXT_color_buffer_float"));if(!(1009===c||ze.convert(c)===Ve.getParameter(Ve.IMPLEMENTATION_COLOR_READ_TYPE)||c===re&&(ge.isWebGL2||pe.has("OES_texture_float")||pe.has("WEBGL_color_buffer_float"))||h))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&Ve.readPixels(t,n,i,r,ze.convert(u),ze.convert(c),a)}finally{var d=null!==O?xe.get(O).__webglFramebuffer:null;ye.bindFramebuffer(Ve.FRAMEBUFFER,d)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=Math.pow(2,-n),r=Math.floor(t.image.width*i),a=Math.floor(t.image.height*i);Me.setTexture2D(t,0),Ve.copyTexSubImage2D(Ve.TEXTURE_2D,n,0,0,e.x,e.y,r,a),ye.unbindTexture()},this.copyTextureToTexture=function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=t.image.width,a=t.image.height,o=ze.convert(n.format),s=ze.convert(n.type);Me.setTexture2D(n,0),Ve.pixelStorei(Ve.UNPACK_FLIP_Y_WEBGL,n.flipY),Ve.pixelStorei(Ve.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),Ve.pixelStorei(Ve.UNPACK_ALIGNMENT,n.unpackAlignment),t.isDataTexture?Ve.texSubImage2D(Ve.TEXTURE_2D,i,e.x,e.y,r,a,o,s,t.image.data):t.isCompressedTexture?Ve.compressedTexSubImage2D(Ve.TEXTURE_2D,i,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,o,t.mipmaps[0].data):Ve.texSubImage2D(Ve.TEXTURE_2D,i,e.x,e.y,o,s,t.image),0===i&&n.generateMipmaps&&Ve.generateMipmap(Ve.TEXTURE_2D),ye.unbindTexture()},this.copyTextureToTexture3D=function(e,t,n,i){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(L.isWebGL1Renderer)console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");else{var a,o=e.max.x-e.min.x+1,s=e.max.y-e.min.y+1,l=e.max.z-e.min.z+1,u=ze.convert(i.format),c=ze.convert(i.type);if(i.isData3DTexture)Me.setTexture3D(i,0),a=Ve.TEXTURE_3D;else{if(!i.isDataArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");Me.setTexture2DArray(i,0),a=Ve.TEXTURE_2D_ARRAY}Ve.pixelStorei(Ve.UNPACK_FLIP_Y_WEBGL,i.flipY),Ve.pixelStorei(Ve.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),Ve.pixelStorei(Ve.UNPACK_ALIGNMENT,i.unpackAlignment);var h=Ve.getParameter(Ve.UNPACK_ROW_LENGTH),d=Ve.getParameter(Ve.UNPACK_IMAGE_HEIGHT),f=Ve.getParameter(Ve.UNPACK_SKIP_PIXELS),p=Ve.getParameter(Ve.UNPACK_SKIP_ROWS),v=Ve.getParameter(Ve.UNPACK_SKIP_IMAGES),m=n.isCompressedTexture?n.mipmaps[0]:n.image;Ve.pixelStorei(Ve.UNPACK_ROW_LENGTH,m.width),Ve.pixelStorei(Ve.UNPACK_IMAGE_HEIGHT,m.height),Ve.pixelStorei(Ve.UNPACK_SKIP_PIXELS,e.min.x),Ve.pixelStorei(Ve.UNPACK_SKIP_ROWS,e.min.y),Ve.pixelStorei(Ve.UNPACK_SKIP_IMAGES,e.min.z),n.isDataTexture||n.isData3DTexture?Ve.texSubImage3D(a,r,t.x,t.y,t.z,o,s,l,u,c,m.data):n.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),Ve.compressedTexSubImage3D(a,r,t.x,t.y,t.z,o,s,l,u,m.data)):Ve.texSubImage3D(a,r,t.x,t.y,t.z,o,s,l,u,c,m),Ve.pixelStorei(Ve.UNPACK_ROW_LENGTH,h),Ve.pixelStorei(Ve.UNPACK_IMAGE_HEIGHT,d),Ve.pixelStorei(Ve.UNPACK_SKIP_PIXELS,f),Ve.pixelStorei(Ve.UNPACK_SKIP_ROWS,p),Ve.pixelStorei(Ve.UNPACK_SKIP_IMAGES,v),0===r&&i.generateMipmaps&&Ve.generateMipmap(a),ye.unbindTexture()}},this.initTexture=function(e){e.isCubeTexture?Me.setTextureCube(e,0):e.isData3DTexture?Me.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?Me.setTexture2DArray(e,0):Me.setTexture2D(e,0),ye.unbindTexture()},this.resetState=function(){N=0,D=0,O=null,ye.reset(),Be.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}return s(e,[{key:"coordinateSystem",get:function(){return 2e3}},{key:"physicallyCorrectLights",get:function(){return console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights},set:function(e){console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}},{key:"outputEncoding",get:function(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===ve?3001:3e3},set:function(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=3001===e?ve:me}},{key:"useLegacyLights",get:function(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights},set:function(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}}]),e}())).prototype.isWebGL1Renderer=!0,e("bQ",function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;a(this,e),this.isFog=!0,this.name="",this.color=new En(t),this.near=n,this.far=i}return s(e,[{key:"clone",value:function(){return new e(this.color,this.near,this.far)}},{key:"toJSON",value:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}]),e}()),e("b9",function(e){u(n,e);var t=g(n);function n(){var e;return a(this,n),(e=t.call(this)).isScene=!0,e.type="Scene",e.background=null,e.environment=null,e.fog=null,e.backgroundBlurriness=0,e.backgroundIntensity=1,e.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:v(e)})),e}return s(n,[{key:"copy",value:function(e,t){return _(c(n.prototype),"copy",this).call(this,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,null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}},{key:"toJSON",value:function(e){var t=_(c(n.prototype),"toJSON",this).call(this,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}}]),n}(an)),e("p",function(){function e(t,n){a(this,e),this.isInterleavedBuffer=!0,this.array=t,this.stride=n,this.count=void 0!==t?t.length/n:0,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Se()}return s(e,[{key:"onUploadCallback",value:function(){}},{key:"needsUpdate",set:function(e){!0===e&&this.version++}},{key:"setUsage",value:function(e){return this.usage=e,this}},{key:"copy",value:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}},{key:"copyAt",value:function(e,t,n){e*=this.stride,n*=t.stride;for(var i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];return this}},{key:"set",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(e,t),this}},{key:"clone",value:function(e){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=Se()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);var t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}},{key:"onUpload",value:function(e){return this.onUploadCallback=e,this}},{key:"toJSON",value:function(e){return void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=Se()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}]),e}());var io=new it,ro=(e("q",function(){function e(t,n,i){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];a(this,e),this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=n,this.offset=i,this.normalized=r}return s(e,[{key:"count",get:function(){return this.data.count}},{key:"array",get:function(){return this.data.array}},{key:"needsUpdate",set:function(e){this.data.needsUpdate=e}},{key:"applyMatrix4",value:function(e){for(var t=0,n=this.data.count;t<n;t++)io.fromBufferAttribute(this,t),io.applyMatrix4(e),this.setXYZ(t,io.x,io.y,io.z);return this}},{key:"applyNormalMatrix",value:function(e){for(var t=0,n=this.count;t<n;t++)io.fromBufferAttribute(this,t),io.applyNormalMatrix(e),this.setXYZ(t,io.x,io.y,io.z);return this}},{key:"transformDirection",value:function(e){for(var t=0,n=this.count;t<n;t++)io.fromBufferAttribute(this,t),io.transformDirection(e),this.setXYZ(t,io.x,io.y,io.z);return this}},{key:"setX",value:function(e,t){return this.normalized&&(t=Le(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}},{key:"setY",value:function(e,t){return this.normalized&&(t=Le(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}},{key:"setZ",value:function(e,t){return this.normalized&&(t=Le(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}},{key:"setW",value:function(e,t){return this.normalized&&(t=Le(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}},{key:"getX",value:function(e){var t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=Ce(t,this.array)),t}},{key:"getY",value:function(e){var t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Ce(t,this.array)),t}},{key:"getZ",value:function(e){var t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Ce(t,this.array)),t}},{key:"getW",value:function(e){var t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Ce(t,this.array)),t}},{key:"setXY",value:function(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Le(t,this.array),n=Le(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}},{key:"setXYZ",value:function(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=Le(t,this.array),n=Le(n,this.array),i=Le(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}},{key:"setXYZW",value:function(e,t,n,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Le(t,this.array),n=Le(n,this.array),i=Le(i,this.array),r=Le(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=r,this}},{key:"clone",value:function(t){if(void 0===t){for(var n=[],i=0;i<this.count;i++)for(var r=i*this.data.stride+this.offset,a=0;a<this.itemSize;a++)n.push(this.data.array[r+a]);return new Pn(new this.array.constructor(n),this.itemSize,this.normalized)}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new e(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}},{key:"toJSON",value:function(e){if(void 0===e){for(var t=[],n=0;n<this.count;n++)for(var i=n*this.data.stride+this.offset,r=0;r<this.itemSize;r++)t.push(this.data.array[i+r]);return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}]),e}()),new it),ao=new Qe,oo=new Qe,so=new it,lo=new Ut,uo=new it,co=new Et,ho=new Ut,fo=new kt,po=(e("E",function(e){u(n,e);var t=g(n);function n(e,i){var r;return a(this,n),(r=t.call(this,e,i)).isSkinnedMesh=!0,r.type="SkinnedMesh",r.bindMode="attached",r.bindMatrix=new Ut,r.bindMatrixInverse=new Ut,r.boundingBox=null,r.boundingSphere=null,r}return s(n,[{key:"computeBoundingBox",value:function(){var e=this.geometry;null===this.boundingBox&&(this.boundingBox=new ot),this.boundingBox.makeEmpty();for(var t=e.getAttribute("position"),n=0;n<t.count;n++)uo.fromBufferAttribute(t,n),this.applyBoneTransform(n,uo),this.boundingBox.expandByPoint(uo)}},{key:"computeBoundingSphere",value:function(){var e=this.geometry;null===this.boundingSphere&&(this.boundingSphere=new Et),this.boundingSphere.makeEmpty();for(var t=e.getAttribute("position"),n=0;n<t.count;n++)uo.fromBufferAttribute(t,n),this.applyBoneTransform(n,uo),this.boundingSphere.expandByPoint(uo)}},{key:"copy",value:function(e,t){return _(c(n.prototype),"copy",this).call(this,e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}},{key:"raycast",value:function(e,t){var n=this.material,i=this.matrixWorld;void 0!==n&&(null===this.boundingSphere&&this.computeBoundingSphere(),co.copy(this.boundingSphere),co.applyMatrix4(i),!1!==e.ray.intersectsSphere(co)&&(ho.copy(i).invert(),fo.copy(e.ray).applyMatrix4(ho),null!==this.boundingBox&&!1===fo.intersectsBox(this.boundingBox)||this._computeIntersections(e,t,fo)))}},{key:"getVertexPosition",value:function(e,t){return _(c(n.prototype),"getVertexPosition",this).call(this,e,t),this.applyBoneTransform(e,t),t}},{key:"bind",value:function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}},{key:"pose",value:function(){this.skeleton.pose()}},{key:"normalizeSkinWeights",value:function(){for(var e=new Qe,t=this.geometry.attributes.skinWeight,n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);var r=1/e.manhattanLength();r!==1/0?e.multiplyScalar(r):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}},{key:"updateMatrixWorld",value:function(e){_(c(n.prototype),"updateMatrixWorld",this).call(this,e),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}},{key:"applyBoneTransform",value:function(e,t){var n=this.skeleton,i=this.geometry;ao.fromBufferAttribute(i.attributes.skinIndex,e),oo.fromBufferAttribute(i.attributes.skinWeight,e),ro.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(var r=0;r<4;r++){var a=oo.getComponent(r);if(0!==a){var o=ao.getComponent(r);lo.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(so.copy(ro).applyMatrix4(lo),a)}}return t.applyMatrix4(this.bindMatrixInverse)}},{key:"boneTransform",value:function(e,t){return console.warn("THREE.SkinnedMesh: .boneTransform() was renamed to .applyBoneTransform() in r151."),this.applyBoneTransform(e,t)}}]),n}(oi)),e("a0",function(e){u(n,e);var t=g(n);function n(){var e;return a(this,n),(e=t.call(this)).isBone=!0,e.type="Bone",e}return s(n)}(an))),vo=e("aq",function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3?arguments[3]:void 0,l=arguments.length>4?arguments[4]:void 0,u=arguments.length>5?arguments[5]:void 0,c=arguments.length>6?arguments[6]:void 0,h=arguments.length>7?arguments[7]:void 0,d=arguments.length>8&&void 0!==arguments[8]?arguments[8]:Q,f=arguments.length>9&&void 0!==arguments[9]?arguments[9]:Q,p=arguments.length>10?arguments[10]:void 0,v=arguments.length>11?arguments[11]:void 0;return a(this,n),(e=t.call(this,null,u,c,h,d,f,s,l,p,v)).isDataTexture=!0,e.image={data:i,width:r,height:o},e.generateMipmaps=!1,e.flipY=!1,e.unpackAlignment=1,e}return s(n)}(Ke)),mo=new Ut,go=new Ut,yo=(e("Z",function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];a(this,e),this.uuid=Se(),this.bones=t.slice(0),this.boneInverses=n,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.init()}return s(e,[{key:"init",value:function(){var e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(16*e.length),0===t.length)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(var n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new Ut)}}},{key:"calculateInverses",value:function(){this.boneInverses.length=0;for(var e=0,t=this.bones.length;e<t;e++){var n=new Ut;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}},{key:"pose",value:function(){for(var e=0,t=this.bones.length;e<t;e++){var n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(var i=0,r=this.bones.length;i<r;i++){var a=this.bones[i];a&&(a.parent&&a.parent.isBone?(a.matrix.copy(a.parent.matrixWorld).invert(),a.matrix.multiply(a.matrixWorld)):a.matrix.copy(a.matrixWorld),a.matrix.decompose(a.position,a.quaternion,a.scale))}}},{key:"update",value:function(){for(var e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture,r=0,a=e.length;r<a;r++){var o=e[r]?e[r].matrixWorld:go;mo.multiplyMatrices(o,t[r]),mo.toArray(n,16*r)}null!==i&&(i.needsUpdate=!0)}},{key:"clone",value:function(){return new e(this.bones,this.boneInverses)}},{key:"computeBoneTexture",value:function(){var e=Math.sqrt(4*this.bones.length);e=Ae(e),e=Math.max(e,4);var t=new Float32Array(e*e*4);t.set(this.boneMatrices);var n=new vo(t,e,e,se,re);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this.boneTextureSize=e,this}},{key:"getBoneByName",value:function(e){for(var t=0,n=this.bones.length;t<n;t++){var i=this.bones[t];if(i.name===e)return i}}},{key:"dispose",value:function(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}},{key:"fromJSON",value:function(e,t){this.uuid=e.uuid;for(var n=0,i=e.bones.length;n<i;n++){var r=e.bones[n],a=t[r];void 0===a&&(console.warn("THREE.Skeleton: No bone found with UUID:",r),a=new po),this.bones.push(a),this.boneInverses.push((new Ut).fromArray(e.boneInverses[n]))}return this.init(),this}},{key:"toJSON",value:function(){var e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;for(var t=this.bones,n=this.boneInverses,i=0,r=t.length;i<r;i++){var a=t[i];e.bones.push(a.uuid);var o=n[i];e.boneInverses.push(o.toArray())}return e}}]),e}()),function(e){u(n,e);var t=g(n);function n(e,i,r){var o,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return a(this,n),(o=t.call(this,e,i,r)).isInstancedBufferAttribute=!0,o.meshPerAttribute=s,o}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}},{key:"toJSON",value:function(){var e=_(c(n.prototype),"toJSON",this).call(this);return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}]),n}(Pn)),_o=new Ut,xo=new Ut,Mo=[],So=new ot,bo=new Ut,Eo=new oi,To=new Et,wo=(e("I",function(e){u(n,e);var t=g(n);function n(e,i,r){var o;a(this,n),(o=t.call(this,e,i)).isInstancedMesh=!0,o.instanceMatrix=new yo(new Float32Array(16*r),16),o.instanceColor=null,o.count=r,o.boundingBox=null,o.boundingSphere=null;for(var s=0;s<r;s++)o.setMatrixAt(s,bo);return o}return s(n,[{key:"computeBoundingBox",value:function(){var e=this.geometry,t=this.count;null===this.boundingBox&&(this.boundingBox=new ot),null===e.boundingBox&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(var n=0;n<t;n++)this.getMatrixAt(n,_o),So.copy(e.boundingBox).applyMatrix4(_o),this.boundingBox.union(So)}},{key:"computeBoundingSphere",value:function(){var e=this.geometry,t=this.count;null===this.boundingSphere&&(this.boundingSphere=new Et),null===e.boundingSphere&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(var n=0;n<t;n++)this.getMatrixAt(n,_o),To.copy(e.boundingSphere).applyMatrix4(_o),this.boundingSphere.union(To)}},{key:"copy",value:function(e,t){return _(c(n.prototype),"copy",this).call(this,e,t),this.instanceMatrix.copy(e.instanceMatrix),null!==e.instanceColor&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}},{key:"getColorAt",value:function(e,t){t.fromArray(this.instanceColor.array,3*e)}},{key:"getMatrixAt",value:function(e,t){t.fromArray(this.instanceMatrix.array,16*e)}},{key:"raycast",value:function(e,t){var n=this.matrixWorld,i=this.count;if(Eo.geometry=this.geometry,Eo.material=this.material,void 0!==Eo.material&&(null===this.boundingSphere&&this.computeBoundingSphere(),To.copy(this.boundingSphere),To.applyMatrix4(n),!1!==e.ray.intersectsSphere(To)))for(var r=0;r<i;r++){this.getMatrixAt(r,_o),xo.multiplyMatrices(n,_o),Eo.matrixWorld=xo,Eo.raycast(e,Mo);for(var a=0,o=Mo.length;a<o;a++){var s=Mo[a];s.instanceId=r,s.object=this,t.push(s)}Mo.length=0}}},{key:"setColorAt",value:function(e,t){null===this.instanceColor&&(this.instanceColor=new yo(new Float32Array(3*this.instanceMatrix.count),3)),t.toArray(this.instanceColor.array,3*e)}},{key:"setMatrixAt",value:function(e,t){t.toArray(this.instanceMatrix.array,16*e)}},{key:"updateMorphTargets",value:function(){}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}}]),n}(oi)),e("w",function(e){u(n,e);var t=g(n);function n(e){var i;return a(this,n),(i=t.call(this)).isLineBasicMaterial=!0,i.type="LineBasicMaterial",i.color=new En(16777215),i.map=null,i.linewidth=1,i.linecap="round",i.linejoin="round",i.fog=!0,i.setValues(e),i}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,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}}]),n}(_n))),Ao=new it,Ro=new it,Co=new Ut,Lo=new kt,Po=new Et,ko=e("J",function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Vn,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new wo;return a(this,n),(e=t.call(this)).isLine=!0,e.type="Line",e.geometry=i,e.material=r,e.updateMorphTargets(),e}return s(n,[{key:"copy",value:function(e,t){return _(c(n.prototype),"copy",this).call(this,e,t),this.material=e.material,this.geometry=e.geometry,this}},{key:"computeLineDistances",value:function(){var e=this.geometry;if(null===e.index){for(var t=e.attributes.position,n=[0],i=1,r=t.count;i<r;i++)Ao.fromBufferAttribute(t,i-1),Ro.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=Ao.distanceTo(Ro);e.setAttribute("lineDistance",new In(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}},{key:"raycast",value:function(e,t){var n=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),Po.copy(n.boundingSphere),Po.applyMatrix4(i),Po.radius+=r,!1!==e.ray.intersectsSphere(Po)){Co.copy(i).invert(),Lo.copy(e.ray).applyMatrix4(Co);var o=r/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,l=new it,u=new it,c=new it,h=new it,d=this.isLineSegments?2:1,f=n.index,p=n.attributes.position;if(null!==f)for(var v=Math.max(0,a.start),m=Math.min(f.count,a.start+a.count)-1;v<m;v+=d){var g=f.getX(v),y=f.getX(v+1);if(l.fromBufferAttribute(p,g),u.fromBufferAttribute(p,y),!(Lo.distanceSqToSegment(l,u,h,c)>s)){h.applyMatrix4(this.matrixWorld);var _=e.ray.origin.distanceTo(h);_<e.near||_>e.far||t.push({distance:_,point:c.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}}else for(var x=Math.max(0,a.start),M=Math.min(p.count,a.start+a.count)-1;x<M;x+=d)if(l.fromBufferAttribute(p,x),u.fromBufferAttribute(p,x+1),!(Lo.distanceSqToSegment(l,u,h,c)>s)){h.applyMatrix4(this.matrixWorld);var S=e.ray.origin.distanceTo(h);S<e.near||S>e.far||t.push({distance:S,point:c.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}},{key:"updateMorphTargets",value:function(){var e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){var n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var i=0,r=n.length;i<r;i++){var a=n[i].name||String(i);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=i}}}}}]),n}(an)),Uo=new it,Io=new it,No=e("H",function(e){u(n,e);var t=g(n);function n(e,i){var r;return a(this,n),(r=t.call(this,e,i)).isLineSegments=!0,r.type="LineSegments",r}return s(n,[{key:"computeLineDistances",value:function(){var e=this.geometry;if(null===e.index){for(var t=e.attributes.position,n=[],i=0,r=t.count;i<r;i+=2)Uo.fromBufferAttribute(t,i),Io.fromBufferAttribute(t,i+1),n[i]=0===i?0:n[i-1],n[i+1]=n[i]+Uo.distanceTo(Io);e.setAttribute("lineDistance",new In(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}]),n}(ko)),Do=(e("K",function(e){u(n,e);var t=g(n);function n(e,i){var r;return a(this,n),(r=t.call(this,e,i)).isLineLoop=!0,r.type="LineLoop",r}return s(n)}(ko)),e("u",function(e){u(n,e);var t=g(n);function n(e){var i;return a(this,n),(i=t.call(this)).isPointsMaterial=!0,i.type="PointsMaterial",i.color=new En(16777215),i.map=null,i.alphaMap=null,i.size=1,i.sizeAttenuation=!0,i.fog=!0,i.setValues(e),i}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}]),n}(_n))),Oo=new Ut,Fo=new kt,zo=new Et,Bo=new it;function Ho(e,t,n,i,r,a,o){var s=Fo.distanceSqToPoint(e);if(s<n){var l=new it;Fo.closestPointToPoint(e,l),l.applyMatrix4(i);var u=r.ray.origin.distanceTo(l);if(u<r.near||u>r.far)return;a.push({distance:u,distanceToRay:Math.sqrt(s),point:l,index:t,face:null,object:o})}}e("N",function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Vn,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Do;return a(this,n),(e=t.call(this)).isPoints=!0,e.type="Points",e.geometry=i,e.material=r,e.updateMorphTargets(),e}return s(n,[{key:"copy",value:function(e,t){return _(c(n.prototype),"copy",this).call(this,e,t),this.material=e.material,this.geometry=e.geometry,this}},{key:"raycast",value:function(e,t){var n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),zo.copy(n.boundingSphere),zo.applyMatrix4(i),zo.radius+=r,!1!==e.ray.intersectsSphere(zo)){Oo.copy(i).invert(),Fo.copy(e.ray).applyMatrix4(Oo);var o=r/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,l=n.index,u=n.attributes.position;if(null!==l)for(var c=Math.max(0,a.start),h=Math.min(l.count,a.start+a.count);c<h;c++){var d=l.getX(c);Bo.fromBufferAttribute(u,d),Ho(Bo,d,s,i,e,t,this)}else for(var f=Math.max(0,a.start),p=Math.min(u.count,a.start+a.count);f<p;f++)Bo.fromBufferAttribute(u,f),Ho(Bo,f,s,i,e,t,this)}}},{key:"updateMorphTargets",value:function(){var e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){var n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var i=0,r=n.length;i<r;i++){var a=n[i].name||String(i);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=i}}}}}]),n}(an));var Vo=function(){function e(){a(this,e),this.type="Curve",this.arcLengthDivisions=200}return s(e,[{key:"getPoint",value:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}},{key:"getPointAt",value:function(e,t){var n=this.getUtoTmapping(e);return this.getPoint(n,t)}},{key:"getPoints",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}},{key:"getSpacedPoints",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=[],n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}},{key:"getLength",value:function(){var e=this.getLengths();return e[e.length-1]}},{key:"getLengths",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.arcLengthDivisions;if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,n=[],i=this.getPoint(0),r=0;n.push(0);for(var a=1;a<=e;a++)r+=(t=this.getPoint(a/e)).distanceTo(i),n.push(r),i=t;return this.cacheArcLengths=n,n}},{key:"updateArcLengths",value:function(){this.needsUpdate=!0,this.getLengths()}},{key:"getUtoTmapping",value:function(e,t){var n,i=this.getLengths(),r=0,a=i.length;n=t||e*i[a-1];for(var o,s=0,l=a-1;s<=l;)if((o=i[r=Math.floor(s+(l-s)/2)]-n)<0)s=r+1;else{if(!(o>0)){l=r;break}l=r-1}if(i[r=l]===n)return r/(a-1);var u=i[r];return(r+(n-u)/(i[r+1]-u))/(a-1)}},{key:"getTangent",value:function(e,t){var n=e-1e-4,i=e+1e-4;n<0&&(n=0),i>1&&(i=1);var r=this.getPoint(n),a=this.getPoint(i),o=t||(r.isVector2?new Pe:new it);return o.copy(a).sub(r).normalize(),o}},{key:"getTangentAt",value:function(e,t){var n=this.getUtoTmapping(e);return this.getTangent(n,t)}},{key:"computeFrenetFrames",value:function(e,t){for(var n=new it,i=[],r=[],a=[],o=new it,s=new Ut,l=0;l<=e;l++){var u=l/e;i[l]=this.getTangentAt(u,new it)}r[0]=new it,a[0]=new it;var c=Number.MAX_VALUE,h=Math.abs(i[0].x),d=Math.abs(i[0].y),f=Math.abs(i[0].z);h<=c&&(c=h,n.set(1,0,0)),d<=c&&(c=d,n.set(0,1,0)),f<=c&&n.set(0,0,1),o.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],o),a[0].crossVectors(i[0],r[0]);for(var p=1;p<=e;p++){if(r[p]=r[p-1].clone(),a[p]=a[p-1].clone(),o.crossVectors(i[p-1],i[p]),o.length()>Number.EPSILON){o.normalize();var v=Math.acos(be(i[p-1].dot(i[p]),-1,1));r[p].applyMatrix4(s.makeRotationAxis(o,v))}a[p].crossVectors(i[p],r[p])}if(!0===t){var m=Math.acos(be(r[0].dot(r[e]),-1,1));m/=e,i[0].dot(o.crossVectors(r[0],r[e]))>0&&(m=-m);for(var g=1;g<=e;g++)r[g].applyMatrix4(s.makeRotationAxis(i[g],m*g)),a[g].crossVectors(i[g],r[g])}return{tangents:i,normals:r,binormals:a}}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},{key:"toJSON",value:function(){var e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}},{key:"fromJSON",value:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}]),e}(),Go=function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2*Math.PI,c=arguments.length>6&&void 0!==arguments[6]&&arguments[6],h=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0;return a(this,n),(e=t.call(this)).isEllipseCurve=!0,e.type="EllipseCurve",e.aX=i,e.aY=r,e.xRadius=o,e.yRadius=s,e.aStartAngle=l,e.aEndAngle=u,e.aClockwise=c,e.aRotation=h,e}return s(n,[{key:"getPoint",value:function(e,t){for(var n=t||new Pe,i=2*Math.PI,r=this.aEndAngle-this.aStartAngle,a=Math.abs(r)<Number.EPSILON;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(r=a?0:i),!0!==this.aClockwise||a||(r===i?r=-i:r-=i);var o=this.aStartAngle+e*r,s=this.aX+this.xRadius*Math.cos(o),l=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){var u=Math.cos(this.aRotation),c=Math.sin(this.aRotation),h=s-this.aX,d=l-this.aY;s=h*u-d*c+this.aX,l=h*c+d*u+this.aY}return n.set(s,l)}},{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,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}},{key:"toJSON",value:function(){var e=_(c(n.prototype),"toJSON",this).call(this);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}},{key:"fromJSON",value:function(e){return _(c(n.prototype),"fromJSON",this).call(this,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}}]),n}(Vo),Wo=function(e){u(n,e);var t=g(n);function n(e,i,r,o,s,l){var u;return a(this,n),(u=t.call(this,e,i,r,r,o,s,l)).isArcCurve=!0,u.type="ArcCurve",u}return s(n)}(Go);function Xo(){var e=0,t=0,n=0,i=0;function r(r,a,o,s){e=r,t=o,n=-3*r+3*a-2*o-s,i=2*r-2*a+o+s}return{initCatmullRom:function(e,t,n,i,a){r(t,n,a*(n-e),a*(i-t))},initNonuniformCatmullRom:function(e,t,n,i,a,o,s){var l=(t-e)/a-(n-e)/(a+o)+(n-t)/o,u=(n-t)/o-(i-t)/(o+s)+(i-n)/s;r(t,n,l*=o,u*=o)},calc:function(r){var a=r*r;return e+t*r+n*a+i*(a*r)}}}var jo=new it,Yo=new Xo,qo=new Xo,Zo=new Xo,Jo=function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"centripetal",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5;return a(this,n),(e=t.call(this)).isCatmullRomCurve3=!0,e.type="CatmullRomCurve3",e.points=i,e.closed=r,e.curveType=o,e.tension=s,e}return s(n,[{key:"getPoint",value:function(e){var t,n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new it,r=i,a=this.points,o=a.length,s=(o-(this.closed?0:1))*e,l=Math.floor(s),u=s-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/o)+1)*o:0===u&&l===o-1&&(l=o-2,u=1),this.closed||l>0?t=a[(l-1)%o]:(jo.subVectors(a[0],a[1]).add(a[0]),t=jo);var c=a[l%o],h=a[(l+1)%o];if(this.closed||l+2<o?n=a[(l+2)%o]:(jo.subVectors(a[o-1],a[o-2]).add(a[o-1]),n=jo),"centripetal"===this.curveType||"chordal"===this.curveType){var d="chordal"===this.curveType?.5:.25,f=Math.pow(t.distanceToSquared(c),d),p=Math.pow(c.distanceToSquared(h),d),v=Math.pow(h.distanceToSquared(n),d);p<1e-4&&(p=1),f<1e-4&&(f=p),v<1e-4&&(v=p),Yo.initNonuniformCatmullRom(t.x,c.x,h.x,n.x,f,p,v),qo.initNonuniformCatmullRom(t.y,c.y,h.y,n.y,f,p,v),Zo.initNonuniformCatmullRom(t.z,c.z,h.z,n.z,f,p,v)}else"catmullrom"===this.curveType&&(Yo.initCatmullRom(t.x,c.x,h.x,n.x,this.tension),qo.initCatmullRom(t.y,c.y,h.y,n.y,this.tension),Zo.initCatmullRom(t.z,c.z,h.z,n.z,this.tension));return r.set(Yo.calc(u),qo.calc(u),Zo.calc(u)),r}},{key:"copy",value:function(e){_(c(n.prototype),"copy",this).call(this,e),this.points=[];for(var t=0,i=e.points.length;t<i;t++){var r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}},{key:"toJSON",value:function(){var e=_(c(n.prototype),"toJSON",this).call(this);e.points=[];for(var t=0,i=this.points.length;t<i;t++){var r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}},{key:"fromJSON",value:function(e){_(c(n.prototype),"fromJSON",this).call(this,e),this.points=[];for(var t=0,i=e.points.length;t<i;t++){var r=e.points[t];this.points.push((new it).fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}]),n}(Vo);function Ko(e,t,n,i,r){var a=.5*(i-t),o=.5*(r-n),s=e*e;return(2*n-2*i+a+o)*(e*s)+(-3*n+3*i-2*a-o)*s+a*e+n}function Qo(e,t,n,i){return function(e,t){var n=1-e;return n*n*t}(e,t)+function(e,t){return 2*(1-e)*e*t}(e,n)+function(e,t){return e*e*t}(e,i)}function $o(e,t,n,i,r){return function(e,t){var n=1-e;return n*n*n*t}(e,t)+function(e,t){var n=1-e;return 3*n*n*e*t}(e,n)+function(e,t){return 3*(1-e)*e*e*t}(e,i)+function(e,t){return e*e*e*t}(e,r)}var es=function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Pe,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Pe,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Pe,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Pe;return a(this,n),(e=t.call(this)).isCubicBezierCurve=!0,e.type="CubicBezierCurve",e.v0=i,e.v1=r,e.v2=o,e.v3=s,e}return s(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Pe,n=t,i=this.v0,r=this.v1,a=this.v2,o=this.v3;return n.set($o(e,i.x,r.x,a.x,o.x),$o(e,i.y,r.y,a.y,o.y)),n}},{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}},{key:"toJSON",value:function(){var e=_(c(n.prototype),"toJSON",this).call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}},{key:"fromJSON",value:function(e){return _(c(n.prototype),"fromJSON",this).call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}]),n}(Vo),ts=function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new it,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new it,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new it,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new it;return a(this,n),(e=t.call(this)).isCubicBezierCurve3=!0,e.type="CubicBezierCurve3",e.v0=i,e.v1=r,e.v2=o,e.v3=s,e}return s(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new it,n=t,i=this.v0,r=this.v1,a=this.v2,o=this.v3;return n.set($o(e,i.x,r.x,a.x,o.x),$o(e,i.y,r.y,a.y,o.y),$o(e,i.z,r.z,a.z,o.z)),n}},{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}},{key:"toJSON",value:function(){var e=_(c(n.prototype),"toJSON",this).call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}},{key:"fromJSON",value:function(e){return _(c(n.prototype),"fromJSON",this).call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}]),n}(Vo),ns=function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Pe,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Pe;return a(this,n),(e=t.call(this)).isLineCurve=!0,e.type="LineCurve",e.v1=i,e.v2=r,e}return s(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Pe,n=t;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}},{key:"getPointAt",value:function(e,t){return this.getPoint(e,t)}},{key:"getTangent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Pe;return t.subVectors(this.v2,this.v1).normalize()}},{key:"getTangentAt",value:function(e,t){return this.getTangent(e,t)}},{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=_(c(n.prototype),"toJSON",this).call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return _(c(n.prototype),"fromJSON",this).call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}]),n}(Vo),is=function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new it,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new it;return a(this,n),(e=t.call(this)).isLineCurve3=!0,e.type="LineCurve3",e.v1=i,e.v2=r,e}return s(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new it,n=t;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}},{key:"getPointAt",value:function(e,t){return this.getPoint(e,t)}},{key:"getTangent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new it;return t.subVectors(this.v2,this.v1).normalize()}},{key:"getTangentAt",value:function(e,t){return this.getTangent(e,t)}},{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=_(c(n.prototype),"toJSON",this).call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return _(c(n.prototype),"fromJSON",this).call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}]),n}(Vo),rs=function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Pe,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Pe,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Pe;return a(this,n),(e=t.call(this)).isQuadraticBezierCurve=!0,e.type="QuadraticBezierCurve",e.v0=i,e.v1=r,e.v2=o,e}return s(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Pe,n=t,i=this.v0,r=this.v1,a=this.v2;return n.set(Qo(e,i.x,r.x,a.x),Qo(e,i.y,r.y,a.y)),n}},{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=_(c(n.prototype),"toJSON",this).call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return _(c(n.prototype),"fromJSON",this).call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}]),n}(Vo),as=function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new it,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new it,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new it;return a(this,n),(e=t.call(this)).isQuadraticBezierCurve3=!0,e.type="QuadraticBezierCurve3",e.v0=i,e.v1=r,e.v2=o,e}return s(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new it,n=t,i=this.v0,r=this.v1,a=this.v2;return n.set(Qo(e,i.x,r.x,a.x),Qo(e,i.y,r.y,a.y),Qo(e,i.z,r.z,a.z)),n}},{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=_(c(n.prototype),"toJSON",this).call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return _(c(n.prototype),"fromJSON",this).call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}]),n}(Vo),os=function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return a(this,n),(e=t.call(this)).isSplineCurve=!0,e.type="SplineCurve",e.points=i,e}return s(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Pe,n=t,i=this.points,r=(i.length-1)*e,a=Math.floor(r),o=r-a,s=i[0===a?a:a-1],l=i[a],u=i[a>i.length-2?i.length-1:a+1],c=i[a>i.length-3?i.length-1:a+2];return n.set(Ko(o,s.x,l.x,u.x,c.x),Ko(o,s.y,l.y,u.y,c.y)),n}},{key:"copy",value:function(e){_(c(n.prototype),"copy",this).call(this,e),this.points=[];for(var t=0,i=e.points.length;t<i;t++){var r=e.points[t];this.points.push(r.clone())}return this}},{key:"toJSON",value:function(){var e=_(c(n.prototype),"toJSON",this).call(this);e.points=[];for(var t=0,i=this.points.length;t<i;t++){var r=this.points[t];e.points.push(r.toArray())}return e}},{key:"fromJSON",value:function(e){_(c(n.prototype),"fromJSON",this).call(this,e),this.points=[];for(var t=0,i=e.points.length;t<i;t++){var r=e.points[t];this.points.push((new Pe).fromArray(r))}return this}}]),n}(Vo),ss=Object.freeze({__proto__:null,ArcCurve:Wo,CatmullRomCurve3:Jo,CubicBezierCurve:es,CubicBezierCurve3:ts,EllipseCurve:Go,LineCurve:ns,LineCurve3:is,QuadraticBezierCurve:rs,QuadraticBezierCurve3:as,SplineCurve:os}),ls=e("bO",function(e){u(n,e);var t=g(n);function n(e){var i;return a(this,n),(i=t.call(this)).type="Path",i.currentPoint=new Pe,e&&i.setFromPoints(e),i}return s(n,[{key:"setFromPoints",value:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}},{key:"moveTo",value:function(e,t){return this.currentPoint.set(e,t),this}},{key:"lineTo",value:function(e,t){var n=new ns(this.currentPoint.clone(),new Pe(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}},{key:"quadraticCurveTo",value:function(e,t,n,i){var r=new rs(this.currentPoint.clone(),new Pe(e,t),new Pe(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this}},{key:"bezierCurveTo",value:function(e,t,n,i,r,a){var o=new es(this.currentPoint.clone(),new Pe(e,t),new Pe(n,i),new Pe(r,a));return this.curves.push(o),this.currentPoint.set(r,a),this}},{key:"splineThru",value:function(e){var t=[this.currentPoint.clone()].concat(e),n=new os(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}},{key:"arc",value:function(e,t,n,i,r,a){var o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(e+o,t+s,n,i,r,a),this}},{key:"absarc",value:function(e,t,n,i,r,a){return this.absellipse(e,t,n,n,i,r,a),this}},{key:"ellipse",value:function(e,t,n,i,r,a,o,s){var l=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+l,t+u,n,i,r,a,o,s),this}},{key:"absellipse",value:function(e,t,n,i,r,a,o,s){var l=new Go(e,t,n,i,r,a,o,s);if(this.curves.length>0){var u=l.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(l);var c=l.getPoint(1);return this.currentPoint.copy(c),this}},{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.currentPoint.copy(e.currentPoint),this}},{key:"toJSON",value:function(){var e=_(c(n.prototype),"toJSON",this).call(this);return e.currentPoint=this.currentPoint.toArray(),e}},{key:"fromJSON",value:function(e){return _(c(n.prototype),"fromJSON",this).call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}]),n}(function(e){u(n,e);var t=g(n);function n(){var e;return a(this,n),(e=t.call(this)).type="CurvePath",e.curves=[],e.autoClose=!1,e}return s(n,[{key:"add",value:function(e){this.curves.push(e)}},{key:"closePath",value:function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new ns(t,e))}},{key:"getPoint",value:function(e,t){for(var n=e*this.getLength(),i=this.getCurveLengths(),r=0;r<i.length;){if(i[r]>=n){var a=i[r]-n,o=this.curves[r],s=o.getLength(),l=0===s?0:1-a/s;return o.getPointAt(l,t)}r++}return null}},{key:"getLength",value:function(){var e=this.getCurveLengths();return e[e.length-1]}},{key:"updateArcLengths",value:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}},{key:"getCurveLengths",value:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}},{key:"getSpacedPoints",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:40,t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}},{key:"getPoints",value:function(){for(var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:12,n=[],i=0,r=this.curves;i<r.length;i++)for(var a=r[i],o=a.isEllipseCurve?2*t:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?t*a.points.length:t,s=a.getPoints(o),l=0;l<s.length;l++){var u=s[l];e&&e.equals(u)||(n.push(u),e=u)}return this.autoClose&&n.length>1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n}},{key:"copy",value:function(e){_(c(n.prototype),"copy",this).call(this,e),this.curves=[];for(var t=0,i=e.curves.length;t<i;t++){var r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this}},{key:"toJSON",value:function(){var e=_(c(n.prototype),"toJSON",this).call(this);e.autoClose=this.autoClose,e.curves=[];for(var t=0,i=this.curves.length;t<i;t++){var r=this.curves[t];e.curves.push(r.toJSON())}return e}},{key:"fromJSON",value:function(e){_(c(n.prototype),"fromJSON",this).call(this,e),this.autoClose=e.autoClose,this.curves=[];for(var t=0,i=e.curves.length;t<i;t++){var r=e.curves[t];this.curves.push((new ss[r.type]).fromJSON(r))}return this}}]),n}(Vo))),us=(e("bS",function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:32,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2*Math.PI;a(this,n),(e=t.call(this)).type="CircleGeometry",e.parameters={radius:i,segments:r,thetaStart:o,thetaLength:s},r=Math.max(3,r);var l=[],u=[],c=[],h=[],d=new it,f=new Pe;u.push(0,0,0),c.push(0,0,1),h.push(.5,.5);for(var p=0,v=3;p<=r;p++,v+=3){var m=o+p/r*s;d.x=i*Math.cos(m),d.y=i*Math.sin(m),u.push(d.x,d.y,d.z),c.push(0,0,1),f.x=(u[v]/i+1)/2,f.y=(u[v+1]/i+1)/2,h.push(f.x,f.y)}for(var g=1;g<=r;g++)l.push(g,g+1,0);return e.setIndex(l),e.setAttribute("position",new In(u,3)),e.setAttribute("normal",new In(c,3)),e.setAttribute("uv",new In(h,2)),e}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}}],[{key:"fromJSON",value:function(e){return new n(e.radius,e.segments,e.thetaStart,e.thetaLength)}}]),n}(Vn)),e("aQ",function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:32,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,u=arguments.length>5&&void 0!==arguments[5]&&arguments[5],c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,h=arguments.length>7&&void 0!==arguments[7]?arguments[7]:2*Math.PI;a(this,n),(e=t.call(this)).type="CylinderGeometry",e.parameters={radiusTop:i,radiusBottom:r,height:o,radialSegments:s,heightSegments:l,openEnded:u,thetaStart:c,thetaLength:h};var d=v(e);s=Math.floor(s),l=Math.floor(l);var f=[],p=[],m=[],g=[],y=0,_=[],x=o/2,M=0;function S(){for(var e=new it,t=new it,n=0,a=(r-i)/o,u=0;u<=l;u++){for(var v=[],S=u/l,b=S*(r-i)+i,E=0;E<=s;E++){var T=E/s,w=T*h+c,A=Math.sin(w),R=Math.cos(w);t.x=b*A,t.y=-S*o+x,t.z=b*R,p.push(t.x,t.y,t.z),e.set(A,a,R).normalize(),m.push(e.x,e.y,e.z),g.push(T,1-S),v.push(y++)}_.push(v)}for(var C=0;C<s;C++)for(var L=0;L<l;L++){var P=_[L][C],k=_[L+1][C],U=_[L+1][C+1],I=_[L][C+1];f.push(P,k,I),f.push(k,U,I),n+=6}d.addGroup(M,n,0),M+=n}function b(e){for(var t=y,n=new Pe,a=new it,o=0,l=!0===e?i:r,u=!0===e?1:-1,v=1;v<=s;v++)p.push(0,x*u,0),m.push(0,u,0),g.push(.5,.5),y++;for(var _=y,S=0;S<=s;S++){var b=S/s*h+c,E=Math.cos(b),T=Math.sin(b);a.x=l*T,a.y=x*u,a.z=l*E,p.push(a.x,a.y,a.z),m.push(0,u,0),n.x=.5*E+.5,n.y=.5*T*u+.5,g.push(n.x,n.y),y++}for(var w=0;w<s;w++){var A=t+w,R=_+w;!0===e?f.push(R,R+1,A):f.push(R+1,R,A),o+=3}d.addGroup(M,o,!0===e?1:2),M+=o}return S(),!1===u&&(i>0&&b(!0),r>0&&b(!1)),e.setIndex(f),e.setAttribute("position",new In(p,3)),e.setAttribute("normal",new In(m,3)),e.setAttribute("uv",new In(g,2)),e}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}}],[{key:"fromJSON",value:function(e){return new n(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}]),n}(Vn))),cs=function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;a(this,n),(e=t.call(this)).type="PolyhedronGeometry",e.parameters={vertices:i,indices:r,radius:o,detail:s};var l=[],u=[];function c(e){for(var t=new it,n=new it,i=new it,a=0;a<r.length;a+=3)m(r[a+0],t),m(r[a+1],n),m(r[a+2],i),h(t,n,i,e)}function h(e,t,n,i){for(var r=i+1,a=[],o=0;o<=r;o++){a[o]=[];for(var s=e.clone().lerp(n,o/r),l=t.clone().lerp(n,o/r),u=r-o,c=0;c<=u;c++)a[o][c]=0===c&&o===r?s:s.clone().lerp(l,c/u)}for(var h=0;h<r;h++)for(var d=0;d<2*(r-h)-1;d++){var f=Math.floor(d/2);d%2==0?(v(a[h][f+1]),v(a[h+1][f]),v(a[h][f])):(v(a[h][f+1]),v(a[h+1][f+1]),v(a[h+1][f]))}}function d(e){for(var t=new it,n=0;n<l.length;n+=3)t.x=l[n+0],t.y=l[n+1],t.z=l[n+2],t.normalize().multiplyScalar(e),l[n+0]=t.x,l[n+1]=t.y,l[n+2]=t.z}function f(){for(var e=new it,t=0;t<l.length;t+=3){e.x=l[t+0],e.y=l[t+1],e.z=l[t+2];var n=_(e)/2/Math.PI+.5,i=x(e)/Math.PI+.5;u.push(n,1-i)}g(),p()}function p(){for(var e=0;e<u.length;e+=6){var t=u[e+0],n=u[e+2],i=u[e+4],r=Math.max(t,n,i),a=Math.min(t,n,i);r>.9&&a<.1&&(t<.2&&(u[e+0]+=1),n<.2&&(u[e+2]+=1),i<.2&&(u[e+4]+=1))}}function v(e){l.push(e.x,e.y,e.z)}function m(e,t){var n=3*e;t.x=i[n+0],t.y=i[n+1],t.z=i[n+2]}function g(){for(var e=new it,t=new it,n=new it,i=new it,r=new Pe,a=new Pe,o=new Pe,s=0,c=0;s<l.length;s+=9,c+=6){e.set(l[s+0],l[s+1],l[s+2]),t.set(l[s+3],l[s+4],l[s+5]),n.set(l[s+6],l[s+7],l[s+8]),r.set(u[c+0],u[c+1]),a.set(u[c+2],u[c+3]),o.set(u[c+4],u[c+5]),i.copy(e).add(t).add(n).divideScalar(3);var h=_(i);y(r,c+0,e,h),y(a,c+2,t,h),y(o,c+4,n,h)}}function y(e,t,n,i){i<0&&1===e.x&&(u[t]=e.x-1),0===n.x&&0===n.z&&(u[t]=i/2/Math.PI+.5)}function _(e){return Math.atan2(e.z,-e.x)}function x(e){return Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))}return c(s),d(o),f(),e.setAttribute("position",new In(l,3)),e.setAttribute("normal",new In(l.slice(),3)),e.setAttribute("uv",new In(u,2)),0===s?e.computeVertexNormals():e.normalizeNormals(),e}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}}],[{key:"fromJSON",value:function(e){return new n(e.vertices,e.indices,e.radius,e.details)}}]),n}(Vn),hs=new it,ds=new it,fs=new it,ps=new gn,vs=(e("aN",function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(a(this,n),(e=t.call(this)).type="EdgesGeometry",e.parameters={geometry:i,thresholdAngle:r},null!==i){for(var o=4,s=Math.pow(10,o),l=Math.cos(xe*r),u=i.getIndex(),c=i.getAttribute("position"),h=u?u.count:c.count,d=[0,0,0],f=["a","b","c"],p=new Array(3),v={},m=[],g=0;g<h;g+=3){u?(d[0]=u.getX(g),d[1]=u.getX(g+1),d[2]=u.getX(g+2)):(d[0]=g,d[1]=g+1,d[2]=g+2);var y=ps.a,_=ps.b,x=ps.c;if(y.fromBufferAttribute(c,d[0]),_.fromBufferAttribute(c,d[1]),x.fromBufferAttribute(c,d[2]),ps.getNormal(fs),p[0]="".concat(Math.round(y.x*s),",").concat(Math.round(y.y*s),",").concat(Math.round(y.z*s)),p[1]="".concat(Math.round(_.x*s),",").concat(Math.round(_.y*s),",").concat(Math.round(_.z*s)),p[2]="".concat(Math.round(x.x*s),",").concat(Math.round(x.y*s),",").concat(Math.round(x.z*s)),p[0]!==p[1]&&p[1]!==p[2]&&p[2]!==p[0])for(var M=0;M<3;M++){var S=(M+1)%3,b=p[M],E=p[S],T=ps[f[M]],w=ps[f[S]],A="".concat(b,"_").concat(E),R="".concat(E,"_").concat(b);R in v&&v[R]?(fs.dot(v[R].normal)<=l&&(m.push(T.x,T.y,T.z),m.push(w.x,w.y,w.z)),v[R]=null):A in v||(v[A]={index0:d[M],index1:d[S],normal:fs.clone()})}}for(var C in v)if(v[C]){var L=v[C],P=L.index0,k=L.index1;hs.fromBufferAttribute(c,P),ds.fromBufferAttribute(c,k),m.push(hs.x,hs.y,hs.z),m.push(ds.x,ds.y,ds.z)}e.setAttribute("position",new In(m,3))}return e}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}}]),n}(Vn)),e("bN",function(e){u(n,e);var t=g(n);function n(e){var i;return a(this,n),(i=t.call(this,e)).uuid=Se(),i.type="Shape",i.holes=[],i}return s(n,[{key:"getPointsHoles",value:function(e){for(var t=[],n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t}},{key:"extractPoints",value:function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}},{key:"copy",value:function(e){_(c(n.prototype),"copy",this).call(this,e),this.holes=[];for(var t=0,i=e.holes.length;t<i;t++){var r=e.holes[t];this.holes.push(r.clone())}return this}},{key:"toJSON",value:function(){var e=_(c(n.prototype),"toJSON",this).call(this);e.uuid=this.uuid,e.holes=[];for(var t=0,i=this.holes.length;t<i;t++){var r=this.holes[t];e.holes.push(r.toJSON())}return e}},{key:"fromJSON",value:function(e){_(c(n.prototype),"fromJSON",this).call(this,e),this.uuid=e.uuid,this.holes=[];for(var t=0,i=e.holes.length;t<i;t++){var r=e.holes[t];this.holes.push((new ls).fromJSON(r))}return this}}]),n}(ls)));function ms(e,t,n,i,r){var a,o;if(r===function(e,t,n,i){for(var r=0,a=t,o=n-i;a<n;a+=i)r+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return r}(e,t,n,i)>0)for(a=t;a<n;a+=i)o=Fs(a,e[a],e[a+1],o);else for(a=n-i;a>=t;a-=i)o=Fs(a,e[a],e[a+1],o);return o&&ks(o,o.next)&&(zs(o),o=o.next),o}function gs(e,t){if(!e)return e;t||(t=e);var n,i=e;do{if(n=!1,i.steiner||!ks(i,i.next)&&0!==Ps(i.prev,i,i.next))i=i.next;else{if(zs(i),(i=t=i.prev)===i.next)break;n=!0}}while(n||i!==t);return t}function ys(e,t,n,i,r,a,o){if(e){!o&&a&&function(e,t,n,i){var r=e;do{0===r.z&&(r.z=As(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){var t,n,i,r,a,o,s,l,u=1;do{for(n=e,e=null,a=null,o=0;n;){for(o++,i=n,s=0,t=0;t<u&&(s++,i=i.nextZ);t++);for(l=u;s>0||l>0&&i;)0!==s&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,s--):(r=i,i=i.nextZ,l--),a?a.nextZ=r:e=r,r.prevZ=a,a=r;n=i}a.nextZ=null,u*=2}while(o>1)}(r)}(e,i,r,a);for(var s,l,u=e;e.prev!==e.next;)if(s=e.prev,l=e.next,a?xs(e,i,r,a):_s(e))t.push(s.i/n|0),t.push(e.i/n|0),t.push(l.i/n|0),zs(e),e=l.next,u=l.next;else if((e=l)===u){o?1===o?ys(e=Ms(gs(e),t,n),t,n,i,r,a,2):2===o&&Ss(e,t,n,i,r,a):ys(gs(e),t,n,i,r,a,1);break}}}function _s(e){var t=e.prev,n=e,i=e.next;if(Ps(t,n,i)>=0)return!1;for(var r=t.x,a=n.x,o=i.x,s=t.y,l=n.y,u=i.y,c=r<a?r<o?r:o:a<o?a:o,h=s<l?s<u?s:u:l<u?l:u,d=r>a?r>o?r:o:a>o?a:o,f=s>l?s>u?s:u:l>u?l:u,p=i.next;p!==t;){if(p.x>=c&&p.x<=d&&p.y>=h&&p.y<=f&&Cs(r,s,a,l,o,u,p.x,p.y)&&Ps(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function xs(e,t,n,i){var r=e.prev,a=e,o=e.next;if(Ps(r,a,o)>=0)return!1;for(var s=r.x,l=a.x,u=o.x,c=r.y,h=a.y,d=o.y,f=s<l?s<u?s:u:l<u?l:u,p=c<h?c<d?c:d:h<d?h:d,v=s>l?s>u?s:u:l>u?l:u,m=c>h?c>d?c:d:h>d?h:d,g=As(f,p,t,n,i),y=As(v,m,t,n,i),_=e.prevZ,x=e.nextZ;_&&_.z>=g&&x&&x.z<=y;){if(_.x>=f&&_.x<=v&&_.y>=p&&_.y<=m&&_!==r&&_!==o&&Cs(s,c,l,h,u,d,_.x,_.y)&&Ps(_.prev,_,_.next)>=0)return!1;if(_=_.prevZ,x.x>=f&&x.x<=v&&x.y>=p&&x.y<=m&&x!==r&&x!==o&&Cs(s,c,l,h,u,d,x.x,x.y)&&Ps(x.prev,x,x.next)>=0)return!1;x=x.nextZ}for(;_&&_.z>=g;){if(_.x>=f&&_.x<=v&&_.y>=p&&_.y<=m&&_!==r&&_!==o&&Cs(s,c,l,h,u,d,_.x,_.y)&&Ps(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;x&&x.z<=y;){if(x.x>=f&&x.x<=v&&x.y>=p&&x.y<=m&&x!==r&&x!==o&&Cs(s,c,l,h,u,d,x.x,x.y)&&Ps(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function Ms(e,t,n){var i=e;do{var r=i.prev,a=i.next.next;!ks(r,a)&&Us(r,i,i.next,a)&&Ds(r,a)&&Ds(a,r)&&(t.push(r.i/n|0),t.push(i.i/n|0),t.push(a.i/n|0),zs(i),zs(i.next),i=e=a),i=i.next}while(i!==e);return gs(i)}function Ss(e,t,n,i,r,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&Ls(o,s)){var l=Os(o,s);return o=gs(o,o.next),l=gs(l,l.next),ys(o,t,n,i,r,a,0),void ys(l,t,n,i,r,a,0)}s=s.next}o=o.next}while(o!==e)}function bs(e,t,n,i){var r,a,o,s=[];for(r=0,a=t.length;r<a;r++)(o=ms(e,t[r]*i,r<a-1?t[r+1]*i:e.length,i,!1))===o.next&&(o.steiner=!0),s.push(Rs(o));for(s.sort(Es),r=0;r<s.length;r++)n=Ts(s[r],n);return n}function Es(e,t){return e.x-t.x}function Ts(e,t){var n=function(e,t){var n,i=t,r=-1/0,a=e.x,o=e.y;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){var s=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=a&&s>r&&(r=s,n=i.x<i.next.x?i:i.next,s===a))return n}i=i.next}while(i!==t);if(!n)return null;var l,u=n,c=n.x,h=n.y,d=1/0;i=n;do{a>=i.x&&i.x>=c&&a!==i.x&&Cs(o<h?a:r,o,c,h,o<h?r:a,o,i.x,i.y)&&(l=Math.abs(o-i.y)/(a-i.x),Ds(i,e)&&(l<d||l===d&&(i.x>n.x||i.x===n.x&&ws(n,i)))&&(n=i,d=l)),i=i.next}while(i!==u);return n}(e,t);if(!n)return t;var i=Os(n,e);return gs(i,i.next),gs(n,n.next)}function ws(e,t){return Ps(e.prev,e,t.prev)<0&&Ps(t.next,e,e.next)<0}function As(e,t,n,i,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Rs(e){var t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function Cs(e,t,n,i,r,a,o,s){return(r-o)*(t-s)>=(e-o)*(a-s)&&(e-o)*(i-s)>=(n-o)*(t-s)&&(n-o)*(a-s)>=(r-o)*(i-s)}function Ls(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&Us(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(Ds(e,t)&&Ds(t,e)&&function(e,t){var n=e,i=!1,r=(e.x+t.x)/2,a=(e.y+t.y)/2;do{n.y>a!=n.next.y>a&&n.next.y!==n.y&&r<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==e);return i}(e,t)&&(Ps(e.prev,e,t.prev)||Ps(e,t.prev,t))||ks(e,t)&&Ps(e.prev,e,e.next)>0&&Ps(t.prev,t,t.next)>0)}function Ps(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function ks(e,t){return e.x===t.x&&e.y===t.y}function Us(e,t,n,i){var r=Ns(Ps(e,t,n)),a=Ns(Ps(e,t,i)),o=Ns(Ps(n,i,e)),s=Ns(Ps(n,i,t));return r!==a&&o!==s||!(0!==r||!Is(e,n,t))||!(0!==a||!Is(e,i,t))||!(0!==o||!Is(n,e,i))||!(0!==s||!Is(n,t,i))}function Is(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function Ns(e){return e>0?1:e<0?-1:0}function Ds(e,t){return Ps(e.prev,e,e.next)<0?Ps(e,t,e.next)>=0&&Ps(e,e.prev,t)>=0:Ps(e,t,e.prev)<0||Ps(e,e.next,t)<0}function Os(e,t){var n=new Bs(e.i,e.x,e.y),i=new Bs(t.i,t.x,t.y),r=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,i.next=n,n.prev=i,a.next=i,i.prev=a,i}function Fs(e,t,n,i){var r=new Bs(e,t,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function zs(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Bs(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}var Hs=function(){function e(){a(this,e)}return s(e,null,[{key:"area",value:function(e){for(var t=e.length,n=0,i=t-1,r=0;r<t;i=r++)n+=e[i].x*e[r].y-e[r].x*e[i].y;return.5*n}},{key:"isClockWise",value:function(t){return e.area(t)<0}},{key:"triangulateShape",value:function(e,t){var n=[],i=[],r=[];Vs(e),Gs(n,e);var a=e.length;t.forEach(Vs);for(var o=0;o<t.length;o++)i.push(a),a+=t[o].length,Gs(n,t[o]);for(var s=function(e,t){var n,i,r,a,o,s,l,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2,c=t&&t.length,h=c?t[0]*u:e.length,d=ms(e,0,h,u,!0),f=[];if(!d||d.next===d.prev)return f;if(c&&(d=bs(e,t,d,u)),e.length>80*u){n=r=e[0],i=a=e[1];for(var p=u;p<h;p+=u)(o=e[p])<n&&(n=o),(s=e[p+1])<i&&(i=s),o>r&&(r=o),s>a&&(a=s);l=0!==(l=Math.max(r-n,a-i))?32767/l:0}return ys(d,f,u,n,i,l,0),f}(n,i),l=0;l<s.length;l+=3)r.push(s.slice(l,l+3));return r}}]),e}();function Vs(e){var t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function Gs(e,t){for(var n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}e("b$",function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new vs([new Pe(.5,.5),new Pe(-.5,.5),new Pe(-.5,-.5),new Pe(.5,-.5)]),r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};a(this,n),(e=t.call(this)).type="ExtrudeGeometry",e.parameters={shapes:i,options:r},i=Array.isArray(i)?i:[i];for(var o=v(e),s=[],l=[],u=0,c=i.length;u<c;u++){var h=i[u];d(h)}function d(e){var t,n,i,a,u,c=[],h=void 0!==r.curveSegments?r.curveSegments:12,d=void 0!==r.steps?r.steps:1,f=void 0!==r.depth?r.depth:1,p=void 0===r.bevelEnabled||r.bevelEnabled,v=void 0!==r.bevelThickness?r.bevelThickness:.2,m=void 0!==r.bevelSize?r.bevelSize:v-.1,g=void 0!==r.bevelOffset?r.bevelOffset:0,y=void 0!==r.bevelSegments?r.bevelSegments:3,_=r.extrudePath,x=void 0!==r.UVGenerator?r.UVGenerator:Ws,M=!1;_&&(t=_.getSpacedPoints(d),M=!0,p=!1,n=_.computeFrenetFrames(d,!1),i=new it,a=new it,u=new it),p||(y=0,v=0,m=0,g=0);var S=e.extractPoints(h),b=S.shape,E=S.holes;if(!Hs.isClockWise(b)){b=b.reverse();for(var T=0,w=E.length;T<w;T++){var A=E[T];Hs.isClockWise(A)&&(E[T]=A.reverse())}}for(var R=Hs.triangulateShape(b,E),C=b,L=0,P=E.length;L<P;L++){var k=E[L];b=b.concat(k)}function U(e,t,n){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().addScaledVector(t,n)}var I=b.length,N=R.length;function D(e,t,n){var i,r,a,o=e.x-t.x,s=e.y-t.y,l=n.x-e.x,u=n.y-e.y,c=o*o+s*s,h=o*u-s*l;if(Math.abs(h)>Number.EPSILON){var d=Math.sqrt(c),f=Math.sqrt(l*l+u*u),p=t.x-s/d,v=t.y+o/d,m=((n.x-u/f-p)*u-(n.y+l/f-v)*l)/(o*u-s*l),g=(i=p+o*m-e.x)*i+(r=v+s*m-e.y)*r;if(g<=2)return new Pe(i,r);a=Math.sqrt(g/2)}else{var y=!1;o>Number.EPSILON?l>Number.EPSILON&&(y=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(u)&&(y=!0),y?(i=-s,r=o,a=Math.sqrt(c)):(i=o,r=s,a=Math.sqrt(c/2))}return new Pe(i/a,r/a)}for(var O=[],F=0,z=C.length,B=z-1,H=F+1;F<z;F++,B++,H++)B===z&&(B=0),H===z&&(H=0),O[F]=D(C[F],C[B],C[H]);for(var V,G=[],W=O.concat(),X=0,j=E.length;X<j;X++){var Y=E[X];V=[];for(var q=0,Z=Y.length,J=Z-1,K=q+1;q<Z;q++,J++,K++)J===Z&&(J=0),K===Z&&(K=0),V[q]=D(Y[q],Y[J],Y[K]);G.push(V),W=W.concat(V)}for(var Q=0;Q<y;Q++){for(var $=Q/y,ee=v*Math.cos($*Math.PI/2),te=m*Math.sin($*Math.PI/2)+g,ne=0,ie=C.length;ne<ie;ne++){var re=U(C[ne],O[ne],te);ke(re.x,re.y,-ee)}for(var ae=0,oe=E.length;ae<oe;ae++){var se=E[ae];V=G[ae];for(var le=0,ue=se.length;le<ue;le++){var ce=U(se[le],V[le],te);ke(ce.x,ce.y,-ee)}}}for(var he=m+g,de=0;de<I;de++){var fe=p?U(b[de],W[de],he):b[de];M?(a.copy(n.normals[0]).multiplyScalar(fe.x),i.copy(n.binormals[0]).multiplyScalar(fe.y),u.copy(t[0]).add(a).add(i),ke(u.x,u.y,u.z)):ke(fe.x,fe.y,0)}for(var pe=1;pe<=d;pe++)for(var ve=0;ve<I;ve++){var me=p?U(b[ve],W[ve],he):b[ve];M?(a.copy(n.normals[pe]).multiplyScalar(me.x),i.copy(n.binormals[pe]).multiplyScalar(me.y),u.copy(t[pe]).add(a).add(i),ke(u.x,u.y,u.z)):ke(me.x,me.y,f/d*pe)}for(var ge=y-1;ge>=0;ge--){for(var ye=ge/y,_e=v*Math.cos(ye*Math.PI/2),xe=m*Math.sin(ye*Math.PI/2)+g,Me=0,Se=C.length;Me<Se;Me++){var be=U(C[Me],O[Me],xe);ke(be.x,be.y,f+_e)}for(var Ee=0,Te=E.length;Ee<Te;Ee++){var we=E[Ee];V=G[Ee];for(var Ae=0,Re=we.length;Ae<Re;Ae++){var Ce=U(we[Ae],V[Ae],xe);M?ke(Ce.x,Ce.y+t[d-1].y,t[d-1].x+_e):ke(Ce.x,Ce.y,f+_e)}}}function Le(e,t){for(var n=e.length;--n>=0;){var i=n,r=n-1;r<0&&(r=e.length-1);for(var a=0,o=d+2*y;a<o;a++){var s=I*a,l=I*(a+1);Ie(t+i+s,t+r+s,t+r+l,t+i+l)}}}function ke(e,t,n){c.push(e),c.push(t),c.push(n)}function Ue(e,t,n){Ne(e),Ne(t),Ne(n);var i=s.length/3,r=x.generateTopUV(o,s,i-3,i-2,i-1);De(r[0]),De(r[1]),De(r[2])}function Ie(e,t,n,i){Ne(e),Ne(t),Ne(i),Ne(t),Ne(n),Ne(i);var r=s.length/3,a=x.generateSideWallUV(o,s,r-6,r-3,r-2,r-1);De(a[0]),De(a[1]),De(a[3]),De(a[1]),De(a[2]),De(a[3])}function Ne(e){s.push(c[3*e+0]),s.push(c[3*e+1]),s.push(c[3*e+2])}function De(e){l.push(e.x),l.push(e.y)}!function(){var e=s.length/3;if(p){for(var t=0,n=I*t,i=0;i<N;i++){var r=R[i];Ue(r[2]+n,r[1]+n,r[0]+n)}n=I*(t=d+2*y);for(var a=0;a<N;a++){var l=R[a];Ue(l[0]+n,l[1]+n,l[2]+n)}}else{for(var u=0;u<N;u++){var c=R[u];Ue(c[2],c[1],c[0])}for(var h=0;h<N;h++){var f=R[h];Ue(f[0]+I*d,f[1]+I*d,f[2]+I*d)}}o.addGroup(e,s.length/3-e,0)}(),function(){var e=s.length/3,t=0;Le(C,t),t+=C.length;for(var n=0,i=E.length;n<i;n++){var r=E[n];Le(r,t),t+=r.length}o.addGroup(e,s.length/3-e,1)}()}return e.setAttribute("position",new In(s,3)),e.setAttribute("uv",new In(l,2)),e.computeVertexNormals(),e}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}},{key:"toJSON",value:function(){var e=_(c(n.prototype),"toJSON",this).call(this);return function(e,t,n){if(n.shapes=[],Array.isArray(e))for(var i=0,r=e.length;i<r;i++){var a=e[i];n.shapes.push(a.uuid)}else n.shapes.push(e.uuid);return n.options=Object.assign({},t),void 0!==t.extrudePath&&(n.options.extrudePath=t.extrudePath.toJSON()),n}(this.parameters.shapes,this.parameters.options,e)}}],[{key:"fromJSON",value:function(e,t){for(var i=[],r=0,a=e.shapes.length;r<a;r++){var o=t[e.shapes[r]];i.push(o)}var s=e.options.extrudePath;return void 0!==s&&(e.options.extrudePath=(new ss[s.type]).fromJSON(s)),new n(i,e.options)}}]),n}(Vn));var Ws={generateTopUV:function(e,t,n,i,r){var a=t[3*n],o=t[3*n+1],s=t[3*i],l=t[3*i+1],u=t[3*r],c=t[3*r+1];return[new Pe(a,o),new Pe(s,l),new Pe(u,c)]},generateSideWallUV:function(e,t,n,i,r,a){var o=t[3*n],s=t[3*n+1],l=t[3*n+2],u=t[3*i],c=t[3*i+1],h=t[3*i+2],d=t[3*r],f=t[3*r+1],p=t[3*r+2],v=t[3*a],m=t[3*a+1],g=t[3*a+2];return Math.abs(s-c)<Math.abs(o-u)?[new Pe(o,1-l),new Pe(u,1-h),new Pe(d,1-p),new Pe(v,1-g)]:[new Pe(s,1-l),new Pe(c,1-h),new Pe(f,1-p),new Pe(m,1-g)]}};e("bR",function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;a(this,n);var o=(1+Math.sqrt(5))/2,s=[-1,o,0,1,o,0,-1,-o,0,1,-o,0,0,-1,o,0,1,o,0,-1,-o,0,1,-o,o,0,-1,o,0,1,-o,0,-1,-o,0,1],l=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];return(e=t.call(this,s,l,i,r)).type="IcosahedronGeometry",e.parameters={radius:i,detail:r},e}return s(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.detail)}}]),n}(cs)),e("aT",function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.5,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:32,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2*Math.PI;a(this,n),(e=t.call(this)).type="RingGeometry",e.parameters={innerRadius:i,outerRadius:r,thetaSegments:o,phiSegments:s,thetaStart:l,thetaLength:u},o=Math.max(3,o);for(var c=[],h=[],d=[],f=[],p=i,v=(r-i)/(s=Math.max(1,s)),m=new it,g=new Pe,y=0;y<=s;y++){for(var _=0;_<=o;_++){var x=l+_/o*u;m.x=p*Math.cos(x),m.y=p*Math.sin(x),h.push(m.x,m.y,m.z),d.push(0,0,1),g.x=(m.x/r+1)/2,g.y=(m.y/r+1)/2,f.push(g.x,g.y)}p+=v}for(var M=0;M<s;M++)for(var S=M*(o+1),b=0;b<o;b++){var E=b+S,T=E,w=E+o+1,A=E+o+2,R=E+1;c.push(T,w,R),c.push(w,A,R)}return e.setIndex(c),e.setAttribute("position",new In(h,3)),e.setAttribute("normal",new In(d,3)),e.setAttribute("uv",new In(f,2)),e}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}}],[{key:"fromJSON",value:function(e){return new n(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}]),n}(Vn)),e("bP",function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new vs([new Pe(0,.5),new Pe(-.5,-.5),new Pe(.5,-.5)]),r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:12;a(this,n),(e=t.call(this)).type="ShapeGeometry",e.parameters={shapes:i,curveSegments:r};var o=[],s=[],l=[],u=[],c=0,h=0;if(!1===Array.isArray(i))f(i);else for(var d=0;d<i.length;d++)f(i[d]),e.addGroup(c,h,d),c+=h,h=0;function f(e){var t=s.length/3,n=e.extractPoints(r),i=n.shape,a=n.holes;!1===Hs.isClockWise(i)&&(i=i.reverse());for(var c=0,d=a.length;c<d;c++){var f=a[c];!0===Hs.isClockWise(f)&&(a[c]=f.reverse())}for(var p=Hs.triangulateShape(i,a),v=0,m=a.length;v<m;v++){var g=a[v];i=i.concat(g)}for(var y=0,_=i.length;y<_;y++){var x=i[y];s.push(x.x,x.y,0),l.push(0,0,1),u.push(x.x,x.y)}for(var M=0,S=p.length;M<S;M++){var b=p[M],E=b[0]+t,T=b[1]+t,w=b[2]+t;o.push(E,T,w),h+=3}}return e.setIndex(o),e.setAttribute("position",new In(s,3)),e.setAttribute("normal",new In(l,3)),e.setAttribute("uv",new In(u,2)),e}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}},{key:"toJSON",value:function(){var e=_(c(n.prototype),"toJSON",this).call(this);return function(e,t){if(t.shapes=[],Array.isArray(e))for(var n=0,i=e.length;n<i;n++){var r=e[n];t.shapes.push(r.uuid)}else t.shapes.push(e.uuid);return t}(this.parameters.shapes,e)}}],[{key:"fromJSON",value:function(e,t){for(var i=[],r=0,a=e.shapes.length;r<a;r++){var o=t[e.shapes[r]];i.push(o)}return new n(i,e.curveSegments)}}]),n}(Vn)),e("aS",function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:32,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:16,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2*Math.PI,u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:Math.PI;a(this,n),(e=t.call(this)).type="SphereGeometry",e.parameters={radius:i,widthSegments:r,heightSegments:o,phiStart:s,phiLength:l,thetaStart:u,thetaLength:c},r=Math.max(3,Math.floor(r)),o=Math.max(2,Math.floor(o));for(var h=Math.min(u+c,Math.PI),d=0,f=[],p=new it,v=new it,m=[],g=[],y=[],_=[],x=0;x<=o;x++){var M=[],S=x/o,b=0;0===x&&0===u?b=.5/r:x===o&&h===Math.PI&&(b=-.5/r);for(var E=0;E<=r;E++){var T=E/r;p.x=-i*Math.cos(s+T*l)*Math.sin(u+S*c),p.y=i*Math.cos(u+S*c),p.z=i*Math.sin(s+T*l)*Math.sin(u+S*c),g.push(p.x,p.y,p.z),v.copy(p).normalize(),y.push(v.x,v.y,v.z),_.push(T+b,1-S),M.push(d++)}f.push(M)}for(var w=0;w<o;w++)for(var A=0;A<r;A++){var R=f[w][A+1],C=f[w][A],L=f[w+1][A],P=f[w+1][A+1];(0!==w||u>0)&&m.push(R,C,P),(w!==o-1||h<Math.PI)&&m.push(C,L,P)}return e.setIndex(m),e.setAttribute("position",new In(g,3)),e.setAttribute("normal",new In(y,3)),e.setAttribute("uv",new In(_,2)),e}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}}],[{key:"fromJSON",value:function(e){return new n(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}]),n}(Vn)),e("bl",function(e){u(n,e);var t=g(n);function n(e){var i;return a(this,n),(i=t.call(this)).isShadowMaterial=!0,i.type="ShadowMaterial",i.color=new En(0),i.transparent=!0,i.fog=!0,i.setValues(e),i}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.color.copy(e.color),this.fog=e.fog,this}}]),n}(_n));var Xs=e("x",function(e){u(n,e);var t=g(n);function n(e){var i;return a(this,n),(i=t.call(this)).isMeshStandardMaterial=!0,i.defines={STANDARD:""},i.type="MeshStandardMaterial",i.color=new En(16777215),i.roughness=1,i.metalness=0,i.map=null,i.lightMap=null,i.lightMapIntensity=1,i.aoMap=null,i.aoMapIntensity=1,i.emissive=new En(0),i.emissiveIntensity=1,i.emissiveMap=null,i.bumpMap=null,i.bumpScale=1,i.normalMap=null,i.normalMapType=0,i.normalScale=new Pe(1,1),i.displacementMap=null,i.displacementScale=1,i.displacementBias=0,i.roughnessMap=null,i.metalnessMap=null,i.alphaMap=null,i.envMap=null,i.envMapIntensity=1,i.wireframe=!1,i.wireframeLinewidth=1,i.wireframeLinecap="round",i.wireframeLinejoin="round",i.flatShading=!1,i.fog=!0,i.setValues(e),i}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,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.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}}]),n}(_n));function js(e,t,n){return qs(e)?new e.constructor(e.subarray(t,void 0!==n?n:e.length)):e.slice(t,n)}function Ys(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)}function qs(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Zs(e){for(var t=e.length,n=new Array(t),i=0;i!==t;++i)n[i]=i;return n.sort((function(t,n){return e[t]-e[n]})),n}function Js(e,t,n){for(var i=e.length,r=new e.constructor(i),a=0,o=0;o!==i;++a)for(var s=n[a]*t,l=0;l!==t;++l)r[o++]=e[s+l];return r}function Ks(e,t,n,i){for(var r=1,a=e[0];void 0!==a&&void 0===a[i];)a=e[r++];if(void 0!==a){var o=a[i];if(void 0!==o)if(Array.isArray(o))do{void 0!==(o=a[i])&&(t.push(a.time),n.push.apply(n,o)),a=e[r++]}while(void 0!==a);else if(void 0!==o.toArray)do{void 0!==(o=a[i])&&(t.push(a.time),o.toArray(n,n.length)),a=e[r++]}while(void 0!==a);else do{void 0!==(o=a[i])&&(t.push(a.time),n.push(o)),a=e[r++]}while(void 0!==a)}}e("l",function(e){u(n,e);var t=g(n);function n(e){var i;return a(this,n),(i=t.call(this)).isMeshPhysicalMaterial=!0,i.defines={STANDARD:"",PHYSICAL:""},i.type="MeshPhysicalMaterial",i.anisotropyRotation=0,i.anisotropyMap=null,i.clearcoatMap=null,i.clearcoatRoughness=0,i.clearcoatRoughnessMap=null,i.clearcoatNormalScale=new Pe(1,1),i.clearcoatNormalMap=null,i.ior=1.5,Object.defineProperty(v(i),"reflectivity",{get:function(){return be(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),i.iridescenceMap=null,i.iridescenceIOR=1.3,i.iridescenceThicknessRange=[100,400],i.iridescenceThicknessMap=null,i.sheenColor=new En(0),i.sheenColorMap=null,i.sheenRoughness=1,i.sheenRoughnessMap=null,i.transmissionMap=null,i.thickness=0,i.thicknessMap=null,i.attenuationDistance=1/0,i.attenuationColor=new En(1,1,1),i.specularIntensity=1,i.specularIntensityMap=null,i.specularColor=new En(1,1,1),i.specularColorMap=null,i._anisotropy=0,i._clearcoat=0,i._iridescence=0,i._sheen=0,i._transmission=0,i.setValues(e),i}return s(n,[{key:"anisotropy",get:function(){return this._anisotropy},set:function(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}},{key:"clearcoat",get:function(){return this._clearcoat},set:function(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}},{key:"iridescence",get:function(){return this._iridescence},set:function(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}},{key:"sheen",get:function(){return this._sheen},set:function(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}},{key:"transmission",get:function(){return this._transmission},set:function(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}},{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=M(e.iridescenceThicknessRange),this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}]),n}(Xs)),e("bm",function(e){u(n,e);var t=g(n);function n(e){var i;return a(this,n),(i=t.call(this)).isMeshPhongMaterial=!0,i.type="MeshPhongMaterial",i.color=new En(16777215),i.specular=new En(1118481),i.shininess=30,i.map=null,i.lightMap=null,i.lightMapIntensity=1,i.aoMap=null,i.aoMapIntensity=1,i.emissive=new En(0),i.emissiveIntensity=1,i.emissiveMap=null,i.bumpMap=null,i.bumpScale=1,i.normalMap=null,i.normalMapType=0,i.normalScale=new Pe(1,1),i.displacementMap=null,i.displacementScale=1,i.displacementBias=0,i.specularMap=null,i.alphaMap=null,i.envMap=null,i.combine=0,i.reflectivity=1,i.refractionRatio=.98,i.wireframe=!1,i.wireframeLinewidth=1,i.wireframeLinecap="round",i.wireframeLinejoin="round",i.flatShading=!1,i.fog=!0,i.setValues(e),i}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,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.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.flatShading=e.flatShading,this.fog=e.fog,this}}]),n}(_n)),e("ba",function(e){u(n,e);var t=g(n);function n(e){var i;return a(this,n),(i=t.call(this)).isMeshNormalMaterial=!0,i.type="MeshNormalMaterial",i.bumpMap=null,i.bumpScale=1,i.normalMap=null,i.normalMapType=0,i.normalScale=new Pe(1,1),i.displacementMap=null,i.displacementScale=1,i.displacementBias=0,i.wireframe=!1,i.wireframeLinewidth=1,i.flatShading=!1,i.setValues(e),i}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),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.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}]),n}(_n)),e("bn",function(e){u(n,e);var t=g(n);function n(e){var i;return a(this,n),(i=t.call(this)).isMeshLambertMaterial=!0,i.type="MeshLambertMaterial",i.color=new En(16777215),i.map=null,i.lightMap=null,i.lightMapIntensity=1,i.aoMap=null,i.aoMapIntensity=1,i.emissive=new En(0),i.emissiveIntensity=1,i.emissiveMap=null,i.bumpMap=null,i.bumpScale=1,i.normalMap=null,i.normalMapType=0,i.normalScale=new Pe(1,1),i.displacementMap=null,i.displacementScale=1,i.displacementBias=0,i.specularMap=null,i.alphaMap=null,i.envMap=null,i.combine=0,i.reflectivity=1,i.refractionRatio=.98,i.wireframe=!1,i.wireframeLinewidth=1,i.wireframeLinecap="round",i.wireframeLinejoin="round",i.flatShading=!1,i.fog=!0,i.setValues(e),i}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,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.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.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.flatShading=e.flatShading,this.fog=e.fog,this}}]),n}(_n)),e("aO",function(e){u(n,e);var t=g(n);function n(e){var i;return a(this,n),(i=t.call(this)).isLineDashedMaterial=!0,i.type="LineDashedMaterial",i.scale=1,i.dashSize=3,i.gapSize=1,i.setValues(e),i}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}]),n}(wo));var Qs=e("aj",function(){function e(t,n,i,r){a(this,e),this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new n.constructor(i),this.sampleValues=n,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}return s(e,[{key:"evaluate",value:function(e){var t=this.parameterPositions,n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{var a;n:{i:if(!(e<i)){for(var o=n+2;;){if(void 0===i){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(r=i,e<(i=t[++n]))break t}a=t.length;break n}if(e>=r)break e;var s=t[1];e<s&&(n=2,r=s);for(var l=n-2;;){if(void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(n===l)break;if(i=r,e>=(r=t[--n-1]))break t}a=n,n=0}for(;n<a;){var u=n+a>>>1;e<t[u]?a=u:n=u+1}if(i=t[n],void 0===(r=t[n-1]))return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===i)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)}},{key:"getSettings_",value:function(){return this.settings||this.DefaultSettings_}},{key:"copySampleValue_",value:function(e){for(var t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i,a=0;a!==i;++a)t[a]=n[r+a];return t}},{key:"interpolate_",value:function(){throw new Error("call to abstract method")}},{key:"intervalChanged_",value:function(){}}]),e}()),$s=function(e){u(n,e);var t=g(n);function n(e,i,r,o){var s;return a(this,n),(s=t.call(this,e,i,r,o))._weightPrev=-0,s._offsetPrev=-0,s._weightNext=-0,s._offsetNext=-0,s.DefaultSettings_={endingStart:2400,endingEnd:2400},s}return s(n,[{key:"intervalChanged_",value:function(e,t,n){var i=this.parameterPositions,r=e-2,a=e+1,o=i[r],s=i[a];if(void 0===o)switch(this.getSettings_().endingStart){case 2401:r=e,o=2*t-n;break;case 2402:o=t+i[r=i.length-2]-i[r+1];break;default:r=e,o=n}if(void 0===s)switch(this.getSettings_().endingEnd){case 2401:a=e,s=2*n-t;break;case 2402:a=1,s=n+i[1]-i[0];break;default:a=e-1,s=t}var l=.5*(n-t),u=this.valueSize;this._weightPrev=l/(t-o),this._weightNext=l/(s-n),this._offsetPrev=r*u,this._offsetNext=a*u}},{key:"interpolate_",value:function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=s-o,u=this._offsetPrev,c=this._offsetNext,h=this._weightPrev,d=this._weightNext,f=(n-t)/(i-t),p=f*f,v=p*f,m=-h*v+2*h*p-h*f,g=(1+h)*v+(-1.5-2*h)*p+(-.5+h)*f+1,y=(-1-d)*v+(1.5+d)*p+.5*f,_=d*v-d*p,x=0;x!==o;++x)r[x]=m*a[u+x]+g*a[l+x]+y*a[s+x]+_*a[c+x];return r}}]),n}(Qs),el=function(e){u(n,e);var t=g(n);function n(e,i,r,o){return a(this,n),t.call(this,e,i,r,o)}return s(n,[{key:"interpolate_",value:function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=s-o,u=(n-t)/(i-t),c=1-u,h=0;h!==o;++h)r[h]=a[l+h]*c+a[s+h]*u;return r}}]),n}(Qs),tl=function(e){u(n,e);var t=g(n);function n(e,i,r,o){return a(this,n),t.call(this,e,i,r,o)}return s(n,[{key:"interpolate_",value:function(e){return this.copySampleValue_(e-1)}}]),n}(Qs),nl=function(){function e(t,n,i,r){if(a(this,e),void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===n||0===n.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Ys(n,this.TimeBufferType),this.values=Ys(i,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}return s(e,[{key:"InterpolantFactoryMethodDiscrete",value:function(e){return new tl(this.times,this.values,this.getValueSize(),e)}},{key:"InterpolantFactoryMethodLinear",value:function(e){return new el(this.times,this.values,this.getValueSize(),e)}},{key:"InterpolantFactoryMethodSmooth",value:function(e){return new $s(this.times,this.values,this.getValueSize(),e)}},{key:"setInterpolation",value:function(e){var t;switch(e){case he:t=this.InterpolantFactoryMethodDiscrete;break;case de:t=this.InterpolantFactoryMethodLinear;break;case 2302:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){var n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(n);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}},{key:"getInterpolation",value:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return he;case this.InterpolantFactoryMethodLinear:return de;case this.InterpolantFactoryMethodSmooth:return 2302}}},{key:"getValueSize",value:function(){return this.values.length/this.times.length}},{key:"shift",value:function(e){if(0!==e)for(var t=this.times,n=0,i=t.length;n!==i;++n)t[n]+=e;return this}},{key:"scale",value:function(e){if(1!==e)for(var t=this.times,n=0,i=t.length;n!==i;++n)t[n]*=e;return this}},{key:"trim",value:function(e,t){for(var n=this.times,i=n.length,r=0,a=i-1;r!==i&&n[r]<e;)++r;for(;-1!==a&&n[a]>t;)--a;if(++a,0!==r||a!==i){r>=a&&(r=(a=Math.max(a,1))-1);var o=this.getValueSize();this.times=js(n,r,a),this.values=js(this.values,r*o,a*o)}return this}},{key:"validate",value:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);var n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var a=null,o=0;o!==r;o++){var s=n[o];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,s),e=!1;break}if(null!==a&&a>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,s,a),e=!1;break}a=s}if(void 0!==i&&qs(i))for(var l=0,u=i.length;l!==u;++l){var c=i[l];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,l,c),e=!1;break}}return e}},{key:"optimize",value:function(){for(var e=js(this.times),t=js(this.values),n=this.getValueSize(),i=2302===this.getInterpolation(),r=e.length-1,a=1,o=1;o<r;++o){var s=!1,l=e[o];if(l!==e[o+1]&&(1!==o||l!==e[0]))if(i)s=!0;else for(var u=o*n,c=u-n,h=u+n,d=0;d!==n;++d){var f=t[u+d];if(f!==t[c+d]||f!==t[h+d]){s=!0;break}}if(s){if(o!==a){e[a]=e[o];for(var p=o*n,v=a*n,m=0;m!==n;++m)t[v+m]=t[p+m]}++a}}if(r>0){e[a]=e[r];for(var g=r*n,y=a*n,_=0;_!==n;++_)t[y+_]=t[g+_];++a}return a!==e.length?(this.times=js(e,0,a),this.values=js(t,0,a*n)):(this.times=e,this.values=t),this}},{key:"clone",value:function(){var e=js(this.times,0),t=js(this.values,0),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}],[{key:"toJSON",value:function(e){var t,n=e.constructor;if(n.toJSON!==this.toJSON)t=n.toJSON(e);else{t={name:e.name,times:Ys(e.times,Array),values:Ys(e.values,Array)};var i=e.getInterpolation();i!==e.DefaultInterpolation&&(t.interpolation=i)}return t.type=e.ValueTypeName,t}}]),e}();nl.prototype.TimeBufferType=Float32Array,nl.prototype.ValueBufferType=Float32Array,nl.prototype.DefaultInterpolation=de;var il=function(e){u(n,e);var t=g(n);function n(){return a(this,n),t.apply(this,arguments)}return s(n)}(nl);il.prototype.ValueTypeName="bool",il.prototype.ValueBufferType=Array,il.prototype.DefaultInterpolation=he,il.prototype.InterpolantFactoryMethodLinear=void 0,il.prototype.InterpolantFactoryMethodSmooth=void 0;var rl=function(e){u(n,e);var t=g(n);function n(){return a(this,n),t.apply(this,arguments)}return s(n)}(nl);rl.prototype.ValueTypeName="color";var al=e("af",function(e){u(n,e);var t=g(n);function n(){return a(this,n),t.apply(this,arguments)}return s(n)}(nl));al.prototype.ValueTypeName="number";var ol=function(e){u(n,e);var t=g(n);function n(e,i,r,o){return a(this,n),t.call(this,e,i,r,o)}return s(n,[{key:"interpolate_",value:function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(n-t)/(i-t),l=e*o,u=l+o;l!==u;l+=4)nt.slerpFlat(r,0,a,l-o,a,l,s);return r}}]),n}(Qs),sl=e("ag",function(e){u(n,e);var t=g(n);function n(){return a(this,n),t.apply(this,arguments)}return s(n,[{key:"InterpolantFactoryMethodLinear",value:function(e){return new ol(this.times,this.values,this.getValueSize(),e)}}]),n}(nl));sl.prototype.ValueTypeName="quaternion",sl.prototype.DefaultInterpolation=de,sl.prototype.InterpolantFactoryMethodSmooth=void 0;var ll=function(e){u(n,e);var t=g(n);function n(){return a(this,n),t.apply(this,arguments)}return s(n)}(nl);ll.prototype.ValueTypeName="string",ll.prototype.ValueBufferType=Array,ll.prototype.DefaultInterpolation=he,ll.prototype.InterpolantFactoryMethodLinear=void 0,ll.prototype.InterpolantFactoryMethodSmooth=void 0;var ul=e("ae",function(e){u(n,e);var t=g(n);function n(){return a(this,n),t.apply(this,arguments)}return s(n)}(nl));function cl(e){if(void 0===e.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");var t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return al;case"vector":case"vector2":case"vector3":case"vector4":return ul;case"color":return rl;case"quaternion":return sl;case"bool":case"boolean":return il;case"string":return ll}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){var n=[],i=[];Ks(e.keys,n,i,"value"),e.times=n,e.values=i}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}ul.prototype.ValueTypeName="vector",e("$",function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,i=arguments.length>2?arguments[2]:void 0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2500;a(this,e),this.name=t,this.tracks=i,this.duration=n,this.blendMode=r,this.uuid=Se(),this.duration<0&&this.resetDuration()}return s(e,[{key:"resetDuration",value:function(){for(var e=0,t=0,n=this.tracks.length;t!==n;++t){var i=this.tracks[t];e=Math.max(e,i.times[i.times.length-1])}return this.duration=e,this}},{key:"trim",value:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}},{key:"validate",value:function(){for(var e=!0,t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}},{key:"optimize",value:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}},{key:"clone",value:function(){for(var e=[],t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}},{key:"toJSON",value:function(){return this.constructor.toJSON(this)}}],[{key:"parse",value:function(e){for(var t=[],n=e.tracks,i=1/(e.fps||1),r=0,a=n.length;r!==a;++r)t.push(cl(n[r]).scale(i));var o=new this(e.name,e.duration,t,e.blendMode);return o.uuid=e.uuid,o}},{key:"toJSON",value:function(e){for(var t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode},r=0,a=n.length;r!==a;++r)t.push(nl.toJSON(n[r]));return i}},{key:"CreateFromMorphTargetSequence",value:function(e,t,n,i){for(var r=t.length,a=[],o=0;o<r;o++){var s=[],l=[];s.push((o+r-1)%r,o,(o+1)%r),l.push(0,1,0);var u=Zs(s);s=Js(s,1,u),l=Js(l,1,u),i||0!==s[0]||(s.push(r),l.push(l[0])),a.push(new al(".morphTargetInfluences["+t[o].name+"]",s,l).scale(1/n))}return new this(e,-1,a)}},{key:"findByName",value:function(e,t){var n=e;if(!Array.isArray(e)){var i=e;n=i.geometry&&i.geometry.animations||i.animations}for(var r=0;r<n.length;r++)if(n[r].name===t)return n[r];return null}},{key:"CreateClipsFromMorphTargetSequences",value:function(e,t,n){for(var i={},r=/^([\w-]*?)([\d]+)$/,a=0,o=e.length;a<o;a++){var s=e[a],l=s.name.match(r);if(l&&l.length>1){var u=l[1],c=i[u];c||(i[u]=c=[]),c.push(s)}}var h=[];for(var d in i)h.push(this.CreateFromMorphTargetSequence(d,i[d],t,n));return h}},{key:"parseAnimation",value:function(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(e,t,n,i,r){if(0!==n.length){var a=[],o=[];Ks(n,a,o,i),0!==a.length&&r.push(new e(t,a,o))}},i=[],r=e.name||"default",a=e.fps||30,o=e.blendMode,s=e.length||-1,l=e.hierarchy||[],u=0;u<l.length;u++){var c=l[u].keys;if(c&&0!==c.length)if(c[0].morphTargets){var h={},d=void 0;for(d=0;d<c.length;d++)if(c[d].morphTargets)for(var f=0;f<c[d].morphTargets.length;f++)h[c[d].morphTargets[f]]=-1;for(var p in h){for(var v=[],m=[],g=0;g!==c[d].morphTargets.length;++g){var y=c[d];v.push(y.time),m.push(y.morphTarget===p?1:0)}i.push(new al(".morphTargetInfluence["+p+"]",v,m))}s=h.length*a}else{var _=".bones["+t[u].name+"]";n(ul,_+".position",c,"pos",i),n(sl,_+".quaternion",c,"rot",i),n(ul,_+".scale",c,"scl",i)}}return 0===i.length?null:new this(r,s,i,o)}}]),e}());var hl={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}},dl=new(s((function e(t,n,i){a(this,e);var r=this,o=!1,s=0,l=0,u=void 0,c=[];this.onStart=void 0,this.onLoad=t,this.onProgress=n,this.onError=i,this.itemStart=function(e){l++,!1===o&&void 0!==r.onStart&&r.onStart(e,s,l),o=!0},this.itemEnd=function(e){s++,void 0!==r.onProgress&&r.onProgress(e,s,l),s===l&&(o=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(e){void 0!==r.onError&&r.onError(e)},this.resolveURL=function(e){return u?u(e):e},this.setURLModifier=function(e){return u=e,this},this.addHandler=function(e,t){return c.push(e,t),this},this.removeHandler=function(e){var t=c.indexOf(e);return-1!==t&&c.splice(t,2),this},this.getHandler=function(e){for(var t=0,n=c.length;t<n;t+=2){var i=c[t],r=c[t+1];if(i.global&&(i.lastIndex=0),i.test(e))return r}return null}}))),fl=e("i",function(){function e(t){a(this,e),this.manager=void 0!==t?t:dl,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}return s(e,[{key:"load",value:function(){}},{key:"loadAsync",value:function(e,t){var n=this;return new Promise((function(i,r){n.load(e,i,t,r)}))}},{key:"parse",value:function(){}},{key:"setCrossOrigin",value:function(e){return this.crossOrigin=e,this}},{key:"setWithCredentials",value:function(e){return this.withCredentials=e,this}},{key:"setPath",value:function(e){return this.path=e,this}},{key:"setResourcePath",value:function(e){return this.resourcePath=e,this}},{key:"setRequestHeader",value:function(e){return this.requestHeader=e,this}}]),e}());fl.DEFAULT_MATERIAL_NAME="__DEFAULT";var pl={},vl=function(e){u(n,e);var t=g(n);function n(e,i){var r;return a(this,n),(r=t.call(this,e)).response=i,r}return s(n)}(p(Error)),ml=e("F",function(e){u(n,e);var t=g(n);function n(e){return a(this,n),t.call(this,e)}return s(n,[{key:"load",value:function(e,t,n,i){var r=this;void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var a=hl.get(e);if(void 0!==a)return this.manager.itemStart(e),setTimeout((function(){t&&t(a),r.manager.itemEnd(e)}),0),a;if(void 0===pl[e]){pl[e]=[],pl[e].push({onLoad:t,onProgress:n,onError:i});var o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),s=this.mimeType,l=this.responseType;fetch(o).then((function(t){if(200===t.status||0===t.status){if(0===t.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;var n=pl[e],i=t.body.getReader(),r=t.headers.get("Content-Length")||t.headers.get("X-File-Size"),a=r?parseInt(r):0,o=0!==a,s=0,l=new ReadableStream({start:function(e){!function t(){i.read().then((function(i){var r=i.done,l=i.value;if(r)e.close();else{s+=l.byteLength;for(var u=new ProgressEvent("progress",{lengthComputable:o,loaded:s,total:a}),c=0,h=n.length;c<h;c++){var d=n[c];d.onProgress&&d.onProgress(u)}e.enqueue(l),t()}}))}()}});return new Response(l)}throw new vl('fetch for "'.concat(t.url,'" responded with ').concat(t.status,": ").concat(t.statusText),t)})).then((function(e){switch(l){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then((function(e){return(new DOMParser).parseFromString(e,s)}));case"json":return e.json();default:if(void 0===s)return e.text();var t=/charset="?([^;"\s]*)"?/i.exec(s),n=t&&t[1]?t[1].toLowerCase():void 0,i=new TextDecoder(n);return e.arrayBuffer().then((function(e){return i.decode(e)}))}})).then((function(t){hl.add(e,t);var n=pl[e];delete pl[e];for(var i=0,r=n.length;i<r;i++){var a=n[i];a.onLoad&&a.onLoad(t)}})).catch((function(t){var n=pl[e];if(void 0===n)throw r.manager.itemError(e),t;delete pl[e];for(var i=0,a=n.length;i<a;i++){var o=n[i];o.onError&&o.onError(t)}r.manager.itemError(e)})).finally((function(){r.manager.itemEnd(e)})),this.manager.itemStart(e)}else pl[e].push({onLoad:t,onProgress:n,onError:i})}},{key:"setResponseType",value:function(e){return this.responseType=e,this}},{key:"setMimeType",value:function(e){return this.mimeType=e,this}}]),n}(fl)),gl=function(e){u(n,e);var t=g(n);function n(e){return a(this,n),t.call(this,e)}return s(n,[{key:"load",value:function(e,t,n,i){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var r=this,a=hl.get(e);if(void 0!==a)return r.manager.itemStart(e),setTimeout((function(){t&&t(a),r.manager.itemEnd(e)}),0),a;var o=Ne("img");function s(){u(),hl.add(e,this),t&&t(this),r.manager.itemEnd(e)}function l(t){u(),i&&i(t),r.manager.itemError(e),r.manager.itemEnd(e)}function u(){o.removeEventListener("load",s,!1),o.removeEventListener("error",l,!1)}return o.addEventListener("load",s,!1),o.addEventListener("error",l,!1),"data:"!==e.slice(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),r.manager.itemStart(e),o.src=e,o}}]),n}(fl),yl=(e("aW",function(e){u(n,e);var t=g(n);function n(e){return a(this,n),t.call(this,e)}return s(n,[{key:"load",value:function(e,t,n,i){var r=this,a=new vo,o=new ml(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(r.withCredentials),o.load(e,(function(e){var n;try{n=r.parse(e)}catch(e){if(void 0===i)return void console.error(e);i(e)}if(!n)return i();void 0!==n.image?a.image=n.image:void 0!==n.data&&(a.image.width=n.width,a.image.height=n.height,a.image.data=n.data),a.wrapS=void 0!==n.wrapS?n.wrapS:J,a.wrapT=void 0!==n.wrapT?n.wrapT:J,a.magFilter=void 0!==n.magFilter?n.magFilter:te,a.minFilter=void 0!==n.minFilter?n.minFilter:te,a.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.colorSpace?a.colorSpace=n.colorSpace:void 0!==n.encoding&&(a.encoding=n.encoding),void 0!==n.flipY&&(a.flipY=n.flipY),void 0!==n.format&&(a.format=n.format),void 0!==n.type&&(a.type=n.type),void 0!==n.mipmaps&&(a.mipmaps=n.mipmaps,a.minFilter=ie),1===n.mipmapCount&&(a.minFilter=te),void 0!==n.generateMipmaps&&(a.generateMipmaps=n.generateMipmaps),a.needsUpdate=!0,t&&t(a,n)}),n,i),a}}]),n}(fl)),e("aa",function(e){u(n,e);var t=g(n);function n(e){return a(this,n),t.call(this,e)}return s(n,[{key:"load",value:function(e,t,n,i){var r=new Ke,a=new gl(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,(function(e){r.image=e,r.needsUpdate=!0,void 0!==t&&t(r)}),n,i),r}}]),n}(fl)),function(e){u(n,e);var t=g(n);function n(e){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return a(this,n),(i=t.call(this)).isLight=!0,i.type="Light",i.color=new En(e),i.intensity=r,i}return s(n,[{key:"dispose",value:function(){}},{key:"copy",value:function(e,t){return _(c(n.prototype),"copy",this).call(this,e,t),this.color.copy(e.color),this.intensity=e.intensity,this}},{key:"toJSON",value:function(e){var t=_(c(n.prototype),"toJSON",this).call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}]),n}(an)),_l=new Ut,xl=new it,Ml=new it,Sl=function(){function e(t){a(this,e),this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Pe(512,512),this.map=null,this.mapPass=null,this.matrix=new Ut,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Ti,this._frameExtents=new Pe(1,1),this._viewportCount=1,this._viewports=[new Qe(0,0,1,1)]}return s(e,[{key:"getViewportCount",value:function(){return this._viewportCount}},{key:"getFrustum",value:function(){return this._frustum}},{key:"updateMatrices",value:function(e){var t=this.camera,n=this.matrix;xl.setFromMatrixPosition(e.matrixWorld),t.position.copy(xl),Ml.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Ml),t.updateMatrixWorld(),_l.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(_l),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(_l)}},{key:"getViewport",value:function(e){return this._viewports[e]}},{key:"getFrameExtents",value:function(){return this._frameExtents}},{key:"dispose",value:function(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}},{key:"copy",value:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"toJSON",value:function(){var e={};return 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}}]),e}(),bl=function(e){u(n,e);var t=g(n);function n(){var e;return a(this,n),(e=t.call(this,new vi(50,1,.5,500))).isSpotLightShadow=!0,e.focus=1,e}return s(n,[{key:"updateMatrices",value:function(e){var t=this.camera,i=2*Me*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height,a=e.distance||t.far;i===t.fov&&r===t.aspect&&a===t.far||(t.fov=i,t.aspect=r,t.far=a,t.updateProjectionMatrix()),_(c(n.prototype),"updateMatrices",this).call(this,e)}},{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.focus=e.focus,this}}]),n}(Sl),El=(e("S",function(e){u(n,e);var t=g(n);function n(e,i){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Math.PI/3,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2;return a(this,n),(r=t.call(this,e,i)).isSpotLight=!0,r.type="SpotLight",r.position.copy(an.DEFAULT_UP),r.updateMatrix(),r.target=new an,r.distance=o,r.angle=s,r.penumbra=l,r.decay=u,r.map=null,r.shadow=new bl,r}return s(n,[{key:"power",get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}},{key:"dispose",value:function(){this.shadow.dispose()}},{key:"copy",value:function(e,t){return _(c(n.prototype),"copy",this).call(this,e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}]),n}(yl)),new Ut),Tl=new it,wl=new it,Al=function(e){u(n,e);var t=g(n);function n(){var e;return a(this,n),(e=t.call(this,new vi(90,1,.5,500))).isPointLightShadow=!0,e._frameExtents=new Pe(4,2),e._viewportCount=6,e._viewports=[new Qe(2,1,1,1),new Qe(0,1,1,1),new Qe(3,1,1,1),new Qe(1,1,1,1),new Qe(3,0,1,1),new Qe(1,0,1,1)],e._cubeDirections=[new it(1,0,0),new it(-1,0,0),new it(0,0,1),new it(0,0,-1),new it(0,1,0),new it(0,-1,0)],e._cubeUps=[new it(0,1,0),new it(0,1,0),new it(0,1,0),new it(0,1,0),new it(0,0,1),new it(0,0,-1)],e}return s(n,[{key:"updateMatrices",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.camera,i=this.matrix,r=e.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),Tl.setFromMatrixPosition(e.matrixWorld),n.position.copy(Tl),wl.copy(n.position),wl.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(wl),n.updateMatrixWorld(),i.makeTranslation(-Tl.x,-Tl.y,-Tl.z),El.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(El)}}]),n}(Sl),Rl=(e("P",function(e){u(n,e);var t=g(n);function n(e,i){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2;return a(this,n),(r=t.call(this,e,i)).isPointLight=!0,r.type="PointLight",r.distance=o,r.decay=s,r.shadow=new Al,r}return s(n,[{key:"power",get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}},{key:"dispose",value:function(){this.shadow.dispose()}},{key:"copy",value:function(e,t){return _(c(n.prototype),"copy",this).call(this,e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}]),n}(yl)),function(e){u(n,e);var t=g(n);function n(){var e;return a(this,n),(e=t.call(this,new zi(-5,5,5,-5,.5,500))).isDirectionalLightShadow=!0,e}return s(n)}(Sl));function Cl(){return("undefined"==typeof performance?Date:performance).now()}e("D",function(e){u(n,e);var t=g(n);function n(e,i){var r;return a(this,n),(r=t.call(this,e,i)).isDirectionalLight=!0,r.type="DirectionalLight",r.position.copy(an.DEFAULT_UP),r.updateMatrix(),r.target=new an,r.shadow=new Rl,r}return s(n,[{key:"dispose",value:function(){this.shadow.dispose()}},{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}]),n}(yl)),e("A",function(e){u(n,e);var t=g(n);function n(e,i){var r;return a(this,n),(r=t.call(this,e,i)).isAmbientLight=!0,r.type="AmbientLight",r}return s(n)}(yl)),e("R",function(e){u(n,e);var t=g(n);function n(e,i){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10;return a(this,n),(r=t.call(this,e,i)).isRectAreaLight=!0,r.type="RectAreaLight",r.width=o,r.height=s,r}return s(n,[{key:"power",get:function(){return this.intensity*this.width*this.height*Math.PI},set:function(e){this.intensity=e/(this.width*this.height*Math.PI)}},{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.width=e.width,this.height=e.height,this}},{key:"toJSON",value:function(e){var t=_(c(n.prototype),"toJSON",this).call(this,e);return t.object.width=this.width,t.object.height=this.height,t}}]),n}(yl)),e("L",function(){function e(){a(this,e)}return s(e,null,[{key:"decodeText",value:function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var t="",n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(e){return t}}},{key:"extractUrlBase",value:function(e){var t=e.lastIndexOf("/");return-1===t?"./":e.slice(0,t+1)}},{key:"resolveURL",value:function(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}]),e}()),e("ab",function(e){u(n,e);var t=g(n);function n(e){var i;return a(this,n),(i=t.call(this,e)).isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),i.options={premultiplyAlpha:"none"},i}return s(n,[{key:"setOptions",value:function(e){return this.options=e,this}},{key:"load",value:function(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var r=this,a=hl.get(e);if(void 0!==a)return r.manager.itemStart(e),setTimeout((function(){t&&t(a),r.manager.itemEnd(e)}),0),a;var o={};o.credentials="anonymous"===this.crossOrigin?"same-origin":"include",o.headers=this.requestHeader,fetch(e,o).then((function(e){return e.blob()})).then((function(e){return createImageBitmap(e,Object.assign(r.options,{colorSpaceConversion:"none"}))})).then((function(n){hl.add(e,n),t&&t(n),r.manager.itemEnd(e)})).catch((function(t){i&&i(t),r.manager.itemError(e),r.manager.itemEnd(e)})),r.manager.itemStart(e)}}]),n}(fl)),e("bU",function(){function e(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];a(this,e),this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}return s(e,[{key:"start",value:function(){this.startTime=Cl(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}},{key:"stop",value:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}},{key:"getElapsedTime",value:function(){return this.getDelta(),this.elapsedTime}},{key:"getDelta",value:function(){var e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var t=Cl();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}]),e}());var Ll=new RegExp("[\\[\\]\\.:\\/]","g"),Pl="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",kl=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]")+/(WCOD+)?/.source.replace("WCOD",Pl)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]")+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]")+"$"),Ul=["material","materials","bones","map"],Il=function(){function e(t,n,i){a(this,e);var r=i||Nl.parseTrackName(n);this._targetGroup=t,this._bindings=t.subscribe_(n,r)}return s(e,[{key:"getValue",value:function(e,t){this.bind();var n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(e,t)}},{key:"setValue",value:function(e,t){for(var n=this._bindings,i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)}},{key:"bind",value:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}},{key:"unbind",value:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}]),e}(),Nl=e("z",function(){function e(t,n,i){a(this,e),this.path=n,this.parsedPath=i||e.parseTrackName(n),this.node=e.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}return s(e,[{key:"_getValue_unavailable",value:function(){}},{key:"_setValue_unavailable",value:function(){}},{key:"_getValue_direct",value:function(e,t){e[t]=this.targetObject[this.propertyName]}},{key:"_getValue_array",value:function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)e[t++]=n[i]}},{key:"_getValue_arrayElement",value:function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}},{key:"_getValue_toArray",value:function(e,t){this.resolvedProperty.toArray(e,t)}},{key:"_setValue_direct",value:function(e,t){this.targetObject[this.propertyName]=e[t]}},{key:"_setValue_direct_setNeedsUpdate",value:function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}},{key:"_setValue_direct_setMatrixWorldNeedsUpdate",value:function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_setValue_array",value:function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=e[t++]}},{key:"_setValue_array_setNeedsUpdate",value:function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}},{key:"_setValue_array_setMatrixWorldNeedsUpdate",value:function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_setValue_arrayElement",value:function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}},{key:"_setValue_arrayElement_setNeedsUpdate",value:function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}},{key:"_setValue_arrayElement_setMatrixWorldNeedsUpdate",value:function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_setValue_fromArray",value:function(e,t){this.resolvedProperty.fromArray(e,t)}},{key:"_setValue_fromArray_setNeedsUpdate",value:function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}},{key:"_setValue_fromArray_setMatrixWorldNeedsUpdate",value:function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_getValue_unbound",value:function(e,t){this.bind(),this.getValue(e,t)}},{key:"_setValue_unbound",value:function(e,t){this.bind(),this.setValue(e,t)}},{key:"bind",value:function(){var t=this.node,n=this.parsedPath,i=n.objectName,r=n.propertyName,a=n.propertyIndex;if(t||(t=e.findNode(this.rootNode,n.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,t){if(i){var o=n.objectIndex;switch(i){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(var s=0;s<t.length;s++)if(t[s].name===o){o=s;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.map)return void console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);t=t.material.map;break;default:if(void 0===t[i])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[i]}if(void 0!==o){if(void 0===t[o])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[o]}}var l=t[r];if(void 0!==l){var u=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?u=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(u=this.Versioning.MatrixWorldNeedsUpdate);var c=this.BindingType.Direct;if(void 0!==a){if("morphTargetInfluences"===r){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[a]&&(a=t.morphTargetDictionary[a])}c=this.BindingType.ArrayElement,this.resolvedProperty=l,this.propertyIndex=a}else void 0!==l.fromArray&&void 0!==l.toArray?(c=this.BindingType.HasFromToArray,this.resolvedProperty=l):Array.isArray(l)?(c=this.BindingType.EntireArray,this.resolvedProperty=l):this.propertyName=r;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][u]}else{var h=n.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+h+"."+r+" but it wasn't found.",t)}}else console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".")}},{key:"unbind",value:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}],[{key:"create",value:function(t,n,i){return t&&t.isAnimationObjectGroup?new e.Composite(t,n,i):new e(t,n,i)}},{key:"sanitizeNodeName",value:function(e){return e.replace(/\s/g,"_").replace(Ll,"")}},{key:"parseTrackName",value:function(e){var t=kl.exec(e);if(null===t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);var n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){var r=n.nodeName.substring(i+1);-1!==Ul.indexOf(r)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=r)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}},{key:"findNode",value:function(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){var n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){var i=function e(n){for(var i=0;i<n.length;i++){var r=n[i];if(r.name===t||r.uuid===t)return r;var a=e(r.children);if(a)return a}return null}(e.children);if(i)return i}return null}}]),e}());function Dl(e,t){return e.distance-t.distance}function Ol(e,t,n,i){if(e.layers.test(t.layers)&&e.raycast(t,n),!0===i)for(var r=e.children,a=0,o=r.length;a<o;a++)Ol(r[a],t,n,!0)}Nl.Composite=Il,Nl.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Nl.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Nl.prototype.GetterByBindingType=[Nl.prototype._getValue_direct,Nl.prototype._getValue_array,Nl.prototype._getValue_arrayElement,Nl.prototype._getValue_toArray],Nl.prototype.SetterByBindingTypeAndVersioning=[[Nl.prototype._setValue_direct,Nl.prototype._setValue_direct_setNeedsUpdate,Nl.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Nl.prototype._setValue_array,Nl.prototype._setValue_array_setNeedsUpdate,Nl.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Nl.prototype._setValue_arrayElement,Nl.prototype._setValue_arrayElement_setNeedsUpdate,Nl.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Nl.prototype._setValue_fromArray,Nl.prototype._setValue_fromArray_setNeedsUpdate,Nl.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]],e("bH",function(){function e(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1/0;a(this,e),this.ray=new kt(t,n),this.near=i,this.far=r,this.camera=null,this.layers=new Wt,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}return s(e,[{key:"set",value:function(e,t){this.ray.set(e,t)}},{key:"setFromCamera",value:function(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):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}},{key:"intersectObject",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return Ol(e,this,n,t),n.sort(Dl),n}},{key:"intersectObjects",value:function(e){for(var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=0,r=e.length;i<r;i++)Ol(e[i],this,n,t);return n.sort(Dl),n}}]),e}());var Fl=new it,zl=new it,Bl=(e("aR",function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new it,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new it;a(this,e),this.start=t,this.end=n}return s(e,[{key:"set",value:function(e,t){return this.start.copy(e),this.end.copy(t),this}},{key:"copy",value:function(e){return this.start.copy(e.start),this.end.copy(e.end),this}},{key:"getCenter",value:function(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}},{key:"delta",value:function(e){return e.subVectors(this.end,this.start)}},{key:"distanceSq",value:function(){return this.start.distanceToSquared(this.end)}},{key:"distance",value:function(){return this.start.distanceTo(this.end)}},{key:"at",value:function(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}},{key:"closestPointToPointParameter",value:function(e,t){Fl.subVectors(e,this.start),zl.subVectors(this.end,this.start);var n=zl.dot(zl),i=zl.dot(Fl)/n;return t&&(i=be(i,0,1)),i}},{key:"closestPointToPoint",value:function(e,t,n){var i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}},{key:"applyMatrix4",value:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}},{key:"equals",value:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}()),new it),Hl=new pi;function Vl(e,t,n,i,r,a,o){Bl.set(r,a,o).unproject(i);var s=t[e];if(void 0!==s)for(var l=n.getAttribute("position"),u=0,c=s.length;u<c;u++)l.setXYZ(s[u],Bl.x,Bl.y,Bl.z)}e("bh",function(e){u(n,e);var t=g(n);function n(e){var i;a(this,n);var r=new Vn,o=new wo({color:16777215,vertexColors:!0,toneMapped:!1}),s=[],l=[],u={};function c(e,t){h(e),h(t)}function h(e){s.push(0,0,0),l.push(0,0,0),void 0===u[e]&&(u[e]=[]),u[e].push(s.length/3-1)}c("n1","n2"),c("n2","n4"),c("n4","n3"),c("n3","n1"),c("f1","f2"),c("f2","f4"),c("f4","f3"),c("f3","f1"),c("n1","f1"),c("n2","f2"),c("n3","f3"),c("n4","f4"),c("p","n1"),c("p","n2"),c("p","n3"),c("p","n4"),c("u1","u2"),c("u2","u3"),c("u3","u1"),c("c","t"),c("p","c"),c("cn1","cn2"),c("cn3","cn4"),c("cf1","cf2"),c("cf3","cf4"),r.setAttribute("position",new In(s,3)),r.setAttribute("color",new In(l,3)),(i=t.call(this,r,o)).type="CameraHelper",i.camera=e,i.camera.updateProjectionMatrix&&i.camera.updateProjectionMatrix(),i.matrix=e.matrixWorld,i.matrixAutoUpdate=!1,i.pointMap=u,i.update();var d=new En(16755200),f=new En(16711680),p=new En(43775),v=new En(16777215),m=new En(3355443);return i.setColors(d,f,p,v,m),i}return s(n,[{key:"setColors",value:function(e,t,n,i,r){var a=this.geometry.getAttribute("color");a.setXYZ(0,e.r,e.g,e.b),a.setXYZ(1,e.r,e.g,e.b),a.setXYZ(2,e.r,e.g,e.b),a.setXYZ(3,e.r,e.g,e.b),a.setXYZ(4,e.r,e.g,e.b),a.setXYZ(5,e.r,e.g,e.b),a.setXYZ(6,e.r,e.g,e.b),a.setXYZ(7,e.r,e.g,e.b),a.setXYZ(8,e.r,e.g,e.b),a.setXYZ(9,e.r,e.g,e.b),a.setXYZ(10,e.r,e.g,e.b),a.setXYZ(11,e.r,e.g,e.b),a.setXYZ(12,e.r,e.g,e.b),a.setXYZ(13,e.r,e.g,e.b),a.setXYZ(14,e.r,e.g,e.b),a.setXYZ(15,e.r,e.g,e.b),a.setXYZ(16,e.r,e.g,e.b),a.setXYZ(17,e.r,e.g,e.b),a.setXYZ(18,e.r,e.g,e.b),a.setXYZ(19,e.r,e.g,e.b),a.setXYZ(20,e.r,e.g,e.b),a.setXYZ(21,e.r,e.g,e.b),a.setXYZ(22,e.r,e.g,e.b),a.setXYZ(23,e.r,e.g,e.b),a.setXYZ(24,t.r,t.g,t.b),a.setXYZ(25,t.r,t.g,t.b),a.setXYZ(26,t.r,t.g,t.b),a.setXYZ(27,t.r,t.g,t.b),a.setXYZ(28,t.r,t.g,t.b),a.setXYZ(29,t.r,t.g,t.b),a.setXYZ(30,t.r,t.g,t.b),a.setXYZ(31,t.r,t.g,t.b),a.setXYZ(32,n.r,n.g,n.b),a.setXYZ(33,n.r,n.g,n.b),a.setXYZ(34,n.r,n.g,n.b),a.setXYZ(35,n.r,n.g,n.b),a.setXYZ(36,n.r,n.g,n.b),a.setXYZ(37,n.r,n.g,n.b),a.setXYZ(38,i.r,i.g,i.b),a.setXYZ(39,i.r,i.g,i.b),a.setXYZ(40,r.r,r.g,r.b),a.setXYZ(41,r.r,r.g,r.b),a.setXYZ(42,r.r,r.g,r.b),a.setXYZ(43,r.r,r.g,r.b),a.setXYZ(44,r.r,r.g,r.b),a.setXYZ(45,r.r,r.g,r.b),a.setXYZ(46,r.r,r.g,r.b),a.setXYZ(47,r.r,r.g,r.b),a.setXYZ(48,r.r,r.g,r.b),a.setXYZ(49,r.r,r.g,r.b),a.needsUpdate=!0}},{key:"update",value:function(){var e=this.geometry,t=this.pointMap;Hl.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),Vl("c",t,e,Hl,0,0,-1),Vl("t",t,e,Hl,0,0,1),Vl("n1",t,e,Hl,-1,-1,-1),Vl("n2",t,e,Hl,1,-1,-1),Vl("n3",t,e,Hl,-1,1,-1),Vl("n4",t,e,Hl,1,1,-1),Vl("f1",t,e,Hl,-1,-1,1),Vl("f2",t,e,Hl,1,-1,1),Vl("f3",t,e,Hl,-1,1,1),Vl("f4",t,e,Hl,1,1,1),Vl("u1",t,e,Hl,.7,1.1,-1),Vl("u2",t,e,Hl,-.7,1.1,-1),Vl("u3",t,e,Hl,0,2,-1),Vl("cf1",t,e,Hl,-1,0,1),Vl("cf2",t,e,Hl,1,0,1),Vl("cf3",t,e,Hl,0,-1,1),Vl("cf4",t,e,Hl,0,1,1),Vl("cn1",t,e,Hl,-1,0,-1),Vl("cn2",t,e,Hl,1,0,-1),Vl("cn3",t,e,Hl,0,-1,-1),Vl("cn4",t,e,Hl,0,1,-1),e.getAttribute("position").needsUpdate=!0}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}}]),n}(No));var Gl,Wl,Xl=new it;e("aP",function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new it(0,0,1),r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new it(0,0,0),o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:16776960,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.2*o,u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:.2*l;return a(this,n),(e=t.call(this)).type="ArrowHelper",void 0===Gl&&((Gl=new Vn).setAttribute("position",new In([0,0,0,0,1,0],3)),(Wl=new us(0,.5,1,5,1)).translate(0,-.5,0)),e.position.copy(r),e.line=new ko(Gl,new wo({color:s,toneMapped:!1})),e.line.matrixAutoUpdate=!1,e.add(e.line),e.cone=new oi(Wl,new wn({color:s,toneMapped:!1})),e.cone.matrixAutoUpdate=!1,e.add(e.cone),e.setDirection(i),e.setLength(o,l,u),e}return s(n,[{key:"setDirection",value:function(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{Xl.set(e.z,0,-e.x).normalize();var t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Xl,t)}}},{key:"setLength",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.2*e,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.2*t;this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}},{key:"setColor",value:function(e){this.line.material.color.set(e),this.cone.material.color.set(e)}},{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}},{key:"dispose",value:function(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}]),n}(an)),e("aC",function(){function e(){a(this,e),this.type="ShapePath",this.color=new En,this.subPaths=[],this.currentPath=null}return s(e,[{key:"moveTo",value:function(e,t){return this.currentPath=new ls,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}},{key:"lineTo",value:function(e,t){return this.currentPath.lineTo(e,t),this}},{key:"quadraticCurveTo",value:function(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}},{key:"bezierCurveTo",value:function(e,t,n,i,r,a){return this.currentPath.bezierCurveTo(e,t,n,i,r,a),this}},{key:"splineThru",value:function(e){return this.currentPath.splineThru(e),this}},{key:"toShapes",value:function(e){function t(e,t){for(var n=t.length,i=!1,r=n-1,a=0;a<n;r=a++){var o=t[r],s=t[a],l=s.x-o.x,u=s.y-o.y;if(Math.abs(u)>Number.EPSILON){if(u<0&&(o=t[a],l=-l,s=t[r],u=-u),e.y<o.y||e.y>s.y)continue;if(e.y===o.y){if(e.x===o.x)return!0}else{var c=u*(e.x-o.x)-l*(e.y-o.y);if(0===c)return!0;if(c<0)continue;i=!i}}else{if(e.y!==o.y)continue;if(s.x<=e.x&&e.x<=o.x||o.x<=e.x&&e.x<=s.x)return!0}}return i}var n,i,r,a=Hs.isClockWise,o=this.subPaths;if(0===o.length)return[];var s=[];if(1===o.length)return i=o[0],(r=new vs).curves=i.curves,s.push(r),s;var l=!a(o[0].getPoints());l=e?!l:l;var u,c,h=[],d=[],f=[],p=0;d[p]=void 0,f[p]=[];for(var v=0,m=o.length;v<m;v++)n=a(u=(i=o[v]).getPoints()),(n=e?!n:n)?(!l&&d[p]&&p++,d[p]={s:new vs,p:u},d[p].s.curves=i.curves,l&&p++,f[p]=[]):f[p].push({h:i,p:u[0]});if(!d[0])return function(e){for(var t=[],n=0,i=e.length;n<i;n++){var r=e[n],a=new vs;a.curves=r.curves,t.push(a)}return t}(o);if(d.length>1){for(var g=!1,y=0,_=0,x=d.length;_<x;_++)h[_]=[];for(var M=0,S=d.length;M<S;M++)for(var b=f[M],E=0;E<b.length;E++){for(var T=b[E],w=!0,A=0;A<d.length;A++)t(T.p,d[A].p)&&(M!==A&&y++,w?(w=!1,h[A].push(T)):g=!0);w&&h[M].push(T)}y>0&&!1===g&&(f=h)}for(var R=0,C=d.length;R<C;R++){r=d[R].s,s.push(r);for(var L=0,P=(c=f[R]).length;L<P;L++)r.holes.push(c[L].h)}return s}}]),e}()),"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"155"}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="155"),e("as",{PRIMARY:14352384,ON_PRIMARY:16777215,DEFAULT_BACKGROUND:16250871,SELECTION:16777215,PREVIEW_DOCKING_COLOR:266198493}),e("at",{SMART:"smart",OFF:"off",ALWAYS:"always"}),e("aM",e=>{document.body.style.cursor=e}),e("aL",e=>{const t=e.headers.get("content-type");if(t&&t.includes("application/json"))return e.json();throw new TypeError("No JSON returned")}),e("g",()=>window.__RML__ENV__&&window.__RML__ENV__.assetPath?window.__RML__ENV__.assetPath:"");const jl=e("aK",(e=null)=>e?(parseInt(e,10)^16*Math.random()>>parseInt(e,10)/4).toString(16):(1e7.toString()+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,jl)),Yl=(e("av",(e,t,n)=>{Yl(e,t,{writable:n})}),e("aw",(e,t,n)=>{const i=Object.getOwnPropertyDescriptor(e,t);for(let e in n)n.hasOwnProperty(e)&&(i[e]=n[e]);Object.defineProperty(e,t,i)})),ql=(e("az",e=>({id:e,name:e,externalIdentifier:"test-identifier",group:"test-group",groupLabel:"test-group-label",color:"#"+new En(.5,.5,.5).getHexString(),thumbnail:ql(e,15),label:"test-label",textures:[1,2,3],shading:{alpha:1,metallic:.5,basecolor:{r:.5,g:.5,b:.5},roughness:.5,doubleSided:!1,alphaCutoff:.5},active:!0,tags:[]})),e("aA",e=>{const t=e.split("_"),n=parseInt(t[1],10);return{mapping:"RGB",id:e,material:e,image:ql(e),url:ql(e),height:n,width:n,mmHeight:1,mmWidth:1,tileable:!0}}),(e,t)=>{const n=e.split("_");return t||(t=parseInt(n[1],10)),"https://loremflickr.com/"+t+"/"+t+"?lock="+Math.abs(parseFloat(n[2]))}),Zl=(e("aU",e=>"string"==typeof e||e instanceof String),e("aI",(e,t)=>e.reduce((e,n)=>{if("object"!=typeof n)return console.warn("objectArrayToMap only works for arrays of objects"),e;const i=n[t];return i?(e.has(i)||e.set(i,n),e):(console.warn('Object has no key "'+t.toString()+'" therefore we do not know where to put it'),e)},new Map)),e("bW",(e,t=16)=>{let n,i=!1,r=0,a=null;return function(...o){n||(n=Date.now()),!i||n+t-Date.now()<0?(e.apply(this,[...arguments]),n=Date.now(),i=!0):r++,a||(a=setInterval(()=>{r&&e.apply(this,[...arguments]),r=0,clearInterval(a),a=null},t))}}),e("bJ",(e,t=16)=>{let n,i=!1;return function(...r){!i||n+t-Date.now()<0?(n=Date.now(),e.apply(this,[...arguments]),i=!0):n=Date.now()}}),e("bK",(e,t)=>{let n;return(...i)=>{clearTimeout(n),n=setTimeout(()=>{e(...i)},t)}}),e("aH",async e=>new Promise(t=>setTimeout(t,e))),e("aJ",(e,t)=>{if(-1===t)return e;const n=Math.pow(10,t);return Math.round(e*n)/n}),new RegExp(/\/3d\/[0-9]+\//)),Jl=(e("aF",e=>{var t;if(null===(t=e.assets.glb)||void 0===t?void 0:t.url)return e.assets.glb.url;if(e.threeDimensionalAsset)return e.threeDimensionalAsset;const n=e.threeDimensionalAssetWeb;return n&&"string"==typeof n?n.match(Zl)?n.replace(Zl,"/3d/glb/").replace(".flash.u3d",".glb"):n:null}),e("au",(e,t)=>{for(const n in t)try{t[n].constructor===Object?e[n]=Jl(e[n],t[n]):e[n]=t[n]}catch(i){e[n]=t[n]}return e})),Kl=(e("ar",(e,t)=>void 0===e?t:e),e("aD",(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)}),e("bY",e=>e?JSON.parse(JSON.stringify(e)):e),e("bL",e=>"string"==typeof e&&Kl(e)?new En(Number(e)):new En(e)),e=>Boolean(e.match(/^0x[0-9a-f]+$/i)));e("bZ",(e,t)=>{var n;return t.materialId?e.materialId=t.materialId:t.color?e.rgbValue=(n=t.color)?Number("0x"+n.substring(1)):-1:t.rgbValue?e.rgbValue=t.rgbValue:e.catalogItemId?e.catalogItemId=t.catalogItemId:t.id?e.materialId=t.id:console.warn("Can not set material because neither a texture nor a RGB value was found"),e}),e("bV",(e,t)=>{const n=document.createElement("a");n.setAttribute("href",t),n.setAttribute("download",e),n.style.display="none",document.body.appendChild(n),n.click(),document.body.removeChild(n)}),e("bM",(e,t)=>!(!e||!t||Math.abs(e.targetX-t.targetX)>.01||Math.abs(e.targetY-t.targetY)>.01||Math.abs(e.targetZ-t.targetZ)>.01||Math.abs(e.yaw-t.yaw)>.01||Math.abs(e.distance-t.distance)>.01)),e("aG",(e,t,n,i,r)=>(e-t)*(r-i)/(n-t)+i);let Ql=0;e("M",class extends class{get eventPoster(){return this._eventPoster&&this._eventPoster.postMessage?this._eventPoster:this.eventListener&&this.eventListener.postMessage?this.eventListener:{postMessage:()=>{}}}hasEventPoster(){return!!this._eventPoster}constructor(e,t){this._callbacks=e,this.eventListener=t,this.eventListener.addEventListener("message",this,!1)}nextConversationId(){return Ql++}setEventPoster(e){this._eventPoster=e}handleEvent(e){if(!e||!e.data)return;const[t,n,i]=JSON.parse(e.data);if(!t||0!==t.indexOf("rml"))return;const[r,a]=t.split("."),o=parseInt(a,10);this._callbacks.onCommand(o,parseInt(n,10),i)}}{constructor(e,t){super(e,t),this._promiseCallbacks=new Map}sendToWorker(e,t=null,n,i){const r=this.nextConversationId(),a=()=>!1;!n&&i&&(n=a),n&&!i&&(i=a),n&&i&&this._promiseCallbacks.set(r,{resolve:n,reject:i}),this.eventPoster.postMessage(JSON.stringify(["rml."+e,r,t]))}resolvePromises(e,t){const n=this._promiseCallbacks.get(e);n&&(n.resolve.apply(n,[t]),this._promiseCallbacks.delete(e))}})}}}));
7
- //# sourceMappingURL=main-thread-to-worker-334452db.legacy.js.map
6
+ */e({_:u,aC:M,ac:x,ak:_,al:c,b_:m,bt:l,bu:v,bv:function(e){for(var n=1;n<arguments.length;n++){var i=null!=arguments[n]?arguments[n]:{};n%2?t(Object(i),!0).forEach((function(t){l(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):t(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e},e:g,f:a,h:s,m:E,o:i}),e("bp",0);var R=e("bo",1),C=e("bq",2),L=e("br",3),P=e("a9",0),k=e("bk",1),U=e("y",2),I=e("b5",0),N=e("bj",2),D=e("bw",5),O=e("b8",100),F=e("bx",103),z=e("b7",200),B=e("by",201),H=e("b9",206),V=e("b6",208),G=e("bA",0),W=e("bB",1),X=e("bC",2),j=e("bD",3),Y=e("bE",4),q=e("b0",303),Z=e("t",1e3),J=e("a6",1001),K=e("a7",1002),Q=e("a2",1003),$=e("a3",1004),ee=e("a5",1005),te=e("r",1006),ne=e("a4",1007),ie=e("s",1008),re=e("aY",1015),ae=e("aW",1016),oe=e("be",1020),se=e("ap",1023),le=e("bd",1027),ue=e("aZ",1028),ce=e("bz",1030),he=e("a8",2300),de=e("a1",2301),fe=(e("T",0),e("d",1),e("c",2),e("bi",3201)),pe=e("a_",""),ve=e("k","srgb"),me=e("am","srgb-linear"),ge=function(){function e(){a(this,e)}return s(e,[{key:"addEventListener",value:function(e,t){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)}},{key:"hasEventListener",value:function(e,t){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)}},{key:"removeEventListener",value:function(e,t){if(void 0!==this._listeners){var n=this._listeners[e];if(void 0!==n){var i=n.indexOf(t);-1!==i&&n.splice(i,1)}}}},{key:"dispatchEvent",value:function(e){if(void 0!==this._listeners){var t=this._listeners[e.type];if(void 0!==t){e.target=this;for(var n=t.slice(0),i=0,r=n.length;i<r;i++)n[i].call(this,e);e.target=null}}}}]),e}(),ye=["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"],_e=1234567,xe=Math.PI/180,Me=180/Math.PI;function Se(){var e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(ye[255&e]+ye[e>>8&255]+ye[e>>16&255]+ye[e>>24&255]+"-"+ye[255&t]+ye[t>>8&255]+"-"+ye[t>>16&15|64]+ye[t>>24&255]+"-"+ye[63&n|128]+ye[n>>8&255]+"-"+ye[n>>16&255]+ye[n>>24&255]+ye[255&i]+ye[i>>8&255]+ye[i>>16&255]+ye[i>>24&255]).toLowerCase()}function be(e,t,n){return Math.max(t,Math.min(n,e))}function Ee(e,t){return(e%t+t)%t}function Te(e,t,n){return(1-n)*e+n*t}function we(e){return 0==(e&e-1)&&0!==e}function Ae(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function Re(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}function Ce(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}function Le(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(4294967295*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(2147483647*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw new Error("Invalid component type.")}}e("X",{DEG2RAD:xe,RAD2DEG:Me,generateUUID:Se,clamp:be,euclideanModulo:Ee,mapLinear:function(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)},inverseLerp:function(e,t,n){return e!==t?(n-e)/(t-e):0},lerp:Te,damp:function(e,t,n,i){return Te(e,t,1-Math.exp(-n*i))},pingpong:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return t-Math.abs(Ee(e,2*t)-t)},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){void 0!==e&&(_e=e);var t=_e+=1831565813;return t=Math.imul(t^t>>>15,1|t),(((t^=t+Math.imul(t^t>>>7,61|t))^t>>>14)>>>0)/4294967296},degToRad:function(e){return e*xe},radToDeg:function(e){return e*Me},isPowerOfTwo:we,ceilPowerOfTwo:Ae,floorPowerOfTwo:Re,setQuaternionFromProperEuler:function(e,t,n,i,r){var a=Math.cos,o=Math.sin,s=a(n/2),l=o(n/2),u=a((t+i)/2),c=o((t+i)/2),h=a((t-i)/2),d=o((t-i)/2),f=a((i-t)/2),p=o((i-t)/2);switch(r){case"XYX":e.set(s*c,l*h,l*d,s*u);break;case"YZY":e.set(l*d,s*c,l*h,s*u);break;case"ZXZ":e.set(l*h,l*d,s*c,s*u);break;case"XZX":e.set(s*c,l*p,l*f,s*u);break;case"YXY":e.set(l*f,s*c,l*p,s*u);break;case"ZYZ":e.set(l*p,l*f,s*c,s*u);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}},normalize:Le,denormalize:Ce});var Pe=e("V",function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;a(this,t),t.prototype.isVector2=!0,this.x=e,this.y=n}return s(t,[{key:"width",get:function(){return this.x},set:function(e){this.x=e}},{key:"height",get:function(){return this.y},set:function(e){this.y=e}},{key:"set",value:function(e,t){return this.x=e,this.y=t,this}},{key:"setScalar",value:function(e){return this.x=e,this.y=e,this}},{key:"setX",value:function(e){return this.x=e,this}},{key:"setY",value:function(e){return this.y=e,this}},{key:"setComponent",value:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}},{key:"getComponent",value:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}},{key:"clone",value:function(){return new this.constructor(this.x,this.y)}},{key:"copy",value:function(e){return this.x=e.x,this.y=e.y,this}},{key:"add",value:function(e){return this.x+=e.x,this.y+=e.y,this}},{key:"addScalar",value:function(e){return this.x+=e,this.y+=e,this}},{key:"addVectors",value:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}},{key:"addScaledVector",value:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}},{key:"sub",value:function(e){return this.x-=e.x,this.y-=e.y,this}},{key:"subScalar",value:function(e){return this.x-=e,this.y-=e,this}},{key:"subVectors",value:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}},{key:"multiply",value:function(e){return this.x*=e.x,this.y*=e.y,this}},{key:"multiplyScalar",value:function(e){return this.x*=e,this.y*=e,this}},{key:"divide",value:function(e){return this.x/=e.x,this.y/=e.y,this}},{key:"divideScalar",value:function(e){return this.multiplyScalar(1/e)}},{key:"applyMatrix3",value:function(e){var t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}},{key:"min",value:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}},{key:"max",value:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}},{key:"clamp",value:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}},{key:"clampScalar",value:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}},{key:"clampLength",value:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}},{key:"floor",value:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}},{key:"ceil",value:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}},{key:"round",value:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},{key:"roundToZero",value:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this}},{key:"dot",value:function(e){return this.x*e.x+this.y*e.y}},{key:"cross",value:function(e){return this.x*e.y-this.y*e.x}},{key:"lengthSq",value:function(){return this.x*this.x+this.y*this.y}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y)}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)}},{key:"normalize",value:function(){return this.divideScalar(this.length()||1)}},{key:"angle",value:function(){return Math.atan2(-this.y,-this.x)+Math.PI}},{key:"angleTo",value:function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;var n=this.dot(e)/t;return Math.acos(be(n,-1,1))}},{key:"distanceTo",value:function(e){return Math.sqrt(this.distanceToSquared(e))}},{key:"distanceToSquared",value:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n}},{key:"manhattanDistanceTo",value:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}},{key:"setLength",value:function(e){return this.normalize().multiplyScalar(e)}},{key:"lerp",value:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}},{key:"lerpVectors",value:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}},{key:"equals",value:function(e){return e.x===this.x&&e.y===this.y}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e}},{key:"fromBufferAttribute",value:function(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}},{key:"rotateAround",value:function(e,t){var n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*n-a*i+e.x,this.y=r*i+a*n+e.y,this}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this}},{key:Symbol.iterator,value:n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.x;case 2:return e.next=4,this.y;case 4:case"end":return e.stop()}}),e,this)}))}]),t}()),ke=e("b2",function(){function e(t,n,i,r,o,s,l,u,c){a(this,e),e.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,n,i,r,o,s,l,u,c)}return s(e,[{key:"set",value:function(e,t,n,i,r,a,o,s,l){var u=this.elements;return u[0]=e,u[1]=i,u[2]=o,u[3]=t,u[4]=r,u[5]=s,u[6]=n,u[7]=a,u[8]=l,this}},{key:"identity",value:function(){return this.set(1,0,0,0,1,0,0,0,1),this}},{key:"copy",value:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}},{key:"extractBasis",value:function(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}},{key:"setFromMatrix4",value:function(e){var 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}},{key:"multiply",value:function(e){return this.multiplyMatrices(this,e)}},{key:"premultiply",value:function(e){return this.multiplyMatrices(e,this)}},{key:"multiplyMatrices",value:function(e,t){var n=e.elements,i=t.elements,r=this.elements,a=n[0],o=n[3],s=n[6],l=n[1],u=n[4],c=n[7],h=n[2],d=n[5],f=n[8],p=i[0],v=i[3],m=i[6],g=i[1],y=i[4],_=i[7],x=i[2],M=i[5],S=i[8];return r[0]=a*p+o*g+s*x,r[3]=a*v+o*y+s*M,r[6]=a*m+o*_+s*S,r[1]=l*p+u*g+c*x,r[4]=l*v+u*y+c*M,r[7]=l*m+u*_+c*S,r[2]=h*p+d*g+f*x,r[5]=h*v+d*y+f*M,r[8]=h*m+d*_+f*S,this}},{key:"multiplyScalar",value:function(e){var 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}},{key:"determinant",value:function(){var e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],s=e[6],l=e[7],u=e[8];return t*a*u-t*o*l-n*r*u+n*o*s+i*r*l-i*a*s}},{key:"invert",value:function(){var e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],s=e[6],l=e[7],u=e[8],c=u*a-o*l,h=o*s-u*r,d=l*r-a*s,f=t*c+n*h+i*d;if(0===f)return this.set(0,0,0,0,0,0,0,0,0);var p=1/f;return e[0]=c*p,e[1]=(i*l-u*n)*p,e[2]=(o*n-i*a)*p,e[3]=h*p,e[4]=(u*t-i*s)*p,e[5]=(i*r-o*t)*p,e[6]=d*p,e[7]=(n*s-l*t)*p,e[8]=(a*t-n*r)*p,this}},{key:"transpose",value:function(){var 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}},{key:"getNormalMatrix",value:function(e){return this.setFromMatrix4(e).invert().transpose()}},{key:"transposeIntoArray",value:function(e){var 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}},{key:"setUvTransform",value:function(e,t,n,i,r,a,o){var s=Math.cos(r),l=Math.sin(r);return this.set(n*s,n*l,-n*(s*a+l*o)+a+e,-i*l,i*s,-i*(-l*a+s*o)+o+t,0,0,1),this}},{key:"scale",value:function(e,t){return this.premultiply(Ue.makeScale(e,t)),this}},{key:"rotate",value:function(e){return this.premultiply(Ue.makeRotation(-e)),this}},{key:"translate",value:function(e,t){return this.premultiply(Ue.makeTranslation(e,t)),this}},{key:"makeTranslation",value:function(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}},{key:"makeRotation",value:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}},{key:"makeScale",value:function(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}},{key:"equals",value:function(e){for(var t=this.elements,n=e.elements,i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}},{key:"fromArray",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=0;n<9;n++)this.elements[n]=e[n+t];return this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}},{key:"clone",value:function(){return(new this.constructor).fromArray(this.elements)}}]),e}()),Ue=new ke;function Ie(e){for(var t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function Ne(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}var De={};function Oe(e){e in De||(De[e]=!0,console.warn(e))}function Fe(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function ze(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}var Be,He=(new ke).fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-1e-7,1e-7,.9105199]),Ve=(new ke).fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]),Ge=(l(w={},me,(function(e){return e})),l(w,ve,(function(e){return e.convertSRGBToLinear()})),l(w,"display-p3",(function(e){return e.convertSRGBToLinear().applyMatrix3(Ve)})),w),We=(l(A={},me,(function(e){return e})),l(A,ve,(function(e){return e.convertLinearToSRGB()})),l(A,"display-p3",(function(e){return e.applyMatrix3(He).convertLinearToSRGB()})),A),Xe={enabled:!0,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(e){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!e},get workingColorSpace(){return me},set workingColorSpace(e){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(e,t,n){if(!1===this.enabled||t===n||!t||!n)return e;var i=Ge[t],r=We[n];if(void 0===i||void 0===r)throw new Error('Unsupported color space conversion, "'.concat(t,'" to "').concat(n,'".'));return r(i(e))},fromWorkingColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this.workingColorSpace)}},je=function(){function e(){a(this,e)}return s(e,null,[{key:"getDataURL",value:function(e){if(/^data:/i.test(e.src))return e.src;if("undefined"==typeof HTMLCanvasElement)return e.src;var t;if(e instanceof HTMLCanvasElement)t=e;else{void 0===Be&&(Be=Ne("canvas")),Be.width=e.width,Be.height=e.height;var n=Be.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Be}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}},{key:"sRGBToLinear",value:function(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){var t=Ne("canvas");t.width=e.width,t.height=e.height;var n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);for(var i=n.getImageData(0,0,e.width,e.height),r=i.data,a=0;a<r.length;a++)r[a]=255*Fe(r[a]/255);return n.putImageData(i,0,0),t}if(e.data){for(var o=e.data.slice(0),s=0;s<o.length;s++)o instanceof Uint8Array||o instanceof Uint8ClampedArray?o[s]=Math.floor(255*Fe(o[s]/255)):o[s]=Fe(o[s]);return{data:o,width:e.width,height:e.height}}return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}]),e}(),Ye=0,qe=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;a(this,e),this.isSource=!0,Object.defineProperty(this,"id",{value:Ye++}),this.uuid=Se(),this.data=t,this.version=0}return s(e,[{key:"needsUpdate",set:function(e){!0===e&&this.version++}},{key:"toJSON",value:function(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];var n={uuid:this.uuid,url:""},i=this.data;if(null!==i){var r;if(Array.isArray(i)){r=[];for(var a=0,o=i.length;a<o;a++)i[a].isDataTexture?r.push(Ze(i[a].image)):r.push(Ze(i[a]))}else r=Ze(i);n.url=r}return t||(e.images[this.uuid]=n),n}}]),e}();function Ze(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?je.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var Je=0,Ke=e("ad",function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n.DEFAULT_IMAGE,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.DEFAULT_MAPPING,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:J,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:J,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:te,u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:ie,c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:se,h=arguments.length>7&&void 0!==arguments[7]?arguments[7]:1009,d=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n.DEFAULT_ANISOTROPY,f=arguments.length>9&&void 0!==arguments[9]?arguments[9]:pe;return a(this,n),(e=t.call(this)).isTexture=!0,Object.defineProperty(v(e),"id",{value:Je++}),e.uuid=Se(),e.name="",e.source=new qe(i),e.mipmaps=[],e.mapping=r,e.channel=0,e.wrapS=o,e.wrapT=s,e.magFilter=l,e.minFilter=u,e.anisotropy=d,e.format=c,e.internalFormat=null,e.type=h,e.offset=new Pe(0,0),e.repeat=new Pe(1,1),e.center=new Pe(0,0),e.rotation=0,e.matrixAutoUpdate=!0,e.matrix=new ke,e.generateMipmaps=!0,e.premultiplyAlpha=!1,e.flipY=!0,e.unpackAlignment=4,"string"==typeof f?e.colorSpace=f:(Oe("THREE.Texture: Property .encoding has been replaced by .colorSpace."),e.colorSpace=3001===f?ve:pe),e.userData={},e.version=0,e.onUpdate=null,e.isRenderTargetTexture=!1,e.needsPMREMUpdate=!1,e}return s(n,[{key:"image",get:function(){return this.source.data},set:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.source.data=e}},{key:"updateMatrix",value:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(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.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}},{key:"toJSON",value:function(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];var n={metadata:{version:4.6,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&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}},{key:"transformUv",value:function(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Z:e.x=e.x-Math.floor(e.x);break;case J:e.x=e.x<0?0:1;break;case K: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 Z:e.y=e.y-Math.floor(e.y);break;case J:e.y=e.y<0?0:1;break;case K: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}},{key:"needsUpdate",set:function(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}},{key:"encoding",get:function(){return Oe("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===ve?3001:3e3},set:function(e){Oe("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=3001===e?ve:pe}}]),n}(ge));Ke.DEFAULT_IMAGE=null,Ke.DEFAULT_MAPPING=300,Ke.DEFAULT_ANISOTROPY=1;var Qe=e("b1",function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;a(this,t),t.prototype.isVector4=!0,this.x=e,this.y=n,this.z=i,this.w=r}return s(t,[{key:"width",get:function(){return this.z},set:function(e){this.z=e}},{key:"height",get:function(){return this.w},set:function(e){this.w=e}},{key:"set",value:function(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}},{key:"setScalar",value:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}},{key:"setX",value:function(e){return this.x=e,this}},{key:"setY",value:function(e){return this.y=e,this}},{key:"setZ",value:function(e){return this.z=e,this}},{key:"setW",value:function(e){return this.w=e,this}},{key:"setComponent",value:function(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 new Error("index is out of range: "+e)}return this}},{key:"getComponent",value:function(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 new Error("index is out of range: "+e)}}},{key:"clone",value:function(){return new this.constructor(this.x,this.y,this.z,this.w)}},{key:"copy",value:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}},{key:"add",value:function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}},{key:"addScalar",value:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}},{key:"addVectors",value:function(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}},{key:"addScaledVector",value:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}},{key:"sub",value:function(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}},{key:"subScalar",value:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}},{key:"subVectors",value:function(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}},{key:"multiply",value:function(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}},{key:"multiplyScalar",value:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}},{key:"applyMatrix4",value:function(e){var t=this.x,n=this.y,i=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*r,this}},{key:"divideScalar",value:function(e){return this.multiplyScalar(1/e)}},{key:"setAxisAngleFromQuaternion",value:function(e){this.w=2*Math.acos(e.w);var 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}},{key:"setAxisAngleFromRotationMatrix",value:function(e){var t,n,i,r,a=e.elements,o=a[0],s=a[4],l=a[8],u=a[1],c=a[5],h=a[9],d=a[2],f=a[6],p=a[10];if(Math.abs(s-u)<.01&&Math.abs(l-d)<.01&&Math.abs(h-f)<.01){if(Math.abs(s+u)<.1&&Math.abs(l+d)<.1&&Math.abs(h+f)<.1&&Math.abs(o+c+p-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;var v=(o+1)/2,m=(c+1)/2,g=(p+1)/2,y=(s+u)/4,_=(l+d)/4,x=(h+f)/4;return v>m&&v>g?v<.01?(n=0,i=.707106781,r=.707106781):(i=y/(n=Math.sqrt(v)),r=_/n):m>g?m<.01?(n=.707106781,i=0,r=.707106781):(n=y/(i=Math.sqrt(m)),r=x/i):g<.01?(n=.707106781,i=.707106781,r=0):(n=_/(r=Math.sqrt(g)),i=x/r),this.set(n,i,r,t),this}var M=Math.sqrt((f-h)*(f-h)+(l-d)*(l-d)+(u-s)*(u-s));return Math.abs(M)<.001&&(M=1),this.x=(f-h)/M,this.y=(l-d)/M,this.z=(u-s)/M,this.w=Math.acos((o+c+p-1)/2),this}},{key:"min",value:function(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}},{key:"max",value:function(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}},{key:"clamp",value:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}},{key:"clampScalar",value:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}},{key:"clampLength",value:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}},{key:"floor",value:function(){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}},{key:"ceil",value:function(){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}},{key:"round",value:function(){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}},{key:"roundToZero",value:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}},{key:"dot",value:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}},{key:"lengthSq",value:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}},{key:"normalize",value:function(){return this.divideScalar(this.length()||1)}},{key:"setLength",value:function(e){return this.normalize().multiplyScalar(e)}},{key:"lerp",value:function(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}},{key:"lerpVectors",value:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}},{key:"equals",value:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}},{key:"fromBufferAttribute",value:function(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}},{key:Symbol.iterator,value:n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.x;case 2:return e.next=4,this.y;case 4:return e.next=6,this.z;case 6:return e.next=8,this.w;case 8:case"end":return e.stop()}}),e,this)}))}]),t}()),$e=e("bb",function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return a(this,n),(e=t.call(this,i,r,o)).isWebGLRenderTarget=!0,e}return s(n)}(function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};a(this,n),(e=t.call(this)).isRenderTarget=!0,e.width=i,e.height=r,e.depth=1,e.scissor=new Qe(0,0,i,r),e.scissorTest=!1,e.viewport=new Qe(0,0,i,r);var s={width:i,height:r,depth:1};return void 0!==o.encoding&&(Oe("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),o.colorSpace=3001===o.encoding?ve:pe),e.texture=new Ke(s,o.mapping,o.wrapS,o.wrapT,o.magFilter,o.minFilter,o.format,o.type,o.anisotropy,o.colorSpace),e.texture.isRenderTargetTexture=!0,e.texture.flipY=!1,e.texture.generateMipmaps=void 0!==o.generateMipmaps&&o.generateMipmaps,e.texture.internalFormat=void 0!==o.internalFormat?o.internalFormat:null,e.texture.minFilter=void 0!==o.minFilter?o.minFilter:te,e.depthBuffer=void 0===o.depthBuffer||o.depthBuffer,e.stencilBuffer=void 0!==o.stencilBuffer&&o.stencilBuffer,e.depthTexture=void 0!==o.depthTexture?o.depthTexture:null,e.samples=void 0!==o.samples?o.samples:0,e}return s(n,[{key:"setSize",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;this.width===e&&this.height===t&&this.depth===n||(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(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.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;var t=Object.assign({},e.texture.image);return this.texture.source=new qe(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}}]),n}(ge))),et=function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return a(this,n),(e=t.call(this,null)).isDataArrayTexture=!0,e.image={data:i,width:r,height:o,depth:s},e.magFilter=Q,e.minFilter=Q,e.wrapR=J,e.generateMipmaps=!1,e.flipY=!1,e.unpackAlignment=1,e}return s(n)}(Ke),tt=function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return a(this,n),(e=t.call(this,null)).isData3DTexture=!0,e.image={data:i,width:r,height:o,depth:s},e.magFilter=Q,e.minFilter=Q,e.wrapR=J,e.generateMipmaps=!1,e.flipY=!1,e.unpackAlignment=1,e}return s(n)}(Ke),nt=e("Q",function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;a(this,t),this.isQuaternion=!0,this._x=e,this._y=n,this._z=i,this._w=r}return s(t,[{key:"x",get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},{key:"w",get:function(){return this._w},set:function(e){this._w=e,this._onChangeCallback()}},{key:"set",value:function(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}},{key:"clone",value:function(){return new this.constructor(this._x,this._y,this._z,this._w)}},{key:"copy",value:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}},{key:"setFromEuler",value:function(e,t){var n=e._x,i=e._y,r=e._z,a=e._order,o=Math.cos,s=Math.sin,l=o(n/2),u=o(i/2),c=o(r/2),h=s(n/2),d=s(i/2),f=s(r/2);switch(a){case"XYZ":this._x=h*u*c+l*d*f,this._y=l*d*c-h*u*f,this._z=l*u*f+h*d*c,this._w=l*u*c-h*d*f;break;case"YXZ":this._x=h*u*c+l*d*f,this._y=l*d*c-h*u*f,this._z=l*u*f-h*d*c,this._w=l*u*c+h*d*f;break;case"ZXY":this._x=h*u*c-l*d*f,this._y=l*d*c+h*u*f,this._z=l*u*f+h*d*c,this._w=l*u*c-h*d*f;break;case"ZYX":this._x=h*u*c-l*d*f,this._y=l*d*c+h*u*f,this._z=l*u*f-h*d*c,this._w=l*u*c+h*d*f;break;case"YZX":this._x=h*u*c+l*d*f,this._y=l*d*c+h*u*f,this._z=l*u*f-h*d*c,this._w=l*u*c-h*d*f;break;case"XZY":this._x=h*u*c-l*d*f,this._y=l*d*c-h*u*f,this._z=l*u*f+h*d*c,this._w=l*u*c+h*d*f;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==t&&this._onChangeCallback(),this}},{key:"setFromAxisAngle",value:function(e,t){var n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}},{key:"setFromRotationMatrix",value:function(e){var t=e.elements,n=t[0],i=t[4],r=t[8],a=t[1],o=t[5],s=t[9],l=t[2],u=t[6],c=t[10],h=n+o+c;if(h>0){var d=.5/Math.sqrt(h+1);this._w=.25/d,this._x=(u-s)*d,this._y=(r-l)*d,this._z=(a-i)*d}else if(n>o&&n>c){var f=2*Math.sqrt(1+n-o-c);this._w=(u-s)/f,this._x=.25*f,this._y=(i+a)/f,this._z=(r+l)/f}else if(o>c){var p=2*Math.sqrt(1+o-n-c);this._w=(r-l)/p,this._x=(i+a)/p,this._y=.25*p,this._z=(s+u)/p}else{var v=2*Math.sqrt(1+c-n-o);this._w=(a-i)/v,this._x=(r+l)/v,this._y=(s+u)/v,this._z=.25*v}return this._onChangeCallback(),this}},{key:"setFromUnitVectors",value:function(e,t){var n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(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=n),this.normalize()}},{key:"angleTo",value:function(e){return 2*Math.acos(Math.abs(be(this.dot(e),-1,1)))}},{key:"rotateTowards",value:function(e,t){var n=this.angleTo(e);if(0===n)return this;var i=Math.min(1,t/n);return this.slerp(e,i),this}},{key:"identity",value:function(){return this.set(0,0,0,1)}},{key:"invert",value:function(){return this.conjugate()}},{key:"conjugate",value:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}},{key:"dot",value:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}},{key:"lengthSq",value:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}},{key:"length",value:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}},{key:"normalize",value:function(){var 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}},{key:"multiply",value:function(e){return this.multiplyQuaternions(this,e)}},{key:"premultiply",value:function(e){return this.multiplyQuaternions(e,this)}},{key:"multiplyQuaternions",value:function(e,t){var n=e._x,i=e._y,r=e._z,a=e._w,o=t._x,s=t._y,l=t._z,u=t._w;return this._x=n*u+a*o+i*l-r*s,this._y=i*u+a*s+r*o-n*l,this._z=r*u+a*l+n*s-i*o,this._w=a*u-n*o-i*s-r*l,this._onChangeCallback(),this}},{key:"slerp",value:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var n=this._x,i=this._y,r=this._z,a=this._w,o=a*e._w+n*e._x+i*e._y+r*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=i,this._z=r,this;var s=1-o*o;if(s<=Number.EPSILON){var l=1-t;return this._w=l*a+t*this._w,this._x=l*n+t*this._x,this._y=l*i+t*this._y,this._z=l*r+t*this._z,this.normalize(),this._onChangeCallback(),this}var u=Math.sqrt(s),c=Math.atan2(u,o),h=Math.sin((1-t)*c)/u,d=Math.sin(t*c)/u;return this._w=a*h+this._w*d,this._x=n*h+this._x*d,this._y=i*h+this._y*d,this._z=r*h+this._z*d,this._onChangeCallback(),this}},{key:"slerpQuaternions",value:function(e,t,n){return this.copy(e).slerp(t,n)}},{key:"random",value:function(){var e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),i=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(t*Math.cos(i),n*Math.sin(r),n*Math.cos(r),t*Math.sin(i))}},{key:"equals",value:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}},{key:"fromBufferAttribute",value:function(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}},{key:"toJSON",value:function(){return this.toArray()}},{key:"_onChange",value:function(e){return this._onChangeCallback=e,this}},{key:"_onChangeCallback",value:function(){}},{key:Symbol.iterator,value:n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._x;case 2:return e.next=4,this._y;case 4:return e.next=6,this._z;case 6:return e.next=8,this._w;case 8:case"end":return e.stop()}}),e,this)}))}],[{key:"slerpFlat",value:function(e,t,n,i,r,a,o){var s=n[i+0],l=n[i+1],u=n[i+2],c=n[i+3],h=r[a+0],d=r[a+1],f=r[a+2],p=r[a+3];if(0===o)return e[t+0]=s,e[t+1]=l,e[t+2]=u,void(e[t+3]=c);if(1===o)return e[t+0]=h,e[t+1]=d,e[t+2]=f,void(e[t+3]=p);if(c!==p||s!==h||l!==d||u!==f){var v=1-o,m=s*h+l*d+u*f+c*p,g=m>=0?1:-1,y=1-m*m;if(y>Number.EPSILON){var _=Math.sqrt(y),x=Math.atan2(_,m*g);v=Math.sin(v*x)/_,o=Math.sin(o*x)/_}var M=o*g;if(s=s*v+h*M,l=l*v+d*M,u=u*v+f*M,c=c*v+p*M,v===1-o){var S=1/Math.sqrt(s*s+l*l+u*u+c*c);s*=S,l*=S,u*=S,c*=S}}e[t]=s,e[t+1]=l,e[t+2]=u,e[t+3]=c}},{key:"multiplyQuaternionsFlat",value:function(e,t,n,i,r,a){var o=n[i],s=n[i+1],l=n[i+2],u=n[i+3],c=r[a],h=r[a+1],d=r[a+2],f=r[a+3];return e[t]=o*f+u*c+s*d-l*h,e[t+1]=s*f+u*h+l*c-o*d,e[t+2]=l*f+u*d+o*h-s*c,e[t+3]=u*f-o*c-s*h-l*d,e}}]),t}()),it=e("a",function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;a(this,t),t.prototype.isVector3=!0,this.x=e,this.y=n,this.z=i}return s(t,[{key:"set",value:function(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}},{key:"setScalar",value:function(e){return this.x=e,this.y=e,this.z=e,this}},{key:"setX",value:function(e){return this.x=e,this}},{key:"setY",value:function(e){return this.y=e,this}},{key:"setZ",value:function(e){return this.z=e,this}},{key:"setComponent",value:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}},{key:"getComponent",value:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}},{key:"clone",value:function(){return new this.constructor(this.x,this.y,this.z)}},{key:"copy",value:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}},{key:"add",value:function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}},{key:"addScalar",value:function(e){return this.x+=e,this.y+=e,this.z+=e,this}},{key:"addVectors",value:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}},{key:"addScaledVector",value:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}},{key:"sub",value:function(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}},{key:"subScalar",value:function(e){return this.x-=e,this.y-=e,this.z-=e,this}},{key:"subVectors",value:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}},{key:"multiply",value:function(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}},{key:"multiplyScalar",value:function(e){return this.x*=e,this.y*=e,this.z*=e,this}},{key:"multiplyVectors",value:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}},{key:"applyEuler",value:function(e){return this.applyQuaternion(at.setFromEuler(e))}},{key:"applyAxisAngle",value:function(e,t){return this.applyQuaternion(at.setFromAxisAngle(e,t))}},{key:"applyMatrix3",value:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}},{key:"applyNormalMatrix",value:function(e){return this.applyMatrix3(e).normalize()}},{key:"applyMatrix4",value:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements,a=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*a,this}},{key:"applyQuaternion",value:function(e){var t=this.x,n=this.y,i=this.z,r=e.x,a=e.y,o=e.z,s=e.w,l=s*t+a*i-o*n,u=s*n+o*t-r*i,c=s*i+r*n-a*t,h=-r*t-a*n-o*i;return this.x=l*s+h*-r+u*-o-c*-a,this.y=u*s+h*-a+c*-r-l*-o,this.z=c*s+h*-o+l*-a-u*-r,this}},{key:"project",value:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}},{key:"unproject",value:function(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}},{key:"transformDirection",value:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()}},{key:"divide",value:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}},{key:"divideScalar",value:function(e){return this.multiplyScalar(1/e)}},{key:"min",value:function(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}},{key:"max",value:function(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}},{key:"clamp",value:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}},{key:"clampScalar",value:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}},{key:"clampLength",value:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}},{key:"floor",value:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}},{key:"ceil",value:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}},{key:"round",value:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}},{key:"roundToZero",value:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}},{key:"dot",value:function(e){return this.x*e.x+this.y*e.y+this.z*e.z}},{key:"lengthSq",value:function(){return this.x*this.x+this.y*this.y+this.z*this.z}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}},{key:"normalize",value:function(){return this.divideScalar(this.length()||1)}},{key:"setLength",value:function(e){return this.normalize().multiplyScalar(e)}},{key:"lerp",value:function(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}},{key:"lerpVectors",value:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}},{key:"cross",value:function(e){return this.crossVectors(this,e)}},{key:"crossVectors",value:function(e,t){var n=e.x,i=e.y,r=e.z,a=t.x,o=t.y,s=t.z;return this.x=i*s-r*o,this.y=r*a-n*s,this.z=n*o-i*a,this}},{key:"projectOnVector",value:function(e){var t=e.lengthSq();if(0===t)return this.set(0,0,0);var n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}},{key:"projectOnPlane",value:function(e){return rt.copy(this).projectOnVector(e),this.sub(rt)}},{key:"reflect",value:function(e){return this.sub(rt.copy(e).multiplyScalar(2*this.dot(e)))}},{key:"angleTo",value:function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;var n=this.dot(e)/t;return Math.acos(be(n,-1,1))}},{key:"distanceTo",value:function(e){return Math.sqrt(this.distanceToSquared(e))}},{key:"distanceToSquared",value:function(e){var t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}},{key:"manhattanDistanceTo",value:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}},{key:"setFromSpherical",value:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}},{key:"setFromSphericalCoords",value:function(e,t,n){var i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}},{key:"setFromCylindrical",value:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}},{key:"setFromCylindricalCoords",value:function(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}},{key:"setFromMatrixPosition",value:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}},{key:"setFromMatrixScale",value:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}},{key:"setFromMatrixColumn",value:function(e,t){return this.fromArray(e.elements,4*t)}},{key:"setFromMatrix3Column",value:function(e,t){return this.fromArray(e.elements,3*t)}},{key:"setFromEuler",value:function(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}},{key:"setFromColor",value:function(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}},{key:"equals",value:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}},{key:"fromBufferAttribute",value:function(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}},{key:"randomDirection",value:function(){var e=2*(Math.random()-.5),t=Math.random()*Math.PI*2,n=Math.sqrt(1-Math.pow(e,2));return this.x=n*Math.cos(t),this.y=n*Math.sin(t),this.z=e,this}},{key:Symbol.iterator,value:n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.x;case 2:return e.next=4,this.y;case 4:return e.next=6,this.z;case 6:case"end":return e.stop()}}),e,this)}))}]),t}()),rt=new it,at=new nt,ot=e("ah",function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new it(1/0,1/0,1/0),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new it(-1/0,-1/0,-1/0);a(this,e),this.isBox3=!0,this.min=t,this.max=n}return s(e,[{key:"set",value:function(e,t){return this.min.copy(e),this.max.copy(t),this}},{key:"setFromArray",value:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t+=3)this.expandByPoint(lt.fromArray(e,t));return this}},{key:"setFromBufferAttribute",value:function(e){this.makeEmpty();for(var t=0,n=e.count;t<n;t++)this.expandByPoint(lt.fromBufferAttribute(e,t));return this}},{key:"setFromPoints",value:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}},{key:"setFromCenterAndSize",value:function(e,t){var n=lt.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}},{key:"setFromObject",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.makeEmpty(),this.expandByObject(e,t)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.min.copy(e.min),this.max.copy(e.max),this}},{key:"makeEmpty",value:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}},{key:"isEmpty",value:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}},{key:"getCenter",value:function(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}},{key:"getSize",value:function(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}},{key:"expandByPoint",value:function(e){return this.min.min(e),this.max.max(e),this}},{key:"expandByVector",value:function(e){return this.min.sub(e),this.max.add(e),this}},{key:"expandByScalar",value:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this}},{key:"expandByObject",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e.updateWorldMatrix(!1,!1),void 0!==e.boundingBox)null===e.boundingBox&&e.computeBoundingBox(),ut.copy(e.boundingBox),ut.applyMatrix4(e.matrixWorld),this.union(ut);else{var n=e.geometry;if(void 0!==n)if(t&&void 0!==n.attributes&&void 0!==n.attributes.position)for(var i=n.attributes.position,r=0,a=i.count;r<a;r++)lt.fromBufferAttribute(i,r).applyMatrix4(e.matrixWorld),this.expandByPoint(lt);else null===n.boundingBox&&n.computeBoundingBox(),ut.copy(n.boundingBox),ut.applyMatrix4(e.matrixWorld),this.union(ut)}for(var o=e.children,s=0,l=o.length;s<l;s++)this.expandByObject(o[s],t);return this}},{key:"containsPoint",value:function(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)}},{key:"containsBox",value:function(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}},{key:"getParameter",value:function(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))}},{key:"intersectsBox",value:function(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)}},{key:"intersectsSphere",value:function(e){return this.clampPoint(e.center,lt),lt.distanceToSquared(e.center)<=e.radius*e.radius}},{key:"intersectsPlane",value:function(e){var t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}},{key:"intersectsTriangle",value:function(e){if(this.isEmpty())return!1;this.getCenter(mt),gt.subVectors(this.max,mt),ct.subVectors(e.a,mt),ht.subVectors(e.b,mt),dt.subVectors(e.c,mt),ft.subVectors(ht,ct),pt.subVectors(dt,ht),vt.subVectors(ct,dt);var t=[0,-ft.z,ft.y,0,-pt.z,pt.y,0,-vt.z,vt.y,ft.z,0,-ft.x,pt.z,0,-pt.x,vt.z,0,-vt.x,-ft.y,ft.x,0,-pt.y,pt.x,0,-vt.y,vt.x,0];return!!xt(t,ct,ht,dt,gt)&&!!xt(t=[1,0,0,0,1,0,0,0,1],ct,ht,dt,gt)&&(yt.crossVectors(ft,pt),xt(t=[yt.x,yt.y,yt.z],ct,ht,dt,gt))}},{key:"clampPoint",value:function(e,t){return t.copy(e).clamp(this.min,this.max)}},{key:"distanceToPoint",value:function(e){return this.clampPoint(e,lt).distanceTo(e)}},{key:"getBoundingSphere",value:function(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(lt).length()),e}},{key:"intersect",value:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}},{key:"union",value:function(e){return this.min.min(e.min),this.max.max(e.max),this}},{key:"applyMatrix4",value:function(e){return this.isEmpty()||(st[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),st[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),st[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),st[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),st[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),st[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),st[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),st[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(st)),this}},{key:"translate",value:function(e){return this.min.add(e),this.max.add(e),this}},{key:"equals",value:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}]),e}()),st=[new it,new it,new it,new it,new it,new it,new it,new it],lt=new it,ut=new ot,ct=new it,ht=new it,dt=new it,ft=new it,pt=new it,vt=new it,mt=new it,gt=new it,yt=new it,_t=new it;function xt(e,t,n,i,r){for(var a=0,o=e.length-3;a<=o;a+=3){_t.fromArray(e,a);var s=r.x*Math.abs(_t.x)+r.y*Math.abs(_t.y)+r.z*Math.abs(_t.z),l=t.dot(_t),u=n.dot(_t),c=i.dot(_t);if(Math.max(-Math.max(l,u,c),Math.min(l,u,c))>s)return!1}return!0}var Mt=new ot,St=new it,bt=new it,Et=e("ai",function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new it,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;a(this,e),this.center=t,this.radius=n}return s(e,[{key:"set",value:function(e,t){return this.center.copy(e),this.radius=t,this}},{key:"setFromPoints",value:function(e,t){var n=this.center;void 0!==t?n.copy(t):Mt.setFromPoints(e).getCenter(n);for(var i=0,r=0,a=e.length;r<a;r++)i=Math.max(i,n.distanceToSquared(e[r]));return this.radius=Math.sqrt(i),this}},{key:"copy",value:function(e){return this.center.copy(e.center),this.radius=e.radius,this}},{key:"isEmpty",value:function(){return this.radius<0}},{key:"makeEmpty",value:function(){return this.center.set(0,0,0),this.radius=-1,this}},{key:"containsPoint",value:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}},{key:"distanceToPoint",value:function(e){return e.distanceTo(this.center)-this.radius}},{key:"intersectsSphere",value:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}},{key:"intersectsBox",value:function(e){return e.intersectsSphere(this)}},{key:"intersectsPlane",value:function(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}},{key:"clampPoint",value:function(e,t){var n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}},{key:"getBoundingBox",value:function(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}},{key:"applyMatrix4",value:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}},{key:"translate",value:function(e){return this.center.add(e),this}},{key:"expandByPoint",value:function(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;St.subVectors(e,this.center);var t=St.lengthSq();if(t>this.radius*this.radius){var n=Math.sqrt(t),i=.5*(n-this.radius);this.center.addScaledVector(St,i/n),this.radius+=i}return this}},{key:"union",value:function(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(bt.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(St.copy(e.center).add(bt)),this.expandByPoint(St.copy(e.center).sub(bt))),this)}},{key:"equals",value:function(e){return e.center.equals(this.center)&&e.radius===this.radius}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}()),Tt=new it,wt=new it,At=new it,Rt=new it,Ct=new it,Lt=new it,Pt=new it,kt=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new it,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new it(0,0,-1);a(this,e),this.origin=t,this.direction=n}return s(e,[{key:"set",value:function(e,t){return this.origin.copy(e),this.direction.copy(t),this}},{key:"copy",value:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}},{key:"at",value:function(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}},{key:"lookAt",value:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this}},{key:"recast",value:function(e){return this.origin.copy(this.at(e,Tt)),this}},{key:"closestPointToPoint",value:function(e,t){t.subVectors(e,this.origin);var n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}},{key:"distanceToPoint",value:function(e){return Math.sqrt(this.distanceSqToPoint(e))}},{key:"distanceSqToPoint",value:function(e){var t=Tt.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Tt.copy(this.origin).addScaledVector(this.direction,t),Tt.distanceToSquared(e))}},{key:"distanceSqToSegment",value:function(e,t,n,i){wt.copy(e).add(t).multiplyScalar(.5),At.copy(t).sub(e).normalize(),Rt.copy(this.origin).sub(wt);var r,a,o,s,l=.5*e.distanceTo(t),u=-this.direction.dot(At),c=Rt.dot(this.direction),h=-Rt.dot(At),d=Rt.lengthSq(),f=Math.abs(1-u*u);if(f>0)if(a=u*c-h,s=l*f,(r=u*h-c)>=0)if(a>=-s)if(a<=s){var p=1/f;o=(r*=p)*(r+u*(a*=p)+2*c)+a*(u*r+a+2*h)+d}else a=l,o=-(r=Math.max(0,-(u*a+c)))*r+a*(a+2*h)+d;else a=-l,o=-(r=Math.max(0,-(u*a+c)))*r+a*(a+2*h)+d;else a<=-s?o=-(r=Math.max(0,-(-u*l+c)))*r+(a=r>0?-l:Math.min(Math.max(-l,-h),l))*(a+2*h)+d:a<=s?(r=0,o=(a=Math.min(Math.max(-l,-h),l))*(a+2*h)+d):o=-(r=Math.max(0,-(u*l+c)))*r+(a=r>0?l:Math.min(Math.max(-l,-h),l))*(a+2*h)+d;else a=u>0?-l:l,o=-(r=Math.max(0,-(u*a+c)))*r+a*(a+2*h)+d;return n&&n.copy(this.origin).addScaledVector(this.direction,r),i&&i.copy(wt).addScaledVector(At,a),o}},{key:"intersectSphere",value:function(e,t){Tt.subVectors(e.center,this.origin);var n=Tt.dot(this.direction),i=Tt.dot(Tt)-n*n,r=e.radius*e.radius;if(i>r)return null;var a=Math.sqrt(r-i),o=n-a,s=n+a;return s<0?null:o<0?this.at(s,t):this.at(o,t)}},{key:"intersectsSphere",value:function(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}},{key:"distanceToPlane",value:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}},{key:"intersectPlane",value:function(e,t){var n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}},{key:"intersectsPlane",value:function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0}},{key:"intersectBox",value:function(e,t){var n,i,r,a,o,s,l=1/this.direction.x,u=1/this.direction.y,c=1/this.direction.z,h=this.origin;return l>=0?(n=(e.min.x-h.x)*l,i=(e.max.x-h.x)*l):(n=(e.max.x-h.x)*l,i=(e.min.x-h.x)*l),u>=0?(r=(e.min.y-h.y)*u,a=(e.max.y-h.y)*u):(r=(e.max.y-h.y)*u,a=(e.min.y-h.y)*u),n>a||r>i?null:((r>n||isNaN(n))&&(n=r),(a<i||isNaN(i))&&(i=a),c>=0?(o=(e.min.z-h.z)*c,s=(e.max.z-h.z)*c):(o=(e.max.z-h.z)*c,s=(e.min.z-h.z)*c),n>s||o>i?null:((o>n||n!=n)&&(n=o),(s<i||i!=i)&&(i=s),i<0?null:this.at(n>=0?n:i,t)))}},{key:"intersectsBox",value:function(e){return null!==this.intersectBox(e,Tt)}},{key:"intersectTriangle",value:function(e,t,n,i,r){Ct.subVectors(t,e),Lt.subVectors(n,e),Pt.crossVectors(Ct,Lt);var a,o=this.direction.dot(Pt);if(o>0){if(i)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}Rt.subVectors(this.origin,e);var s=a*this.direction.dot(Lt.crossVectors(Rt,Lt));if(s<0)return null;var l=a*this.direction.dot(Ct.cross(Rt));if(l<0)return null;if(s+l>o)return null;var u=-a*Rt.dot(Pt);return u<0?null:this.at(u/o,r)}},{key:"applyMatrix4",value:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}},{key:"equals",value:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),Ut=e("n",function(){function e(t,n,i,r,o,s,l,u,c,h,d,f,p,v,m,g){a(this,e),e.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,n,i,r,o,s,l,u,c,h,d,f,p,v,m,g)}return s(e,[{key:"set",value:function(e,t,n,i,r,a,o,s,l,u,c,h,d,f,p,v){var m=this.elements;return m[0]=e,m[4]=t,m[8]=n,m[12]=i,m[1]=r,m[5]=a,m[9]=o,m[13]=s,m[2]=l,m[6]=u,m[10]=c,m[14]=h,m[3]=d,m[7]=f,m[11]=p,m[15]=v,this}},{key:"identity",value:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}},{key:"clone",value:function(){return(new e).fromArray(this.elements)}},{key:"copy",value:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}},{key:"copyPosition",value:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}},{key:"setFromMatrix3",value:function(e){var 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}},{key:"extractBasis",value:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}},{key:"makeBasis",value:function(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}},{key:"extractRotation",value:function(e){var t=this.elements,n=e.elements,i=1/It.setFromMatrixColumn(e,0).length(),r=1/It.setFromMatrixColumn(e,1).length(),a=1/It.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}},{key:"makeRotationFromEuler",value:function(e){var t=this.elements,n=e.x,i=e.y,r=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(i),l=Math.sin(i),u=Math.cos(r),c=Math.sin(r);if("XYZ"===e.order){var h=a*u,d=a*c,f=o*u,p=o*c;t[0]=s*u,t[4]=-s*c,t[8]=l,t[1]=d+f*l,t[5]=h-p*l,t[9]=-o*s,t[2]=p-h*l,t[6]=f+d*l,t[10]=a*s}else if("YXZ"===e.order){var v=s*u,m=s*c,g=l*u,y=l*c;t[0]=v+y*o,t[4]=g*o-m,t[8]=a*l,t[1]=a*c,t[5]=a*u,t[9]=-o,t[2]=m*o-g,t[6]=y+v*o,t[10]=a*s}else if("ZXY"===e.order){var _=s*u,x=s*c,M=l*u,S=l*c;t[0]=_-S*o,t[4]=-a*c,t[8]=M+x*o,t[1]=x+M*o,t[5]=a*u,t[9]=S-_*o,t[2]=-a*l,t[6]=o,t[10]=a*s}else if("ZYX"===e.order){var b=a*u,E=a*c,T=o*u,w=o*c;t[0]=s*u,t[4]=T*l-E,t[8]=b*l+w,t[1]=s*c,t[5]=w*l+b,t[9]=E*l-T,t[2]=-l,t[6]=o*s,t[10]=a*s}else if("YZX"===e.order){var A=a*s,R=a*l,C=o*s,L=o*l;t[0]=s*u,t[4]=L-A*c,t[8]=C*c+R,t[1]=c,t[5]=a*u,t[9]=-o*u,t[2]=-l*u,t[6]=R*c+C,t[10]=A-L*c}else if("XZY"===e.order){var P=a*s,k=a*l,U=o*s,I=o*l;t[0]=s*u,t[4]=-c,t[8]=l*u,t[1]=P*c+I,t[5]=a*u,t[9]=k*c-U,t[2]=U*c-k,t[6]=o*u,t[10]=I*c+P}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}},{key:"makeRotationFromQuaternion",value:function(e){return this.compose(Dt,e,Ot)}},{key:"lookAt",value:function(e,t,n){var i=this.elements;return Bt.subVectors(e,t),0===Bt.lengthSq()&&(Bt.z=1),Bt.normalize(),Ft.crossVectors(n,Bt),0===Ft.lengthSq()&&(1===Math.abs(n.z)?Bt.x+=1e-4:Bt.z+=1e-4,Bt.normalize(),Ft.crossVectors(n,Bt)),Ft.normalize(),zt.crossVectors(Bt,Ft),i[0]=Ft.x,i[4]=zt.x,i[8]=Bt.x,i[1]=Ft.y,i[5]=zt.y,i[9]=Bt.y,i[2]=Ft.z,i[6]=zt.z,i[10]=Bt.z,this}},{key:"multiply",value:function(e){return this.multiplyMatrices(this,e)}},{key:"premultiply",value:function(e){return this.multiplyMatrices(e,this)}},{key:"multiplyMatrices",value:function(e,t){var n=e.elements,i=t.elements,r=this.elements,a=n[0],o=n[4],s=n[8],l=n[12],u=n[1],c=n[5],h=n[9],d=n[13],f=n[2],p=n[6],v=n[10],m=n[14],g=n[3],y=n[7],_=n[11],x=n[15],M=i[0],S=i[4],b=i[8],E=i[12],T=i[1],w=i[5],A=i[9],R=i[13],C=i[2],L=i[6],P=i[10],k=i[14],U=i[3],I=i[7],N=i[11],D=i[15];return r[0]=a*M+o*T+s*C+l*U,r[4]=a*S+o*w+s*L+l*I,r[8]=a*b+o*A+s*P+l*N,r[12]=a*E+o*R+s*k+l*D,r[1]=u*M+c*T+h*C+d*U,r[5]=u*S+c*w+h*L+d*I,r[9]=u*b+c*A+h*P+d*N,r[13]=u*E+c*R+h*k+d*D,r[2]=f*M+p*T+v*C+m*U,r[6]=f*S+p*w+v*L+m*I,r[10]=f*b+p*A+v*P+m*N,r[14]=f*E+p*R+v*k+m*D,r[3]=g*M+y*T+_*C+x*U,r[7]=g*S+y*w+_*L+x*I,r[11]=g*b+y*A+_*P+x*N,r[15]=g*E+y*R+_*k+x*D,this}},{key:"multiplyScalar",value:function(e){var 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}},{key:"determinant",value:function(){var e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],a=e[1],o=e[5],s=e[9],l=e[13],u=e[2],c=e[6],h=e[10],d=e[14];return e[3]*(+r*s*c-i*l*c-r*o*h+n*l*h+i*o*d-n*s*d)+e[7]*(+t*s*d-t*l*h+r*a*h-i*a*d+i*l*u-r*s*u)+e[11]*(+t*l*c-t*o*d-r*a*c+n*a*d+r*o*u-n*l*u)+e[15]*(-i*o*u-t*s*c+t*o*h+i*a*c-n*a*h+n*s*u)}},{key:"transpose",value:function(){var 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}},{key:"setPosition",value:function(e,t,n){var i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}},{key:"invert",value:function(){var e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],s=e[6],l=e[7],u=e[8],c=e[9],h=e[10],d=e[11],f=e[12],p=e[13],v=e[14],m=e[15],g=c*v*l-p*h*l+p*s*d-o*v*d-c*s*m+o*h*m,y=f*h*l-u*v*l-f*s*d+a*v*d+u*s*m-a*h*m,_=u*p*l-f*c*l+f*o*d-a*p*d-u*o*m+a*c*m,x=f*c*s-u*p*s-f*o*h+a*p*h+u*o*v-a*c*v,M=t*g+n*y+i*_+r*x;if(0===M)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var S=1/M;return e[0]=g*S,e[1]=(p*h*r-c*v*r-p*i*d+n*v*d+c*i*m-n*h*m)*S,e[2]=(o*v*r-p*s*r+p*i*l-n*v*l-o*i*m+n*s*m)*S,e[3]=(c*s*r-o*h*r-c*i*l+n*h*l+o*i*d-n*s*d)*S,e[4]=y*S,e[5]=(u*v*r-f*h*r+f*i*d-t*v*d-u*i*m+t*h*m)*S,e[6]=(f*s*r-a*v*r-f*i*l+t*v*l+a*i*m-t*s*m)*S,e[7]=(a*h*r-u*s*r+u*i*l-t*h*l-a*i*d+t*s*d)*S,e[8]=_*S,e[9]=(f*c*r-u*p*r-f*n*d+t*p*d+u*n*m-t*c*m)*S,e[10]=(a*p*r-f*o*r+f*n*l-t*p*l-a*n*m+t*o*m)*S,e[11]=(u*o*r-a*c*r-u*n*l+t*c*l+a*n*d-t*o*d)*S,e[12]=x*S,e[13]=(u*p*i-f*c*i+f*n*h-t*p*h-u*n*v+t*c*v)*S,e[14]=(f*o*i-a*p*i-f*n*s+t*p*s+a*n*v-t*o*v)*S,e[15]=(a*c*i-u*o*i+u*n*s-t*c*s-a*n*h+t*o*h)*S,this}},{key:"scale",value:function(e){var t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}},{key:"getMaxScaleOnAxis",value:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}},{key:"makeTranslation",value:function(e,t,n){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,n,0,0,0,1),this}},{key:"makeRotationX",value:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}},{key:"makeRotationY",value:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}},{key:"makeRotationZ",value:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}},{key:"makeRotationAxis",value:function(e,t){var n=Math.cos(t),i=Math.sin(t),r=1-n,a=e.x,o=e.y,s=e.z,l=r*a,u=r*o;return this.set(l*a+n,l*o-i*s,l*s+i*o,0,l*o+i*s,u*o+n,u*s-i*a,0,l*s-i*o,u*s+i*a,r*s*s+n,0,0,0,0,1),this}},{key:"makeScale",value:function(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}},{key:"makeShear",value:function(e,t,n,i,r,a){return this.set(1,n,r,0,e,1,a,0,t,i,1,0,0,0,0,1),this}},{key:"compose",value:function(e,t,n){var i=this.elements,r=t._x,a=t._y,o=t._z,s=t._w,l=r+r,u=a+a,c=o+o,h=r*l,d=r*u,f=r*c,p=a*u,v=a*c,m=o*c,g=s*l,y=s*u,_=s*c,x=n.x,M=n.y,S=n.z;return i[0]=(1-(p+m))*x,i[1]=(d+_)*x,i[2]=(f-y)*x,i[3]=0,i[4]=(d-_)*M,i[5]=(1-(h+m))*M,i[6]=(v+g)*M,i[7]=0,i[8]=(f+y)*S,i[9]=(v-g)*S,i[10]=(1-(h+p))*S,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}},{key:"decompose",value:function(e,t,n){var i=this.elements,r=It.set(i[0],i[1],i[2]).length(),a=It.set(i[4],i[5],i[6]).length(),o=It.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),e.x=i[12],e.y=i[13],e.z=i[14],Nt.copy(this);var s=1/r,l=1/a,u=1/o;return Nt.elements[0]*=s,Nt.elements[1]*=s,Nt.elements[2]*=s,Nt.elements[4]*=l,Nt.elements[5]*=l,Nt.elements[6]*=l,Nt.elements[8]*=u,Nt.elements[9]*=u,Nt.elements[10]*=u,t.setFromRotationMatrix(Nt),n.x=r,n.y=a,n.z=o,this}},{key:"makePerspective",value:function(e,t,n,i,r,a){var o,s,l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:2e3,u=this.elements,c=2*r/(t-e),h=2*r/(n-i),d=(t+e)/(t-e),f=(n+i)/(n-i);if(2e3===l)o=-(a+r)/(a-r),s=-2*a*r/(a-r);else{if(2001!==l)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+l);o=-a/(a-r),s=-a*r/(a-r)}return u[0]=c,u[4]=0,u[8]=d,u[12]=0,u[1]=0,u[5]=h,u[9]=f,u[13]=0,u[2]=0,u[6]=0,u[10]=o,u[14]=s,u[3]=0,u[7]=0,u[11]=-1,u[15]=0,this}},{key:"makeOrthographic",value:function(e,t,n,i,r,a){var o,s,l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:2e3,u=this.elements,c=1/(t-e),h=1/(n-i),d=1/(a-r),f=(t+e)*c,p=(n+i)*h;if(2e3===l)o=(a+r)*d,s=-2*d;else{if(2001!==l)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+l);o=r*d,s=-1*d}return u[0]=2*c,u[4]=0,u[8]=0,u[12]=-f,u[1]=0,u[5]=2*h,u[9]=0,u[13]=-p,u[2]=0,u[6]=0,u[10]=s,u[14]=-o,u[3]=0,u[7]=0,u[11]=0,u[15]=1,this}},{key:"equals",value:function(e){for(var t=this.elements,n=e.elements,i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}},{key:"fromArray",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=0;n<16;n++)this.elements[n]=e[n+t];return this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}]),e}()),It=new it,Nt=new Ut,Dt=new it(0,0,0),Ot=new it(1,1,1),Ft=new it,zt=new it,Bt=new it,Ht=new Ut,Vt=new nt,Gt=e("an",function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.DEFAULT_ORDER;a(this,t),this.isEuler=!0,this._x=e,this._y=n,this._z=i,this._order=r}return s(t,[{key:"x",get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},{key:"order",get:function(){return this._order},set:function(e){this._order=e,this._onChangeCallback()}},{key:"set",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this._order;return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}},{key:"clone",value:function(){return new this.constructor(this._x,this._y,this._z,this._order)}},{key:"copy",value:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}},{key:"setFromRotationMatrix",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=e.elements,r=i[0],a=i[4],o=i[8],s=i[1],l=i[5],u=i[9],c=i[2],h=i[6],d=i[10];switch(t){case"XYZ":this._y=Math.asin(be(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(h,l),this._z=0);break;case"YXZ":this._x=Math.asin(-be(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(s,l)):(this._y=Math.atan2(-c,r),this._z=0);break;case"ZXY":this._x=Math.asin(be(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-c,d),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(s,r));break;case"ZYX":this._y=Math.asin(-be(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(h,d),this._z=Math.atan2(s,r)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(be(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-c,r)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-be(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(h,l),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-u,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}},{key:"setFromQuaternion",value:function(e,t,n){return Ht.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Ht,t,n)}},{key:"setFromVector3",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order;return this.set(e.x,e.y,e.z,t)}},{key:"reorder",value:function(e){return Vt.setFromEuler(this),this.setFromQuaternion(Vt,e)}},{key:"equals",value:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}},{key:"fromArray",value:function(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}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}},{key:"_onChange",value:function(e){return this._onChangeCallback=e,this}},{key:"_onChangeCallback",value:function(){}},{key:Symbol.iterator,value:n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._x;case 2:return e.next=4,this._y;case 4:return e.next=6,this._z;case 6:return e.next=8,this._order;case 8:case"end":return e.stop()}}),e,this)}))}]),t}());Gt.DEFAULT_ORDER="XYZ";var Wt=e("bF",function(){function e(){a(this,e),this.mask=1}return s(e,[{key:"set",value:function(e){this.mask=(1<<e|0)>>>0}},{key:"enable",value:function(e){this.mask|=1<<e|0}},{key:"enableAll",value:function(){this.mask=-1}},{key:"toggle",value:function(e){this.mask^=1<<e|0}},{key:"disable",value:function(e){this.mask&=~(1<<e|0)}},{key:"disableAll",value:function(){this.mask=0}},{key:"test",value:function(e){return 0!=(this.mask&e.mask)}},{key:"isEnabled",value:function(e){return 0!=(this.mask&(1<<e|0))}}]),e}()),Xt=0,jt=new it,Yt=new nt,qt=new Ut,Zt=new it,Jt=new it,Kt=new it,Qt=new nt,$t=new it(1,0,0),en=new it(0,1,0),tn=new it(0,0,1),nn={type:"added"},rn={type:"removed"},an=e("O",function(e){u(n,e);var t=g(n);function n(){var e;a(this,n),(e=t.call(this)).isObject3D=!0,Object.defineProperty(v(e),"id",{value:Xt++}),e.uuid=Se(),e.name="",e.type="Object3D",e.parent=null,e.children=[],e.up=n.DEFAULT_UP.clone();var i=new it,r=new Gt,o=new nt,s=new it(1,1,1);return r._onChange((function(){o.setFromEuler(r,!1)})),o._onChange((function(){r.setFromQuaternion(o,void 0,!1)})),Object.defineProperties(v(e),{position:{configurable:!0,enumerable:!0,value:i},rotation:{configurable:!0,enumerable:!0,value:r},quaternion:{configurable:!0,enumerable:!0,value:o},scale:{configurable:!0,enumerable:!0,value:s},modelViewMatrix:{value:new Ut},normalMatrix:{value:new ke}}),e.matrix=new Ut,e.matrixWorld=new Ut,e.matrixAutoUpdate=n.DEFAULT_MATRIX_AUTO_UPDATE,e.matrixWorldNeedsUpdate=!1,e.matrixWorldAutoUpdate=n.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,e.layers=new Wt,e.visible=!0,e.castShadow=!1,e.receiveShadow=!1,e.frustumCulled=!0,e.renderOrder=0,e.animations=[],e.userData={},e}return s(n,[{key:"onBeforeRender",value:function(){}},{key:"onAfterRender",value:function(){}},{key:"applyMatrix4",value:function(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}},{key:"applyQuaternion",value:function(e){return this.quaternion.premultiply(e),this}},{key:"setRotationFromAxisAngle",value:function(e,t){this.quaternion.setFromAxisAngle(e,t)}},{key:"setRotationFromEuler",value:function(e){this.quaternion.setFromEuler(e,!0)}},{key:"setRotationFromMatrix",value:function(e){this.quaternion.setFromRotationMatrix(e)}},{key:"setRotationFromQuaternion",value:function(e){this.quaternion.copy(e)}},{key:"rotateOnAxis",value:function(e,t){return Yt.setFromAxisAngle(e,t),this.quaternion.multiply(Yt),this}},{key:"rotateOnWorldAxis",value:function(e,t){return Yt.setFromAxisAngle(e,t),this.quaternion.premultiply(Yt),this}},{key:"rotateX",value:function(e){return this.rotateOnAxis($t,e)}},{key:"rotateY",value:function(e){return this.rotateOnAxis(en,e)}},{key:"rotateZ",value:function(e){return this.rotateOnAxis(tn,e)}},{key:"translateOnAxis",value:function(e,t){return jt.copy(e).applyQuaternion(this.quaternion),this.position.add(jt.multiplyScalar(t)),this}},{key:"translateX",value:function(e){return this.translateOnAxis($t,e)}},{key:"translateY",value:function(e){return this.translateOnAxis(en,e)}},{key:"translateZ",value:function(e){return this.translateOnAxis(tn,e)}},{key:"localToWorld",value:function(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}},{key:"worldToLocal",value:function(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(qt.copy(this.matrixWorld).invert())}},{key:"lookAt",value:function(e,t,n){e.isVector3?Zt.copy(e):Zt.set(e,t,n);var i=this.parent;this.updateWorldMatrix(!0,!1),Jt.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?qt.lookAt(Jt,Zt,this.up):qt.lookAt(Zt,Jt,this.up),this.quaternion.setFromRotationMatrix(qt),i&&(qt.extractRotation(i.matrixWorld),Yt.setFromRotationMatrix(qt),this.quaternion.premultiply(Yt.invert()))}},{key:"add",value:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(nn)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}},{key:"remove",value:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}var n=this.children.indexOf(e);return-1!==n&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(rn)),this}},{key:"removeFromParent",value:function(){var e=this.parent;return null!==e&&e.remove(this),this}},{key:"clear",value:function(){for(var e=0;e<this.children.length;e++){var t=this.children[e];t.parent=null,t.dispatchEvent(rn)}return this.children.length=0,this}},{key:"attach",value:function(e){return this.updateWorldMatrix(!0,!1),qt.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),qt.multiply(e.parent.matrixWorld)),e.applyMatrix4(qt),this.add(e),e.updateWorldMatrix(!1,!0),this}},{key:"getObjectById",value:function(e){return this.getObjectByProperty("id",e)}},{key:"getObjectByName",value:function(e){return this.getObjectByProperty("name",e)}},{key:"getObjectByProperty",value:function(e,t){if(this[e]===t)return this;for(var n=0,i=this.children.length;n<i;n++){var r=this.children[n].getObjectByProperty(e,t);if(void 0!==r)return r}}},{key:"getObjectsByProperty",value:function(e,t){var n=[];this[e]===t&&n.push(this);for(var i=0,r=this.children.length;i<r;i++){var a=this.children[i].getObjectsByProperty(e,t);a.length>0&&(n=n.concat(a))}return n}},{key:"getWorldPosition",value:function(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}},{key:"getWorldQuaternion",value:function(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Jt,e,Kt),e}},{key:"getWorldScale",value:function(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Jt,Qt,e),e}},{key:"getWorldDirection",value:function(e){this.updateWorldMatrix(!0,!1);var t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}},{key:"raycast",value:function(){}},{key:"traverse",value:function(e){e(this);for(var t=this.children,n=0,i=t.length;n<i;n++)t[n].traverse(e)}},{key:"traverseVisible",value:function(e){if(!1!==this.visible){e(this);for(var t=this.children,n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}}},{key:"traverseAncestors",value:function(e){var t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))}},{key:"updateMatrix",value:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}},{key:"updateMatrixWorld",value:function(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(var t=this.children,n=0,i=t.length;n<i;n++){var r=t[n];!0!==r.matrixWorldAutoUpdate&&!0!==e||r.updateMatrixWorld(e)}}},{key:"updateWorldMatrix",value:function(e,t){var n=this.parent;if(!0===e&&null!==n&&!0===n.matrixWorldAutoUpdate&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===t)for(var i=this.children,r=0,a=i.length;r<a;r++){var o=i[r];!0===o.matrixWorldAutoUpdate&&o.updateWorldMatrix(!1,!0)}}},{key:"toJSON",value:function(e){var t=void 0===e||"string"==typeof e,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});var i={};function r(t,n){return void 0===t[n.uuid]&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),!1===this.frustumCulled&&(i.frustumCulled=!1),0!==this.renderOrder&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);var a=this.geometry.parameters;if(void 0!==a&&void 0!==a.shapes){var o=a.shapes;if(Array.isArray(o))for(var s=0,l=o.length;s<l;s++){var u=o[s];r(e.shapes,u)}else r(e.shapes,o)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){for(var c=[],h=0,d=this.material.length;h<d;h++)c.push(r(e.materials,this.material[h]));i.material=c}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(var f=0;f<this.children.length;f++)i.children.push(this.children[f].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(var p=0;p<this.animations.length;p++){var v=this.animations[p];i.animations.push(r(e.animations,v))}}if(t){var m=E(e.geometries),g=E(e.materials),y=E(e.textures),_=E(e.images),x=E(e.shapes),M=E(e.skeletons),S=E(e.animations),b=E(e.nodes);m.length>0&&(n.geometries=m),g.length>0&&(n.materials=g),y.length>0&&(n.textures=y),_.length>0&&(n.images=_),x.length>0&&(n.shapes=x),M.length>0&&(n.skeletons=M),S.length>0&&(n.animations=S),b.length>0&&(n.nodes=b)}return n.object=i,n;function E(e){var t=[];for(var n in e){var i=e[n];delete i.metadata,t.push(i)}return t}}},{key:"clone",value:function(e){return(new this.constructor).copy(this,e)}},{key:"copy",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];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),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,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.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(var n=0;n<e.children.length;n++){var i=e.children[n];this.add(i.clone())}return this}}]),n}(ge));an.DEFAULT_UP=new it(0,1,0),an.DEFAULT_MATRIX_AUTO_UPDATE=!0,an.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var on=new it,sn=new it,ln=new it,un=new it,cn=new it,hn=new it,dn=new it,fn=new it,pn=new it,vn=new it,mn=!1,gn=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new it,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new it,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new it;a(this,e),this.a=t,this.b=n,this.c=i}return s(e,[{key:"set",value:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}},{key:"setFromPointsAndIndices",value:function(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}},{key:"setFromAttributeAndIndices",value:function(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}},{key:"getArea",value:function(){return on.subVectors(this.c,this.b),sn.subVectors(this.a,this.b),.5*on.cross(sn).length()}},{key:"getMidpoint",value:function(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}},{key:"getNormal",value:function(t){return e.getNormal(this.a,this.b,this.c,t)}},{key:"getPlane",value:function(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}},{key:"getBarycoord",value:function(t,n){return e.getBarycoord(t,this.a,this.b,this.c,n)}},{key:"getUV",value:function(t,n,i,r,a){return!1===mn&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),mn=!0),e.getInterpolation(t,this.a,this.b,this.c,n,i,r,a)}},{key:"getInterpolation",value:function(t,n,i,r,a){return e.getInterpolation(t,this.a,this.b,this.c,n,i,r,a)}},{key:"containsPoint",value:function(t){return e.containsPoint(t,this.a,this.b,this.c)}},{key:"isFrontFacing",value:function(t){return e.isFrontFacing(this.a,this.b,this.c,t)}},{key:"intersectsBox",value:function(e){return e.intersectsTriangle(this)}},{key:"closestPointToPoint",value:function(e,t){var n,i,r=this.a,a=this.b,o=this.c;cn.subVectors(a,r),hn.subVectors(o,r),fn.subVectors(e,r);var s=cn.dot(fn),l=hn.dot(fn);if(s<=0&&l<=0)return t.copy(r);pn.subVectors(e,a);var u=cn.dot(pn),c=hn.dot(pn);if(u>=0&&c<=u)return t.copy(a);var h=s*c-u*l;if(h<=0&&s>=0&&u<=0)return n=s/(s-u),t.copy(r).addScaledVector(cn,n);vn.subVectors(e,o);var d=cn.dot(vn),f=hn.dot(vn);if(f>=0&&d<=f)return t.copy(o);var p=d*l-s*f;if(p<=0&&l>=0&&f<=0)return i=l/(l-f),t.copy(r).addScaledVector(hn,i);var v=u*f-d*c;if(v<=0&&c-u>=0&&d-f>=0)return dn.subVectors(o,a),i=(c-u)/(c-u+(d-f)),t.copy(a).addScaledVector(dn,i);var m=1/(v+p+h);return n=p*m,i=h*m,t.copy(r).addScaledVector(cn,n).addScaledVector(hn,i)}},{key:"equals",value:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}],[{key:"getNormal",value:function(e,t,n,i){i.subVectors(n,t),on.subVectors(e,t),i.cross(on);var r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}},{key:"getBarycoord",value:function(e,t,n,i,r){on.subVectors(i,t),sn.subVectors(n,t),ln.subVectors(e,t);var a=on.dot(on),o=on.dot(sn),s=on.dot(ln),l=sn.dot(sn),u=sn.dot(ln),c=a*l-o*o;if(0===c)return r.set(-2,-1,-1);var h=1/c,d=(l*s-o*u)*h,f=(a*u-o*s)*h;return r.set(1-d-f,f,d)}},{key:"containsPoint",value:function(e,t,n,i){return this.getBarycoord(e,t,n,i,un),un.x>=0&&un.y>=0&&un.x+un.y<=1}},{key:"getUV",value:function(e,t,n,i,r,a,o,s){return!1===mn&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),mn=!0),this.getInterpolation(e,t,n,i,r,a,o,s)}},{key:"getInterpolation",value:function(e,t,n,i,r,a,o,s){return this.getBarycoord(e,t,n,i,un),s.setScalar(0),s.addScaledVector(r,un.x),s.addScaledVector(a,un.y),s.addScaledVector(o,un.z),s}},{key:"isFrontFacing",value:function(e,t,n,i){return on.subVectors(n,t),sn.subVectors(e,t),on.cross(sn).dot(i)<0}}]),e}(),yn=0,_n=e("v",function(e){u(n,e);var t=g(n);function n(){var e;return a(this,n),(e=t.call(this)).isMaterial=!0,Object.defineProperty(v(e),"id",{value:yn++}),e.uuid=Se(),e.name="",e.type="Material",e.blending=1,e.side=P,e.vertexColors=!1,e.opacity=1,e.transparent=!1,e.alphaHash=!1,e.blendSrc=204,e.blendDst=205,e.blendEquation=O,e.blendSrcAlpha=null,e.blendDstAlpha=null,e.blendEquationAlpha=null,e.depthFunc=3,e.depthTest=!0,e.depthWrite=!0,e.stencilWriteMask=255,e.stencilFunc=519,e.stencilRef=0,e.stencilFuncMask=255,e.stencilFail=7680,e.stencilZFail=7680,e.stencilZPass=7680,e.stencilWrite=!1,e.clippingPlanes=null,e.clipIntersection=!1,e.clipShadows=!1,e.shadowSide=null,e.colorWrite=!0,e.precision=null,e.polygonOffset=!1,e.polygonOffsetFactor=0,e.polygonOffsetUnits=0,e.dithering=!1,e.alphaToCoverage=!1,e.premultipliedAlpha=!1,e.forceSinglePass=!1,e.visible=!0,e.toneMapped=!0,e.userData={},e.version=0,e._alphaTest=0,e}return s(n,[{key:"alphaTest",get:function(){return this._alphaTest},set:function(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}},{key:"onBuild",value:function(){}},{key:"onBeforeRender",value:function(){}},{key:"onBeforeCompile",value:function(){}},{key:"customProgramCacheKey",value:function(){return this.onBeforeCompile.toString()}},{key:"setValues",value:function(e){if(void 0!==e)for(var t in e){var n=e[t];if(void 0!==n){var i=this[t];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n:console.warn("THREE.Material: '".concat(t,"' is not a property of THREE.").concat(this.type,"."))}else console.warn("THREE.Material: parameter '".concat(t,"' has value of undefined."))}}},{key:"toJSON",value:function(e){var t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});var n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function i(e){var t=[];for(var n in e){var i=e[n];delete i.metadata,t.push(i)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),this.side!==P&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaHash&&(n.alphaHash=this.alphaHash),!0===this.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.forceSinglePass&&(n.forceSinglePass=this.forceSinglePass),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),t){var r=i(e.textures),a=i(e.images);r.length>0&&(n.textures=r),a.length>0&&(n.images=a)}return n}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(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.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;var t=e.clippingPlanes,n=null;if(null!==t){var i=t.length;n=new Array(i);for(var r=0;r!==i;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,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.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}},{key:"needsUpdate",set:function(e){!0===e&&this.version++}}]),n}(ge)),xn={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Mn={h:0,s:0,l:0},Sn={h:0,s:0,l:0};function bn(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}var En=e("C",function(e){function t(e,n,i){return a(this,t),this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,n,i)}return s(t,[{key:"set",value:function(e,t,n){if(void 0===t&&void 0===n){var i=e;i&&i.isColor?this.copy(i):"number"==typeof i?this.setHex(i):"string"==typeof i&&this.setStyle(i)}else this.setRGB(e,t,n);return this}},{key:"setScalar",value:function(e){return this.r=e,this.g=e,this.b=e,this}},{key:"setHex",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ve;return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,Xe.toWorkingColorSpace(this,t),this}},{key:"setRGB",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Xe.workingColorSpace;return this.r=e,this.g=t,this.b=n,Xe.toWorkingColorSpace(this,i),this}},{key:"setHSL",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Xe.workingColorSpace;if(e=Ee(e,1),t=be(t,0,1),n=be(n,0,1),0===t)this.r=this.g=this.b=n;else{var r=n<=.5?n*(1+t):n+t-n*t,a=2*n-r;this.r=bn(a,r,e+1/3),this.g=bn(a,r,e),this.b=bn(a,r,e-1/3)}return Xe.toWorkingColorSpace(this,i),this}},{key:"setStyle",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ve;function i(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}if(t=/^(\w+)\(([^\)]*)\)/.exec(e)){var r,a=t[1],o=t[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(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,n);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(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,n);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,n);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(t=/^\#([A-Fa-f\d]+)$/.exec(e)){var s=t[1],l=s.length;if(3===l)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,n);if(6===l)return this.setHex(parseInt(s,16),n);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}},{key:"setColorName",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ve,n=xn[e.toLowerCase()];return void 0!==n?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}},{key:"clone",value:function(){return new this.constructor(this.r,this.g,this.b)}},{key:"copy",value:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}},{key:"copySRGBToLinear",value:function(e){return this.r=Fe(e.r),this.g=Fe(e.g),this.b=Fe(e.b),this}},{key:"copyLinearToSRGB",value:function(e){return this.r=ze(e.r),this.g=ze(e.g),this.b=ze(e.b),this}},{key:"convertSRGBToLinear",value:function(){return this.copySRGBToLinear(this),this}},{key:"convertLinearToSRGB",value:function(){return this.copyLinearToSRGB(this),this}},{key:"getHex",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ve;return Xe.fromWorkingColorSpace(Tn.copy(this),e),65536*Math.round(be(255*Tn.r,0,255))+256*Math.round(be(255*Tn.g,0,255))+Math.round(be(255*Tn.b,0,255))}},{key:"getHexString",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ve;return("000000"+this.getHex(e).toString(16)).slice(-6)}},{key:"getHSL",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Xe.workingColorSpace;Xe.fromWorkingColorSpace(Tn.copy(this),t);var n,i,r=Tn.r,a=Tn.g,o=Tn.b,s=Math.max(r,a,o),l=Math.min(r,a,o),u=(l+s)/2;if(l===s)n=0,i=0;else{var c=s-l;switch(i=u<=.5?c/(s+l):c/(2-s-l),s){case r:n=(a-o)/c+(a<o?6:0);break;case a:n=(o-r)/c+2;break;case o:n=(r-a)/c+4}n/=6}return e.h=n,e.s=i,e.l=u,e}},{key:"getRGB",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Xe.workingColorSpace;return Xe.fromWorkingColorSpace(Tn.copy(this),t),e.r=Tn.r,e.g=Tn.g,e.b=Tn.b,e}},{key:"getStyle",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ve;Xe.fromWorkingColorSpace(Tn.copy(this),e);var t=Tn.r,n=Tn.g,i=Tn.b;return e!==ve?"color(".concat(e," ").concat(t.toFixed(3)," ").concat(n.toFixed(3)," ").concat(i.toFixed(3),")"):"rgb(".concat(Math.round(255*t),",").concat(Math.round(255*n),",").concat(Math.round(255*i),")")}},{key:"offsetHSL",value:function(e,t,n){return this.getHSL(Mn),Mn.h+=e,Mn.s+=t,Mn.l+=n,this.setHSL(Mn.h,Mn.s,Mn.l),this}},{key:"add",value:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}},{key:"addColors",value:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}},{key:"addScalar",value:function(e){return this.r+=e,this.g+=e,this.b+=e,this}},{key:"sub",value:function(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}},{key:"multiply",value:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}},{key:"multiplyScalar",value:function(e){return this.r*=e,this.g*=e,this.b*=e,this}},{key:"lerp",value:function(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}},{key:"lerpColors",value:function(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}},{key:"lerpHSL",value:function(e,t){this.getHSL(Mn),e.getHSL(Sn);var n=Te(Mn.h,Sn.h,t),i=Te(Mn.s,Sn.s,t),r=Te(Mn.l,Sn.l,t);return this.setHSL(n,i,r),this}},{key:"setFromVector3",value:function(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}},{key:"applyMatrix3",value:function(e){var t=this.r,n=this.g,i=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*i,this.g=r[1]*t+r[4]*n+r[7]*i,this.b=r[2]*t+r[5]*n+r[8]*i,this}},{key:"equals",value:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}},{key:"fromBufferAttribute",value:function(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}},{key:"toJSON",value:function(){return this.getHex()}},{key:Symbol.iterator,value:n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.r;case 2:return e.next=4,this.g;case 4:return e.next=6,this.b;case 6:case"end":return e.stop()}}),e,this)}))}]),t}()),Tn=new En;En.NAMES=xn;var wn=e("j",function(e){u(n,e);var t=g(n);function n(e){var i;return a(this,n),(i=t.call(this)).isMeshBasicMaterial=!0,i.type="MeshBasicMaterial",i.color=new En(16777215),i.map=null,i.lightMap=null,i.lightMapIntensity=1,i.aoMap=null,i.aoMapIntensity=1,i.specularMap=null,i.alphaMap=null,i.envMap=null,i.combine=0,i.reflectivity=1,i.refractionRatio=.98,i.wireframe=!1,i.wireframeLinewidth=1,i.wireframeLinecap="round",i.wireframeLinejoin="round",i.fog=!0,i.setValues(e),i}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,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.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}}]),n}(_n)),An=Rn();function Rn(){for(var e=new ArrayBuffer(4),t=new Float32Array(e),n=new Uint32Array(e),i=new Uint32Array(512),r=new Uint32Array(512),a=0;a<256;++a){var o=a-127;o<-27?(i[a]=0,i[256|a]=32768,r[a]=24,r[256|a]=24):o<-14?(i[a]=1024>>-o-14,i[256|a]=1024>>-o-14|32768,r[a]=-o-1,r[256|a]=-o-1):o<=15?(i[a]=o+15<<10,i[256|a]=o+15<<10|32768,r[a]=13,r[256|a]=13):o<128?(i[a]=31744,i[256|a]=64512,r[a]=24,r[256|a]=24):(i[a]=31744,i[256|a]=64512,r[a]=13,r[256|a]=13)}for(var s=new Uint32Array(2048),l=new Uint32Array(64),u=new Uint32Array(64),c=1;c<1024;++c){for(var h=c<<13,d=0;0==(8388608&h);)h<<=1,d-=8388608;h&=-8388609,d+=947912704,s[c]=h|d}for(var f=1024;f<2048;++f)s[f]=939524096+(f-1024<<13);for(var p=1;p<31;++p)l[p]=p<<23;l[31]=1199570944,l[32]=2147483648;for(var v=33;v<63;++v)l[v]=2147483648+(v-32<<23);l[63]=3347054592;for(var m=1;m<64;++m)32!==m&&(u[m]=1024);return{floatView:t,uint32View:n,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:l,offsetTable:u}}e("a$",{toHalfFloat:function(e){Math.abs(e)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=be(e,-65504,65504),An.floatView[0]=e;var t=An.uint32View[0],n=t>>23&511;return An.baseTable[n]+((8388607&t)>>An.shiftTable[n])},fromHalfFloat:function(e){var t=e>>10;return An.uint32View[0]=An.mantissaTable[An.offsetTable[t]+(1023&e)]+An.exponentTable[t],An.floatView[0]}});var Cn=new it,Ln=new Pe,Pn=e("b",function(){function e(t,n){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(a(this,e),Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=n,this.count=void 0!==t?t.length/n:0,this.normalized=i,this.usage=35044,this.updateRange={offset:0,count:-1},this.gpuType=re,this.version=0}return s(e,[{key:"onUploadCallback",value:function(){}},{key:"needsUpdate",set:function(e){!0===e&&this.version++}},{key:"setUsage",value:function(e){return this.usage=e,this}},{key:"copy",value:function(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}},{key:"copyAt",value:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(var i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this}},{key:"copyArray",value:function(e){return this.array.set(e),this}},{key:"applyMatrix3",value:function(e){if(2===this.itemSize)for(var t=0,n=this.count;t<n;t++)Ln.fromBufferAttribute(this,t),Ln.applyMatrix3(e),this.setXY(t,Ln.x,Ln.y);else if(3===this.itemSize)for(var i=0,r=this.count;i<r;i++)Cn.fromBufferAttribute(this,i),Cn.applyMatrix3(e),this.setXYZ(i,Cn.x,Cn.y,Cn.z);return this}},{key:"applyMatrix4",value:function(e){for(var t=0,n=this.count;t<n;t++)Cn.fromBufferAttribute(this,t),Cn.applyMatrix4(e),this.setXYZ(t,Cn.x,Cn.y,Cn.z);return this}},{key:"applyNormalMatrix",value:function(e){for(var t=0,n=this.count;t<n;t++)Cn.fromBufferAttribute(this,t),Cn.applyNormalMatrix(e),this.setXYZ(t,Cn.x,Cn.y,Cn.z);return this}},{key:"transformDirection",value:function(e){for(var t=0,n=this.count;t<n;t++)Cn.fromBufferAttribute(this,t),Cn.transformDirection(e),this.setXYZ(t,Cn.x,Cn.y,Cn.z);return this}},{key:"set",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(e,t),this}},{key:"getComponent",value:function(e,t){var n=this.array[e*this.itemSize+t];return this.normalized&&(n=Ce(n,this.array)),n}},{key:"setComponent",value:function(e,t,n){return this.normalized&&(n=Le(n,this.array)),this.array[e*this.itemSize+t]=n,this}},{key:"getX",value:function(e){var t=this.array[e*this.itemSize];return this.normalized&&(t=Ce(t,this.array)),t}},{key:"setX",value:function(e,t){return this.normalized&&(t=Le(t,this.array)),this.array[e*this.itemSize]=t,this}},{key:"getY",value:function(e){var t=this.array[e*this.itemSize+1];return this.normalized&&(t=Ce(t,this.array)),t}},{key:"setY",value:function(e,t){return this.normalized&&(t=Le(t,this.array)),this.array[e*this.itemSize+1]=t,this}},{key:"getZ",value:function(e){var t=this.array[e*this.itemSize+2];return this.normalized&&(t=Ce(t,this.array)),t}},{key:"setZ",value:function(e,t){return this.normalized&&(t=Le(t,this.array)),this.array[e*this.itemSize+2]=t,this}},{key:"getW",value:function(e){var t=this.array[e*this.itemSize+3];return this.normalized&&(t=Ce(t,this.array)),t}},{key:"setW",value:function(e,t){return this.normalized&&(t=Le(t,this.array)),this.array[e*this.itemSize+3]=t,this}},{key:"setXY",value:function(e,t,n){return e*=this.itemSize,this.normalized&&(t=Le(t,this.array),n=Le(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}},{key:"setXYZ",value:function(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=Le(t,this.array),n=Le(n,this.array),i=Le(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}},{key:"setXYZW",value:function(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=Le(t,this.array),n=Le(n,this.array),i=Le(i,this.array),r=Le(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this}},{key:"onUpload",value:function(e){return this.onUploadCallback=e,this}},{key:"clone",value:function(){return new this.constructor(this.array,this.itemSize).copy(this)}},{key:"toJSON",value:function(){var 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),0===this.updateRange.offset&&-1===this.updateRange.count||(e.updateRange=this.updateRange),e}}]),e}()),kn=function(e){u(n,e);var t=g(n);function n(e,i,r){return a(this,n),t.call(this,new Uint16Array(e),i,r)}return s(n)}(Pn),Un=e("ay",function(e){u(n,e);var t=g(n);function n(e,i,r){return a(this,n),t.call(this,new Uint32Array(e),i,r)}return s(n)}(Pn)),In=e("az",function(e){u(n,e);var t=g(n);function n(e,i,r){return a(this,n),t.call(this,new Float32Array(e),i,r)}return s(n)}(Pn)),Nn=0,Dn=new Ut,On=new an,Fn=new it,zn=new ot,Bn=new ot,Hn=new it,Vn=e("B",function(e){u(n,e);var t=g(n);function n(){var e;return a(this,n),(e=t.call(this)).isBufferGeometry=!0,Object.defineProperty(v(e),"id",{value:Nn++}),e.uuid=Se(),e.name="",e.type="BufferGeometry",e.index=null,e.attributes={},e.morphAttributes={},e.morphTargetsRelative=!1,e.groups=[],e.boundingBox=null,e.boundingSphere=null,e.drawRange={start:0,count:1/0},e.userData={},e}return s(n,[{key:"getIndex",value:function(){return this.index}},{key:"setIndex",value:function(e){return Array.isArray(e)?this.index=new(Ie(e)?Un:kn)(e,1):this.index=e,this}},{key:"getAttribute",value:function(e){return this.attributes[e]}},{key:"setAttribute",value:function(e,t){return this.attributes[e]=t,this}},{key:"deleteAttribute",value:function(e){return delete this.attributes[e],this}},{key:"hasAttribute",value:function(e){return void 0!==this.attributes[e]}},{key:"addGroup",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.groups.push({start:e,count:t,materialIndex:n})}},{key:"clearGroups",value:function(){this.groups=[]}},{key:"setDrawRange",value:function(e,t){this.drawRange.start=e,this.drawRange.count=t}},{key:"applyMatrix4",value:function(e){var t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);var n=this.attributes.normal;if(void 0!==n){var i=(new ke).getNormalMatrix(e);n.applyNormalMatrix(i),n.needsUpdate=!0}var r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(e),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}},{key:"applyQuaternion",value:function(e){return Dn.makeRotationFromQuaternion(e),this.applyMatrix4(Dn),this}},{key:"rotateX",value:function(e){return Dn.makeRotationX(e),this.applyMatrix4(Dn),this}},{key:"rotateY",value:function(e){return Dn.makeRotationY(e),this.applyMatrix4(Dn),this}},{key:"rotateZ",value:function(e){return Dn.makeRotationZ(e),this.applyMatrix4(Dn),this}},{key:"translate",value:function(e,t,n){return Dn.makeTranslation(e,t,n),this.applyMatrix4(Dn),this}},{key:"scale",value:function(e,t,n){return Dn.makeScale(e,t,n),this.applyMatrix4(Dn),this}},{key:"lookAt",value:function(e){return On.lookAt(e),On.updateMatrix(),this.applyMatrix4(On.matrix),this}},{key:"center",value:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(Fn).negate(),this.translate(Fn.x,Fn.y,Fn.z),this}},{key:"setFromPoints",value:function(e){for(var t=[],n=0,i=e.length;n<i;n++){var r=e[n];t.push(r.x,r.y,r.z||0)}return this.setAttribute("position",new In(t,3)),this}},{key:"computeBoundingBox",value:function(){null===this.boundingBox&&(this.boundingBox=new ot);var e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingBox.set(new it(-1/0,-1/0,-1/0),new it(1/0,1/0,1/0));if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(var n=0,i=t.length;n<i;n++){var r=t[n];zn.setFromBufferAttribute(r),this.morphTargetsRelative?(Hn.addVectors(this.boundingBox.min,zn.min),this.boundingBox.expandByPoint(Hn),Hn.addVectors(this.boundingBox.max,zn.max),this.boundingBox.expandByPoint(Hn)):(this.boundingBox.expandByPoint(zn.min),this.boundingBox.expandByPoint(zn.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}},{key:"computeBoundingSphere",value:function(){null===this.boundingSphere&&(this.boundingSphere=new Et);var e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingSphere.set(new it,1/0);if(e){var n=this.boundingSphere.center;if(zn.setFromBufferAttribute(e),t)for(var i=0,r=t.length;i<r;i++){var a=t[i];Bn.setFromBufferAttribute(a),this.morphTargetsRelative?(Hn.addVectors(zn.min,Bn.min),zn.expandByPoint(Hn),Hn.addVectors(zn.max,Bn.max),zn.expandByPoint(Hn)):(zn.expandByPoint(Bn.min),zn.expandByPoint(Bn.max))}zn.getCenter(n);for(var o=0,s=0,l=e.count;s<l;s++)Hn.fromBufferAttribute(e,s),o=Math.max(o,n.distanceToSquared(Hn));if(t)for(var u=0,c=t.length;u<c;u++)for(var h=t[u],d=this.morphTargetsRelative,f=0,p=h.count;f<p;f++)Hn.fromBufferAttribute(h,f),d&&(Fn.fromBufferAttribute(e,f),Hn.add(Fn)),o=Math.max(o,n.distanceToSquared(Hn));this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}},{key:"computeTangents",value:function(){var e=this.index,t=this.attributes;if(null!==e&&void 0!==t.position&&void 0!==t.normal&&void 0!==t.uv){var n=e.array,i=t.position.array,r=t.normal.array,a=t.uv.array,o=i.length/3;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new Pn(new Float32Array(4*o),4));for(var s=this.getAttribute("tangent").array,l=[],u=[],c=0;c<o;c++)l[c]=new it,u[c]=new it;var h=new it,d=new it,f=new it,p=new Pe,v=new Pe,m=new Pe,g=new it,y=new it,_=this.groups;0===_.length&&(_=[{start:0,count:n.length}]);for(var x=0,M=_.length;x<M;++x)for(var S=_[x],b=S.start,E=b,T=b+S.count;E<T;E+=3)D(n[E+0],n[E+1],n[E+2]);for(var w=new it,A=new it,R=new it,C=new it,L=0,P=_.length;L<P;++L)for(var k=_[L],U=k.start,I=U,N=U+k.count;I<N;I+=3)O(n[I+0]),O(n[I+1]),O(n[I+2])}else console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");function D(e,t,n){h.fromArray(i,3*e),d.fromArray(i,3*t),f.fromArray(i,3*n),p.fromArray(a,2*e),v.fromArray(a,2*t),m.fromArray(a,2*n),d.sub(h),f.sub(h),v.sub(p),m.sub(p);var r=1/(v.x*m.y-m.x*v.y);isFinite(r)&&(g.copy(d).multiplyScalar(m.y).addScaledVector(f,-v.y).multiplyScalar(r),y.copy(f).multiplyScalar(v.x).addScaledVector(d,-m.x).multiplyScalar(r),l[e].add(g),l[t].add(g),l[n].add(g),u[e].add(y),u[t].add(y),u[n].add(y))}function O(e){R.fromArray(r,3*e),C.copy(R);var t=l[e];w.copy(t),w.sub(R.multiplyScalar(R.dot(t))).normalize(),A.crossVectors(C,t);var n=A.dot(u[e])<0?-1:1;s[4*e]=w.x,s[4*e+1]=w.y,s[4*e+2]=w.z,s[4*e+3]=n}}},{key:"computeVertexNormals",value:function(){var e=this.index,t=this.getAttribute("position");if(void 0!==t){var n=this.getAttribute("normal");if(void 0===n)n=new Pn(new Float32Array(3*t.count),3),this.setAttribute("normal",n);else for(var i=0,r=n.count;i<r;i++)n.setXYZ(i,0,0,0);var a=new it,o=new it,s=new it,l=new it,u=new it,c=new it,h=new it,d=new it;if(e)for(var f=0,p=e.count;f<p;f+=3){var v=e.getX(f+0),m=e.getX(f+1),g=e.getX(f+2);a.fromBufferAttribute(t,v),o.fromBufferAttribute(t,m),s.fromBufferAttribute(t,g),h.subVectors(s,o),d.subVectors(a,o),h.cross(d),l.fromBufferAttribute(n,v),u.fromBufferAttribute(n,m),c.fromBufferAttribute(n,g),l.add(h),u.add(h),c.add(h),n.setXYZ(v,l.x,l.y,l.z),n.setXYZ(m,u.x,u.y,u.z),n.setXYZ(g,c.x,c.y,c.z)}else for(var y=0,_=t.count;y<_;y+=3)a.fromBufferAttribute(t,y+0),o.fromBufferAttribute(t,y+1),s.fromBufferAttribute(t,y+2),h.subVectors(s,o),d.subVectors(a,o),h.cross(d),n.setXYZ(y+0,h.x,h.y,h.z),n.setXYZ(y+1,h.x,h.y,h.z),n.setXYZ(y+2,h.x,h.y,h.z);this.normalizeNormals(),n.needsUpdate=!0}}},{key:"normalizeNormals",value:function(){for(var e=this.attributes.normal,t=0,n=e.count;t<n;t++)Hn.fromBufferAttribute(e,t),Hn.normalize(),e.setXYZ(t,Hn.x,Hn.y,Hn.z)}},{key:"toNonIndexed",value:function(){function e(e,t){for(var n=e.array,i=e.itemSize,r=e.normalized,a=new n.constructor(t.length*i),o=0,s=0,l=0,u=t.length;l<u;l++){o=e.isInterleavedBufferAttribute?t[l]*e.data.stride+e.offset:t[l]*i;for(var c=0;c<i;c++)a[s++]=n[o++]}return new Pn(a,i,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;var t=new n,i=this.index.array,r=this.attributes;for(var a in r){var o=e(r[a],i);t.setAttribute(a,o)}var s=this.morphAttributes;for(var l in s){for(var u=[],c=s[l],h=0,d=c.length;h<d;h++){var f=e(c[h],i);u.push(f)}t.morphAttributes[l]=u}t.morphTargetsRelative=this.morphTargetsRelative;for(var p=this.groups,v=0,m=p.length;v<m;v++){var g=p[v];t.addGroup(g.start,g.count,g.materialIndex)}return t}},{key:"toJSON",value:function(){var e={metadata:{version:4.6,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){var t=this.parameters;for(var n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};var i=this.index;null!==i&&(e.data.index={type:i.array.constructor.name,array:Array.prototype.slice.call(i.array)});var r=this.attributes;for(var a in r){var o=r[a];e.data.attributes[a]=o.toJSON(e.data)}var s={},l=!1;for(var u in this.morphAttributes){for(var c=this.morphAttributes[u],h=[],d=0,f=c.length;d<f;d++){var p=c[d];h.push(p.toJSON(e.data))}h.length>0&&(s[u]=h,l=!0)}l&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);var v=this.groups;v.length>0&&(e.data.groups=JSON.parse(JSON.stringify(v)));var m=this.boundingSphere;return null!==m&&(e.data.boundingSphere={center:m.center.toArray(),radius:m.radius}),e}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;var t={};this.name=e.name;var n=e.index;null!==n&&this.setIndex(n.clone(t));var i=e.attributes;for(var r in i){var a=i[r];this.setAttribute(r,a.clone(t))}var o=e.morphAttributes;for(var s in o){for(var l=[],u=o[s],c=0,h=u.length;c<h;c++)l.push(u[c].clone(t));this.morphAttributes[s]=l}this.morphTargetsRelative=e.morphTargetsRelative;for(var d=e.groups,f=0,p=d.length;f<p;f++){var v=d[f];this.addGroup(v.start,v.count,v.materialIndex)}var m=e.boundingBox;null!==m&&(this.boundingBox=m.clone());var g=e.boundingSphere;return null!==g&&(this.boundingSphere=g.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}}]),n}(ge)),Gn=new Ut,Wn=new kt,Xn=new Et,jn=new it,Yn=new it,qn=new it,Zn=new it,Jn=new it,Kn=new it,Qn=new Pe,$n=new Pe,ei=new Pe,ti=new it,ni=new it,ii=new it,ri=new it,ai=new it,oi=e("G",function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Vn,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new wn;return a(this,n),(e=t.call(this)).isMesh=!0,e.type="Mesh",e.geometry=i,e.material=r,e.updateMorphTargets(),e}return s(n,[{key:"copy",value:function(e,t){return _(c(n.prototype),"copy",this).call(this,e,t),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=e.material,this.geometry=e.geometry,this}},{key:"updateMorphTargets",value:function(){var e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){var n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var i=0,r=n.length;i<r;i++){var a=n[i].name||String(i);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=i}}}}},{key:"getVertexPosition",value:function(e,t){var n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(i,e);var o=this.morphTargetInfluences;if(r&&o){Kn.set(0,0,0);for(var s=0,l=r.length;s<l;s++){var u=o[s],c=r[s];0!==u&&(Jn.fromBufferAttribute(c,e),a?Kn.addScaledVector(Jn,u):Kn.addScaledVector(Jn.sub(t),u))}t.add(Kn)}return t}},{key:"raycast",value:function(e,t){var n=this.geometry,i=this.material,r=this.matrixWorld;if(void 0!==i){if(null===n.boundingSphere&&n.computeBoundingSphere(),Xn.copy(n.boundingSphere),Xn.applyMatrix4(r),Wn.copy(e.ray).recast(e.near),!1===Xn.containsPoint(Wn.origin)){if(null===Wn.intersectSphere(Xn,jn))return;if(Wn.origin.distanceToSquared(jn)>Math.pow(e.far-e.near,2))return}Gn.copy(r).invert(),Wn.copy(e.ray).applyMatrix4(Gn),null!==n.boundingBox&&!1===Wn.intersectsBox(n.boundingBox)||this._computeIntersections(e,t,Wn)}}},{key:"_computeIntersections",value:function(e,t,n){var i,r=this.geometry,a=this.material,o=r.index,s=r.attributes.position,l=r.attributes.uv,u=r.attributes.uv1,c=r.attributes.normal,h=r.groups,d=r.drawRange;if(null!==o)if(Array.isArray(a))for(var f=0,p=h.length;f<p;f++)for(var v=h[f],m=a[v.materialIndex],g=Math.max(v.start,d.start),y=Math.min(o.count,Math.min(v.start+v.count,d.start+d.count));g<y;g+=3)(i=si(this,m,e,n,l,u,c,o.getX(g),o.getX(g+1),o.getX(g+2)))&&(i.faceIndex=Math.floor(g/3),i.face.materialIndex=v.materialIndex,t.push(i));else for(var _=Math.max(0,d.start),x=Math.min(o.count,d.start+d.count);_<x;_+=3)(i=si(this,a,e,n,l,u,c,o.getX(_),o.getX(_+1),o.getX(_+2)))&&(i.faceIndex=Math.floor(_/3),t.push(i));else if(void 0!==s)if(Array.isArray(a))for(var M=0,S=h.length;M<S;M++)for(var b=h[M],E=a[b.materialIndex],T=Math.max(b.start,d.start),w=Math.min(s.count,Math.min(b.start+b.count,d.start+d.count));T<w;T+=3)(i=si(this,E,e,n,l,u,c,T,T+1,T+2))&&(i.faceIndex=Math.floor(T/3),i.face.materialIndex=b.materialIndex,t.push(i));else for(var A=Math.max(0,d.start),R=Math.min(s.count,d.start+d.count);A<R;A+=3)(i=si(this,a,e,n,l,u,c,A,A+1,A+2))&&(i.faceIndex=Math.floor(A/3),t.push(i))}}]),n}(an));function si(e,t,n,i,r,a,o,s,l,u){e.getVertexPosition(s,Yn),e.getVertexPosition(l,qn),e.getVertexPosition(u,Zn);var c=function(e,t,n,i,r,a,o,s){if(null===(t.side===k?i.intersectTriangle(o,a,r,!0,s):i.intersectTriangle(r,a,o,t.side===P,s)))return null;ai.copy(s),ai.applyMatrix4(e.matrixWorld);var l=n.ray.origin.distanceTo(ai);return l<n.near||l>n.far?null:{distance:l,point:ai.clone(),object:e}}(e,t,n,i,Yn,qn,Zn,ri);if(c){r&&(Qn.fromBufferAttribute(r,s),$n.fromBufferAttribute(r,l),ei.fromBufferAttribute(r,u),c.uv=gn.getInterpolation(ri,Yn,qn,Zn,Qn,$n,ei,new Pe)),a&&(Qn.fromBufferAttribute(a,s),$n.fromBufferAttribute(a,l),ei.fromBufferAttribute(a,u),c.uv1=gn.getInterpolation(ri,Yn,qn,Zn,Qn,$n,ei,new Pe),c.uv2=c.uv1),o&&(ti.fromBufferAttribute(o,s),ni.fromBufferAttribute(o,l),ii.fromBufferAttribute(o,u),c.normal=gn.getInterpolation(ri,Yn,qn,Zn,ti,ni,ii,new it),c.normal.dot(i.direction)>0&&c.normal.multiplyScalar(-1));var h={a:s,b:l,c:u,normal:new it,materialIndex:0};gn.getNormal(Yn,qn,Zn,h.normal),c.face=h}return c}var li=e("aF",function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1;a(this,n),(e=t.call(this)).type="BoxGeometry",e.parameters={width:i,height:r,depth:o,widthSegments:s,heightSegments:l,depthSegments:u};var c=v(e);s=Math.floor(s),l=Math.floor(l),u=Math.floor(u);var h=[],d=[],f=[],p=[],m=0,g=0;function y(e,t,n,i,r,a,o,s,l,u,v){for(var y=a/l,_=o/u,x=a/2,M=o/2,S=s/2,b=l+1,E=u+1,T=0,w=0,A=new it,R=0;R<E;R++)for(var C=R*_-M,L=0;L<b;L++){var P=L*y-x;A[e]=P*i,A[t]=C*r,A[n]=S,d.push(A.x,A.y,A.z),A[e]=0,A[t]=0,A[n]=s>0?1:-1,f.push(A.x,A.y,A.z),p.push(L/l),p.push(1-R/u),T+=1}for(var k=0;k<u;k++)for(var U=0;U<l;U++){var I=m+U+b*k,N=m+U+b*(k+1),D=m+(U+1)+b*(k+1),O=m+(U+1)+b*k;h.push(I,N,O),h.push(N,D,O),w+=6}c.addGroup(g,w,v),g+=w,m+=T}return y("z","y","x",-1,-1,o,r,i,u,l,0),y("z","y","x",1,-1,o,r,-i,u,l,1),y("x","z","y",1,1,i,o,r,s,u,2),y("x","z","y",1,-1,i,o,-r,s,u,3),y("x","y","z",1,-1,i,r,o,s,l,4),y("x","y","z",-1,-1,i,r,-o,s,l,5),e.setIndex(h),e.setAttribute("position",new In(d,3)),e.setAttribute("normal",new In(f,3)),e.setAttribute("uv",new In(p,2)),e}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}}],[{key:"fromJSON",value:function(e){return new n(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}]),n}(Vn));function ui(e){var t={};for(var n in e)for(var i in t[n]={},e[n]){var r=e[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[n][i]=null):t[n][i]=r.clone():Array.isArray(r)?t[n][i]=r.slice():t[n][i]=r}return t}function ci(e){for(var t={},n=0;n<e.length;n++){var i=ui(e[n]);for(var r in i)t[r]=i[r]}return t}function hi(e){return null===e.getRenderTarget()?e.outputColorSpace:me}var di=e("b4",{clone:ui,merge:ci}),fi=e("b3",function(e){u(n,e);var t=g(n);function n(e){var i;return a(this,n),(i=t.call(this)).isShaderMaterial=!0,i.type="ShaderMaterial",i.defines={},i.uniforms={},i.uniformsGroups=[],i.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",i.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",i.linewidth=1,i.wireframe=!1,i.wireframeLinewidth=1,i.fog=!1,i.lights=!1,i.clipping=!1,i.forceSinglePass=!0,i.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},i.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},i.index0AttributeName=void 0,i.uniformsNeedUpdate=!1,i.glslVersion=null,void 0!==e&&i.setValues(e),i}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=ui(e.uniforms),this.uniformsGroups=function(e){for(var t=[],n=0;n<e.length;n++)t.push(e[n].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}},{key:"toJSON",value:function(e){var t=_(c(n.prototype),"toJSON",this).call(this,e);for(var i in t.glslVersion=this.glslVersion,t.uniforms={},this.uniforms){var r=this.uniforms[i].value;r&&r.isTexture?t.uniforms[i]={type:"t",value:r.toJSON(e).uuid}:r&&r.isColor?t.uniforms[i]={type:"c",value:r.getHex()}:r&&r.isVector2?t.uniforms[i]={type:"v2",value:r.toArray()}:r&&r.isVector3?t.uniforms[i]={type:"v3",value:r.toArray()}:r&&r.isVector4?t.uniforms[i]={type:"v4",value:r.toArray()}:r&&r.isMatrix3?t.uniforms[i]={type:"m3",value:r.toArray()}:r&&r.isMatrix4?t.uniforms[i]={type:"m4",value:r.toArray()}:t.uniforms[i]={value:r}}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;var a={};for(var o in this.extensions)!0===this.extensions[o]&&(a[o]=!0);return Object.keys(a).length>0&&(t.extensions=a),t}}]),n}(_n)),pi=e("bs",function(e){u(n,e);var t=g(n);function n(){var e;return a(this,n),(e=t.call(this)).isCamera=!0,e.type="Camera",e.matrixWorldInverse=new Ut,e.projectionMatrix=new Ut,e.projectionMatrixInverse=new Ut,e.coordinateSystem=2e3,e}return s(n,[{key:"copy",value:function(e,t){return _(c(n.prototype),"copy",this).call(this,e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}},{key:"getWorldDirection",value:function(e){this.updateWorldMatrix(!0,!1);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}},{key:"updateMatrixWorld",value:function(e){_(c(n.prototype),"updateMatrixWorld",this).call(this,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}},{key:"updateWorldMatrix",value:function(e,t){_(c(n.prototype),"updateWorldMatrix",this).call(this,e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),n}(an)),vi=e("W",function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2e3;return a(this,n),(e=t.call(this)).isPerspectiveCamera=!0,e.type="PerspectiveCamera",e.fov=i,e.zoom=1,e.near=o,e.far=s,e.focus=10,e.aspect=r,e.view=null,e.filmGauge=35,e.filmOffset=0,e.updateProjectionMatrix(),e}return s(n,[{key:"copy",value:function(e,t){return _(c(n.prototype),"copy",this).call(this,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}},{key:"setFocalLength",value:function(e){var t=.5*this.getFilmHeight()/e;this.fov=2*Me*Math.atan(t),this.updateProjectionMatrix()}},{key:"getFocalLength",value:function(){var e=Math.tan(.5*xe*this.fov);return.5*this.getFilmHeight()/e}},{key:"getEffectiveFOV",value:function(){return 2*Me*Math.atan(Math.tan(.5*xe*this.fov)/this.zoom)}},{key:"getFilmWidth",value:function(){return this.filmGauge*Math.min(this.aspect,1)}},{key:"getFilmHeight",value:function(){return this.filmGauge/Math.max(this.aspect,1)}},{key:"setViewOffset",value:function(e,t,n,i,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=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}},{key:"clearViewOffset",value:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}},{key:"updateProjectionMatrix",value:function(){var e=this.near,t=e*Math.tan(.5*xe*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i,a=this.view;if(null!==this.view&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;r+=a.offsetX*i/o,t-=a.offsetY*n/s,i*=a.width/o,n*=a.height/s}var l=this.filmOffset;0!==l&&(r+=e*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}},{key:"toJSON",value:function(e){var t=_(c(n.prototype),"toJSON",this).call(this,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}}]),n}(pi)),mi=function(e){u(n,e);var t=g(n);function n(e,i,r){var o;a(this,n),(o=t.call(this)).type="CubeCamera",o.renderTarget=r,o.coordinateSystem=null;var s=new vi(-90,1,e,i);s.layers=o.layers,o.add(s);var l=new vi(-90,1,e,i);l.layers=o.layers,o.add(l);var u=new vi(-90,1,e,i);u.layers=o.layers,o.add(u);var c=new vi(-90,1,e,i);c.layers=o.layers,o.add(c);var h=new vi(-90,1,e,i);h.layers=o.layers,o.add(h);var d=new vi(-90,1,e,i);return d.layers=o.layers,o.add(d),o}return s(n,[{key:"updateCoordinateSystem",value:function(){var e,t=this.coordinateSystem,n=this.children.concat(),i=x(n,6),r=i[0],a=i[1],o=i[2],s=i[3],l=i[4],u=i[5],c=E(n);try{for(c.s();!(e=c.n()).done;){var h=e.value;this.remove(h)}}catch(e){c.e(e)}finally{c.f()}if(2e3===t)r.up.set(0,1,0),r.lookAt(1,0,0),a.up.set(0,1,0),a.lookAt(-1,0,0),o.up.set(0,0,-1),o.lookAt(0,1,0),s.up.set(0,0,1),s.lookAt(0,-1,0),l.up.set(0,1,0),l.lookAt(0,0,1),u.up.set(0,1,0),u.lookAt(0,0,-1);else{if(2001!==t)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);r.up.set(0,-1,0),r.lookAt(-1,0,0),a.up.set(0,-1,0),a.lookAt(1,0,0),o.up.set(0,0,1),o.lookAt(0,1,0),s.up.set(0,0,-1),s.lookAt(0,-1,0),l.up.set(0,-1,0),l.lookAt(0,0,1),u.up.set(0,-1,0),u.lookAt(0,0,-1)}var d,f=E(n);try{for(f.s();!(d=f.n()).done;){var p=d.value;this.add(p),p.updateMatrixWorld()}}catch(e){f.e(e)}finally{f.f()}}},{key:"update",value:function(e,t){null===this.parent&&this.updateMatrixWorld();var n=this.renderTarget;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());var i=x(this.children,6),r=i[0],a=i[1],o=i[2],s=i[3],l=i[4],u=i[5],c=e.getRenderTarget(),h=e.xr.enabled;e.xr.enabled=!1;var d=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,r),e.setRenderTarget(n,1),e.render(t,a),e.setRenderTarget(n,2),e.render(t,o),e.setRenderTarget(n,3),e.render(t,s),e.setRenderTarget(n,4),e.render(t,l),n.texture.generateMipmaps=d,e.setRenderTarget(n,5),e.render(t,u),e.setRenderTarget(c),e.xr.enabled=h,n.texture.needsPMREMUpdate=!0}}]),n}(an),gi=e("ao",function(e){u(n,e);var t=g(n);function n(e,i,r,o,s,l,u,c,h,d){var f;return a(this,n),e=void 0!==e?e:[],i=void 0!==i?i:301,(f=t.call(this,e,i,r,o,s,l,u,c,h,d)).isCubeTexture=!0,f.flipY=!1,f}return s(n,[{key:"images",get:function(){return this.image},set:function(e){this.image=e}}]),n}(Ke)),yi=function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};a(this,n),(e=t.call(this,i,i,r)).isWebGLCubeRenderTarget=!0;var o={width:i,height:i,depth:1},s=[o,o,o,o,o,o];return void 0!==r.encoding&&(Oe("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),r.colorSpace=3001===r.encoding?ve:pe),e.texture=new gi(s,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.colorSpace),e.texture.isRenderTargetTexture=!0,e.texture.generateMipmaps=void 0!==r.generateMipmaps&&r.generateMipmaps,e.texture.minFilter=void 0!==r.minFilter?r.minFilter:te,e}return s(n,[{key:"fromEquirectangularTexture",value:function(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;var n=new li(5,5,5),i=new fi({name:"CubemapFromEquirect",uniforms:ui({tEquirect:{value:null}}),vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",side:k,blending:I});i.uniforms.tEquirect.value=t;var r=new oi(n,i),a=t.minFilter;return t.minFilter===ie&&(t.minFilter=te),new mi(1,10,this).update(e,r),t.minFilter=a,r.geometry.dispose(),r.material.dispose(),this}},{key:"clear",value:function(e,t,n,i){for(var r=e.getRenderTarget(),a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,i);e.setRenderTarget(r)}}]),n}($e),_i=new it,xi=new it,Mi=new ke,Si=e("bI",function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new it(1,0,0),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;a(this,e),this.isPlane=!0,this.normal=t,this.constant=n}return s(e,[{key:"set",value:function(e,t){return this.normal.copy(e),this.constant=t,this}},{key:"setComponents",value:function(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}},{key:"setFromNormalAndCoplanarPoint",value:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}},{key:"setFromCoplanarPoints",value:function(e,t,n){var i=_i.subVectors(n,t).cross(xi.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}},{key:"copy",value:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this}},{key:"normalize",value:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}},{key:"negate",value:function(){return this.constant*=-1,this.normal.negate(),this}},{key:"distanceToPoint",value:function(e){return this.normal.dot(e)+this.constant}},{key:"distanceToSphere",value:function(e){return this.distanceToPoint(e.center)-e.radius}},{key:"projectPoint",value:function(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}},{key:"intersectLine",value:function(e,t){var n=e.delta(_i),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;var r=-(e.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:t.copy(e.start).addScaledVector(n,r)}},{key:"intersectsLine",value:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}},{key:"intersectsBox",value:function(e){return e.intersectsPlane(this)}},{key:"intersectsSphere",value:function(e){return e.intersectsPlane(this)}},{key:"coplanarPoint",value:function(e){return e.copy(this.normal).multiplyScalar(-this.constant)}},{key:"applyMatrix4",value:function(e,t){var n=t||Mi.getNormalMatrix(e),i=this.coplanarPoint(_i).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}},{key:"translate",value:function(e){return this.constant-=e.dot(this.normal),this}},{key:"equals",value:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}()),bi=new Et,Ei=new it,Ti=e("bX",function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Si,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Si,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Si,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Si,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:new Si,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:new Si;a(this,e),this.planes=[t,n,i,r,o,s]}return s(e,[{key:"set",value:function(e,t,n,i,r,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(a),this}},{key:"copy",value:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this}},{key:"setFromProjectionMatrix",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2e3,n=this.planes,i=e.elements,r=i[0],a=i[1],o=i[2],s=i[3],l=i[4],u=i[5],c=i[6],h=i[7],d=i[8],f=i[9],p=i[10],v=i[11],m=i[12],g=i[13],y=i[14],_=i[15];if(n[0].setComponents(s-r,h-l,v-d,_-m).normalize(),n[1].setComponents(s+r,h+l,v+d,_+m).normalize(),n[2].setComponents(s+a,h+u,v+f,_+g).normalize(),n[3].setComponents(s-a,h-u,v-f,_-g).normalize(),n[4].setComponents(s-o,h-c,v-p,_-y).normalize(),2e3===t)n[5].setComponents(s+o,h+c,v+p,_+y).normalize();else{if(2001!==t)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);n[5].setComponents(o,c,p,y).normalize()}return this}},{key:"intersectsObject",value:function(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),bi.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{var t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),bi.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(bi)}},{key:"intersectsSprite",value:function(e){return bi.center.set(0,0,0),bi.radius=.7071067811865476,bi.applyMatrix4(e.matrixWorld),this.intersectsSphere(bi)}},{key:"intersectsSphere",value:function(e){for(var t=this.planes,n=e.center,i=-e.radius,r=0;r<6;r++)if(t[r].distanceToPoint(n)<i)return!1;return!0}},{key:"intersectsBox",value:function(e){for(var t=this.planes,n=0;n<6;n++){var i=t[n];if(Ei.x=i.normal.x>0?e.max.x:e.min.x,Ei.y=i.normal.y>0?e.max.y:e.min.y,Ei.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Ei)<0)return!1}return!0}},{key:"containsPoint",value:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}());function wi(){var e=null,t=!1,n=null,i=null;function r(t,a){n(t,a),i=e.requestAnimationFrame(r)}return{start:function(){!0!==t&&null!==n&&(i=e.requestAnimationFrame(r),t=!0)},stop:function(){e.cancelAnimationFrame(i),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function Ai(e,t){var n=t.isWebGL2,i=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),i.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);var n=i.get(t);n&&(e.deleteBuffer(n.buffer),i.delete(t))},update:function(t,r){if(t.isGLBufferAttribute){var a=i.get(t);(!a||a.version<t.version)&&i.set(t,{buffer:t.buffer,type:t.type,bytesPerElement:t.elementSize,version:t.version})}else{t.isInterleavedBufferAttribute&&(t=t.data);var o=i.get(t);void 0===o?i.set(t,function(t,i){var r,a=t.array,o=t.usage,s=e.createBuffer();if(e.bindBuffer(i,s),e.bufferData(i,a,o),t.onUploadCallback(),a instanceof Float32Array)r=e.FLOAT;else if(a instanceof Uint16Array)if(t.isFloat16BufferAttribute){if(!n)throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");r=e.HALF_FLOAT}else r=e.UNSIGNED_SHORT;else if(a instanceof Int16Array)r=e.SHORT;else if(a instanceof Uint32Array)r=e.UNSIGNED_INT;else if(a instanceof Int32Array)r=e.INT;else if(a instanceof Int8Array)r=e.BYTE;else if(a instanceof Uint8Array)r=e.UNSIGNED_BYTE;else{if(!(a instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+a);r=e.UNSIGNED_BYTE}return{buffer:s,type:r,bytesPerElement:a.BYTES_PER_ELEMENT,version:t.version}}(t,r)):o.version<t.version&&(function(t,i,r){var a=i.array,o=i.updateRange;e.bindBuffer(r,t),-1===o.count?e.bufferSubData(r,0,a):(n?e.bufferSubData(r,o.offset*a.BYTES_PER_ELEMENT,a,o.offset,o.count):e.bufferSubData(r,o.offset*a.BYTES_PER_ELEMENT,a.subarray(o.offset,o.offset+o.count)),o.count=-1),i.onUploadCallback()}(o.buffer,t,r),o.version=t.version)}}}}var Ri=e("bf",function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;a(this,n),(e=t.call(this)).type="PlaneGeometry",e.parameters={width:i,height:r,widthSegments:o,heightSegments:s};for(var l=i/2,u=r/2,c=Math.floor(o),h=Math.floor(s),d=c+1,f=h+1,p=i/c,v=r/h,m=[],g=[],y=[],_=[],x=0;x<f;x++)for(var M=x*v-u,S=0;S<d;S++){var b=S*p-l;g.push(b,-M,0),y.push(0,0,1),_.push(S/c),_.push(1-x/h)}for(var E=0;E<h;E++)for(var T=0;T<c;T++){var w=T+d*E,A=T+d*(E+1),R=T+1+d*(E+1),C=T+1+d*E;m.push(w,A,C),m.push(A,R,C)}return e.setIndex(m),e.setAttribute("position",new In(g,3)),e.setAttribute("normal",new In(y,3)),e.setAttribute("uv",new In(_,2)),e}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}}],[{key:"fromJSON",value:function(e){return new n(e.width,e.height,e.widthSegments,e.heightSegments)}}]),n}(Vn)),Ci={alphahash_fragment:"#ifdef USE_ALPHAHASH\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n\tconst float ALPHA_HASH_SCALE = 0.05;\n\tfloat hash2D( vec2 value ) {\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n\t}\n\tfloat hash3D( vec3 value ) {\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\n\t}\n\tfloat getAlphaHashThreshold( vec3 position ) {\n\t\tfloat maxDeriv = max(\n\t\t\tlength( dFdx( position.xyz ) ),\n\t\t\tlength( dFdy( position.xyz ) )\n\t\t);\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n\t\tvec2 pixScales = vec2(\n\t\t\texp2( floor( log2( pixScale ) ) ),\n\t\t\texp2( ceil( log2( pixScale ) ) )\n\t\t);\n\t\tvec2 alpha = vec2(\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\n\t\t);\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\n\t\tvec3 cases = vec3(\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n\t\t);\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\n\t\t\t: cases.z;\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\n\t}\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\tif ( diffuseColor.a < alphaTest ) discard;\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn 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\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.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\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\treturn vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = dFdx( surf_pos.xyz );\n\t\tvec3 vSigmaY = dFdy( surf_pos.xyz );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\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\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n\treturn dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_v0 0.339\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_v1 0.276\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_v4 0.046\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_v5 0.016\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_v6 0.0038\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"vec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn 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\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform 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\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( LEGACY_LIGHTS )\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#else\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_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\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\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\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tanisotropyV /= material.anisotropy;\n\tmaterial.anisotropy = saturate( material.anisotropy );\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x - tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x + tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = 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\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat 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\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn 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\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn 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\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn 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\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometry.viewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometry.normal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometry.viewDir, geometry.normal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, vMapUv );\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform ivec2 morphTargetsTextureSize;\n\t\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform 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\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec2 packDepthToRG( in highp float v ) {\n\treturn packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n\treturn unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn 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\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#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\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tuniform int boneTextureSize;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tfloat j = i * 4.0;\n\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\ty = dy * ( y + 0.5 );\n\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\treturn bone;\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_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\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( 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\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",depth_vert:"#include <common>\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\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform 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\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\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\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\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 <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#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\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#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\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\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\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying 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\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\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\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\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 <envmap_common_pars_fragment>\n#include <envmap_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\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\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\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - 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\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\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\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - 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\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\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\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\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\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#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 <packing>\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 <envmap_common_pars_fragment>\n#include <envmap_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\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\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\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\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\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\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\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\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\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#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\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#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\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\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\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\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\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_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\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#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\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}"},Li={common:{diffuse:{value:new En(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new ke},alphaMap:{value:null},alphaMapTransform:{value:new ke},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new ke}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new ke}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new ke}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new ke},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new ke},normalScale:{value:new Pe(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new ke},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new ke}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new ke}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new ke}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new En(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},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 En(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new ke},alphaTest:{value:0},uvTransform:{value:new ke}},sprite:{diffuse:{value:new En(16777215)},opacity:{value:1},center:{value:new Pe(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new ke},alphaMap:{value:null},alphaMapTransform:{value:new ke},alphaTest:{value:0}}},Pi={basic:{uniforms:ci([Li.common,Li.specularmap,Li.envmap,Li.aomap,Li.lightmap,Li.fog]),vertexShader:Ci.meshbasic_vert,fragmentShader:Ci.meshbasic_frag},lambert:{uniforms:ci([Li.common,Li.specularmap,Li.envmap,Li.aomap,Li.lightmap,Li.emissivemap,Li.bumpmap,Li.normalmap,Li.displacementmap,Li.fog,Li.lights,{emissive:{value:new En(0)}}]),vertexShader:Ci.meshlambert_vert,fragmentShader:Ci.meshlambert_frag},phong:{uniforms:ci([Li.common,Li.specularmap,Li.envmap,Li.aomap,Li.lightmap,Li.emissivemap,Li.bumpmap,Li.normalmap,Li.displacementmap,Li.fog,Li.lights,{emissive:{value:new En(0)},specular:{value:new En(1118481)},shininess:{value:30}}]),vertexShader:Ci.meshphong_vert,fragmentShader:Ci.meshphong_frag},standard:{uniforms:ci([Li.common,Li.envmap,Li.aomap,Li.lightmap,Li.emissivemap,Li.bumpmap,Li.normalmap,Li.displacementmap,Li.roughnessmap,Li.metalnessmap,Li.fog,Li.lights,{emissive:{value:new En(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ci.meshphysical_vert,fragmentShader:Ci.meshphysical_frag},toon:{uniforms:ci([Li.common,Li.aomap,Li.lightmap,Li.emissivemap,Li.bumpmap,Li.normalmap,Li.displacementmap,Li.gradientmap,Li.fog,Li.lights,{emissive:{value:new En(0)}}]),vertexShader:Ci.meshtoon_vert,fragmentShader:Ci.meshtoon_frag},matcap:{uniforms:ci([Li.common,Li.bumpmap,Li.normalmap,Li.displacementmap,Li.fog,{matcap:{value:null}}]),vertexShader:Ci.meshmatcap_vert,fragmentShader:Ci.meshmatcap_frag},points:{uniforms:ci([Li.points,Li.fog]),vertexShader:Ci.points_vert,fragmentShader:Ci.points_frag},dashed:{uniforms:ci([Li.common,Li.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ci.linedashed_vert,fragmentShader:Ci.linedashed_frag},depth:{uniforms:ci([Li.common,Li.displacementmap]),vertexShader:Ci.depth_vert,fragmentShader:Ci.depth_frag},normal:{uniforms:ci([Li.common,Li.bumpmap,Li.normalmap,Li.displacementmap,{opacity:{value:1}}]),vertexShader:Ci.meshnormal_vert,fragmentShader:Ci.meshnormal_frag},sprite:{uniforms:ci([Li.sprite,Li.fog]),vertexShader:Ci.sprite_vert,fragmentShader:Ci.sprite_frag},background:{uniforms:{uvTransform:{value:new ke},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Ci.background_vert,fragmentShader:Ci.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:Ci.backgroundCube_vert,fragmentShader:Ci.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ci.cube_vert,fragmentShader:Ci.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ci.equirect_vert,fragmentShader:Ci.equirect_frag},distanceRGBA:{uniforms:ci([Li.common,Li.displacementmap,{referencePosition:{value:new it},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ci.distanceRGBA_vert,fragmentShader:Ci.distanceRGBA_frag},shadow:{uniforms:ci([Li.lights,Li.fog,{color:{value:new En(0)},opacity:{value:1}}]),vertexShader:Ci.shadow_vert,fragmentShader:Ci.shadow_frag}};Pi.physical={uniforms:ci([Pi.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new ke},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new ke},clearcoatNormalScale:{value:new Pe(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new ke},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new ke},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new ke},sheen:{value:0},sheenColor:{value:new En(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new ke},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new ke},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new ke},transmissionSamplerSize:{value:new Pe},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new ke},attenuationDistance:{value:0},attenuationColor:{value:new En(0)},specularColor:{value:new En(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new ke},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new ke},anisotropyVector:{value:new Pe},anisotropyMap:{value:null},anisotropyMapTransform:{value:new ke}}]),vertexShader:Ci.meshphysical_vert,fragmentShader:Ci.meshphysical_frag};var ki={r:0,b:0,g:0};function Ui(e,t,n,i,r,a,o){var s,l,u=new En(0),c=!0===a?0:1,h=null,d=0,f=null;function p(t,n){t.getRGB(ki,hi(e)),i.buffers.color.setClear(ki.r,ki.g,ki.b,n,o)}return{getClearColor:function(){return u},setClearColor:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;u.set(e),p(u,c=t)},getClearAlpha:function(){return c},setClearAlpha:function(e){p(u,c=e)},render:function(a,v){var m=!1,g=!0===v.isScene?v.background:null;switch(g&&g.isTexture&&(g=(v.backgroundBlurriness>0?n:t).get(g)),null===g?p(u,c):g&&g.isColor&&(p(g,1),m=!0),e.xr.getEnvironmentBlendMode()){case"opaque":m=!0;break;case"additive":i.buffers.color.setClear(0,0,0,1,o),m=!0;break;case"alpha-blend":i.buffers.color.setClear(0,0,0,0,o),m=!0}(e.autoClear||m)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),g&&(g.isCubeTexture||306===g.mapping)?(void 0===l&&((l=new oi(new li(1,1,1),new fi({name:"BackgroundCubeMaterial",uniforms:ui(Pi.backgroundCube.uniforms),vertexShader:Pi.backgroundCube.vertexShader,fragmentShader:Pi.backgroundCube.fragmentShader,side:k,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(l)),l.material.uniforms.envMap.value=g,l.material.uniforms.flipEnvMap.value=g.isCubeTexture&&!1===g.isRenderTargetTexture?-1:1,l.material.uniforms.backgroundBlurriness.value=v.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,l.material.toneMapped=g.colorSpace!==ve,h===g&&d===g.version&&f===e.toneMapping||(l.material.needsUpdate=!0,h=g,d=g.version,f=e.toneMapping),l.layers.enableAll(),a.unshift(l,l.geometry,l.material,0,0,null)):g&&g.isTexture&&(void 0===s&&((s=new oi(new Ri(2,2),new fi({name:"BackgroundMaterial",uniforms:ui(Pi.background.uniforms),vertexShader:Pi.background.vertexShader,fragmentShader:Pi.background.fragmentShader,side:P,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(s.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(s)),s.material.uniforms.t2D.value=g,s.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,s.material.toneMapped=g.colorSpace!==ve,!0===g.matrixAutoUpdate&&g.updateMatrix(),s.material.uniforms.uvTransform.value.copy(g.matrix),h===g&&d===g.version&&f===e.toneMapping||(s.material.needsUpdate=!0,h=g,d=g.version,f=e.toneMapping),s.layers.enableAll(),a.unshift(s,s.geometry,s.material,0,0,null))}}}function Ii(e,t,n,i){var r=e.getParameter(e.MAX_VERTEX_ATTRIBS),a=i.isWebGL2?null:t.get("OES_vertex_array_object"),o=i.isWebGL2||null!==a,s={},l=f(null),u=l,c=!1;function h(t){return i.isWebGL2?e.bindVertexArray(t):a.bindVertexArrayOES(t)}function d(t){return i.isWebGL2?e.deleteVertexArray(t):a.deleteVertexArrayOES(t)}function f(e){for(var t=[],n=[],i=[],a=0;a<r;a++)t[a]=0,n[a]=0,i[a]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:n,attributeDivisors:i,object:e,attributes:{},index:null}}function p(){for(var e=u.newAttributes,t=0,n=e.length;t<n;t++)e[t]=0}function v(e){m(e,0)}function m(n,r){var a=u.newAttributes,o=u.enabledAttributes,s=u.attributeDivisors;a[n]=1,0===o[n]&&(e.enableVertexAttribArray(n),o[n]=1),s[n]!==r&&((i.isWebGL2?e:t.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](n,r),s[n]=r)}function g(){for(var t=u.newAttributes,n=u.enabledAttributes,i=0,r=n.length;i<r;i++)n[i]!==t[i]&&(e.disableVertexAttribArray(i),n[i]=0)}function y(t,n,i,r,a,o,s){!0===s?e.vertexAttribIPointer(t,n,i,a,o):e.vertexAttribPointer(t,n,i,r,a,o)}function _(){x(),c=!0,u!==l&&h((u=l).object)}function x(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:function(r,l,d,_,x){var M=!1;if(o){var S=function(t,n,r){var o=!0===r.wireframe,l=s[t.id];void 0===l&&(l={},s[t.id]=l);var u=l[n.id];void 0===u&&(u={},l[n.id]=u);var c=u[o];return void 0===c&&(c=f(i.isWebGL2?e.createVertexArray():a.createVertexArrayOES()),u[o]=c),c}(_,d,l);u!==S&&h((u=S).object),(M=function(e,t,n,i){var r=u.attributes,a=t.attributes,o=0,s=n.getAttributes();for(var l in s)if(s[l].location>=0){var c=r[l],h=a[l];if(void 0===h&&("instanceMatrix"===l&&e.instanceMatrix&&(h=e.instanceMatrix),"instanceColor"===l&&e.instanceColor&&(h=e.instanceColor)),void 0===c)return!0;if(c.attribute!==h)return!0;if(h&&c.data!==h.data)return!0;o++}return u.attributesNum!==o||u.index!==i}(r,_,d,x))&&function(e,t,n,i){var r={},a=t.attributes,o=0,s=n.getAttributes();for(var l in s)if(s[l].location>=0){var c=a[l];void 0===c&&("instanceMatrix"===l&&e.instanceMatrix&&(c=e.instanceMatrix),"instanceColor"===l&&e.instanceColor&&(c=e.instanceColor));var h={};h.attribute=c,c&&c.data&&(h.data=c.data),r[l]=h,o++}u.attributes=r,u.attributesNum=o,u.index=i}(r,_,d,x)}else{var b=!0===l.wireframe;u.geometry===_.id&&u.program===d.id&&u.wireframe===b||(u.geometry=_.id,u.program=d.id,u.wireframe=b,M=!0)}null!==x&&n.update(x,e.ELEMENT_ARRAY_BUFFER),(M||c)&&(c=!1,function(r,a,o,s){if(!1!==i.isWebGL2||!r.isInstancedMesh&&!s.isInstancedBufferGeometry||null!==t.get("ANGLE_instanced_arrays")){p();var l=s.attributes,u=o.getAttributes(),c=a.defaultAttributeValues;for(var h in u){var d=u[h];if(d.location>=0){var f=l[h];if(void 0===f&&("instanceMatrix"===h&&r.instanceMatrix&&(f=r.instanceMatrix),"instanceColor"===h&&r.instanceColor&&(f=r.instanceColor)),void 0!==f){var _=f.normalized,x=f.itemSize,M=n.get(f);if(void 0===M)continue;var S=M.buffer,b=M.type,E=M.bytesPerElement,T=!0===i.isWebGL2&&(b===e.INT||b===e.UNSIGNED_INT||1013===f.gpuType);if(f.isInterleavedBufferAttribute){var w=f.data,A=w.stride,R=f.offset;if(w.isInstancedInterleavedBuffer){for(var C=0;C<d.locationSize;C++)m(d.location+C,w.meshPerAttribute);!0!==r.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=w.meshPerAttribute*w.count)}else for(var L=0;L<d.locationSize;L++)v(d.location+L);e.bindBuffer(e.ARRAY_BUFFER,S);for(var P=0;P<d.locationSize;P++)y(d.location+P,x/d.locationSize,b,_,A*E,(R+x/d.locationSize*P)*E,T)}else{if(f.isInstancedBufferAttribute){for(var k=0;k<d.locationSize;k++)m(d.location+k,f.meshPerAttribute);!0!==r.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=f.meshPerAttribute*f.count)}else for(var U=0;U<d.locationSize;U++)v(d.location+U);e.bindBuffer(e.ARRAY_BUFFER,S);for(var I=0;I<d.locationSize;I++)y(d.location+I,x/d.locationSize,b,_,x*E,x/d.locationSize*I*E,T)}}else if(void 0!==c){var N=c[h];if(void 0!==N)switch(N.length){case 2:e.vertexAttrib2fv(d.location,N);break;case 3:e.vertexAttrib3fv(d.location,N);break;case 4:e.vertexAttrib4fv(d.location,N);break;default:e.vertexAttrib1fv(d.location,N)}}}}g()}}(r,l,d,_),null!==x&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.get(x).buffer))},reset:_,resetDefaultState:x,dispose:function(){for(var e in _(),s){var t=s[e];for(var n in t){var i=t[n];for(var r in i)d(i[r].object),delete i[r];delete t[n]}delete s[e]}},releaseStatesOfGeometry:function(e){if(void 0!==s[e.id]){var t=s[e.id];for(var n in t){var i=t[n];for(var r in i)d(i[r].object),delete i[r];delete t[n]}delete s[e.id]}},releaseStatesOfProgram:function(e){for(var t in s){var n=s[t];if(void 0!==n[e.id]){var i=n[e.id];for(var r in i)d(i[r].object),delete i[r];delete n[e.id]}}},initAttributes:p,enableAttribute:v,disableUnusedAttributes:g}}function Ni(e,t,n,i){var r,a=i.isWebGL2;this.setMode=function(e){r=e},this.render=function(t,i){e.drawArrays(r,t,i),n.update(i,r,1)},this.renderInstances=function(i,o,s){if(0!==s){var l,u;if(a)l=e,u="drawArraysInstanced";else if(u="drawArraysInstancedANGLE",null===(l=t.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[u](r,i,o,s),n.update(o,r,s)}}}function Di(e,t,n){var i;function r(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"}var a="undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===e.constructor.name,o=void 0!==n.precision?n.precision:"highp",s=r(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var l=a||t.has("WEBGL_draw_buffers"),u=!0===n.logarithmicDepthBuffer,c=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),d=e.getParameter(e.MAX_TEXTURE_SIZE),f=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),p=e.getParameter(e.MAX_VERTEX_ATTRIBS),v=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),m=e.getParameter(e.MAX_VARYING_VECTORS),g=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),y=h>0,_=a||t.has("OES_texture_float");return{isWebGL2:a,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==i)return i;if(!0===t.has("EXT_texture_filter_anisotropic")){var n=t.get("EXT_texture_filter_anisotropic");i=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i},getMaxPrecision:r,precision:o,logarithmicDepthBuffer:u,maxTextures:c,maxVertexTextures:h,maxTextureSize:d,maxCubemapSize:f,maxAttributes:p,maxVertexUniforms:v,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:y,floatFragmentTextures:_,floatVertexTextures:y&&_,maxSamples:a?e.getParameter(e.MAX_SAMPLES):0}}function Oi(e){var t=this,n=null,i=0,r=!1,a=!1,o=new Si,s=new ke,l={value:null,needsUpdate:!1};function u(e,n,i,r){var a=null!==e?e.length:0,u=null;if(0!==a){if(u=l.value,!0!==r||null===u){var c=i+4*a,h=n.matrixWorldInverse;s.getNormalMatrix(h),(null===u||u.length<c)&&(u=new Float32Array(c));for(var d=0,f=i;d!==a;++d,f+=4)o.copy(e[d]).applyMatrix4(h,s),o.normal.toArray(u,f),u[f+3]=o.constant}l.value=u,l.needsUpdate=!0}return t.numPlanes=a,t.numIntersection=0,u}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){var n=0!==e.length||t||0!==i||r;return r=t,i=e.length,n},this.beginShadows=function(){a=!0,u(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(e,t){n=u(e,t,0)},this.setState=function(o,s,c){var h=o.clippingPlanes,d=o.clipIntersection,f=o.clipShadows,p=e.get(o);if(!r||null===h||0===h.length||a&&!f)a?u(null):(l.value!==n&&(l.value=n,l.needsUpdate=i>0),t.numPlanes=i,t.numIntersection=0);else{var v=a?0:i,m=4*v,g=p.clippingState||null;l.value=g,g=u(h,s,m,c);for(var y=0;y!==m;++y)g[y]=n[y];p.clippingState=g,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=v}}}function Fi(e){var t=new WeakMap;function n(e,t){return t===q?e.mapping=301:304===t&&(e.mapping=302),e}function i(e){var n=e.target;n.removeEventListener("dispose",i);var r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture&&!1===r.isRenderTargetTexture){var a=r.mapping;if(a===q||304===a){if(t.has(r))return n(t.get(r).texture,r.mapping);var o=r.image;if(o&&o.height>0){var s=new yi(o.height/2);return s.fromEquirectangularTexture(e,r),t.set(r,s),r.addEventListener("dispose",i),n(s.texture,r.mapping)}return null}}return r},dispose:function(){t=new WeakMap}}}var zi=e("Y",function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.1,u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2e3;return a(this,n),(e=t.call(this)).isOrthographicCamera=!0,e.type="OrthographicCamera",e.zoom=1,e.view=null,e.left=i,e.right=r,e.top=o,e.bottom=s,e.near=l,e.far=u,e.updateProjectionMatrix(),e}return s(n,[{key:"copy",value:function(e,t){return _(c(n.prototype),"copy",this).call(this,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}},{key:"setViewOffset",value:function(e,t,n,i,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=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}},{key:"clearViewOffset",value:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}},{key:"updateProjectionMatrix",value:function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2,r=n-e,a=n+e,o=i+t,s=i-t;if(null!==this.view&&this.view.enabled){var l=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;a=(r+=l*this.view.offsetX)+l*this.view.width,s=(o-=u*this.view.offsetY)-u*this.view.height}this.projectionMatrix.makeOrthographic(r,a,o,s,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}},{key:"toJSON",value:function(e){var t=_(c(n.prototype),"toJSON",this).call(this,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}}]),n}(pi)),Bi=[.125,.215,.35,.446,.526,.582],Hi=new zi,Vi=new En,Gi=null,Wi=(1+Math.sqrt(5))/2,Xi=1/Wi,ji=[new it(1,1,1),new it(-1,1,1),new it(1,1,-1),new it(-1,1,-1),new it(0,Wi,Xi),new it(0,Wi,-Xi),new it(Xi,0,Wi),new it(-Xi,0,Wi),new it(Wi,Xi,0),new it(-Wi,Xi,0)],Yi=e("bT",function(){function e(t){a(this,e),this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}return s(e,[{key:"fromScene",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100;Gi=this._renderer.getRenderTarget(),this._setSize(256);var r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,n,i,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}},{key:"fromEquirectangular",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(e,t)}},{key:"fromCubemap",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(e,t)}},{key:"compileCubemapShader",value:function(){null===this._cubemapMaterial&&(this._cubemapMaterial=Ki(),this._compileMaterial(this._cubemapMaterial))}},{key:"compileEquirectangularShader",value:function(){null===this._equirectMaterial&&(this._equirectMaterial=Ji(),this._compileMaterial(this._equirectMaterial))}},{key:"dispose",value:function(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}},{key:"_setSize",value:function(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}},{key:"_dispose",value:function(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(var e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}},{key:"_cleanup",value:function(e){this._renderer.setRenderTarget(Gi),e.scissorTest=!1,Zi(e,0,0,e.width,e.height)}},{key:"_fromTexture",value:function(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),Gi=this._renderer.getRenderTarget();var n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}},{key:"_allocateTargets",value:function(){var e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:te,minFilter:te,generateMipmaps:!1,type:ae,format:se,colorSpace:me,depthBuffer:!1},i=qi(e,t,n);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=qi(e,t,n);var r=this._lodMax,a=function(e){for(var t=[],n=[],i=[],r=e,a=e-4+1+Bi.length,o=0;o<a;o++){var s=Math.pow(2,r);n.push(s);var l=1/s;o>e-4?l=Bi[o-e+4-1]:0===o&&(l=0),i.push(l);for(var u=1/(s-2),c=-u,h=1+u,d=[c,c,h,c,h,h,c,c,h,h,c,h],f=new Float32Array(108),p=new Float32Array(72),v=new Float32Array(36),m=0;m<6;m++){var g=m%3*2/3-1,y=m>2?0:-1,_=[g,y,0,g+2/3,y,0,g+2/3,y+1,0,g,y,0,g+2/3,y+1,0,g,y+1,0];f.set(_,18*m),p.set(d,12*m);var x=[m,m,m,m,m,m];v.set(x,6*m)}var M=new Vn;M.setAttribute("position",new Pn(f,3)),M.setAttribute("uv",new Pn(p,2)),M.setAttribute("faceIndex",new Pn(v,1)),t.push(M),r>4&&r--}return{lodPlanes:t,sizeLods:n,sigmas:i}}(r);this._sizeLods=a.sizeLods,this._lodPlanes=a.lodPlanes,this._sigmas=a.sigmas,this._blurMaterial=function(e,t,n){var i=new Float32Array(20),r=new it(0,1,0);return new fi({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:"".concat(e,".0")},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:I,depthTest:!1,depthWrite:!1})}(r,e,t)}return i}},{key:"_compileMaterial",value:function(e){var t=new oi(this._lodPlanes[0],e);this._renderer.compile(t,Hi)}},{key:"_sceneToCubeUV",value:function(e,t,n,i){var r=new vi(90,1,t,n),a=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],s=this._renderer,l=s.autoClear,u=s.toneMapping;s.getClearColor(Vi),s.toneMapping=G,s.autoClear=!1;var c=new wn({name:"PMREM.Background",side:k,depthWrite:!1,depthTest:!1}),h=new oi(new li,c),d=!1,f=e.background;f?f.isColor&&(c.color.copy(f),e.background=null,d=!0):(c.color.copy(Vi),d=!0);for(var p=0;p<6;p++){var v=p%3;0===v?(r.up.set(0,a[p],0),r.lookAt(o[p],0,0)):1===v?(r.up.set(0,0,a[p]),r.lookAt(0,o[p],0)):(r.up.set(0,a[p],0),r.lookAt(0,0,o[p]));var m=this._cubeSize;Zi(i,v*m,p>2?m:0,m,m),s.setRenderTarget(i),d&&s.render(h,r),s.render(e,r)}h.geometry.dispose(),h.material.dispose(),s.toneMapping=u,s.autoClear=l,e.background=f}},{key:"_textureToCubeUV",value:function(e,t){var n=this._renderer,i=301===e.mapping||302===e.mapping;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=Ki()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=Ji());var r=i?this._cubemapMaterial:this._equirectMaterial,a=new oi(this._lodPlanes[0],r);r.uniforms.envMap.value=e;var o=this._cubeSize;Zi(t,0,0,3*o,2*o),n.setRenderTarget(t),n.render(a,Hi)}},{key:"_applyPMREM",value:function(e){var t=this._renderer,n=t.autoClear;t.autoClear=!1;for(var i=1;i<this._lodPlanes.length;i++){var r=Math.sqrt(this._sigmas[i]*this._sigmas[i]-this._sigmas[i-1]*this._sigmas[i-1]),a=ji[(i-1)%ji.length];this._blur(e,i-1,i,r,a)}t.autoClear=n}},{key:"_blur",value:function(e,t,n,i,r){var a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,i,"latitudinal",r),this._halfBlur(a,e,n,n,i,"longitudinal",r)}},{key:"_halfBlur",value:function(e,t,n,i,r,a,o){var s=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");var u=new oi(this._lodPlanes[i],l),c=l.uniforms,h=this._sizeLods[n]-1,d=isFinite(r)?Math.PI/(2*h):2*Math.PI/39,f=r/d,p=isFinite(r)?1+Math.floor(3*f):20;p>20&&console.warn("sigmaRadians, ".concat(r,", is too large and will clip, as it requested ").concat(p," samples when the maximum is set to ").concat(20));for(var v=[],m=0,g=0;g<20;++g){var y=g/f,_=Math.exp(-y*y/2);v.push(_),0===g?m+=_:g<p&&(m+=2*_)}for(var x=0;x<v.length;x++)v[x]=v[x]/m;c.envMap.value=e.texture,c.samples.value=p,c.weights.value=v,c.latitudinal.value="latitudinal"===a,o&&(c.poleAxis.value=o);var M=this._lodMax;c.dTheta.value=d,c.mipInt.value=M-n;var S=this._sizeLods[i];Zi(t,3*S*(i>M-4?i-M+4:0),4*(this._cubeSize-S),3*S,2*S),s.setRenderTarget(t),s.render(u,Hi)}}]),e}());function qi(e,t,n){var i=new $e(e,t,n);return i.texture.mapping=306,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Zi(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function Ji(){return new fi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:I,depthTest:!1,depthWrite:!1})}function Ki(){return new fi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:I,depthTest:!1,depthWrite:!1})}function Qi(e){var t=new WeakMap,n=null;function i(e){var n=e.target;n.removeEventListener("dispose",i);var r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){var a=r.mapping,o=a===q||304===a,s=301===a||302===a;if(o||s){if(r.isRenderTargetTexture&&!0===r.needsPMREMUpdate){r.needsPMREMUpdate=!1;var l=t.get(r);return null===n&&(n=new Yi(e)),l=o?n.fromEquirectangular(r,l):n.fromCubemap(r,l),t.set(r,l),l.texture}if(t.has(r))return t.get(r).texture;var u=r.image;if(o&&u&&u.height>0||s&&u&&function(e){for(var t=0,n=0;n<6;n++)void 0!==e[n]&&t++;return 6===t}(u)){null===n&&(n=new Yi(e));var c=o?n.fromEquirectangular(r):n.fromCubemap(r);return t.set(r,c),r.addEventListener("dispose",i),c.texture}return null}}return r},dispose:function(){t=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function $i(e){var t={};function n(n){if(void 0!==t[n])return t[n];var i;switch(n){case"WEBGL_depth_texture":i=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=e.getExtension(n)}return t[n]=i,i}return{has:function(e){return null!==n(e)},init:function(e){e.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture")},get:function(e){var t=n(e);return null===t&&console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function er(e,t,n,i){var r={},a=new WeakMap;function o(e){var s=e.target;for(var l in null!==s.index&&t.remove(s.index),s.attributes)t.remove(s.attributes[l]);for(var u in s.morphAttributes)for(var c=s.morphAttributes[u],h=0,d=c.length;h<d;h++)t.remove(c[h]);s.removeEventListener("dispose",o),delete r[s.id];var f=a.get(s);f&&(t.remove(f),a.delete(s)),i.releaseStatesOfGeometry(s),!0===s.isInstancedBufferGeometry&&delete s._maxInstanceCount,n.memory.geometries--}function s(e){var n=[],i=e.index,r=e.attributes.position,o=0;if(null!==i){var s=i.array;o=i.version;for(var l=0,u=s.length;l<u;l+=3){var c=s[l+0],h=s[l+1],d=s[l+2];n.push(c,h,h,d,d,c)}}else{if(void 0===r)return;var f=r.array;o=r.version;for(var p=0,v=f.length/3-1;p<v;p+=3){var m=p+0,g=p+1,y=p+2;n.push(m,g,g,y,y,m)}}var _=new(Ie(n)?Un:kn)(n,1);_.version=o;var x=a.get(e);x&&t.remove(x),a.set(e,_)}return{get:function(e,t){return!0===r[t.id]||(t.addEventListener("dispose",o),r[t.id]=!0,n.memory.geometries++),t},update:function(n){var i=n.attributes;for(var r in i)t.update(i[r],e.ARRAY_BUFFER);var a=n.morphAttributes;for(var o in a)for(var s=a[o],l=0,u=s.length;l<u;l++)t.update(s[l],e.ARRAY_BUFFER)},getWireframeAttribute:function(e){var t=a.get(e);if(t){var n=e.index;null!==n&&t.version<n.version&&s(e)}else s(e);return a.get(e)}}}function tr(e,t,n,i){var r,a,o,s=i.isWebGL2;this.setMode=function(e){r=e},this.setIndex=function(e){a=e.type,o=e.bytesPerElement},this.render=function(t,i){e.drawElements(r,i,a,t*o),n.update(i,r,1)},this.renderInstances=function(i,l,u){if(0!==u){var c,h;if(s)c=e,h="drawElementsInstanced";else if(h="drawElementsInstancedANGLE",null===(c=t.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");c[h](r,l,a,i*o,u),n.update(l,r,u)}}}function nr(e){var 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(n,i,r){switch(t.calls++,i){case e.TRIANGLES:t.triangles+=r*(n/3);break;case e.LINES:t.lines+=r*(n/2);break;case e.LINE_STRIP:t.lines+=r*(n-1);break;case e.LINE_LOOP:t.lines+=r*n;break;case e.POINTS:t.points+=r*n;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",i)}}}}function ir(e,t){return e[0]-t[0]}function rr(e,t){return Math.abs(t[1])-Math.abs(e[1])}function ar(e,t,n){for(var i={},r=new Float32Array(8),a=new WeakMap,o=new Qe,s=[],l=0;l<8;l++)s[l]=[l,0];return{update:function(l,u,c){var h=l.morphTargetInfluences;if(!0===t.isWebGL2){var d=u.morphAttributes.position||u.morphAttributes.normal||u.morphAttributes.color,f=void 0!==d?d.length:0,p=a.get(u);if(void 0===p||p.count!==f){void 0!==p&&p.texture.dispose();var v=void 0!==u.morphAttributes.position,m=void 0!==u.morphAttributes.normal,g=void 0!==u.morphAttributes.color,y=u.morphAttributes.position||[],_=u.morphAttributes.normal||[],x=u.morphAttributes.color||[],M=0;!0===v&&(M=1),!0===m&&(M=2),!0===g&&(M=3);var S=u.attributes.position.count*M,b=1;S>t.maxTextureSize&&(b=Math.ceil(S/t.maxTextureSize),S=t.maxTextureSize);var E=new Float32Array(S*b*4*f),T=new et(E,S,b,f);T.type=re,T.needsUpdate=!0;for(var w=4*M,A=0;A<f;A++)for(var R=y[A],C=_[A],L=x[A],P=S*b*4*A,k=0;k<R.count;k++){var U=k*w;!0===v&&(o.fromBufferAttribute(R,k),E[P+U+0]=o.x,E[P+U+1]=o.y,E[P+U+2]=o.z,E[P+U+3]=0),!0===m&&(o.fromBufferAttribute(C,k),E[P+U+4]=o.x,E[P+U+5]=o.y,E[P+U+6]=o.z,E[P+U+7]=0),!0===g&&(o.fromBufferAttribute(L,k),E[P+U+8]=o.x,E[P+U+9]=o.y,E[P+U+10]=o.z,E[P+U+11]=4===L.itemSize?o.w:1)}p={count:f,texture:T,size:new Pe(S,b)},a.set(u,p),u.addEventListener("dispose",(function e(){T.dispose(),a.delete(u),u.removeEventListener("dispose",e)}))}for(var I=0,N=0;N<h.length;N++)I+=h[N];var D=u.morphTargetsRelative?1:1-I;c.getUniforms().setValue(e,"morphTargetBaseInfluence",D),c.getUniforms().setValue(e,"morphTargetInfluences",h),c.getUniforms().setValue(e,"morphTargetsTexture",p.texture,n),c.getUniforms().setValue(e,"morphTargetsTextureSize",p.size)}else{var O=void 0===h?0:h.length,F=i[u.id];if(void 0===F||F.length!==O){F=[];for(var z=0;z<O;z++)F[z]=[z,0];i[u.id]=F}for(var B=0;B<O;B++){var H=F[B];H[0]=B,H[1]=h[B]}F.sort(rr);for(var V=0;V<8;V++)V<O&&F[V][1]?(s[V][0]=F[V][0],s[V][1]=F[V][1]):(s[V][0]=Number.MAX_SAFE_INTEGER,s[V][1]=0);s.sort(ir);for(var G=u.morphAttributes.position,W=u.morphAttributes.normal,X=0,j=0;j<8;j++){var Y=s[j],q=Y[0],Z=Y[1];q!==Number.MAX_SAFE_INTEGER&&Z?(G&&u.getAttribute("morphTarget"+j)!==G[q]&&u.setAttribute("morphTarget"+j,G[q]),W&&u.getAttribute("morphNormal"+j)!==W[q]&&u.setAttribute("morphNormal"+j,W[q]),r[j]=Z,X+=Z):(G&&!0===u.hasAttribute("morphTarget"+j)&&u.deleteAttribute("morphTarget"+j),W&&!0===u.hasAttribute("morphNormal"+j)&&u.deleteAttribute("morphNormal"+j),r[j]=0)}var J=u.morphTargetsRelative?1:1-X;c.getUniforms().setValue(e,"morphTargetBaseInfluence",J),c.getUniforms().setValue(e,"morphTargetInfluences",r)}}}}function or(e,t,n,i){var r=new WeakMap;function a(e){var t=e.target;t.removeEventListener("dispose",a),n.remove(t.instanceMatrix),null!==t.instanceColor&&n.remove(t.instanceColor)}return{update:function(o){var s=i.render.frame,l=o.geometry,u=t.get(o,l);if(r.get(u)!==s&&(t.update(u),r.set(u,s)),o.isInstancedMesh&&(!1===o.hasEventListener("dispose",a)&&o.addEventListener("dispose",a),r.get(o)!==s&&(n.update(o.instanceMatrix,e.ARRAY_BUFFER),null!==o.instanceColor&&n.update(o.instanceColor,e.ARRAY_BUFFER),r.set(o,s))),o.isSkinnedMesh){var c=o.skeleton;r.get(c)!==s&&(c.update(),r.set(c,s))}return u},dispose:function(){r=new WeakMap}}}var sr=new Ke,lr=new et,ur=new tt,cr=new gi,hr=[],dr=[],fr=new Float32Array(16),pr=new Float32Array(9),vr=new Float32Array(4);function mr(e,t,n){var i=e[0];if(i<=0||i>0)return e;var r=t*n,a=hr[r];if(void 0===a&&(a=new Float32Array(r),hr[r]=a),0!==t){i.toArray(a,0);for(var o=1,s=0;o!==t;++o)s+=n,e[o].toArray(a,s)}return a}function gr(e,t){if(e.length!==t.length)return!1;for(var n=0,i=e.length;n<i;n++)if(e[n]!==t[n])return!1;return!0}function yr(e,t){for(var n=0,i=t.length;n<i;n++)e[n]=t[n]}function _r(e,t){var n=dr[t];void 0===n&&(n=new Int32Array(t),dr[t]=n);for(var i=0;i!==t;++i)n[i]=e.allocateTextureUnit();return n}function xr(e,t){var n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function Mr(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(gr(n,t))return;e.uniform2fv(this.addr,t),yr(n,t)}}function Sr(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(void 0!==t.r)n[0]===t.r&&n[1]===t.g&&n[2]===t.b||(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if(gr(n,t))return;e.uniform3fv(this.addr,t),yr(n,t)}}function br(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(gr(n,t))return;e.uniform4fv(this.addr,t),yr(n,t)}}function Er(e,t){var n=this.cache,i=t.elements;if(void 0===i){if(gr(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),yr(n,t)}else{if(gr(n,i))return;vr.set(i),e.uniformMatrix2fv(this.addr,!1,vr),yr(n,i)}}function Tr(e,t){var n=this.cache,i=t.elements;if(void 0===i){if(gr(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),yr(n,t)}else{if(gr(n,i))return;pr.set(i),e.uniformMatrix3fv(this.addr,!1,pr),yr(n,i)}}function wr(e,t){var n=this.cache,i=t.elements;if(void 0===i){if(gr(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),yr(n,t)}else{if(gr(n,i))return;fr.set(i),e.uniformMatrix4fv(this.addr,!1,fr),yr(n,i)}}function Ar(e,t){var n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function Rr(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2i(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(gr(n,t))return;e.uniform2iv(this.addr,t),yr(n,t)}}function Cr(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3i(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(gr(n,t))return;e.uniform3iv(this.addr,t),yr(n,t)}}function Lr(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4i(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(gr(n,t))return;e.uniform4iv(this.addr,t),yr(n,t)}}function Pr(e,t){var n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function kr(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2ui(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(gr(n,t))return;e.uniform2uiv(this.addr,t),yr(n,t)}}function Ur(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3ui(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(gr(n,t))return;e.uniform3uiv(this.addr,t),yr(n,t)}}function Ir(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(gr(n,t))return;e.uniform4uiv(this.addr,t),yr(n,t)}}function Nr(e,t,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture2D(t||sr,r)}function Dr(e,t,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(t||ur,r)}function Or(e,t,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTextureCube(t||cr,r)}function Fr(e,t,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(t||lr,r)}function zr(e,t){e.uniform1fv(this.addr,t)}function Br(e,t){var n=mr(t,this.size,2);e.uniform2fv(this.addr,n)}function Hr(e,t){var n=mr(t,this.size,3);e.uniform3fv(this.addr,n)}function Vr(e,t){var n=mr(t,this.size,4);e.uniform4fv(this.addr,n)}function Gr(e,t){var n=mr(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function Wr(e,t){var n=mr(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function Xr(e,t){var n=mr(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function jr(e,t){e.uniform1iv(this.addr,t)}function Yr(e,t){e.uniform2iv(this.addr,t)}function qr(e,t){e.uniform3iv(this.addr,t)}function Zr(e,t){e.uniform4iv(this.addr,t)}function Jr(e,t){e.uniform1uiv(this.addr,t)}function Kr(e,t){e.uniform2uiv(this.addr,t)}function Qr(e,t){e.uniform3uiv(this.addr,t)}function $r(e,t){e.uniform4uiv(this.addr,t)}function ea(e,t,n){var i=this.cache,r=t.length,a=_r(n,r);gr(i,a)||(e.uniform1iv(this.addr,a),yr(i,a));for(var o=0;o!==r;++o)n.setTexture2D(t[o]||sr,a[o])}function ta(e,t,n){var i=this.cache,r=t.length,a=_r(n,r);gr(i,a)||(e.uniform1iv(this.addr,a),yr(i,a));for(var o=0;o!==r;++o)n.setTexture3D(t[o]||ur,a[o])}function na(e,t,n){var i=this.cache,r=t.length,a=_r(n,r);gr(i,a)||(e.uniform1iv(this.addr,a),yr(i,a));for(var o=0;o!==r;++o)n.setTextureCube(t[o]||cr,a[o])}function ia(e,t,n){var i=this.cache,r=t.length,a=_r(n,r);gr(i,a)||(e.uniform1iv(this.addr,a),yr(i,a));for(var o=0;o!==r;++o)n.setTexture2DArray(t[o]||lr,a[o])}var ra=s((function e(t,n,i){a(this,e),this.id=t,this.addr=i,this.cache=[],this.setValue=function(e){switch(e){case 5126:return xr;case 35664:return Mr;case 35665:return Sr;case 35666:return br;case 35674:return Er;case 35675:return Tr;case 35676:return wr;case 5124:case 35670:return Ar;case 35667:case 35671:return Rr;case 35668:case 35672:return Cr;case 35669:case 35673:return Lr;case 5125:return Pr;case 36294:return kr;case 36295:return Ur;case 36296:return Ir;case 35678:case 36198:case 36298:case 36306:case 35682:return Nr;case 35679:case 36299:case 36307:return Dr;case 35680:case 36300:case 36308:case 36293:return Or;case 36289:case 36303:case 36311:case 36292:return Fr}}(n.type)})),aa=s((function e(t,n,i){a(this,e),this.id=t,this.addr=i,this.cache=[],this.size=n.size,this.setValue=function(e){switch(e){case 5126:return zr;case 35664:return Br;case 35665:return Hr;case 35666:return Vr;case 35674:return Gr;case 35675:return Wr;case 35676:return Xr;case 5124:case 35670:return jr;case 35667:case 35671:return Yr;case 35668:case 35672:return qr;case 35669:case 35673:return Zr;case 5125:return Jr;case 36294:return Kr;case 36295:return Qr;case 36296:return $r;case 35678:case 36198:case 36298:case 36306:case 35682:return ea;case 35679:case 36299:case 36307:return ta;case 35680:case 36300:case 36308:case 36293:return na;case 36289:case 36303:case 36311:case 36292:return ia}}(n.type)})),oa=function(){function e(t){a(this,e),this.id=t,this.seq=[],this.map={}}return s(e,[{key:"setValue",value:function(e,t,n){for(var i=this.seq,r=0,a=i.length;r!==a;++r){var o=i[r];o.setValue(e,t[o.id],n)}}}]),e}(),sa=/(\w+)(\])?(\[|\.)?/g;function la(e,t){e.seq.push(t),e.map[t.id]=t}function ua(e,t,n){var i=e.name,r=i.length;for(sa.lastIndex=0;;){var a=sa.exec(i),o=sa.lastIndex,s=a[1],l="]"===a[2],u=a[3];if(l&&(s|=0),void 0===u||"["===u&&o+2===r){la(n,void 0===u?new ra(s,e,t):new aa(s,e,t));break}var c=n.map[s];void 0===c&&la(n,c=new oa(s)),n=c}}var ca=function(){function e(t,n){a(this,e),this.seq=[],this.map={};for(var i=t.getProgramParameter(n,t.ACTIVE_UNIFORMS),r=0;r<i;++r){var o=t.getActiveUniform(n,r);ua(o,t.getUniformLocation(n,o.name),this)}}return s(e,[{key:"setValue",value:function(e,t,n,i){var r=this.map[t];void 0!==r&&r.setValue(e,n,i)}},{key:"setOptional",value:function(e,t,n){var i=t[n];void 0!==i&&this.setValue(e,n,i)}}],[{key:"upload",value:function(e,t,n,i){for(var r=0,a=t.length;r!==a;++r){var o=t[r],s=n[o.id];!1!==s.needsUpdate&&o.setValue(e,s.value,i)}}},{key:"seqWithValue",value:function(e,t){for(var n=[],i=0,r=e.length;i!==r;++i){var a=e[i];a.id in t&&n.push(a)}return n}}]),e}();function ha(e,t,n){var i=e.createShader(t);return e.shaderSource(i,n),e.compileShader(i),i}var da=0;function fa(e,t,n){var i=e.getShaderParameter(t,e.COMPILE_STATUS),r=e.getShaderInfoLog(t).trim();if(i&&""===r)return"";var a=/ERROR: 0:(\d+)/.exec(r);if(a){var o=parseInt(a[1]);return n.toUpperCase()+"\n\n"+r+"\n\n"+function(e,t){for(var n=e.split("\n"),i=[],r=Math.max(t-6,0),a=Math.min(t+6,n.length),o=r;o<a;o++){var s=o+1;i.push("".concat(s===t?">":" "," ").concat(s,": ").concat(n[o]))}return i.join("\n")}(e.getShaderSource(t),o)}return r}function pa(e,t){var n;switch(t){case W:n="Linear";break;case X:n="Reinhard";break;case j:n="OptimizedCineon";break;case Y:n="ACESFilmic";break;case 5:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),n="Linear"}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function va(e){return""!==e}function ma(e,t){var n=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,n).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 ga(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var ya=/^[ \t]*#include +<([\w\d./]+)>/gm;function _a(e){return e.replace(ya,Ma)}var xa=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function Ma(e,t){var n=Ci[t];if(void 0===n){var i=xa.get(t);if(void 0===i)throw new Error("Can not resolve #include <"+t+">");n=Ci[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,i)}return _a(n)}var Sa=/#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 ba(e){return e.replace(Sa,Ea)}function Ea(e,t,n,i){for(var r="",a=parseInt(t);a<parseInt(n);a++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return r}function Ta(e){var t="precision "+e.precision+" float;\nprecision "+e.precision+" int;";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}function wa(e,t,n,i){var r,a,o,s,l=e.getContext(),u=n.defines,c=n.vertexShader,h=n.fragmentShader,d=function(e){var t="SHADOWMAP_TYPE_BASIC";return e.shadowMapType===R?t="SHADOWMAP_TYPE_PCF":e.shadowMapType===C?t="SHADOWMAP_TYPE_PCF_SOFT":e.shadowMapType===L&&(t="SHADOWMAP_TYPE_VSM"),t}(n),f=function(e){var t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case 301:case 302:t="ENVMAP_TYPE_CUBE";break;case 306:t="ENVMAP_TYPE_CUBE_UV"}return t}(n),p=function(e){var t="ENVMAP_MODE_REFLECTION";if(e.envMap)switch(e.envMapMode){case 302:t="ENVMAP_MODE_REFRACTION"}return t}(n),v=function(e){var t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case 0:t="ENVMAP_BLENDING_MULTIPLY";break;case 1:t="ENVMAP_BLENDING_MIX";break;case 2:t="ENVMAP_BLENDING_ADD"}return t}(n),m=function(e){var t=e.envMapCubeUVHeight;if(null===t)return null;var n=Math.log2(t)-2,i=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:i,maxMip:n}}(n),g=n.isWebGL2?"":function(e){return[e.extensionDerivatives||e.envMapCubeUVHeight||e.bumpMap||e.normalMapTangentSpace||e.clearcoatNormalMap||e.flatShading||"physical"===e.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(e.extensionFragDepth||e.logarithmicDepthBuffer)&&e.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",e.extensionDrawBuffers&&e.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(e.extensionShaderTextureLOD||e.envMap||e.transmission)&&e.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(va).join("\n")}(n),y=function(e){var t=[];for(var n in e){var i=e[n];!1!==i&&t.push("#define "+n+" "+i)}return t.join("\n")}(u),_=l.createProgram(),x=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?((r=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,y].filter(va).join("\n")).length>0&&(r+="\n"),(a=[g,"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,y].filter(va).join("\n")).length>0&&(a+="\n")):(r=[Ta(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,y,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+p:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors&&n.isWebGL2?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+d:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.useLegacyLights?"#define LEGACY_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(va).join("\n"),a=[g,Ta(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,y,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+f:"",n.envMap?"#define "+p:"",n.envMap?"#define "+v:"",m?"#define CUBEUV_TEXEL_WIDTH "+m.texelWidth:"",m?"#define CUBEUV_TEXEL_HEIGHT "+m.texelHeight:"",m?"#define CUBEUV_MAX_MIP "+m.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+d:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.useLegacyLights?"#define LEGACY_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==G?"#define TONE_MAPPING":"",n.toneMapping!==G?Ci.tonemapping_pars_fragment:"",n.toneMapping!==G?pa("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Ci.colorspace_pars_fragment,(o=n.outputColorSpace,s=function(e){switch(e){case me:return["Linear","( value )"];case ve:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",e),["Linear","( value )"]}}(o),"vec4 linearToOutputTexel( vec4 value ) { return LinearTo"+s[0]+s[1]+"; }"),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(va).join("\n")),c=ga(c=ma(c=_a(c),n),n),h=ga(h=ma(h=_a(h),n),n),c=ba(c),h=ba(h),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(x="#version 300 es\n",r=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+r,a=["#define varying in","300 es"===n.glslVersion?"":"layout(location = 0) out highp vec4 pc_fragColor;","300 es"===n.glslVersion?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+a);var M,S,b=x+r+c,E=x+a+h,T=ha(l,l.VERTEX_SHADER,b),w=ha(l,l.FRAGMENT_SHADER,E);if(l.attachShader(_,T),l.attachShader(_,w),void 0!==n.index0AttributeName?l.bindAttribLocation(_,0,n.index0AttributeName):!0===n.morphTargets&&l.bindAttribLocation(_,0,"position"),l.linkProgram(_),e.debug.checkShaderErrors){var A=l.getProgramInfoLog(_).trim(),P=l.getShaderInfoLog(T).trim(),k=l.getShaderInfoLog(w).trim(),U=!0,I=!0;if(!1===l.getProgramParameter(_,l.LINK_STATUS))if(U=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(l,_,T,w);else{var N=fa(l,T,"vertex"),D=fa(l,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+l.getError()+" - VALIDATE_STATUS "+l.getProgramParameter(_,l.VALIDATE_STATUS)+"\n\nProgram Info Log: "+A+"\n"+N+"\n"+D)}else""!==A?console.warn("THREE.WebGLProgram: Program Info Log:",A):""!==P&&""!==k||(I=!1);I&&(this.diagnostics={runnable:U,programLog:A,vertexShader:{log:P,prefix:r},fragmentShader:{log:k,prefix:a}})}return l.deleteShader(T),l.deleteShader(w),this.getUniforms=function(){return void 0===M&&(M=new ca(l,_)),M},this.getAttributes=function(){return void 0===S&&(S=function(e,t){for(var n={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES),r=0;r<i;r++){var a=e.getActiveAttrib(t,r),o=a.name,s=1;a.type===e.FLOAT_MAT2&&(s=2),a.type===e.FLOAT_MAT3&&(s=3),a.type===e.FLOAT_MAT4&&(s=4),n[o]={type:a.type,location:e.getAttribLocation(t,o),locationSize:s}}return n}(l,_)),S},this.destroy=function(){i.releaseStatesOfProgram(this),l.deleteProgram(_),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=da++,this.cacheKey=t,this.usedTimes=1,this.program=_,this.vertexShader=T,this.fragmentShader=w,this}var Aa=0,Ra=function(){function e(){a(this,e),this.shaderCache=new Map,this.materialCache=new Map}return s(e,[{key:"update",value:function(e){var t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),r=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return!1===a.has(i)&&(a.add(i),i.usedTimes++),!1===a.has(r)&&(a.add(r),r.usedTimes++),this}},{key:"remove",value:function(e){var t,n=E(this.materialCache.get(e));try{for(n.s();!(t=n.n()).done;){var i=t.value;i.usedTimes--,0===i.usedTimes&&this.shaderCache.delete(i.code)}}catch(e){n.e(e)}finally{n.f()}return this.materialCache.delete(e),this}},{key:"getVertexShaderID",value:function(e){return this._getShaderStage(e.vertexShader).id}},{key:"getFragmentShaderID",value:function(e){return this._getShaderStage(e.fragmentShader).id}},{key:"dispose",value:function(){this.shaderCache.clear(),this.materialCache.clear()}},{key:"_getShaderCacheForMaterial",value:function(e){var t=this.materialCache,n=t.get(e);return void 0===n&&(n=new Set,t.set(e,n)),n}},{key:"_getShaderStage",value:function(e){var t=this.shaderCache,n=t.get(e);return void 0===n&&(n=new Ca(e),t.set(e,n)),n}}]),e}(),Ca=s((function e(t){a(this,e),this.id=Aa++,this.code=t,this.usedTimes=0}));function La(e,t,n,i,r,a,o){var s=new Wt,l=new Ra,u=[],c=r.isWebGL2,h=r.logarithmicDepthBuffer,d=r.vertexTextures,f=r.precision,p={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",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 v(e){return 0===e?"uv":"uv".concat(e)}return{getParameters:function(a,s,u,m,g){var y=m.fog,_=g.geometry,x=a.isMeshStandardMaterial?m.environment:null,M=(a.isMeshStandardMaterial?n:t).get(a.envMap||x),S=M&&306===M.mapping?M.image.height:null,b=p[a.type];null!==a.precision&&(f=r.getMaxPrecision(a.precision))!==a.precision&&console.warn("THREE.WebGLProgram.getParameters:",a.precision,"not supported, using",f,"instead.");var E,T,w,A,R=_.morphAttributes.position||_.morphAttributes.normal||_.morphAttributes.color,C=void 0!==R?R.length:0,L=0;if(void 0!==_.morphAttributes.position&&(L=1),void 0!==_.morphAttributes.normal&&(L=2),void 0!==_.morphAttributes.color&&(L=3),b){var P=Pi[b];E=P.vertexShader,T=P.fragmentShader}else E=a.vertexShader,T=a.fragmentShader,l.update(a),w=l.getVertexShaderID(a),A=l.getFragmentShaderID(a);var I=e.getRenderTarget(),N=!0===g.isInstancedMesh,D=!!a.map,O=!!a.matcap,F=!!M,z=!!a.aoMap,B=!!a.lightMap,H=!!a.bumpMap,V=!!a.normalMap,W=!!a.displacementMap,X=!!a.emissiveMap,j=!!a.metalnessMap,Y=!!a.roughnessMap,q=a.anisotropy>0,Z=a.clearcoat>0,J=a.iridescence>0,K=a.sheen>0,Q=a.transmission>0,$=q&&!!a.anisotropyMap,ee=Z&&!!a.clearcoatMap,te=Z&&!!a.clearcoatNormalMap,ne=Z&&!!a.clearcoatRoughnessMap,ie=J&&!!a.iridescenceMap,re=J&&!!a.iridescenceThicknessMap,ae=K&&!!a.sheenColorMap,oe=K&&!!a.sheenRoughnessMap,se=!!a.specularMap,le=!!a.specularColorMap,ue=!!a.specularIntensityMap,ce=Q&&!!a.transmissionMap,he=Q&&!!a.thicknessMap,de=!!a.gradientMap,fe=!!a.alphaMap,pe=a.alphaTest>0,ve=!!a.alphaHash,ge=!!a.extensions,ye=!!_.attributes.uv1,_e=!!_.attributes.uv2,xe=!!_.attributes.uv3,Me=G;return a.toneMapped&&(null!==I&&!0!==I.isXRRenderTarget||(Me=e.toneMapping)),{isWebGL2:c,shaderID:b,shaderType:a.type,shaderName:a.name,vertexShader:E,fragmentShader:T,defines:a.defines,customVertexShaderID:w,customFragmentShaderID:A,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:f,instancing:N,instancingColor:N&&null!==g.instanceColor,supportsVertexTextures:d,outputColorSpace:null===I?e.outputColorSpace:!0===I.isXRRenderTarget?I.texture.colorSpace:me,map:D,matcap:O,envMap:F,envMapMode:F&&M.mapping,envMapCubeUVHeight:S,aoMap:z,lightMap:B,bumpMap:H,normalMap:V,displacementMap:d&&W,emissiveMap:X,normalMapObjectSpace:V&&1===a.normalMapType,normalMapTangentSpace:V&&0===a.normalMapType,metalnessMap:j,roughnessMap:Y,anisotropy:q,anisotropyMap:$,clearcoat:Z,clearcoatMap:ee,clearcoatNormalMap:te,clearcoatRoughnessMap:ne,iridescence:J,iridescenceMap:ie,iridescenceThicknessMap:re,sheen:K,sheenColorMap:ae,sheenRoughnessMap:oe,specularMap:se,specularColorMap:le,specularIntensityMap:ue,transmission:Q,transmissionMap:ce,thicknessMap:he,gradientMap:de,opaque:!1===a.transparent&&1===a.blending,alphaMap:fe,alphaTest:pe,alphaHash:ve,combine:a.combine,mapUv:D&&v(a.map.channel),aoMapUv:z&&v(a.aoMap.channel),lightMapUv:B&&v(a.lightMap.channel),bumpMapUv:H&&v(a.bumpMap.channel),normalMapUv:V&&v(a.normalMap.channel),displacementMapUv:W&&v(a.displacementMap.channel),emissiveMapUv:X&&v(a.emissiveMap.channel),metalnessMapUv:j&&v(a.metalnessMap.channel),roughnessMapUv:Y&&v(a.roughnessMap.channel),anisotropyMapUv:$&&v(a.anisotropyMap.channel),clearcoatMapUv:ee&&v(a.clearcoatMap.channel),clearcoatNormalMapUv:te&&v(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ne&&v(a.clearcoatRoughnessMap.channel),iridescenceMapUv:ie&&v(a.iridescenceMap.channel),iridescenceThicknessMapUv:re&&v(a.iridescenceThicknessMap.channel),sheenColorMapUv:ae&&v(a.sheenColorMap.channel),sheenRoughnessMapUv:oe&&v(a.sheenRoughnessMap.channel),specularMapUv:se&&v(a.specularMap.channel),specularColorMapUv:le&&v(a.specularColorMap.channel),specularIntensityMapUv:ue&&v(a.specularIntensityMap.channel),transmissionMapUv:ce&&v(a.transmissionMap.channel),thicknessMapUv:he&&v(a.thicknessMap.channel),alphaMapUv:fe&&v(a.alphaMap.channel),vertexTangents:!!_.attributes.tangent&&(V||q),vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!_.attributes.color&&4===_.attributes.color.itemSize,vertexUv1s:ye,vertexUv2s:_e,vertexUv3s:xe,pointsUvs:!0===g.isPoints&&!!_.attributes.uv&&(D||fe),fog:!!y,useFog:!0===a.fog,fogExp2:y&&y.isFogExp2,flatShading:!0===a.flatShading,sizeAttenuation:!0===a.sizeAttenuation,logarithmicDepthBuffer:h,skinning:!0===g.isSkinnedMesh,morphTargets:void 0!==_.morphAttributes.position,morphNormals:void 0!==_.morphAttributes.normal,morphColors:void 0!==_.morphAttributes.color,morphTargetsCount:C,morphTextureStride:L,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,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:a.dithering,shadowMapEnabled:e.shadowMap.enabled&&u.length>0,shadowMapType:e.shadowMap.type,toneMapping:Me,useLegacyLights:e._useLegacyLights,premultipliedAlpha:a.premultipliedAlpha,doubleSided:a.side===U,flipSided:a.side===k,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionDerivatives:ge&&!0===a.extensions.derivatives,extensionFragDepth:ge&&!0===a.extensions.fragDepth,extensionDrawBuffers:ge&&!0===a.extensions.drawBuffers,extensionShaderTextureLOD:ge&&!0===a.extensions.shaderTextureLOD,rendererExtensionFragDepth:c||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:c||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:c||i.has("EXT_shader_texture_lod"),customProgramCacheKey:a.customProgramCacheKey()}},getProgramCacheKey:function(t){var n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),void 0!==t.defines)for(var i in t.defines)n.push(i),n.push(t.defines[i]);return!1===t.isRawShaderMaterial&&(function(e,t){e.push(t.precision),e.push(t.outputColorSpace),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.mapUv),e.push(t.alphaMapUv),e.push(t.lightMapUv),e.push(t.aoMapUv),e.push(t.bumpMapUv),e.push(t.normalMapUv),e.push(t.displacementMapUv),e.push(t.emissiveMapUv),e.push(t.metalnessMapUv),e.push(t.roughnessMapUv),e.push(t.anisotropyMapUv),e.push(t.clearcoatMapUv),e.push(t.clearcoatNormalMapUv),e.push(t.clearcoatRoughnessMapUv),e.push(t.iridescenceMapUv),e.push(t.iridescenceThicknessMapUv),e.push(t.sheenColorMapUv),e.push(t.sheenRoughnessMapUv),e.push(t.specularMapUv),e.push(t.specularColorMapUv),e.push(t.specularIntensityMapUv),e.push(t.transmissionMapUv),e.push(t.thicknessMapUv),e.push(t.combine),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numSpotLightMaps),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.numSpotLightShadowsWithMaps),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}(n,t),function(e,t){s.disableAll(),t.isWebGL2&&s.enable(0),t.supportsVertexTextures&&s.enable(1),t.instancing&&s.enable(2),t.instancingColor&&s.enable(3),t.matcap&&s.enable(4),t.envMap&&s.enable(5),t.normalMapObjectSpace&&s.enable(6),t.normalMapTangentSpace&&s.enable(7),t.clearcoat&&s.enable(8),t.iridescence&&s.enable(9),t.alphaTest&&s.enable(10),t.vertexColors&&s.enable(11),t.vertexAlphas&&s.enable(12),t.vertexUv1s&&s.enable(13),t.vertexUv2s&&s.enable(14),t.vertexUv3s&&s.enable(15),t.vertexTangents&&s.enable(16),t.anisotropy&&s.enable(17),e.push(s.mask),s.disableAll(),t.fog&&s.enable(0),t.useFog&&s.enable(1),t.flatShading&&s.enable(2),t.logarithmicDepthBuffer&&s.enable(3),t.skinning&&s.enable(4),t.morphTargets&&s.enable(5),t.morphNormals&&s.enable(6),t.morphColors&&s.enable(7),t.premultipliedAlpha&&s.enable(8),t.shadowMapEnabled&&s.enable(9),t.useLegacyLights&&s.enable(10),t.doubleSided&&s.enable(11),t.flipSided&&s.enable(12),t.useDepthPacking&&s.enable(13),t.dithering&&s.enable(14),t.transmission&&s.enable(15),t.sheen&&s.enable(16),t.opaque&&s.enable(17),t.pointsUvs&&s.enable(18),e.push(s.mask)}(n,t),n.push(e.outputColorSpace)),n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){var t,n=p[e.type];if(n){var i=Pi[n];t=di.clone(i.uniforms)}else t=e.uniforms;return t},acquireProgram:function(t,n){for(var i,r=0,o=u.length;r<o;r++){var s=u[r];if(s.cacheKey===n){++(i=s).usedTimes;break}}return void 0===i&&(i=new wa(e,n,t,a),u.push(i)),i},releaseProgram:function(e){if(0==--e.usedTimes){var t=u.indexOf(e);u[t]=u[u.length-1],u.pop(),e.destroy()}},releaseShaderCache:function(e){l.remove(e)},programs:u,dispose:function(){l.dispose()}}}function Pa(){var e=new WeakMap;return{get:function(t){var n=e.get(t);return void 0===n&&(n={},e.set(t,n)),n},remove:function(t){e.delete(t)},update:function(t,n,i){e.get(t)[n]=i},dispose:function(){e=new WeakMap}}}function ka(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function Ua(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 Ia(){var e=[],t=0,n=[],i=[],r=[];function a(n,i,r,a,o,s){var l=e[t];return void 0===l?(l={id:n.id,object:n,geometry:i,material:r,groupOrder:a,renderOrder:n.renderOrder,z:o,group:s},e[t]=l):(l.id=n.id,l.object=n,l.geometry=i,l.material=r,l.groupOrder=a,l.renderOrder=n.renderOrder,l.z=o,l.group=s),t++,l}return{opaque:n,transmissive:i,transparent:r,init:function(){t=0,n.length=0,i.length=0,r.length=0},push:function(e,t,o,s,l,u){var c=a(e,t,o,s,l,u);o.transmission>0?i.push(c):!0===o.transparent?r.push(c):n.push(c)},unshift:function(e,t,o,s,l,u){var c=a(e,t,o,s,l,u);o.transmission>0?i.unshift(c):!0===o.transparent?r.unshift(c):n.unshift(c)},finish:function(){for(var n=t,i=e.length;n<i;n++){var r=e[n];if(null===r.id)break;r.id=null,r.object=null,r.geometry=null,r.material=null,r.group=null}},sort:function(e,t){n.length>1&&n.sort(e||ka),i.length>1&&i.sort(t||Ua),r.length>1&&r.sort(t||Ua)}}}function Na(){var e=new WeakMap;return{get:function(t,n){var i,r=e.get(t);return void 0===r?(i=new Ia,e.set(t,[i])):n>=r.length?(i=new Ia,r.push(i)):i=r[n],i},dispose:function(){e=new WeakMap}}}function Da(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var n;switch(t.type){case"DirectionalLight":n={direction:new it,color:new En};break;case"SpotLight":n={position:new it,direction:new it,color:new En,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new it,color:new En,distance:0,decay:0};break;case"HemisphereLight":n={direction:new it,skyColor:new En,groundColor:new En};break;case"RectAreaLight":n={color:new En,position:new it,halfWidth:new it,halfHeight:new it}}return e[t.id]=n,n}}}var Oa=0;function Fa(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function za(e,t){for(var n,i=new Da,r=(n={},{get:function(e){if(void 0!==n[e.id])return n[e.id];var t;switch(e.type){case"DirectionalLight":case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Pe};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Pe,shadowCameraNear:1,shadowCameraFar:1e3}}return n[e.id]=t,t}}),a={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-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},o=0;o<9;o++)a.probe.push(new it);var s=new it,l=new Ut,u=new Ut;return{setup:function(n,o){for(var s=0,l=0,u=0,c=0;c<9;c++)a.probe[c].set(0,0,0);var h=0,d=0,f=0,p=0,v=0,m=0,g=0,y=0,_=0,x=0;n.sort(Fa);for(var M=!0===o?Math.PI:1,S=0,b=n.length;S<b;S++){var E=n[S],T=E.color,w=E.intensity,A=E.distance,R=E.shadow&&E.shadow.map?E.shadow.map.texture:null;if(E.isAmbientLight)s+=T.r*w*M,l+=T.g*w*M,u+=T.b*w*M;else if(E.isLightProbe)for(var C=0;C<9;C++)a.probe[C].addScaledVector(E.sh.coefficients[C],w);else if(E.isDirectionalLight){var L=i.get(E);if(L.color.copy(E.color).multiplyScalar(E.intensity*M),E.castShadow){var P=E.shadow,k=r.get(E);k.shadowBias=P.bias,k.shadowNormalBias=P.normalBias,k.shadowRadius=P.radius,k.shadowMapSize=P.mapSize,a.directionalShadow[h]=k,a.directionalShadowMap[h]=R,a.directionalShadowMatrix[h]=E.shadow.matrix,m++}a.directional[h]=L,h++}else if(E.isSpotLight){var U=i.get(E);U.position.setFromMatrixPosition(E.matrixWorld),U.color.copy(T).multiplyScalar(w*M),U.distance=A,U.coneCos=Math.cos(E.angle),U.penumbraCos=Math.cos(E.angle*(1-E.penumbra)),U.decay=E.decay,a.spot[f]=U;var I=E.shadow;if(E.map&&(a.spotLightMap[_]=E.map,_++,I.updateMatrices(E),E.castShadow&&x++),a.spotLightMatrix[f]=I.matrix,E.castShadow){var N=r.get(E);N.shadowBias=I.bias,N.shadowNormalBias=I.normalBias,N.shadowRadius=I.radius,N.shadowMapSize=I.mapSize,a.spotShadow[f]=N,a.spotShadowMap[f]=R,y++}f++}else if(E.isRectAreaLight){var D=i.get(E);D.color.copy(T).multiplyScalar(w),D.halfWidth.set(.5*E.width,0,0),D.halfHeight.set(0,.5*E.height,0),a.rectArea[p]=D,p++}else if(E.isPointLight){var O=i.get(E);if(O.color.copy(E.color).multiplyScalar(E.intensity*M),O.distance=E.distance,O.decay=E.decay,E.castShadow){var F=E.shadow,z=r.get(E);z.shadowBias=F.bias,z.shadowNormalBias=F.normalBias,z.shadowRadius=F.radius,z.shadowMapSize=F.mapSize,z.shadowCameraNear=F.camera.near,z.shadowCameraFar=F.camera.far,a.pointShadow[d]=z,a.pointShadowMap[d]=R,a.pointShadowMatrix[d]=E.shadow.matrix,g++}a.point[d]=O,d++}else if(E.isHemisphereLight){var B=i.get(E);B.skyColor.copy(E.color).multiplyScalar(w*M),B.groundColor.copy(E.groundColor).multiplyScalar(w*M),a.hemi[v]=B,v++}}p>0&&(t.isWebGL2||!0===e.has("OES_texture_float_linear")?(a.rectAreaLTC1=Li.LTC_FLOAT_1,a.rectAreaLTC2=Li.LTC_FLOAT_2):!0===e.has("OES_texture_half_float_linear")?(a.rectAreaLTC1=Li.LTC_HALF_1,a.rectAreaLTC2=Li.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),a.ambient[0]=s,a.ambient[1]=l,a.ambient[2]=u;var H=a.hash;H.directionalLength===h&&H.pointLength===d&&H.spotLength===f&&H.rectAreaLength===p&&H.hemiLength===v&&H.numDirectionalShadows===m&&H.numPointShadows===g&&H.numSpotShadows===y&&H.numSpotMaps===_||(a.directional.length=h,a.spot.length=f,a.rectArea.length=p,a.point.length=d,a.hemi.length=v,a.directionalShadow.length=m,a.directionalShadowMap.length=m,a.pointShadow.length=g,a.pointShadowMap.length=g,a.spotShadow.length=y,a.spotShadowMap.length=y,a.directionalShadowMatrix.length=m,a.pointShadowMatrix.length=g,a.spotLightMatrix.length=y+_-x,a.spotLightMap.length=_,a.numSpotLightShadowsWithMaps=x,H.directionalLength=h,H.pointLength=d,H.spotLength=f,H.rectAreaLength=p,H.hemiLength=v,H.numDirectionalShadows=m,H.numPointShadows=g,H.numSpotShadows=y,H.numSpotMaps=_,a.version=Oa++)},setupView:function(e,t){for(var n=0,i=0,r=0,o=0,c=0,h=t.matrixWorldInverse,d=0,f=e.length;d<f;d++){var p=e[d];if(p.isDirectionalLight){var v=a.directional[n];v.direction.setFromMatrixPosition(p.matrixWorld),s.setFromMatrixPosition(p.target.matrixWorld),v.direction.sub(s),v.direction.transformDirection(h),n++}else if(p.isSpotLight){var m=a.spot[r];m.position.setFromMatrixPosition(p.matrixWorld),m.position.applyMatrix4(h),m.direction.setFromMatrixPosition(p.matrixWorld),s.setFromMatrixPosition(p.target.matrixWorld),m.direction.sub(s),m.direction.transformDirection(h),r++}else if(p.isRectAreaLight){var g=a.rectArea[o];g.position.setFromMatrixPosition(p.matrixWorld),g.position.applyMatrix4(h),u.identity(),l.copy(p.matrixWorld),l.premultiply(h),u.extractRotation(l),g.halfWidth.set(.5*p.width,0,0),g.halfHeight.set(0,.5*p.height,0),g.halfWidth.applyMatrix4(u),g.halfHeight.applyMatrix4(u),o++}else if(p.isPointLight){var y=a.point[i];y.position.setFromMatrixPosition(p.matrixWorld),y.position.applyMatrix4(h),i++}else if(p.isHemisphereLight){var _=a.hemi[c];_.direction.setFromMatrixPosition(p.matrixWorld),_.direction.transformDirection(h),c++}}},state:a}}function Ba(e,t){var n=new za(e,t),i=[],r=[];return{init:function(){i.length=0,r.length=0},state:{lightsArray:i,shadowsArray:r,lights:n},setupLights:function(e){n.setup(i,e)},setupLightsView:function(e){n.setupView(i,e)},pushLight:function(e){i.push(e)},pushShadow:function(e){r.push(e)}}}function Ha(e,t){var n=new WeakMap;return{get:function(i){var r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=n.get(i);return void 0===o?(r=new Ba(e,t),n.set(i,[r])):a>=o.length?(r=new Ba(e,t),o.push(r)):r=o[a],r},dispose:function(){n=new WeakMap}}}var Va=e("bg",function(e){u(n,e);var t=g(n);function n(e){var i;return a(this,n),(i=t.call(this)).isMeshDepthMaterial=!0,i.type="MeshDepthMaterial",i.depthPacking=3200,i.map=null,i.alphaMap=null,i.displacementMap=null,i.displacementScale=1,i.displacementBias=0,i.wireframe=!1,i.wireframeLinewidth=1,i.setValues(e),i}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,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}}]),n}(_n)),Ga=function(e){u(n,e);var t=g(n);function n(e){var i;return a(this,n),(i=t.call(this)).isMeshDistanceMaterial=!0,i.type="MeshDistanceMaterial",i.map=null,i.alphaMap=null,i.displacementMap=null,i.displacementScale=1,i.displacementBias=0,i.setValues(e),i}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}]),n}(_n);function Wa(e,t,n){var i,r=new Ti,a=new Pe,o=new Pe,s=new Qe,u=new Va({depthPacking:fe}),c=new Ga,h={},d=n.maxTextureSize,f=(l(i={},P,k),l(i,k,P),l(i,U,U),i),p=new fi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Pe},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),v=p.clone();v.defines.HORIZONTAL_PASS=1;var m=new Vn;m.setAttribute("position",new Pn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var g=new oi(m,p),y=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=R;var _=this.type;function x(n,i){var r=t.update(g);p.defines.VSM_SAMPLES!==n.blurSamples&&(p.defines.VSM_SAMPLES=n.blurSamples,v.defines.VSM_SAMPLES=n.blurSamples,p.needsUpdate=!0,v.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new $e(a.x,a.y)),p.uniforms.shadow_pass.value=n.map.texture,p.uniforms.resolution.value=n.mapSize,p.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(i,null,r,p,g,null),v.uniforms.shadow_pass.value=n.mapPass.texture,v.uniforms.resolution.value=n.mapSize,v.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(i,null,r,v,g,null)}function M(t,n,i,r){var a=null,o=!0===i.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==o)a=o;else if(a=!0===i.isPointLight?c:u,e.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0){var s=a.uuid,l=n.uuid,d=h[s];void 0===d&&(d={},h[s]=d);var p=d[l];void 0===p&&(p=a.clone(),d[l]=p),a=p}return a.visible=n.visible,a.wireframe=n.wireframe,a.side=r===L?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:f[n.side],a.alphaMap=n.alphaMap,a.alphaTest=n.alphaTest,a.map=n.map,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.clipIntersection=n.clipIntersection,a.displacementMap=n.displacementMap,a.displacementScale=n.displacementScale,a.displacementBias=n.displacementBias,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,!0===i.isPointLight&&!0===a.isMeshDistanceMaterial&&(e.properties.get(a).light=i),a}function S(n,i,a,o,s){if(!1!==n.visible){if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&s===L)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);var l=t.update(n),u=n.material;if(Array.isArray(u))for(var c=l.groups,h=0,d=c.length;h<d;h++){var f=c[h],p=u[f.materialIndex];if(p&&p.visible){var v=M(n,p,o,s);e.renderBufferDirect(a,null,l,v,n,f)}}else if(u.visible){var m=M(n,u,o,s);e.renderBufferDirect(a,null,l,m,n,null)}}for(var g=n.children,y=0,_=g.length;y<_;y++)S(g[y],i,a,o,s)}}this.render=function(t,n,i){if(!1!==y.enabled&&(!1!==y.autoUpdate||!1!==y.needsUpdate)&&0!==t.length){var l=e.getRenderTarget(),u=e.getActiveCubeFace(),c=e.getActiveMipmapLevel(),h=e.state;h.setBlending(I),h.buffers.color.setClear(1,1,1,1),h.buffers.depth.setTest(!0),h.setScissorTest(!1);for(var f=_!==L&&this.type===L,p=_===L&&this.type!==L,v=0,m=t.length;v<m;v++){var g=t[v],M=g.shadow;if(void 0!==M){if(!1!==M.autoUpdate||!1!==M.needsUpdate){a.copy(M.mapSize);var b=M.getFrameExtents();if(a.multiply(b),o.copy(M.mapSize),(a.x>d||a.y>d)&&(a.x>d&&(o.x=Math.floor(d/b.x),a.x=o.x*b.x,M.mapSize.x=o.x),a.y>d&&(o.y=Math.floor(d/b.y),a.y=o.y*b.y,M.mapSize.y=o.y)),null===M.map||!0===f||!0===p){var E=this.type!==L?{minFilter:Q,magFilter:Q}:{};null!==M.map&&M.map.dispose(),M.map=new $e(a.x,a.y,E),M.map.texture.name=g.name+".shadowMap",M.camera.updateProjectionMatrix()}e.setRenderTarget(M.map),e.clear();for(var T=M.getViewportCount(),w=0;w<T;w++){var A=M.getViewport(w);s.set(o.x*A.x,o.y*A.y,o.x*A.z,o.y*A.w),h.viewport(s),M.updateMatrices(g,w),r=M.getFrustum(),S(n,i,M.camera,g,this.type)}!0!==M.isPointLightShadow&&this.type===L&&x(M,i),M.needsUpdate=!1}}else console.warn("THREE.WebGLShadowMap:",g,"has no shadow.")}_=this.type,y.needsUpdate=!1,e.setRenderTarget(l,u,c)}}}function Xa(e,t,n){var i,r,a=n.isWebGL2,o=new function(){var t=!1,n=new Qe,i=null,r=new Qe(0,0,0,0);return{setMask:function(n){i===n||t||(e.colorMask(n,n,n,n),i=n)},setLocked:function(e){t=e},setClear:function(t,i,a,o,s){!0===s&&(t*=o,i*=o,a*=o),n.set(t,i,a,o),!1===r.equals(n)&&(e.clearColor(t,i,a,o),r.copy(n))},reset:function(){t=!1,i=null,r.set(-1,0,0,0)}}},s=new function(){var t=!1,n=null,i=null,r=null;return{setTest:function(t){t?ee(e.DEPTH_TEST):te(e.DEPTH_TEST)},setMask:function(i){n===i||t||(e.depthMask(i),n=i)},setFunc:function(t){if(i!==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: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);break;default:e.depthFunc(e.LEQUAL)}i=t}},setLocked:function(e){t=e},setClear:function(t){r!==t&&(e.clearDepth(t),r=t)},reset:function(){t=!1,n=null,i=null,r=null}}},u=new function(){var t=!1,n=null,i=null,r=null,a=null,o=null,s=null,l=null,u=null;return{setTest:function(n){t||(n?ee(e.STENCIL_TEST):te(e.STENCIL_TEST))},setMask:function(i){n===i||t||(e.stencilMask(i),n=i)},setFunc:function(t,n,o){i===t&&r===n&&a===o||(e.stencilFunc(t,n,o),i=t,r=n,a=o)},setOp:function(t,n,i){o===t&&s===n&&l===i||(e.stencilOp(t,n,i),o=t,s=n,l=i)},setLocked:function(e){t=e},setClear:function(t){u!==t&&(e.clearStencil(t),u=t)},reset:function(){t=!1,n=null,i=null,r=null,a=null,o=null,s=null,l=null,u=null}}},c=new WeakMap,h=new WeakMap,d={},f={},p=new WeakMap,v=[],m=null,g=!1,y=null,_=null,x=null,M=null,S=null,b=null,E=null,T=!1,w=null,A=null,R=null,C=null,L=null,P=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),G=!1,W=0,X=e.getParameter(e.VERSION);-1!==X.indexOf("WebGL")?(W=parseFloat(/^WebGL (\d)/.exec(X)[1]),G=W>=1):-1!==X.indexOf("OpenGL ES")&&(W=parseFloat(/^OpenGL ES (\d)/.exec(X)[1]),G=W>=2);var j=null,Y={},q=e.getParameter(e.SCISSOR_BOX),Z=e.getParameter(e.VIEWPORT),J=(new Qe).fromArray(q),K=(new Qe).fromArray(Z);function Q(t,n,i,r){var o=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(var l=0;l<i;l++)!a||t!==e.TEXTURE_3D&&t!==e.TEXTURE_2D_ARRAY?e.texImage2D(n+l,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,o):e.texImage3D(n,0,e.RGBA,1,1,r,0,e.RGBA,e.UNSIGNED_BYTE,o);return s}var $={};function ee(t){!0!==d[t]&&(e.enable(t),d[t]=!0)}function te(t){!1!==d[t]&&(e.disable(t),d[t]=!1)}$[e.TEXTURE_2D]=Q(e.TEXTURE_2D,e.TEXTURE_2D,1),$[e.TEXTURE_CUBE_MAP]=Q(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),a&&($[e.TEXTURE_2D_ARRAY]=Q(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),$[e.TEXTURE_3D]=Q(e.TEXTURE_3D,e.TEXTURE_3D,1,1)),o.setClear(0,0,0,1),s.setClear(1),u.setClear(0),ee(e.DEPTH_TEST),s.setFunc(3),oe(!1),se(1),ee(e.CULL_FACE),ae(I);var ne=(l(i={},O,e.FUNC_ADD),l(i,101,e.FUNC_SUBTRACT),l(i,102,e.FUNC_REVERSE_SUBTRACT),i);if(a)ne[F]=e.MIN,ne[104]=e.MAX;else{var ie=t.get("EXT_blend_minmax");null!==ie&&(ne[F]=ie.MIN_EXT,ne[104]=ie.MAX_EXT)}var re=(l(r={},z,e.ZERO),l(r,B,e.ONE),l(r,202,e.SRC_COLOR),l(r,204,e.SRC_ALPHA),l(r,210,e.SRC_ALPHA_SATURATE),l(r,V,e.DST_COLOR),l(r,H,e.DST_ALPHA),l(r,203,e.ONE_MINUS_SRC_COLOR),l(r,205,e.ONE_MINUS_SRC_ALPHA),l(r,209,e.ONE_MINUS_DST_COLOR),l(r,207,e.ONE_MINUS_DST_ALPHA),r);function ae(t,n,i,r,a,o,s,l){if(t!==I){if(!1===g&&(ee(e.BLEND),g=!0),t===D)a=a||n,o=o||i,s=s||r,n===_&&a===S||(e.blendEquationSeparate(ne[n],ne[a]),_=n,S=a),i===x&&r===M&&o===b&&s===E||(e.blendFuncSeparate(re[i],re[r],re[o],re[s]),x=i,M=r,b=o,E=s),y=t,T=!1;else if(t!==y||l!==T){if(_===O&&S===O||(e.blendEquation(e.FUNC_ADD),_=O,S=O),l)switch(t){case 1:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case N: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.ZERO,e.SRC_COLOR,e.ZERO,e.SRC_ALPHA);break;default:console.error("THREE.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 N:e.blendFunc(e.SRC_ALPHA,e.ONE);break;case 3:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case 4:e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}x=null,M=null,b=null,E=null,y=t,T=l}}else!0===g&&(te(e.BLEND),g=!1)}function oe(t){w!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),w=t)}function se(t){0!==t?(ee(e.CULL_FACE),t!==A&&(1===t?e.cullFace(e.BACK):2===t?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))):te(e.CULL_FACE),A=t}function le(t,n,i){t?(ee(e.POLYGON_OFFSET_FILL),C===n&&L===i||(e.polygonOffset(n,i),C=n,L=i)):te(e.POLYGON_OFFSET_FILL)}return{buffers:{color:o,depth:s,stencil:u},enable:ee,disable:te,bindFramebuffer:function(t,n){return f[t]!==n&&(e.bindFramebuffer(t,n),f[t]=n,a&&(t===e.DRAW_FRAMEBUFFER&&(f[e.FRAMEBUFFER]=n),t===e.FRAMEBUFFER&&(f[e.DRAW_FRAMEBUFFER]=n)),!0)},drawBuffers:function(i,r){var a=v,o=!1;if(i)if(void 0===(a=p.get(r))&&(a=[],p.set(r,a)),i.isWebGLMultipleRenderTargets){var s=i.texture;if(a.length!==s.length||a[0]!==e.COLOR_ATTACHMENT0){for(var l=0,u=s.length;l<u;l++)a[l]=e.COLOR_ATTACHMENT0+l;a.length=s.length,o=!0}}else a[0]!==e.COLOR_ATTACHMENT0&&(a[0]=e.COLOR_ATTACHMENT0,o=!0);else a[0]!==e.BACK&&(a[0]=e.BACK,o=!0);o&&(n.isWebGL2?e.drawBuffers(a):t.get("WEBGL_draw_buffers").drawBuffersWEBGL(a))},useProgram:function(t){return m!==t&&(e.useProgram(t),m=t,!0)},setBlending:ae,setMaterial:function(t,n){t.side===U?te(e.CULL_FACE):ee(e.CULL_FACE);var i=t.side===k;n&&(i=!i),oe(i),1===t.blending&&!1===t.transparent?ae(I):ae(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha),s.setFunc(t.depthFunc),s.setTest(t.depthTest),s.setMask(t.depthWrite),o.setMask(t.colorWrite);var r=t.stencilWrite;u.setTest(r),r&&(u.setMask(t.stencilWriteMask),u.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),u.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),le(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),!0===t.alphaToCoverage?ee(e.SAMPLE_ALPHA_TO_COVERAGE):te(e.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:oe,setCullFace:se,setLineWidth:function(t){t!==R&&(G&&e.lineWidth(t),R=t)},setPolygonOffset:le,setScissorTest:function(t){t?ee(e.SCISSOR_TEST):te(e.SCISSOR_TEST)},activeTexture:function(t){void 0===t&&(t=e.TEXTURE0+P-1),j!==t&&(e.activeTexture(t),j=t)},bindTexture:function(t,n,i){void 0===i&&(i=null===j?e.TEXTURE0+P-1:j);var r=Y[i];void 0===r&&(r={type:void 0,texture:void 0},Y[i]=r),r.type===t&&r.texture===n||(j!==i&&(e.activeTexture(i),j=i),e.bindTexture(t,n||$[t]),r.type=t,r.texture=n)},unbindTexture:function(){var t=Y[j];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.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexImage3D:function(){try{e.compressedTexImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{e.texImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{e.texImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},updateUBOMapping:function(t,n){var i=h.get(n);void 0===i&&(i=new WeakMap,h.set(n,i));var r=i.get(t);void 0===r&&(r=e.getUniformBlockIndex(n,t.name),i.set(t,r))},uniformBlockBinding:function(t,n){var i=h.get(n).get(t);c.get(n)!==i&&(e.uniformBlockBinding(n,i,t.__bindingPointIndex),c.set(n,i))},texStorage2D:function(){try{e.texStorage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texStorage3D:function(){try{e.texStorage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage2D:function(){try{e.texSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage3D:function(){try{e.texSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage2D:function(){try{e.compressedTexSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage3D:function(){try{e.compressedTexSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(t){!1===J.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),J.copy(t))},viewport:function(t){!1===K.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),K.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.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(e.ALWAYS,0,4294967295),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),!0===a&&(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),d={},j=null,Y={},f={},p=new WeakMap,v=[],m=null,g=!1,y=null,_=null,x=null,M=null,S=null,b=null,E=null,T=!1,w=null,A=null,R=null,C=null,L=null,J.set(0,0,e.canvas.width,e.canvas.height),K.set(0,0,e.canvas.width,e.canvas.height),o.reset(),s.reset(),u.reset()}}}function ja(e,t,n,i,r,a,o){var s,u,c,h,d=r.isWebGL2,f=r.maxTextures,p=r.maxCubemapSize,v=r.maxTextureSize,m=r.maxSamples,g=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,y="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),_=new WeakMap,x=new WeakMap,M=!1;try{M="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function S(e,t){return M?new OffscreenCanvas(e,t):Ne("canvas")}function b(e,t,n,i){var r=1;if((e.width>i||e.height>i)&&(r=i/Math.max(e.width,e.height)),r<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){var a=t?Re:Math.floor,o=a(r*e.width),s=a(r*e.height);void 0===h&&(h=S(o,s));var l=n?S(o,s):h;return l.width=o,l.height=s,l.getContext("2d").drawImage(e,0,0,o,s),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+o+"x"+s+")."),l}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function E(e){return we(e.width)&&we(e.height)}function T(e,t){return e.generateMipmaps&&t&&e.minFilter!==Q&&e.minFilter!==te}function w(t){e.generateMipmap(t)}function A(n,i,r,a){var o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(!1===d)return i;if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}var s=i;return i===e.RED&&(r===e.FLOAT&&(s=e.R32F),r===e.HALF_FLOAT&&(s=e.R16F),r===e.UNSIGNED_BYTE&&(s=e.R8)),i===e.RED_INTEGER&&(r===e.UNSIGNED_BYTE&&(s=e.R8UI),r===e.UNSIGNED_SHORT&&(s=e.R16UI),r===e.UNSIGNED_INT&&(s=e.R32UI),r===e.BYTE&&(s=e.R8I),r===e.SHORT&&(s=e.R16I),r===e.INT&&(s=e.R32I)),i===e.RG&&(r===e.FLOAT&&(s=e.RG32F),r===e.HALF_FLOAT&&(s=e.RG16F),r===e.UNSIGNED_BYTE&&(s=e.RG8)),i===e.RGBA&&(r===e.FLOAT&&(s=e.RGBA32F),r===e.HALF_FLOAT&&(s=e.RGBA16F),r===e.UNSIGNED_BYTE&&(s=a===ve&&!1===o?e.SRGB8_ALPHA8:e.RGBA8),r===e.UNSIGNED_SHORT_4_4_4_4&&(s=e.RGBA4),r===e.UNSIGNED_SHORT_5_5_5_1&&(s=e.RGB5_A1)),s!==e.R16F&&s!==e.R32F&&s!==e.RG16F&&s!==e.RG32F&&s!==e.RGBA16F&&s!==e.RGBA32F||t.get("EXT_color_buffer_float"),s}function R(e,t,n){return!0===T(e,n)||e.isFramebufferTexture&&e.minFilter!==Q&&e.minFilter!==te?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 C(t){return t===Q||t===$||t===ee?e.NEAREST:e.LINEAR}function L(e){var t=e.target;t.removeEventListener("dispose",L),function(e){var t=i.get(e);if(void 0!==t.__webglInit){var n=e.source,r=x.get(n);if(r){var a=r[t.__cacheKey];a.usedTimes--,0===a.usedTimes&&k(e),0===Object.keys(r).length&&x.delete(n)}i.remove(e)}}(t),t.isVideoTexture&&_.delete(t)}function P(t){var n=t.target;n.removeEventListener("dispose",P),function(t){var n=t.texture,r=i.get(t),a=i.get(n);if(void 0!==a.__webglTexture&&(e.deleteTexture(a.__webglTexture),o.memory.textures--),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(var s=0;s<6;s++){if(Array.isArray(r.__webglFramebuffer[s]))for(var l=0;l<r.__webglFramebuffer[s].length;l++)e.deleteFramebuffer(r.__webglFramebuffer[s][l]);else e.deleteFramebuffer(r.__webglFramebuffer[s]);r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer[s])}else{if(Array.isArray(r.__webglFramebuffer))for(var u=0;u<r.__webglFramebuffer.length;u++)e.deleteFramebuffer(r.__webglFramebuffer[u]);else e.deleteFramebuffer(r.__webglFramebuffer);if(r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&e.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer)for(var c=0;c<r.__webglColorRenderbuffer.length;c++)r.__webglColorRenderbuffer[c]&&e.deleteRenderbuffer(r.__webglColorRenderbuffer[c]);r.__webglDepthRenderbuffer&&e.deleteRenderbuffer(r.__webglDepthRenderbuffer)}if(t.isWebGLMultipleRenderTargets)for(var h=0,d=n.length;h<d;h++){var f=i.get(n[h]);f.__webglTexture&&(e.deleteTexture(f.__webglTexture),o.memory.textures--),i.remove(n[h])}i.remove(n),i.remove(t)}(n)}function k(t){var n=i.get(t);e.deleteTexture(n.__webglTexture);var r=t.source;delete x.get(r)[n.__cacheKey],o.memory.textures--}var U=0;function I(t,r){var a=i.get(t);if(t.isVideoTexture&&function(e){var t=o.render.frame;_.get(e)!==t&&(_.set(e,t),e.update())}(t),!1===t.isRenderTargetTexture&&t.version>0&&a.__version!==t.version){var s=t.image;if(null===s)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==s.complete)return void B(a,t,r);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.bindTexture(e.TEXTURE_2D,a.__webglTexture,e.TEXTURE0+r)}var N=(l(s={},Z,e.REPEAT),l(s,J,e.CLAMP_TO_EDGE),l(s,K,e.MIRRORED_REPEAT),s),D=(l(u={},Q,e.NEAREST),l(u,$,e.NEAREST_MIPMAP_NEAREST),l(u,ee,e.NEAREST_MIPMAP_LINEAR),l(u,te,e.LINEAR),l(u,ne,e.LINEAR_MIPMAP_NEAREST),l(u,ie,e.LINEAR_MIPMAP_LINEAR),u),O=(l(c={},512,e.NEVER),l(c,519,e.ALWAYS),l(c,513,e.LESS),l(c,515,e.LEQUAL),l(c,514,e.EQUAL),l(c,518,e.GEQUAL),l(c,516,e.GREATER),l(c,517,e.NOTEQUAL),c);function F(n,a,o){if(o?(e.texParameteri(n,e.TEXTURE_WRAP_S,N[a.wrapS]),e.texParameteri(n,e.TEXTURE_WRAP_T,N[a.wrapT]),n!==e.TEXTURE_3D&&n!==e.TEXTURE_2D_ARRAY||e.texParameteri(n,e.TEXTURE_WRAP_R,N[a.wrapR]),e.texParameteri(n,e.TEXTURE_MAG_FILTER,D[a.magFilter]),e.texParameteri(n,e.TEXTURE_MIN_FILTER,D[a.minFilter])):(e.texParameteri(n,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(n,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),n!==e.TEXTURE_3D&&n!==e.TEXTURE_2D_ARRAY||e.texParameteri(n,e.TEXTURE_WRAP_R,e.CLAMP_TO_EDGE),a.wrapS===J&&a.wrapT===J||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(n,e.TEXTURE_MAG_FILTER,C(a.magFilter)),e.texParameteri(n,e.TEXTURE_MIN_FILTER,C(a.minFilter)),a.minFilter!==Q&&a.minFilter!==te&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),a.compareFunction&&(e.texParameteri(n,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,O[a.compareFunction])),!0===t.has("EXT_texture_filter_anisotropic")){var s=t.get("EXT_texture_filter_anisotropic");if(a.magFilter===Q)return;if(a.minFilter!==ee&&a.minFilter!==ie)return;if(a.type===re&&!1===t.has("OES_texture_float_linear"))return;if(!1===d&&a.type===ae&&!1===t.has("OES_texture_half_float_linear"))return;(a.anisotropy>1||i.get(a).__currentAnisotropy)&&(e.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy)}}function z(t,n){var i=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",L));var r=n.source,a=x.get(r);void 0===a&&(a={},x.set(r,a));var s=function(e){var t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.colorSpace),t.join()}(n);if(s!==t.__cacheKey){void 0===a[s]&&(a[s]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,i=!0),a[s].usedTimes++;var l=a[t.__cacheKey];void 0!==l&&(a[t.__cacheKey].usedTimes--,0===l.usedTimes&&k(n)),t.__cacheKey=s,t.__webglTexture=a[s].texture}return i}function B(t,r,o){var s=e.TEXTURE_2D;(r.isDataArrayTexture||r.isCompressedArrayTexture)&&(s=e.TEXTURE_2D_ARRAY),r.isData3DTexture&&(s=e.TEXTURE_3D);var l=z(t,r),u=r.source;n.bindTexture(s,t.__webglTexture,e.TEXTURE0+o);var c=i.get(u);if(u.version!==c.__version||!0===l){n.activeTexture(e.TEXTURE0+o),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,r.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,r.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE);var h,f=function(e){return!d&&(e.wrapS!==J||e.wrapT!==J||e.minFilter!==Q&&e.minFilter!==te)}(r)&&!1===E(r.image),p=b(r.image,f,!1,v),m=E(p=j(r,p))||d,g=a.convert(r.format,r.colorSpace),y=a.convert(r.type),_=A(r.internalFormat,g,y,r.colorSpace);F(s,r,m);var x=r.mipmaps,M=d&&!0!==r.isVideoTexture,S=void 0===c.__version||!0===l,C=R(r,p,m);if(r.isDepthTexture)_=e.DEPTH_COMPONENT,d?_=r.type===re?e.DEPTH_COMPONENT32F:1014===r.type?e.DEPTH_COMPONENT24:r.type===oe?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT16:r.type===re&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),1026===r.format&&_===e.DEPTH_COMPONENT&&1012!==r.type&&1014!==r.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=1014,y=a.convert(r.type)),r.format===le&&_===e.DEPTH_COMPONENT&&(_=e.DEPTH_STENCIL,r.type!==oe&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=oe,y=a.convert(r.type))),S&&(M?n.texStorage2D(e.TEXTURE_2D,1,_,p.width,p.height):n.texImage2D(e.TEXTURE_2D,0,_,p.width,p.height,0,g,y,null));else if(r.isDataTexture)if(x.length>0&&m){M&&S&&n.texStorage2D(e.TEXTURE_2D,C,_,x[0].width,x[0].height);for(var L=0,P=x.length;L<P;L++)h=x[L],M?n.texSubImage2D(e.TEXTURE_2D,L,0,0,h.width,h.height,g,y,h.data):n.texImage2D(e.TEXTURE_2D,L,_,h.width,h.height,0,g,y,h.data);r.generateMipmaps=!1}else M?(S&&n.texStorage2D(e.TEXTURE_2D,C,_,p.width,p.height),n.texSubImage2D(e.TEXTURE_2D,0,0,0,p.width,p.height,g,y,p.data)):n.texImage2D(e.TEXTURE_2D,0,_,p.width,p.height,0,g,y,p.data);else if(r.isCompressedTexture)if(r.isCompressedArrayTexture){M&&S&&n.texStorage3D(e.TEXTURE_2D_ARRAY,C,_,x[0].width,x[0].height,p.depth);for(var k=0,U=x.length;k<U;k++)h=x[k],r.format!==se?null!==g?M?n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,k,0,0,0,h.width,h.height,p.depth,g,h.data,0,0):n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,k,_,h.width,h.height,p.depth,0,h.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):M?n.texSubImage3D(e.TEXTURE_2D_ARRAY,k,0,0,0,h.width,h.height,p.depth,g,y,h.data):n.texImage3D(e.TEXTURE_2D_ARRAY,k,_,h.width,h.height,p.depth,0,g,y,h.data)}else{M&&S&&n.texStorage2D(e.TEXTURE_2D,C,_,x[0].width,x[0].height);for(var I=0,N=x.length;I<N;I++)h=x[I],r.format!==se?null!==g?M?n.compressedTexSubImage2D(e.TEXTURE_2D,I,0,0,h.width,h.height,g,h.data):n.compressedTexImage2D(e.TEXTURE_2D,I,_,h.width,h.height,0,h.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):M?n.texSubImage2D(e.TEXTURE_2D,I,0,0,h.width,h.height,g,y,h.data):n.texImage2D(e.TEXTURE_2D,I,_,h.width,h.height,0,g,y,h.data)}else if(r.isDataArrayTexture)M?(S&&n.texStorage3D(e.TEXTURE_2D_ARRAY,C,_,p.width,p.height,p.depth),n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,p.width,p.height,p.depth,g,y,p.data)):n.texImage3D(e.TEXTURE_2D_ARRAY,0,_,p.width,p.height,p.depth,0,g,y,p.data);else if(r.isData3DTexture)M?(S&&n.texStorage3D(e.TEXTURE_3D,C,_,p.width,p.height,p.depth),n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,p.width,p.height,p.depth,g,y,p.data)):n.texImage3D(e.TEXTURE_3D,0,_,p.width,p.height,p.depth,0,g,y,p.data);else if(r.isFramebufferTexture){if(S)if(M)n.texStorage2D(e.TEXTURE_2D,C,_,p.width,p.height);else for(var D=p.width,O=p.height,B=0;B<C;B++)n.texImage2D(e.TEXTURE_2D,B,_,D,O,0,g,y,null),D>>=1,O>>=1}else if(x.length>0&&m){M&&S&&n.texStorage2D(e.TEXTURE_2D,C,_,x[0].width,x[0].height);for(var H=0,V=x.length;H<V;H++)h=x[H],M?n.texSubImage2D(e.TEXTURE_2D,H,0,0,g,y,h):n.texImage2D(e.TEXTURE_2D,H,_,g,y,h);r.generateMipmaps=!1}else M?(S&&n.texStorage2D(e.TEXTURE_2D,C,_,p.width,p.height),n.texSubImage2D(e.TEXTURE_2D,0,0,0,g,y,p)):n.texImage2D(e.TEXTURE_2D,0,_,g,y,p);T(r,m)&&w(s),c.__version=u.version,r.onUpdate&&r.onUpdate(r)}t.__version=r.version}function H(t,r,o,s,l,u){var c=a.convert(o.format,o.colorSpace),h=a.convert(o.type),d=A(o.internalFormat,c,h,o.colorSpace);if(!i.get(r).__hasExternalTextures){var f=Math.max(1,r.width>>u),p=Math.max(1,r.height>>u);l===e.TEXTURE_3D||l===e.TEXTURE_2D_ARRAY?n.texImage3D(l,u,d,f,p,r.depth,0,c,h,null):n.texImage2D(l,u,d,f,p,0,c,h,null)}n.bindFramebuffer(e.FRAMEBUFFER,t),X(r)?g.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,s,l,i.get(o).__webglTexture,0,W(r)):(l===e.TEXTURE_2D||l>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&l<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,s,l,i.get(o).__webglTexture,u),n.bindFramebuffer(e.FRAMEBUFFER,null)}function V(t,n,i){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer&&!n.stencilBuffer){var r=e.DEPTH_COMPONENT16;if(i||X(n)){var o=n.depthTexture;o&&o.isDepthTexture&&(o.type===re?r=e.DEPTH_COMPONENT32F:1014===o.type&&(r=e.DEPTH_COMPONENT24));var s=W(n);X(n)?g.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,s,r,n.width,n.height):e.renderbufferStorageMultisample(e.RENDERBUFFER,s,r,n.width,n.height)}else e.renderbufferStorage(e.RENDERBUFFER,r,n.width,n.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t)}else if(n.depthBuffer&&n.stencilBuffer){var l=W(n);i&&!1===X(n)?e.renderbufferStorageMultisample(e.RENDERBUFFER,l,e.DEPTH24_STENCIL8,n.width,n.height):X(n)?g.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,l,e.DEPTH24_STENCIL8,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t)}else for(var u=!0===n.isWebGLMultipleRenderTargets?n.texture:[n.texture],c=0;c<u.length;c++){var h=u[c],d=a.convert(h.format,h.colorSpace),f=a.convert(h.type),p=A(h.internalFormat,d,f,h.colorSpace),v=W(n);i&&!1===X(n)?e.renderbufferStorageMultisample(e.RENDERBUFFER,v,p,n.width,n.height):X(n)?g.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,v,p,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,p,n.width,n.height)}e.bindRenderbuffer(e.RENDERBUFFER,null)}function G(t){var r=i.get(t),a=!0===t.isWebGLCubeRenderTarget;if(t.depthTexture&&!r.__autoAllocateDepthBuffer){if(a)throw new Error("target.depthTexture not supported in Cube render targets");!function(t,r){if(r&&r.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(e.FRAMEBUFFER,t),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");i.get(r.depthTexture).__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),I(r.depthTexture,0);var a=i.get(r.depthTexture).__webglTexture,o=W(r);if(1026===r.depthTexture.format)X(r)?g.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,a,0,o):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,a,0);else{if(r.depthTexture.format!==le)throw new Error("Unknown depthTexture format");X(r)?g.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,a,0,o):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,a,0)}}(r.__webglFramebuffer,t)}else if(a){r.__webglDepthbuffer=[];for(var o=0;o<6;o++)n.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer[o]),r.__webglDepthbuffer[o]=e.createRenderbuffer(),V(r.__webglDepthbuffer[o],t,!1)}else n.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer),r.__webglDepthbuffer=e.createRenderbuffer(),V(r.__webglDepthbuffer,t,!1);n.bindFramebuffer(e.FRAMEBUFFER,null)}function W(e){return Math.min(m,e.samples)}function X(e){var n=i.get(e);return d&&e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function j(e,n){var i=e.colorSpace,r=e.format,a=e.type;return!0===e.isCompressedTexture||1035===e.format||i!==me&&i!==pe&&(i===ve?!1===d?!0===t.has("EXT_sRGB")&&r===se?(e.format=1035,e.minFilter=te,e.generateMipmaps=!1):n=je.sRGBToLinear(n):r===se&&1009===a||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",i)),n}this.allocateTextureUnit=function(){var e=U;return e>=f&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+f),U+=1,e},this.resetTextureUnits=function(){U=0},this.setTexture2D=I,this.setTexture2DArray=function(t,r){var a=i.get(t);t.version>0&&a.__version!==t.version?B(a,t,r):n.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+r)},this.setTexture3D=function(t,r){var a=i.get(t);t.version>0&&a.__version!==t.version?B(a,t,r):n.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+r)},this.setTextureCube=function(t,r){var o=i.get(t);t.version>0&&o.__version!==t.version?function(t,r,o){if(6===r.image.length){var s=z(t,r),l=r.source;n.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+o);var u=i.get(l);if(l.version!==u.__version||!0===s){n.activeTexture(e.TEXTURE0+o),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,r.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,r.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE);for(var c=r.isCompressedTexture||r.image[0].isCompressedTexture,h=r.image[0]&&r.image[0].isDataTexture,f=[],v=0;v<6;v++)f[v]=c||h?h?r.image[v].image:r.image[v]:b(r.image[v],!1,!0,p),f[v]=j(r,f[v]);var m,g=f[0],y=E(g)||d,_=a.convert(r.format,r.colorSpace),x=a.convert(r.type),M=A(r.internalFormat,_,x,r.colorSpace),S=d&&!0!==r.isVideoTexture,C=void 0===u.__version||!0===s,L=R(r,g,y);if(F(e.TEXTURE_CUBE_MAP,r,y),c){S&&C&&n.texStorage2D(e.TEXTURE_CUBE_MAP,L,M,g.width,g.height);for(var P=0;P<6;P++){m=f[P].mipmaps;for(var k=0;k<m.length;k++){var U=m[k];r.format!==se?null!==_?S?n.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+P,k,0,0,U.width,U.height,_,U.data):n.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+P,k,M,U.width,U.height,0,U.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):S?n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+P,k,0,0,U.width,U.height,_,x,U.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+P,k,M,U.width,U.height,0,_,x,U.data)}}}else{m=r.mipmaps,S&&C&&(m.length>0&&L++,n.texStorage2D(e.TEXTURE_CUBE_MAP,L,M,f[0].width,f[0].height));for(var I=0;I<6;I++)if(h){S?n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+I,0,0,0,f[I].width,f[I].height,_,x,f[I].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+I,0,M,f[I].width,f[I].height,0,_,x,f[I].data);for(var N=0;N<m.length;N++){var D=m[N].image[I].image;S?n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+I,N+1,0,0,D.width,D.height,_,x,D.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+I,N+1,M,D.width,D.height,0,_,x,D.data)}}else{S?n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+I,0,0,0,_,x,f[I]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+I,0,M,_,x,f[I]);for(var O=0;O<m.length;O++){var B=m[O];S?n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+I,O+1,0,0,_,x,B.image[I]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+I,O+1,M,_,x,B.image[I])}}}T(r,y)&&w(e.TEXTURE_CUBE_MAP),u.__version=l.version,r.onUpdate&&r.onUpdate(r)}t.__version=r.version}}(o,t,r):n.bindTexture(e.TEXTURE_CUBE_MAP,o.__webglTexture,e.TEXTURE0+r)},this.rebindTextures=function(t,n,r){var a=i.get(t);void 0!==n&&H(a.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),void 0!==r&&G(t)},this.setupRenderTarget=function(t){var s=t.texture,l=i.get(t),u=i.get(s);t.addEventListener("dispose",P),!0!==t.isWebGLMultipleRenderTargets&&(void 0===u.__webglTexture&&(u.__webglTexture=e.createTexture()),u.__version=s.version,o.memory.textures++);var c=!0===t.isWebGLCubeRenderTarget,h=!0===t.isWebGLMultipleRenderTargets,f=E(t)||d;if(c){l.__webglFramebuffer=[];for(var p=0;p<6;p++)if(d&&s.mipmaps&&s.mipmaps.length>0){l.__webglFramebuffer[p]=[];for(var v=0;v<s.mipmaps.length;v++)l.__webglFramebuffer[p][v]=e.createFramebuffer()}else l.__webglFramebuffer[p]=e.createFramebuffer()}else{if(d&&s.mipmaps&&s.mipmaps.length>0){l.__webglFramebuffer=[];for(var m=0;m<s.mipmaps.length;m++)l.__webglFramebuffer[m]=e.createFramebuffer()}else l.__webglFramebuffer=e.createFramebuffer();if(h)if(r.drawBuffers)for(var g=t.texture,y=0,_=g.length;y<_;y++){var x=i.get(g[y]);void 0===x.__webglTexture&&(x.__webglTexture=e.createTexture(),o.memory.textures++)}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(d&&t.samples>0&&!1===X(t)){var M=h?s:[s];l.__webglMultisampledFramebuffer=e.createFramebuffer(),l.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,l.__webglMultisampledFramebuffer);for(var S=0;S<M.length;S++){var b=M[S];l.__webglColorRenderbuffer[S]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,l.__webglColorRenderbuffer[S]);var R=a.convert(b.format,b.colorSpace),C=a.convert(b.type),L=A(b.internalFormat,R,C,b.colorSpace,!0===t.isXRRenderTarget),k=W(t);e.renderbufferStorageMultisample(e.RENDERBUFFER,k,L,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+S,e.RENDERBUFFER,l.__webglColorRenderbuffer[S])}e.bindRenderbuffer(e.RENDERBUFFER,null),t.depthBuffer&&(l.__webglDepthRenderbuffer=e.createRenderbuffer(),V(l.__webglDepthRenderbuffer,t,!0)),n.bindFramebuffer(e.FRAMEBUFFER,null)}}if(c){n.bindTexture(e.TEXTURE_CUBE_MAP,u.__webglTexture),F(e.TEXTURE_CUBE_MAP,s,f);for(var U=0;U<6;U++)if(d&&s.mipmaps&&s.mipmaps.length>0)for(var I=0;I<s.mipmaps.length;I++)H(l.__webglFramebuffer[U][I],t,s,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+U,I);else H(l.__webglFramebuffer[U],t,s,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+U,0);T(s,f)&&w(e.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(h){for(var N=t.texture,D=0,O=N.length;D<O;D++){var z=N[D],B=i.get(z);n.bindTexture(e.TEXTURE_2D,B.__webglTexture),F(e.TEXTURE_2D,z,f),H(l.__webglFramebuffer,t,z,e.COLOR_ATTACHMENT0+D,e.TEXTURE_2D,0),T(z,f)&&w(e.TEXTURE_2D)}n.unbindTexture()}else{var j=e.TEXTURE_2D;if((t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(d?j=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),n.bindTexture(j,u.__webglTexture),F(j,s,f),d&&s.mipmaps&&s.mipmaps.length>0)for(var Y=0;Y<s.mipmaps.length;Y++)H(l.__webglFramebuffer[Y],t,s,e.COLOR_ATTACHMENT0,j,Y);else H(l.__webglFramebuffer,t,s,e.COLOR_ATTACHMENT0,j,0);T(s,f)&&w(j),n.unbindTexture()}t.depthBuffer&&G(t)},this.updateRenderTargetMipmap=function(t){for(var r=E(t)||d,a=!0===t.isWebGLMultipleRenderTargets?t.texture:[t.texture],o=0,s=a.length;o<s;o++){var l=a[o];if(T(l,r)){var u=t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:e.TEXTURE_2D,c=i.get(l).__webglTexture;n.bindTexture(u,c),w(u),n.unbindTexture()}}},this.updateMultisampleRenderTarget=function(t){if(d&&t.samples>0&&!1===X(t)){var r=t.isWebGLMultipleRenderTargets?t.texture:[t.texture],a=t.width,o=t.height,s=e.COLOR_BUFFER_BIT,l=[],u=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,c=i.get(t),h=!0===t.isWebGLMultipleRenderTargets;if(h)for(var f=0;f<r.length;f++)n.bindFramebuffer(e.FRAMEBUFFER,c.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+f,e.RENDERBUFFER,null),n.bindFramebuffer(e.FRAMEBUFFER,c.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+f,e.TEXTURE_2D,null,0);n.bindFramebuffer(e.READ_FRAMEBUFFER,c.__webglMultisampledFramebuffer),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglFramebuffer);for(var p=0;p<r.length;p++){l.push(e.COLOR_ATTACHMENT0+p),t.depthBuffer&&l.push(u);var v=void 0!==c.__ignoreDepthValues&&c.__ignoreDepthValues;if(!1===v&&(t.depthBuffer&&(s|=e.DEPTH_BUFFER_BIT),t.stencilBuffer&&(s|=e.STENCIL_BUFFER_BIT)),h&&e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,c.__webglColorRenderbuffer[p]),!0===v&&(e.invalidateFramebuffer(e.READ_FRAMEBUFFER,[u]),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[u])),h){var m=i.get(r[p]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,m,0)}e.blitFramebuffer(0,0,a,o,0,0,a,o,s,e.NEAREST),y&&e.invalidateFramebuffer(e.READ_FRAMEBUFFER,l)}if(n.bindFramebuffer(e.READ_FRAMEBUFFER,null),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),h)for(var g=0;g<r.length;g++){n.bindFramebuffer(e.FRAMEBUFFER,c.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+g,e.RENDERBUFFER,c.__webglColorRenderbuffer[g]);var _=i.get(r[g]).__webglTexture;n.bindFramebuffer(e.FRAMEBUFFER,c.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+g,e.TEXTURE_2D,_,0)}n.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=G,this.setupFrameBufferTexture=H,this.useMultisampledRTT=X}function Ya(e,t,n){var i=n.isWebGL2;return{convert:function(n){var r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:pe;if(1009===n)return e.UNSIGNED_BYTE;if(1017===n)return e.UNSIGNED_SHORT_4_4_4_4;if(1018===n)return e.UNSIGNED_SHORT_5_5_5_1;if(1010===n)return e.BYTE;if(1011===n)return e.SHORT;if(1012===n)return e.UNSIGNED_SHORT;if(1013===n)return e.INT;if(1014===n)return e.UNSIGNED_INT;if(n===re)return e.FLOAT;if(n===ae)return i?e.HALF_FLOAT:null!==(r=t.get("OES_texture_half_float"))?r.HALF_FLOAT_OES:null;if(1021===n)return e.ALPHA;if(n===se)return e.RGBA;if(1024===n)return e.LUMINANCE;if(1025===n)return e.LUMINANCE_ALPHA;if(1026===n)return e.DEPTH_COMPONENT;if(n===le)return e.DEPTH_STENCIL;if(1035===n)return null!==(r=t.get("EXT_sRGB"))?r.SRGB_ALPHA_EXT:null;if(n===ue)return e.RED;if(1029===n)return e.RED_INTEGER;if(n===ce)return e.RG;if(1031===n)return e.RG_INTEGER;if(1033===n)return e.RGBA_INTEGER;if(33776===n||33777===n||33778===n||33779===n)if(a===ve){if(null===(r=t.get("WEBGL_compressed_texture_s3tc_srgb")))return null;if(33776===n)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(33777===n)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(33778===n)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(33779===n)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(null===(r=t.get("WEBGL_compressed_texture_s3tc")))return null;if(33776===n)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===n)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===n)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===n)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===n||35841===n||35842===n||35843===n){if(null===(r=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(35840===n)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===n)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===n)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===n)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===n)return null!==(r=t.get("WEBGL_compressed_texture_etc1"))?r.COMPRESSED_RGB_ETC1_WEBGL:null;if(37492===n||37496===n){if(null===(r=t.get("WEBGL_compressed_texture_etc")))return null;if(37492===n)return a===ve?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(37496===n)return a===ve?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}if(37808===n||37809===n||37810===n||37811===n||37812===n||37813===n||37814===n||37815===n||37816===n||37817===n||37818===n||37819===n||37820===n||37821===n){if(null===(r=t.get("WEBGL_compressed_texture_astc")))return null;if(37808===n)return a===ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(37809===n)return a===ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(37810===n)return a===ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(37811===n)return a===ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(37812===n)return a===ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(37813===n)return a===ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(37814===n)return a===ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(37815===n)return a===ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(37816===n)return a===ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(37817===n)return a===ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(37818===n)return a===ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(37819===n)return a===ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(37820===n)return a===ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(37821===n)return a===ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}if(36492===n){if(null===(r=t.get("EXT_texture_compression_bptc")))return null;if(36492===n)return a===ve?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT}if(36283===n||36284===n||36285===n||36286===n){if(null===(r=t.get("EXT_texture_compression_rgtc")))return null;if(36492===n)return r.COMPRESSED_RED_RGTC1_EXT;if(36284===n)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(36285===n)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(36286===n)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return n===oe?i?e.UNSIGNED_INT_24_8:null!==(r=t.get("WEBGL_depth_texture"))?r.UNSIGNED_INT_24_8_WEBGL:null:void 0!==e[n]?e[n]:null}}}var qa=function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return a(this,n),(e=t.call(this)).isArrayCamera=!0,e.cameras=i,e}return s(n)}(vi),Za=e("U",function(e){u(n,e);var t=g(n);function n(){var e;return a(this,n),(e=t.call(this)).isGroup=!0,e.type="Group",e}return s(n)}(an)),Ja={type:"move"},Ka=function(){function e(){a(this,e),this._targetRay=null,this._grip=null,this._hand=null}return s(e,[{key:"getHandSpace",value:function(){return null===this._hand&&(this._hand=new Za,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}},{key:"getTargetRaySpace",value:function(){return null===this._targetRay&&(this._targetRay=new Za,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new it,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new it),this._targetRay}},{key:"getGripSpace",value:function(){return null===this._grip&&(this._grip=new Za,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new it,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new it),this._grip}},{key:"dispatchEvent",value:function(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}},{key:"connect",value:function(e){if(e&&e.hand){var t=this._hand;if(t){var n,i=E(e.hand.values());try{for(i.s();!(n=i.n()).done;){var r=n.value;this._getHandJoint(t,r)}}catch(e){i.e(e)}finally{i.f()}}}return this.dispatchEvent({type:"connected",data:e}),this}},{key:"disconnect",value:function(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}},{key:"update",value:function(e,t,n){var i=null,r=null,a=null,o=this._targetRay,s=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(l&&e.hand){a=!0;var u,c=E(e.hand.values());try{for(c.s();!(u=c.n()).done;){var h=u.value,d=t.getJointPose(h,n),f=this._getHandJoint(l,h);null!==d&&(f.matrix.fromArray(d.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,f.jointRadius=d.radius),f.visible=null!==d}}catch(e){c.e(e)}finally{c.f()}var p=l.joints["index-finger-tip"],v=l.joints["thumb-tip"],m=p.position.distanceTo(v.position);l.inputState.pinching&&m>.025?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&m<=.015&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==s&&e.gripSpace&&null!==(r=t.getPose(e.gripSpace,n))&&(s.matrix.fromArray(r.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,r.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(r.linearVelocity)):s.hasLinearVelocity=!1,r.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(r.angularVelocity)):s.hasAngularVelocity=!1);null!==o&&(null===(i=t.getPose(e.targetRaySpace,n))&&null!==r&&(i=r),null!==i&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Ja)))}return null!==o&&(o.visible=null!==i),null!==s&&(s.visible=null!==r),null!==l&&(l.visible=null!==a),this}},{key:"_getHandJoint",value:function(e,t){if(void 0===e.joints[t.jointName]){var n=new Za;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}]),e}(),Qa=e("bc",function(e){u(n,e);var t=g(n);function n(e,i,r,o,s,l,u,c,h,d){var f;if(a(this,n),1026!==(d=void 0!==d?d:1026)&&d!==le)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");return void 0===r&&1026===d&&(r=1014),void 0===r&&d===le&&(r=oe),(f=t.call(this,null,o,s,l,u,c,d,r,h)).isDepthTexture=!0,f.image={width:e,height:i},f.magFilter=void 0!==u?u:Q,f.minFilter=void 0!==c?c:Q,f.flipY=!1,f.generateMipmaps=!1,f.compareFunction=null,f}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.compareFunction=e.compareFunction,this}},{key:"toJSON",value:function(e){var t=_(c(n.prototype),"toJSON",this).call(this,e);return null!==this.compareFunction&&(t.compareFunction=this.compareFunction),t}}]),n}(Ke)),$a=function(e){u(i,e);var t=g(i);function i(e,o){var s;a(this,i);var l=v(s=t.call(this)),u=null,c=1,h=null,d="local-floor",f=1,p=null,m=null,g=null,y=null,_=null,x=null,M=o.getContextAttributes(),S=null,b=null,E=[],T=[],w=new vi;w.layers.enable(1),w.viewport=new Qe;var A=new vi;A.layers.enable(2),A.viewport=new Qe;var R=[w,A],C=new qa;C.layers.enable(1),C.layers.enable(2);var L=null,P=null;function k(e){var t=T.indexOf(e.inputSource);if(-1!==t){var n=E[t];void 0!==n&&(n.update(e.inputSource,e.frame,p||h),n.dispatchEvent({type:e.type,data:e.inputSource}))}}function U(){u.removeEventListener("select",k),u.removeEventListener("selectstart",k),u.removeEventListener("selectend",k),u.removeEventListener("squeeze",k),u.removeEventListener("squeezestart",k),u.removeEventListener("squeezeend",k),u.removeEventListener("end",U),u.removeEventListener("inputsourceschange",I);for(var t=0;t<E.length;t++){var n=T[t];null!==n&&(T[t]=null,E[t].disconnect(n))}L=null,P=null,e.setRenderTarget(S),_=null,y=null,g=null,u=null,b=null,z.stop(),l.isPresenting=!1,l.dispatchEvent({type:"sessionend"})}function I(e){for(var t=0;t<e.removed.length;t++){var n=e.removed[t],i=T.indexOf(n);i>=0&&(T[i]=null,E[i].disconnect(n))}for(var r=0;r<e.added.length;r++){var a=e.added[r],o=T.indexOf(a);if(-1===o){for(var s=0;s<E.length;s++){if(s>=T.length){T.push(a),o=s;break}if(null===T[s]){T[s]=a,o=s;break}}if(-1===o)break}var l=E[o];l&&l.connect(a)}}s.cameraAutoUpdate=!0,s.enabled=!1,s.isPresenting=!1,s.getController=function(e){var t=E[e];return void 0===t&&(t=new Ka,E[e]=t),t.getTargetRaySpace()},s.getControllerGrip=function(e){var t=E[e];return void 0===t&&(t=new Ka,E[e]=t),t.getGripSpace()},s.getHand=function(e){var t=E[e];return void 0===t&&(t=new Ka,E[e]=t),t.getHandSpace()},s.setFramebufferScaleFactor=function(e){c=e,!0===l.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},s.setReferenceSpaceType=function(e){d=e,!0===l.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},s.getReferenceSpace=function(){return p||h},s.setReferenceSpace=function(e){p=e},s.getBaseLayer=function(){return null!==y?y:_},s.getBinding=function(){return g},s.getFrame=function(){return x},s.getSession=function(){return u},s.setSession=function(){var t,i=(t=n().mark((function t(i){var r,a,s,v,m;return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null===(u=i)){t.next=25;break}if(S=e.getRenderTarget(),u.addEventListener("select",k),u.addEventListener("selectstart",k),u.addEventListener("selectend",k),u.addEventListener("squeeze",k),u.addEventListener("squeezestart",k),u.addEventListener("squeezeend",k),u.addEventListener("end",U),u.addEventListener("inputsourceschange",I),!0===M.xrCompatible){t.next=14;break}return t.next=14,o.makeXRCompatible();case 14:return void 0===u.renderState.layers||!1===e.capabilities.isWebGL2?(r={antialias:void 0!==u.renderState.layers||M.antialias,alpha:!0,depth:M.depth,stencil:M.stencil,framebufferScaleFactor:c},_=new XRWebGLLayer(u,o,r),u.updateRenderState({baseLayer:_}),b=new $e(_.framebufferWidth,_.framebufferHeight,{format:se,type:1009,colorSpace:e.outputColorSpace,stencilBuffer:M.stencil})):(a=null,s=null,v=null,M.depth&&(v=M.stencil?o.DEPTH24_STENCIL8:o.DEPTH_COMPONENT24,a=M.stencil?le:1026,s=M.stencil?oe:1014),m={colorFormat:o.RGBA8,depthFormat:v,scaleFactor:c},g=new XRWebGLBinding(u,o),y=g.createProjectionLayer(m),u.updateRenderState({layers:[y]}),b=new $e(y.textureWidth,y.textureHeight,{format:se,type:1009,depthTexture:new Qa(y.textureWidth,y.textureHeight,s,void 0,void 0,void 0,void 0,void 0,void 0,a),stencilBuffer:M.stencil,colorSpace:e.outputColorSpace,samples:M.antialias?4:0}),e.properties.get(b).__ignoreDepthValues=y.ignoreDepthValues),b.isXRRenderTarget=!0,this.setFoveation(f),p=null,t.next=20,u.requestReferenceSpace(d);case 20:h=t.sent,z.setContext(u),z.start(),l.isPresenting=!0,l.dispatchEvent({type:"sessionstart"});case 25:case"end":return t.stop()}}),t,this)})),function(){var e=this,n=arguments;return new Promise((function(i,a){var o=t.apply(e,n);function s(e){r(o,i,a,s,l,"next",e)}function l(e){r(o,i,a,s,l,"throw",e)}s(void 0)}))});return function(e){return i.apply(this,arguments)}}(),s.getEnvironmentBlendMode=function(){if(null!==u)return u.environmentBlendMode};var N=new it,D=new it;function O(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}s.updateCamera=function(e){if(null!==u){C.near=A.near=w.near=e.near,C.far=A.far=w.far=e.far,L===C.near&&P===C.far||(u.updateRenderState({depthNear:C.near,depthFar:C.far}),L=C.near,P=C.far);var t=e.parent,n=C.cameras;O(C,t);for(var i=0;i<n.length;i++)O(n[i],t);2===n.length?function(e,t,n){N.setFromMatrixPosition(t.matrixWorld),D.setFromMatrixPosition(n.matrixWorld);var i=N.distanceTo(D),r=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=r[14]/(r[10]-1),s=r[14]/(r[10]+1),l=(r[9]+1)/r[5],u=(r[9]-1)/r[5],c=(r[8]-1)/r[0],h=(a[8]+1)/a[0],d=o*c,f=o*h,p=i/(-c+h),v=p*-c;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(v),e.translateZ(p),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert();var m=o+p,g=s+p,y=d-v,_=f+(i-v),x=l*s/g*m,M=u*s/g*m;e.projectionMatrix.makePerspective(y,_,x,M,m,g),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}(C,w,A):C.projectionMatrix.copy(w.projectionMatrix),function(e,t,n){null===n?e.matrix.copy(t.matrixWorld):(e.matrix.copy(n.matrixWorld),e.matrix.invert(),e.matrix.multiply(t.matrixWorld)),e.matrix.decompose(e.position,e.quaternion,e.scale),e.updateMatrixWorld(!0);for(var i=e.children,r=0,a=i.length;r<a;r++)i[r].updateMatrixWorld(!0);e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse),e.isPerspectiveCamera&&(e.fov=2*Me*Math.atan(1/e.projectionMatrix.elements[5]),e.zoom=1)}(e,C,t)}},s.getCamera=function(){return C},s.getFoveation=function(){if(null!==y||null!==_)return f},s.setFoveation=function(e){f=e,null!==y&&(y.fixedFoveation=e),null!==_&&void 0!==_.fixedFoveation&&(_.fixedFoveation=e)};var F=null,z=new wi;return z.setAnimationLoop((function(t,n){if(m=n.getViewerPose(p||h),x=n,null!==m){var i=m.views;null!==_&&(e.setRenderTargetFramebuffer(b,_.framebuffer),e.setRenderTarget(b));var r=!1;i.length!==C.cameras.length&&(C.cameras.length=0,r=!0);for(var a=0;a<i.length;a++){var o=i[a],s=null;if(null!==_)s=_.getViewport(o);else{var u=g.getViewSubImage(y,o);s=u.viewport,0===a&&(e.setRenderTargetTextures(b,u.colorTexture,y.ignoreDepthValues?void 0:u.depthStencilTexture),e.setRenderTarget(b))}var c=R[a];void 0===c&&((c=new vi).layers.enable(a),c.viewport=new Qe,R[a]=c),c.matrix.fromArray(o.transform.matrix),c.matrix.decompose(c.position,c.quaternion,c.scale),c.projectionMatrix.fromArray(o.projectionMatrix),c.projectionMatrixInverse.copy(c.projectionMatrix).invert(),c.viewport.set(s.x,s.y,s.width,s.height),0===a&&(C.matrix.copy(c.matrix),C.matrix.decompose(C.position,C.quaternion,C.scale)),!0===r&&C.cameras.push(c)}}for(var d=0;d<E.length;d++){var f=T[d],v=E[d];null!==f&&void 0!==v&&v.update(f,n,p||h)}F&&F(t,n),n.detectedPlanes&&l.dispatchEvent({type:"planesdetected",data:n}),x=null})),s.setAnimationLoop=function(e){F=e},s.dispose=function(){},s}return s(i)}(ge);function eo(e,t){function n(e,t){!0===e.matrixAutoUpdate&&e.updateMatrix(),t.value.copy(e.matrix)}function i(i,r){i.opacity.value=r.opacity,r.color&&i.diffuse.value.copy(r.color),r.emissive&&i.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),r.map&&(i.map.value=r.map,n(r.map,i.mapTransform)),r.alphaMap&&(i.alphaMap.value=r.alphaMap,n(r.alphaMap,i.alphaMapTransform)),r.bumpMap&&(i.bumpMap.value=r.bumpMap,n(r.bumpMap,i.bumpMapTransform),i.bumpScale.value=r.bumpScale,r.side===k&&(i.bumpScale.value*=-1)),r.normalMap&&(i.normalMap.value=r.normalMap,n(r.normalMap,i.normalMapTransform),i.normalScale.value.copy(r.normalScale),r.side===k&&i.normalScale.value.negate()),r.displacementMap&&(i.displacementMap.value=r.displacementMap,n(r.displacementMap,i.displacementMapTransform),i.displacementScale.value=r.displacementScale,i.displacementBias.value=r.displacementBias),r.emissiveMap&&(i.emissiveMap.value=r.emissiveMap,n(r.emissiveMap,i.emissiveMapTransform)),r.specularMap&&(i.specularMap.value=r.specularMap,n(r.specularMap,i.specularMapTransform)),r.alphaTest>0&&(i.alphaTest.value=r.alphaTest);var a=t.get(r).envMap;if(a&&(i.envMap.value=a,i.flipEnvMap.value=a.isCubeTexture&&!1===a.isRenderTargetTexture?-1:1,i.reflectivity.value=r.reflectivity,i.ior.value=r.ior,i.refractionRatio.value=r.refractionRatio),r.lightMap){i.lightMap.value=r.lightMap;var o=!0===e._useLegacyLights?Math.PI:1;i.lightMapIntensity.value=r.lightMapIntensity*o,n(r.lightMap,i.lightMapTransform)}r.aoMap&&(i.aoMap.value=r.aoMap,i.aoMapIntensity.value=r.aoMapIntensity,n(r.aoMap,i.aoMapTransform))}return{refreshFogUniforms:function(t,n){n.color.getRGB(t.fogColor.value,hi(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)},refreshMaterialUniforms:function(e,r,a,o,s){r.isMeshBasicMaterial||r.isMeshLambertMaterial?i(e,r):r.isMeshToonMaterial?(i(e,r),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(e,r)):r.isMeshPhongMaterial?(i(e,r),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}(e,r)):r.isMeshStandardMaterial?(i(e,r),function(e,i){e.metalness.value=i.metalness,i.metalnessMap&&(e.metalnessMap.value=i.metalnessMap,n(i.metalnessMap,e.metalnessMapTransform)),e.roughness.value=i.roughness,i.roughnessMap&&(e.roughnessMap.value=i.roughnessMap,n(i.roughnessMap,e.roughnessMapTransform)),t.get(i).envMap&&(e.envMapIntensity.value=i.envMapIntensity)}(e,r),r.isMeshPhysicalMaterial&&function(e,t,i){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,n(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform))),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,n(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),t.side===k&&e.clearcoatNormalScale.value.negate())),t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,n(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform))),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=i.texture,e.transmissionSamplerSize.value.set(i.width,i.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,n(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,n(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,n(t.anisotropyMap,e.anisotropyMapTransform))),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,n(t.specularColorMap,e.specularColorMapTransform)),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,n(t.specularIntensityMap,e.specularIntensityMapTransform))}(e,r,s)):r.isMeshMatcapMaterial?(i(e,r),function(e,t){t.matcap&&(e.matcap.value=t.matcap)}(e,r)):r.isMeshDepthMaterial?i(e,r):r.isMeshDistanceMaterial?(i(e,r),function(e,n){var i=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(i.matrixWorld),e.nearDistance.value=i.shadow.camera.near,e.farDistance.value=i.shadow.camera.far}(e,r)):r.isMeshNormalMaterial?i(e,r):r.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform))}(e,r),r.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,r)):r.isPointsMaterial?function(e,t,i,r){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*i,e.scale.value=.5*r,t.map&&(e.map.value=t.map,n(t.map,e.uvTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,r,a,o):r.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,r):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function to(e,t,n,i){var r={},a={},o=[],s=n.isWebGL2?e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(e,t,n){var i=e.value;if(void 0===n[t]){if("number"==typeof i)n[t]=i;else{for(var r=Array.isArray(i)?i:[i],a=[],o=0;o<r.length;o++)a.push(r[o].clone());n[t]=a}return!0}if("number"==typeof i){if(n[t]!==i)return n[t]=i,!0}else for(var s=Array.isArray(n[t])?n[t]:[n[t]],l=Array.isArray(i)?i:[i],u=0;u<s.length;u++){var c=s[u];if(!1===c.equals(l[u]))return c.copy(l[u]),!0}return!1}function u(e){var t={boundary:0,storage:0};return"number"==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?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",e),t}function c(t){var n=t.target;n.removeEventListener("dispose",c);var i=o.indexOf(n.__bindingPointIndex);o.splice(i,1),e.deleteBuffer(r[n.id]),delete r[n.id],delete a[n.id]}return{bind:function(e,t){var n=t.program;i.uniformBlockBinding(e,n)},update:function(n,h){var d=r[n.id];void 0===d&&(function(e){for(var t=e.uniforms,n=0,i=0,r=0,a=t.length;r<a;r++){for(var o=t[r],s={boundary:0,storage:0},l=Array.isArray(o.value)?o.value:[o.value],c=0,h=l.length;c<h;c++){var d=u(l[c]);s.boundary+=d.boundary,s.storage+=d.storage}if(o.__data=new Float32Array(s.storage/Float32Array.BYTES_PER_ELEMENT),o.__offset=n,r>0){var f=16-(i=n%16);0!==i&&f-s.boundary<0&&(n+=16-i,o.__offset=n)}n+=s.storage}(i=n%16)>0&&(n+=16-i),e.__size=n,e.__cache={}}(n),d=function(t){var n=function(){for(var e=0;e<s;e++)if(-1===o.indexOf(e))return o.push(e),e;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();t.__bindingPointIndex=n;var i=e.createBuffer(),r=t.__size,a=t.usage;return e.bindBuffer(e.UNIFORM_BUFFER,i),e.bufferData(e.UNIFORM_BUFFER,r,a),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,n,i),i}(n),r[n.id]=d,n.addEventListener("dispose",c));var f=h.program;i.updateUBOMapping(n,f);var p=t.render.frame;a[n.id]!==p&&(function(t){var n=r[t.id],i=t.uniforms,a=t.__cache;e.bindBuffer(e.UNIFORM_BUFFER,n);for(var o=0,s=i.length;o<s;o++){var c=i[o];if(!0===l(c,o,a)){for(var h=c.__offset,d=Array.isArray(c.value)?c.value:[c.value],f=0,p=0;p<d.length;p++){var v=d[p],m=u(v);"number"==typeof v?(c.__data[0]=v,e.bufferSubData(e.UNIFORM_BUFFER,h+f,c.__data)):v.isMatrix3?(c.__data[0]=v.elements[0],c.__data[1]=v.elements[1],c.__data[2]=v.elements[2],c.__data[3]=v.elements[0],c.__data[4]=v.elements[3],c.__data[5]=v.elements[4],c.__data[6]=v.elements[5],c.__data[7]=v.elements[0],c.__data[8]=v.elements[6],c.__data[9]=v.elements[7],c.__data[10]=v.elements[8],c.__data[11]=v.elements[0]):(v.toArray(c.__data,f),f+=m.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(e.UNIFORM_BUFFER,h,c.__data)}}e.bindBuffer(e.UNIFORM_BUFFER,null)}(n),a[n.id]=p)},dispose:function(){for(var t in r)e.deleteBuffer(r[t]);o=[],r={},a={}}}}function no(){var e=Ne("canvas");return e.style.display="block",e}(function(e){u(n,e);var t=g(n);function n(){return a(this,n),t.apply(this,arguments)}return s(n)})(e("bG",function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a(this,e);var n,i=t.canvas,r=void 0===i?no():i,o=t.context,s=void 0===o?null:o,l=t.depth,u=void 0===l||l,c=t.stencil,h=void 0===c||c,d=t.alpha,f=void 0!==d&&d,p=t.antialias,v=void 0!==p&&p,m=t.premultipliedAlpha,g=void 0===m||m,y=t.preserveDrawingBuffer,_=void 0!==y&&y,x=t.powerPreference,M=void 0===x?"default":x,S=t.failIfMajorPerformanceCaveat,b=void 0!==S&&S;this.isWebGLRenderer=!0,n=null!==s?s.getContextAttributes().alpha:f;var E=new Uint32Array(4),T=new Int32Array(4),w=null,A=null,R=[],C=[];this.domElement=r,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.outputColorSpace=ve,this._useLegacyLights=!1,this.toneMapping=G,this.toneMappingExposure=1;var L=this,I=!1,N=0,D=0,O=null,F=-1,z=null,B=new Qe,H=new Qe,V=null,W=new En(0),X=0,j=r.width,Y=r.height,q=1,Z=null,J=null,K=new Qe(0,0,j,Y),Q=new Qe(0,0,j,Y),$=!1,ee=new Ti,te=!1,ne=!1,le=null,ue=new Ut,ce=new Pe,he=new it,de={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function fe(){return null===O?q:1}var pe,ge,ye,_e,xe,Me,Se,be,Ee,Te,we,Ae,Ce,Le,ke,Ue,Ie,Ne,De,Oe,Fe,ze,Be,He,Ve=s;function Ge(e,t){for(var n=0;n<e.length;n++){var i=e[n],a=r.getContext(i,t);if(null!==a)return a}return null}try{var We={alpha:!0,depth:u,stencil:h,antialias:v,premultipliedAlpha:g,preserveDrawingBuffer:_,powerPreference:M,failIfMajorPerformanceCaveat:b};if("setAttribute"in r&&r.setAttribute("data-engine","three.js r".concat("155")),r.addEventListener("webglcontextlost",qe,!1),r.addEventListener("webglcontextrestored",Ze,!1),r.addEventListener("webglcontextcreationerror",Je,!1),null===Ve){var Xe=["webgl2","webgl","experimental-webgl"];if(!0===L.isWebGL1Renderer&&Xe.shift(),null===(Ve=Ge(Xe,We)))throw Ge(Xe)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}"undefined"!=typeof WebGLRenderingContext&&Ve instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),void 0===Ve.getShaderPrecisionFormat&&(Ve.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}function je(){pe=new $i(Ve),ge=new Di(Ve,pe,t),pe.init(ge),ze=new Ya(Ve,pe,ge),ye=new Xa(Ve,pe,ge),_e=new nr(Ve),xe=new Pa,Me=new ja(Ve,pe,ye,xe,ge,ze,_e),Se=new Fi(L),be=new Qi(L),Ee=new Ai(Ve,ge),Be=new Ii(Ve,pe,Ee,ge),Te=new er(Ve,Ee,_e,Be),we=new or(Ve,Te,Ee,_e),De=new ar(Ve,ge,Me),Ue=new Oi(xe),Ae=new La(L,Se,be,pe,ge,Be,Ue),Ce=new eo(L,xe),Le=new Na,ke=new Ha(pe,ge),Ne=new Ui(L,Se,be,ye,we,n,g),Ie=new Wa(L,we,ge),He=new to(Ve,_e,ge,ye),Oe=new Ni(Ve,pe,_e,ge),Fe=new tr(Ve,pe,_e,ge),_e.programs=Ae.programs,L.capabilities=ge,L.extensions=pe,L.properties=xe,L.renderLists=Le,L.shadowMap=Ie,L.state=ye,L.info=_e}je();var Ye=new $a(L,Ve);function qe(e){e.preventDefault(),I=!0}function Ze(){I=!1;var e=_e.autoReset,t=Ie.enabled,n=Ie.autoUpdate,i=Ie.needsUpdate,r=Ie.type;je(),_e.autoReset=e,Ie.enabled=t,Ie.autoUpdate=n,Ie.needsUpdate=i,Ie.type=r}function Je(e){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function Ke(e){var t=e.target;t.removeEventListener("dispose",Ke),et(t)}function et(e){tt(e),xe.remove(e)}function tt(e){var t=xe.get(e).programs;void 0!==t&&(t.forEach((function(e){Ae.releaseProgram(e)})),e.isShaderMaterial&&Ae.releaseShaderCache(e))}this.xr=Ye,this.getContext=function(){return Ve},this.getContextAttributes=function(){return Ve.getContextAttributes()},this.forceContextLoss=function(){var e=pe.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){var e=pe.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return q},this.setPixelRatio=function(e){void 0!==e&&(q=e,this.setSize(j,Y,!1))},this.getSize=function(e){return e.set(j,Y)},this.setSize=function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];Ye.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(j=e,Y=t,r.width=Math.floor(e*q),r.height=Math.floor(t*q),!0===n&&(r.style.width=e+"px",r.style.height=t+"px"),this.setViewport(0,0,e,t))},this.getDrawingBufferSize=function(e){return e.set(j*q,Y*q).floor()},this.setDrawingBufferSize=function(e,t,n){j=e,Y=t,q=n,r.width=Math.floor(e*n),r.height=Math.floor(t*n),this.setViewport(0,0,e,t)},this.getCurrentViewport=function(e){return e.copy(B)},this.getViewport=function(e){return e.copy(K)},this.setViewport=function(e,t,n,i){e.isVector4?K.set(e.x,e.y,e.z,e.w):K.set(e,t,n,i),ye.viewport(B.copy(K).multiplyScalar(q).floor())},this.getScissor=function(e){return e.copy(Q)},this.setScissor=function(e,t,n,i){e.isVector4?Q.set(e.x,e.y,e.z,e.w):Q.set(e,t,n,i),ye.scissor(H.copy(Q).multiplyScalar(q).floor())},this.getScissorTest=function(){return $},this.setScissorTest=function(e){ye.setScissorTest($=e)},this.setOpaqueSort=function(e){Z=e},this.setTransparentSort=function(e){J=e},this.getClearColor=function(e){return e.copy(Ne.getClearColor())},this.setClearColor=function(){Ne.setClearColor.apply(Ne,arguments)},this.getClearAlpha=function(){return Ne.getClearAlpha()},this.setClearAlpha=function(){Ne.setClearAlpha.apply(Ne,arguments)},this.clear=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=0;if(e){var r=!1;if(null!==O){var a=O.texture.format;r=1033===a||1031===a||1029===a}if(r){var o=O.texture.type,s=1009===o||1014===o||1012===o||o===oe||1017===o||1018===o,l=Ne.getClearColor(),u=Ne.getClearAlpha(),c=l.r,h=l.g,d=l.b;s?(E[0]=c,E[1]=h,E[2]=d,E[3]=u,Ve.clearBufferuiv(Ve.COLOR,0,E)):(T[0]=c,T[1]=h,T[2]=d,T[3]=u,Ve.clearBufferiv(Ve.COLOR,0,T))}else i|=Ve.COLOR_BUFFER_BIT}t&&(i|=Ve.DEPTH_BUFFER_BIT),n&&(i|=Ve.STENCIL_BUFFER_BIT),Ve.clear(i)},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(){r.removeEventListener("webglcontextlost",qe,!1),r.removeEventListener("webglcontextrestored",Ze,!1),r.removeEventListener("webglcontextcreationerror",Je,!1),Le.dispose(),ke.dispose(),xe.dispose(),Se.dispose(),be.dispose(),we.dispose(),Be.dispose(),He.dispose(),Ae.dispose(),Ye.dispose(),Ye.removeEventListener("sessionstart",at),Ye.removeEventListener("sessionend",ot),le&&(le.dispose(),le=null),st.stop()},this.renderBufferDirect=function(e,t,n,i,r,a){null===t&&(t=de);var o=r.isMesh&&r.matrixWorld.determinant()<0,s=vt(e,t,n,i,r);ye.setMaterial(i,o);var l=n.index,u=1;if(!0===i.wireframe){if(void 0===(l=Te.getWireframeAttribute(n)))return;u=2}var c=n.drawRange,h=n.attributes.position,d=c.start*u,f=(c.start+c.count)*u;null!==a&&(d=Math.max(d,a.start*u),f=Math.min(f,(a.start+a.count)*u)),null!==l?(d=Math.max(d,0),f=Math.min(f,l.count)):null!=h&&(d=Math.max(d,0),f=Math.min(f,h.count));var p=f-d;if(!(p<0||p===1/0)){var v;Be.setup(r,i,s,n,l);var m=Oe;if(null!==l&&(v=Ee.get(l),(m=Fe).setIndex(v)),r.isMesh)!0===i.wireframe?(ye.setLineWidth(i.wireframeLinewidth*fe()),m.setMode(Ve.LINES)):m.setMode(Ve.TRIANGLES);else if(r.isLine){var g=i.linewidth;void 0===g&&(g=1),ye.setLineWidth(g*fe()),r.isLineSegments?m.setMode(Ve.LINES):r.isLineLoop?m.setMode(Ve.LINE_LOOP):m.setMode(Ve.LINE_STRIP)}else r.isPoints?m.setMode(Ve.POINTS):r.isSprite&&m.setMode(Ve.TRIANGLES);if(r.isInstancedMesh)m.renderInstances(d,p,r.count);else if(n.isInstancedBufferGeometry){var y=void 0!==n._maxInstanceCount?n._maxInstanceCount:1/0,_=Math.min(n.instanceCount,y);m.renderInstances(d,p,_)}else m.render(d,p)}},this.compile=function(e,t){function n(e,t,n){!0===e.transparent&&e.side===U&&!1===e.forceSinglePass?(e.side=k,e.needsUpdate=!0,ft(e,t,n),e.side=P,e.needsUpdate=!0,ft(e,t,n),e.side=U):ft(e,t,n)}(A=ke.get(e)).init(),C.push(A),e.traverseVisible((function(e){e.isLight&&e.layers.test(t.layers)&&(A.pushLight(e),e.castShadow&&A.pushShadow(e))})),A.setupLights(L._useLegacyLights),e.traverse((function(t){var i=t.material;if(i)if(Array.isArray(i))for(var r=0;r<i.length;r++)n(i[r],e,t);else n(i,e,t)})),C.pop(),A=null};var nt=null;function rt(e){nt&&nt(e)}function at(){st.stop()}function ot(){st.start()}var st=new wi;function lt(e,t,n,i){if(!1!==e.visible){if(e.layers.test(t.layers))if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)A.pushLight(e),e.castShadow&&A.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||ee.intersectsSprite(e)){i&&he.setFromMatrixPosition(e.matrixWorld).applyMatrix4(ue);var r=we.update(e),a=e.material;a.visible&&w.push(e,r,a,n,he.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||ee.intersectsObject(e))){var o=we.update(e),s=e.material;if(i&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),he.copy(e.boundingSphere.center)):(null===o.boundingSphere&&o.computeBoundingSphere(),he.copy(o.boundingSphere.center)),he.applyMatrix4(e.matrixWorld).applyMatrix4(ue)),Array.isArray(s))for(var l=o.groups,u=0,c=l.length;u<c;u++){var h=l[u],d=s[h.materialIndex];d&&d.visible&&w.push(e,o,d,n,he.z,h)}else s.visible&&w.push(e,o,s,n,he.z,null)}for(var f=e.children,p=0,v=f.length;p<v;p++)lt(f[p],t,n,i)}}function ut(e,t,n,i){var r=e.opaque,a=e.transmissive,o=e.transparent;A.setupLightsView(n),!0===te&&Ue.setGlobalState(L.clippingPlanes,n),a.length>0&&ct(r,a,t,n),i&&ye.viewport(B.copy(i)),r.length>0&&ht(r,t,n),a.length>0&&ht(a,t,n),o.length>0&&ht(o,t,n),ye.buffers.depth.setTest(!0),ye.buffers.depth.setMask(!0),ye.buffers.color.setMask(!0),ye.setPolygonOffset(!1)}function ct(e,t,n,i){var r=ge.isWebGL2;null===le&&(le=new $e(1,1,{generateMipmaps:!0,type:pe.has("EXT_color_buffer_half_float")?ae:1009,minFilter:ie,samples:r?4:0})),L.getDrawingBufferSize(ce),r?le.setSize(ce.x,ce.y):le.setSize(Re(ce.x),Re(ce.y));var a=L.getRenderTarget();L.setRenderTarget(le),L.getClearColor(W),(X=L.getClearAlpha())<1&&L.setClearColor(16777215,.5),L.clear();var o=L.toneMapping;L.toneMapping=G,ht(e,n,i),Me.updateMultisampleRenderTarget(le),Me.updateRenderTargetMipmap(le);for(var s=!1,l=0,u=t.length;l<u;l++){var c=t[l],h=c.object,d=c.geometry,f=c.material,p=c.group;if(f.side===U&&h.layers.test(i.layers)){var v=f.side;f.side=k,f.needsUpdate=!0,dt(h,n,i,d,f,p),f.side=v,f.needsUpdate=!0,s=!0}}!0===s&&(Me.updateMultisampleRenderTarget(le),Me.updateRenderTargetMipmap(le)),L.setRenderTarget(a),L.setClearColor(W,X),L.toneMapping=o}function ht(e,t,n){for(var i=!0===t.isScene?t.overrideMaterial:null,r=0,a=e.length;r<a;r++){var o=e[r],s=o.object,l=o.geometry,u=null===i?o.material:i,c=o.group;s.layers.test(n.layers)&&dt(s,t,n,l,u,c)}}function dt(e,t,n,i,r,a){e.onBeforeRender(L,t,n,i,r,a),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),r.onBeforeRender(L,t,n,i,e,a),!0===r.transparent&&r.side===U&&!1===r.forceSinglePass?(r.side=k,r.needsUpdate=!0,L.renderBufferDirect(n,t,i,r,e,a),r.side=P,r.needsUpdate=!0,L.renderBufferDirect(n,t,i,r,e,a),r.side=U):L.renderBufferDirect(n,t,i,r,e,a),e.onAfterRender(L,t,n,i,r,a)}function ft(e,t,n){!0!==t.isScene&&(t=de);var i=xe.get(e),r=A.state.lights,a=A.state.shadowsArray,o=r.state.version,s=Ae.getParameters(e,r.state,a,t,n),l=Ae.getProgramCacheKey(s),u=i.programs;i.environment=e.isMeshStandardMaterial?t.environment:null,i.fog=t.fog,i.envMap=(e.isMeshStandardMaterial?be:Se).get(e.envMap||i.environment),void 0===u&&(e.addEventListener("dispose",Ke),u=new Map,i.programs=u);var c=u.get(l);if(void 0!==c){if(i.currentProgram===c&&i.lightsStateVersion===o)return pt(e,s),c}else s.uniforms=Ae.getUniforms(e),e.onBuild(n,s,L),e.onBeforeCompile(s,L),c=Ae.acquireProgram(s,l),u.set(l,c),i.uniforms=s.uniforms;var h=i.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(h.clippingPlanes=Ue.uniform),pt(e,s),i.needsLights=gt(e),i.lightsStateVersion=o,i.needsLights&&(h.ambientLightColor.value=r.state.ambient,h.lightProbe.value=r.state.probe,h.directionalLights.value=r.state.directional,h.directionalLightShadows.value=r.state.directionalShadow,h.spotLights.value=r.state.spot,h.spotLightShadows.value=r.state.spotShadow,h.rectAreaLights.value=r.state.rectArea,h.ltc_1.value=r.state.rectAreaLTC1,h.ltc_2.value=r.state.rectAreaLTC2,h.pointLights.value=r.state.point,h.pointLightShadows.value=r.state.pointShadow,h.hemisphereLights.value=r.state.hemi,h.directionalShadowMap.value=r.state.directionalShadowMap,h.directionalShadowMatrix.value=r.state.directionalShadowMatrix,h.spotShadowMap.value=r.state.spotShadowMap,h.spotLightMatrix.value=r.state.spotLightMatrix,h.spotLightMap.value=r.state.spotLightMap,h.pointShadowMap.value=r.state.pointShadowMap,h.pointShadowMatrix.value=r.state.pointShadowMatrix);var d=c.getUniforms(),f=ca.seqWithValue(d.seq,h);return i.currentProgram=c,i.uniformsList=f,c}function pt(e,t){var n=xe.get(e);n.outputColorSpace=t.outputColorSpace,n.instancing=t.instancing,n.instancingColor=t.instancingColor,n.skinning=t.skinning,n.morphTargets=t.morphTargets,n.morphNormals=t.morphNormals,n.morphColors=t.morphColors,n.morphTargetsCount=t.morphTargetsCount,n.numClippingPlanes=t.numClippingPlanes,n.numIntersection=t.numClipIntersection,n.vertexAlphas=t.vertexAlphas,n.vertexTangents=t.vertexTangents,n.toneMapping=t.toneMapping}function vt(e,t,n,i,r){!0!==t.isScene&&(t=de),Me.resetTextureUnits();var a=t.fog,o=i.isMeshStandardMaterial?t.environment:null,s=null===O?L.outputColorSpace:!0===O.isXRRenderTarget?O.texture.colorSpace:me,l=(i.isMeshStandardMaterial?be:Se).get(i.envMap||o),u=!0===i.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,c=!!n.attributes.tangent&&(!!i.normalMap||i.anisotropy>0),h=!!n.morphAttributes.position,d=!!n.morphAttributes.normal,f=!!n.morphAttributes.color,p=G;i.toneMapped&&(null!==O&&!0!==O.isXRRenderTarget||(p=L.toneMapping));var v=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,m=void 0!==v?v.length:0,g=xe.get(i),y=A.state.lights;if(!0===te&&(!0===ne||e!==z)){var _=e===z&&i.id===F;Ue.setState(i,e,_)}var x=!1;i.version===g.__version?g.needsLights&&g.lightsStateVersion!==y.state.version||g.outputColorSpace!==s||r.isInstancedMesh&&!1===g.instancing?x=!0:r.isInstancedMesh||!0!==g.instancing?r.isSkinnedMesh&&!1===g.skinning?x=!0:r.isSkinnedMesh||!0!==g.skinning?r.isInstancedMesh&&!0===g.instancingColor&&null===r.instanceColor||r.isInstancedMesh&&!1===g.instancingColor&&null!==r.instanceColor||g.envMap!==l||!0===i.fog&&g.fog!==a?x=!0:void 0===g.numClippingPlanes||g.numClippingPlanes===Ue.numPlanes&&g.numIntersection===Ue.numIntersection?(g.vertexAlphas!==u||g.vertexTangents!==c||g.morphTargets!==h||g.morphNormals!==d||g.morphColors!==f||g.toneMapping!==p||!0===ge.isWebGL2&&g.morphTargetsCount!==m)&&(x=!0):x=!0:x=!0:x=!0:(x=!0,g.__version=i.version);var M=g.currentProgram;!0===x&&(M=ft(i,t,r));var S=!1,b=!1,E=!1,T=M.getUniforms(),w=g.uniforms;if(ye.useProgram(M.program)&&(S=!0,b=!0,E=!0),i.id!==F&&(F=i.id,b=!0),S||z!==e){if(T.setValue(Ve,"projectionMatrix",e.projectionMatrix),ge.logarithmicDepthBuffer&&T.setValue(Ve,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),z!==e&&(z=e,b=!0,E=!0),i.isShaderMaterial||i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshStandardMaterial||i.envMap){var R=T.map.cameraPosition;void 0!==R&&R.setValue(Ve,he.setFromMatrixPosition(e.matrixWorld))}(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&T.setValue(Ve,"isOrthographic",!0===e.isOrthographicCamera),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial||i.isShadowMaterial||r.isSkinnedMesh)&&T.setValue(Ve,"viewMatrix",e.matrixWorldInverse)}if(r.isSkinnedMesh){T.setOptional(Ve,r,"bindMatrix"),T.setOptional(Ve,r,"bindMatrixInverse");var C=r.skeleton;C&&(ge.floatVertexTextures?(null===C.boneTexture&&C.computeBoneTexture(),T.setValue(Ve,"boneTexture",C.boneTexture,Me),T.setValue(Ve,"boneTextureSize",C.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}var P=n.morphAttributes;if((void 0!==P.position||void 0!==P.normal||void 0!==P.color&&!0===ge.isWebGL2)&&De.update(r,n,M),(b||g.receiveShadow!==r.receiveShadow)&&(g.receiveShadow=r.receiveShadow,T.setValue(Ve,"receiveShadow",r.receiveShadow)),i.isMeshGouraudMaterial&&null!==i.envMap&&(w.envMap.value=l,w.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1),b&&(T.setValue(Ve,"toneMappingExposure",L.toneMappingExposure),g.needsLights&&mt(w,E),a&&!0===i.fog&&Ce.refreshFogUniforms(w,a),Ce.refreshMaterialUniforms(w,i,q,Y,le),ca.upload(Ve,g.uniformsList,w,Me)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(ca.upload(Ve,g.uniformsList,w,Me),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&T.setValue(Ve,"center",r.center),T.setValue(Ve,"modelViewMatrix",r.modelViewMatrix),T.setValue(Ve,"normalMatrix",r.normalMatrix),T.setValue(Ve,"modelMatrix",r.matrixWorld),i.isShaderMaterial||i.isRawShaderMaterial)for(var k=i.uniformsGroups,U=0,I=k.length;U<I;U++)if(ge.isWebGL2){var N=k[U];He.update(N,M),He.bind(N,M)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.");return M}function mt(e,t){e.ambientLightColor.needsUpdate=t,e.lightProbe.needsUpdate=t,e.directionalLights.needsUpdate=t,e.directionalLightShadows.needsUpdate=t,e.pointLights.needsUpdate=t,e.pointLightShadows.needsUpdate=t,e.spotLights.needsUpdate=t,e.spotLightShadows.needsUpdate=t,e.rectAreaLights.needsUpdate=t,e.hemisphereLights.needsUpdate=t}function gt(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights}st.setAnimationLoop(rt),"undefined"!=typeof self&&st.setContext(self),this.setAnimationLoop=function(e){nt=e,Ye.setAnimationLoop(e),null===e?st.stop():st.start()},Ye.addEventListener("sessionstart",at),Ye.addEventListener("sessionend",ot),this.render=function(e,t){if(void 0===t||!0===t.isCamera){if(!0!==I){!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0===Ye.enabled&&!0===Ye.isPresenting&&(!0===Ye.cameraAutoUpdate&&Ye.updateCamera(t),t=Ye.getCamera()),!0===e.isScene&&e.onBeforeRender(L,e,t,O),(A=ke.get(e,C.length)).init(),C.push(A),ue.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),ee.setFromProjectionMatrix(ue),ne=this.localClippingEnabled,te=Ue.init(this.clippingPlanes,ne),(w=Le.get(e,R.length)).init(),R.push(w),lt(e,t,0,L.sortObjects),w.finish(),!0===L.sortObjects&&w.sort(Z,J),this.info.render.frame++,!0===te&&Ue.beginShadows();var n=A.state.shadowsArray;if(Ie.render(n,e,t),!0===te&&Ue.endShadows(),!0===this.info.autoReset&&this.info.reset(),Ne.render(w,e),A.setupLights(L._useLegacyLights),t.isArrayCamera)for(var i=t.cameras,r=0,a=i.length;r<a;r++){var o=i[r];ut(w,e,o,o.viewport)}else ut(w,e,t);null!==O&&(Me.updateMultisampleRenderTarget(O),Me.updateRenderTargetMipmap(O)),!0===e.isScene&&e.onAfterRender(L,e,t),Be.resetDefaultState(),F=-1,z=null,C.pop(),A=C.length>0?C[C.length-1]:null,R.pop(),w=R.length>0?R[R.length-1]:null}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.getActiveCubeFace=function(){return N},this.getActiveMipmapLevel=function(){return D},this.getRenderTarget=function(){return O},this.setRenderTargetTextures=function(e,t,n){xe.get(e.texture).__webglTexture=t,xe.get(e.depthTexture).__webglTexture=n;var i=xe.get(e);i.__hasExternalTextures=!0,i.__hasExternalTextures&&(i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||!0===pe.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),i.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(e,t){var n=xe.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;O=e,N=t,D=n;var i=!0,r=null,a=!1,o=!1;if(e){var s=xe.get(e);void 0!==s.__useDefaultFramebuffer?(ye.bindFramebuffer(Ve.FRAMEBUFFER,null),i=!1):void 0===s.__webglFramebuffer?Me.setupRenderTarget(e):s.__hasExternalTextures&&Me.rebindTextures(e,xe.get(e.texture).__webglTexture,xe.get(e.depthTexture).__webglTexture);var l=e.texture;(l.isData3DTexture||l.isDataArrayTexture||l.isCompressedArrayTexture)&&(o=!0);var u=xe.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=Array.isArray(u[t])?u[t][n]:u[t],a=!0):r=ge.isWebGL2&&e.samples>0&&!1===Me.useMultisampledRTT(e)?xe.get(e).__webglMultisampledFramebuffer:Array.isArray(u)?u[n]:u,B.copy(e.viewport),H.copy(e.scissor),V=e.scissorTest}else B.copy(K).multiplyScalar(q).floor(),H.copy(Q).multiplyScalar(q).floor(),V=$;var c=ye.bindFramebuffer(Ve.FRAMEBUFFER,r);if(c&&ge.drawBuffers&&i&&ye.drawBuffers(e,r),ye.viewport(B),ye.scissor(H),ye.setScissorTest(V),a){var h=xe.get(e.texture);Ve.framebufferTexture2D(Ve.FRAMEBUFFER,Ve.COLOR_ATTACHMENT0,Ve.TEXTURE_CUBE_MAP_POSITIVE_X+t,h.__webglTexture,n)}else if(o){var d=xe.get(e.texture),f=t||0;Ve.framebufferTextureLayer(Ve.FRAMEBUFFER,Ve.COLOR_ATTACHMENT0,d.__webglTexture,n||0,f)}F=-1},this.readRenderTargetPixels=function(e,t,n,i,r,a,o){if(e&&e.isWebGLRenderTarget){var s=xe.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(s=s[o]),s){ye.bindFramebuffer(Ve.FRAMEBUFFER,s);try{var l=e.texture,u=l.format,c=l.type;if(u!==se&&ze.convert(u)!==Ve.getParameter(Ve.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");var h=c===ae&&(pe.has("EXT_color_buffer_half_float")||ge.isWebGL2&&pe.has("EXT_color_buffer_float"));if(!(1009===c||ze.convert(c)===Ve.getParameter(Ve.IMPLEMENTATION_COLOR_READ_TYPE)||c===re&&(ge.isWebGL2||pe.has("OES_texture_float")||pe.has("WEBGL_color_buffer_float"))||h))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&Ve.readPixels(t,n,i,r,ze.convert(u),ze.convert(c),a)}finally{var d=null!==O?xe.get(O).__webglFramebuffer:null;ye.bindFramebuffer(Ve.FRAMEBUFFER,d)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=Math.pow(2,-n),r=Math.floor(t.image.width*i),a=Math.floor(t.image.height*i);Me.setTexture2D(t,0),Ve.copyTexSubImage2D(Ve.TEXTURE_2D,n,0,0,e.x,e.y,r,a),ye.unbindTexture()},this.copyTextureToTexture=function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=t.image.width,a=t.image.height,o=ze.convert(n.format),s=ze.convert(n.type);Me.setTexture2D(n,0),Ve.pixelStorei(Ve.UNPACK_FLIP_Y_WEBGL,n.flipY),Ve.pixelStorei(Ve.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),Ve.pixelStorei(Ve.UNPACK_ALIGNMENT,n.unpackAlignment),t.isDataTexture?Ve.texSubImage2D(Ve.TEXTURE_2D,i,e.x,e.y,r,a,o,s,t.image.data):t.isCompressedTexture?Ve.compressedTexSubImage2D(Ve.TEXTURE_2D,i,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,o,t.mipmaps[0].data):Ve.texSubImage2D(Ve.TEXTURE_2D,i,e.x,e.y,o,s,t.image),0===i&&n.generateMipmaps&&Ve.generateMipmap(Ve.TEXTURE_2D),ye.unbindTexture()},this.copyTextureToTexture3D=function(e,t,n,i){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(L.isWebGL1Renderer)console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");else{var a,o=e.max.x-e.min.x+1,s=e.max.y-e.min.y+1,l=e.max.z-e.min.z+1,u=ze.convert(i.format),c=ze.convert(i.type);if(i.isData3DTexture)Me.setTexture3D(i,0),a=Ve.TEXTURE_3D;else{if(!i.isDataArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");Me.setTexture2DArray(i,0),a=Ve.TEXTURE_2D_ARRAY}Ve.pixelStorei(Ve.UNPACK_FLIP_Y_WEBGL,i.flipY),Ve.pixelStorei(Ve.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),Ve.pixelStorei(Ve.UNPACK_ALIGNMENT,i.unpackAlignment);var h=Ve.getParameter(Ve.UNPACK_ROW_LENGTH),d=Ve.getParameter(Ve.UNPACK_IMAGE_HEIGHT),f=Ve.getParameter(Ve.UNPACK_SKIP_PIXELS),p=Ve.getParameter(Ve.UNPACK_SKIP_ROWS),v=Ve.getParameter(Ve.UNPACK_SKIP_IMAGES),m=n.isCompressedTexture?n.mipmaps[0]:n.image;Ve.pixelStorei(Ve.UNPACK_ROW_LENGTH,m.width),Ve.pixelStorei(Ve.UNPACK_IMAGE_HEIGHT,m.height),Ve.pixelStorei(Ve.UNPACK_SKIP_PIXELS,e.min.x),Ve.pixelStorei(Ve.UNPACK_SKIP_ROWS,e.min.y),Ve.pixelStorei(Ve.UNPACK_SKIP_IMAGES,e.min.z),n.isDataTexture||n.isData3DTexture?Ve.texSubImage3D(a,r,t.x,t.y,t.z,o,s,l,u,c,m.data):n.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),Ve.compressedTexSubImage3D(a,r,t.x,t.y,t.z,o,s,l,u,m.data)):Ve.texSubImage3D(a,r,t.x,t.y,t.z,o,s,l,u,c,m),Ve.pixelStorei(Ve.UNPACK_ROW_LENGTH,h),Ve.pixelStorei(Ve.UNPACK_IMAGE_HEIGHT,d),Ve.pixelStorei(Ve.UNPACK_SKIP_PIXELS,f),Ve.pixelStorei(Ve.UNPACK_SKIP_ROWS,p),Ve.pixelStorei(Ve.UNPACK_SKIP_IMAGES,v),0===r&&i.generateMipmaps&&Ve.generateMipmap(a),ye.unbindTexture()}},this.initTexture=function(e){e.isCubeTexture?Me.setTextureCube(e,0):e.isData3DTexture?Me.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?Me.setTexture2DArray(e,0):Me.setTexture2D(e,0),ye.unbindTexture()},this.resetState=function(){N=0,D=0,O=null,ye.reset(),Be.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}return s(e,[{key:"coordinateSystem",get:function(){return 2e3}},{key:"physicallyCorrectLights",get:function(){return console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights},set:function(e){console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}},{key:"outputEncoding",get:function(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===ve?3001:3e3},set:function(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=3001===e?ve:me}},{key:"useLegacyLights",get:function(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights},set:function(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}}]),e}())).prototype.isWebGL1Renderer=!0,e("bQ",function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;a(this,e),this.isFog=!0,this.name="",this.color=new En(t),this.near=n,this.far=i}return s(e,[{key:"clone",value:function(){return new e(this.color,this.near,this.far)}},{key:"toJSON",value:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}]),e}()),e("as",function(e){u(n,e);var t=g(n);function n(){var e;return a(this,n),(e=t.call(this)).isScene=!0,e.type="Scene",e.background=null,e.environment=null,e.fog=null,e.backgroundBlurriness=0,e.backgroundIntensity=1,e.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:v(e)})),e}return s(n,[{key:"copy",value:function(e,t){return _(c(n.prototype),"copy",this).call(this,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,null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}},{key:"toJSON",value:function(e){var t=_(c(n.prototype),"toJSON",this).call(this,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}}]),n}(an)),e("p",function(){function e(t,n){a(this,e),this.isInterleavedBuffer=!0,this.array=t,this.stride=n,this.count=void 0!==t?t.length/n:0,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Se()}return s(e,[{key:"onUploadCallback",value:function(){}},{key:"needsUpdate",set:function(e){!0===e&&this.version++}},{key:"setUsage",value:function(e){return this.usage=e,this}},{key:"copy",value:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}},{key:"copyAt",value:function(e,t,n){e*=this.stride,n*=t.stride;for(var i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];return this}},{key:"set",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(e,t),this}},{key:"clone",value:function(e){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=Se()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);var t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}},{key:"onUpload",value:function(e){return this.onUploadCallback=e,this}},{key:"toJSON",value:function(e){return void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=Se()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}]),e}());var io=new it,ro=(e("q",function(){function e(t,n,i){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];a(this,e),this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=n,this.offset=i,this.normalized=r}return s(e,[{key:"count",get:function(){return this.data.count}},{key:"array",get:function(){return this.data.array}},{key:"needsUpdate",set:function(e){this.data.needsUpdate=e}},{key:"applyMatrix4",value:function(e){for(var t=0,n=this.data.count;t<n;t++)io.fromBufferAttribute(this,t),io.applyMatrix4(e),this.setXYZ(t,io.x,io.y,io.z);return this}},{key:"applyNormalMatrix",value:function(e){for(var t=0,n=this.count;t<n;t++)io.fromBufferAttribute(this,t),io.applyNormalMatrix(e),this.setXYZ(t,io.x,io.y,io.z);return this}},{key:"transformDirection",value:function(e){for(var t=0,n=this.count;t<n;t++)io.fromBufferAttribute(this,t),io.transformDirection(e),this.setXYZ(t,io.x,io.y,io.z);return this}},{key:"setX",value:function(e,t){return this.normalized&&(t=Le(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}},{key:"setY",value:function(e,t){return this.normalized&&(t=Le(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}},{key:"setZ",value:function(e,t){return this.normalized&&(t=Le(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}},{key:"setW",value:function(e,t){return this.normalized&&(t=Le(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}},{key:"getX",value:function(e){var t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=Ce(t,this.array)),t}},{key:"getY",value:function(e){var t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Ce(t,this.array)),t}},{key:"getZ",value:function(e){var t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Ce(t,this.array)),t}},{key:"getW",value:function(e){var t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Ce(t,this.array)),t}},{key:"setXY",value:function(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Le(t,this.array),n=Le(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}},{key:"setXYZ",value:function(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=Le(t,this.array),n=Le(n,this.array),i=Le(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}},{key:"setXYZW",value:function(e,t,n,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Le(t,this.array),n=Le(n,this.array),i=Le(i,this.array),r=Le(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=r,this}},{key:"clone",value:function(t){if(void 0===t){for(var n=[],i=0;i<this.count;i++)for(var r=i*this.data.stride+this.offset,a=0;a<this.itemSize;a++)n.push(this.data.array[r+a]);return new Pn(new this.array.constructor(n),this.itemSize,this.normalized)}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new e(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}},{key:"toJSON",value:function(e){if(void 0===e){for(var t=[],n=0;n<this.count;n++)for(var i=n*this.data.stride+this.offset,r=0;r<this.itemSize;r++)t.push(this.data.array[i+r]);return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}]),e}()),new it),ao=new Qe,oo=new Qe,so=new it,lo=new Ut,uo=new it,co=new Et,ho=new Ut,fo=new kt,po=(e("E",function(e){u(n,e);var t=g(n);function n(e,i){var r;return a(this,n),(r=t.call(this,e,i)).isSkinnedMesh=!0,r.type="SkinnedMesh",r.bindMode="attached",r.bindMatrix=new Ut,r.bindMatrixInverse=new Ut,r.boundingBox=null,r.boundingSphere=null,r}return s(n,[{key:"computeBoundingBox",value:function(){var e=this.geometry;null===this.boundingBox&&(this.boundingBox=new ot),this.boundingBox.makeEmpty();for(var t=e.getAttribute("position"),n=0;n<t.count;n++)uo.fromBufferAttribute(t,n),this.applyBoneTransform(n,uo),this.boundingBox.expandByPoint(uo)}},{key:"computeBoundingSphere",value:function(){var e=this.geometry;null===this.boundingSphere&&(this.boundingSphere=new Et),this.boundingSphere.makeEmpty();for(var t=e.getAttribute("position"),n=0;n<t.count;n++)uo.fromBufferAttribute(t,n),this.applyBoneTransform(n,uo),this.boundingSphere.expandByPoint(uo)}},{key:"copy",value:function(e,t){return _(c(n.prototype),"copy",this).call(this,e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}},{key:"raycast",value:function(e,t){var n=this.material,i=this.matrixWorld;void 0!==n&&(null===this.boundingSphere&&this.computeBoundingSphere(),co.copy(this.boundingSphere),co.applyMatrix4(i),!1!==e.ray.intersectsSphere(co)&&(ho.copy(i).invert(),fo.copy(e.ray).applyMatrix4(ho),null!==this.boundingBox&&!1===fo.intersectsBox(this.boundingBox)||this._computeIntersections(e,t,fo)))}},{key:"getVertexPosition",value:function(e,t){return _(c(n.prototype),"getVertexPosition",this).call(this,e,t),this.applyBoneTransform(e,t),t}},{key:"bind",value:function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}},{key:"pose",value:function(){this.skeleton.pose()}},{key:"normalizeSkinWeights",value:function(){for(var e=new Qe,t=this.geometry.attributes.skinWeight,n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);var r=1/e.manhattanLength();r!==1/0?e.multiplyScalar(r):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}},{key:"updateMatrixWorld",value:function(e){_(c(n.prototype),"updateMatrixWorld",this).call(this,e),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}},{key:"applyBoneTransform",value:function(e,t){var n=this.skeleton,i=this.geometry;ao.fromBufferAttribute(i.attributes.skinIndex,e),oo.fromBufferAttribute(i.attributes.skinWeight,e),ro.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(var r=0;r<4;r++){var a=oo.getComponent(r);if(0!==a){var o=ao.getComponent(r);lo.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(so.copy(ro).applyMatrix4(lo),a)}}return t.applyMatrix4(this.bindMatrixInverse)}},{key:"boneTransform",value:function(e,t){return console.warn("THREE.SkinnedMesh: .boneTransform() was renamed to .applyBoneTransform() in r151."),this.applyBoneTransform(e,t)}}]),n}(oi)),e("a0",function(e){u(n,e);var t=g(n);function n(){var e;return a(this,n),(e=t.call(this)).isBone=!0,e.type="Bone",e}return s(n)}(an))),vo=e("aq",function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3?arguments[3]:void 0,l=arguments.length>4?arguments[4]:void 0,u=arguments.length>5?arguments[5]:void 0,c=arguments.length>6?arguments[6]:void 0,h=arguments.length>7?arguments[7]:void 0,d=arguments.length>8&&void 0!==arguments[8]?arguments[8]:Q,f=arguments.length>9&&void 0!==arguments[9]?arguments[9]:Q,p=arguments.length>10?arguments[10]:void 0,v=arguments.length>11?arguments[11]:void 0;return a(this,n),(e=t.call(this,null,u,c,h,d,f,s,l,p,v)).isDataTexture=!0,e.image={data:i,width:r,height:o},e.generateMipmaps=!1,e.flipY=!1,e.unpackAlignment=1,e}return s(n)}(Ke)),mo=new Ut,go=new Ut,yo=(e("Z",function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];a(this,e),this.uuid=Se(),this.bones=t.slice(0),this.boneInverses=n,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.init()}return s(e,[{key:"init",value:function(){var e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(16*e.length),0===t.length)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(var n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new Ut)}}},{key:"calculateInverses",value:function(){this.boneInverses.length=0;for(var e=0,t=this.bones.length;e<t;e++){var n=new Ut;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}},{key:"pose",value:function(){for(var e=0,t=this.bones.length;e<t;e++){var n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(var i=0,r=this.bones.length;i<r;i++){var a=this.bones[i];a&&(a.parent&&a.parent.isBone?(a.matrix.copy(a.parent.matrixWorld).invert(),a.matrix.multiply(a.matrixWorld)):a.matrix.copy(a.matrixWorld),a.matrix.decompose(a.position,a.quaternion,a.scale))}}},{key:"update",value:function(){for(var e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture,r=0,a=e.length;r<a;r++){var o=e[r]?e[r].matrixWorld:go;mo.multiplyMatrices(o,t[r]),mo.toArray(n,16*r)}null!==i&&(i.needsUpdate=!0)}},{key:"clone",value:function(){return new e(this.bones,this.boneInverses)}},{key:"computeBoneTexture",value:function(){var e=Math.sqrt(4*this.bones.length);e=Ae(e),e=Math.max(e,4);var t=new Float32Array(e*e*4);t.set(this.boneMatrices);var n=new vo(t,e,e,se,re);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this.boneTextureSize=e,this}},{key:"getBoneByName",value:function(e){for(var t=0,n=this.bones.length;t<n;t++){var i=this.bones[t];if(i.name===e)return i}}},{key:"dispose",value:function(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}},{key:"fromJSON",value:function(e,t){this.uuid=e.uuid;for(var n=0,i=e.bones.length;n<i;n++){var r=e.bones[n],a=t[r];void 0===a&&(console.warn("THREE.Skeleton: No bone found with UUID:",r),a=new po),this.bones.push(a),this.boneInverses.push((new Ut).fromArray(e.boneInverses[n]))}return this.init(),this}},{key:"toJSON",value:function(){var e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;for(var t=this.bones,n=this.boneInverses,i=0,r=t.length;i<r;i++){var a=t[i];e.bones.push(a.uuid);var o=n[i];e.boneInverses.push(o.toArray())}return e}}]),e}()),function(e){u(n,e);var t=g(n);function n(e,i,r){var o,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return a(this,n),(o=t.call(this,e,i,r)).isInstancedBufferAttribute=!0,o.meshPerAttribute=s,o}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}},{key:"toJSON",value:function(){var e=_(c(n.prototype),"toJSON",this).call(this);return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}]),n}(Pn)),_o=new Ut,xo=new Ut,Mo=[],So=new ot,bo=new Ut,Eo=new oi,To=new Et,wo=(e("I",function(e){u(n,e);var t=g(n);function n(e,i,r){var o;a(this,n),(o=t.call(this,e,i)).isInstancedMesh=!0,o.instanceMatrix=new yo(new Float32Array(16*r),16),o.instanceColor=null,o.count=r,o.boundingBox=null,o.boundingSphere=null;for(var s=0;s<r;s++)o.setMatrixAt(s,bo);return o}return s(n,[{key:"computeBoundingBox",value:function(){var e=this.geometry,t=this.count;null===this.boundingBox&&(this.boundingBox=new ot),null===e.boundingBox&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(var n=0;n<t;n++)this.getMatrixAt(n,_o),So.copy(e.boundingBox).applyMatrix4(_o),this.boundingBox.union(So)}},{key:"computeBoundingSphere",value:function(){var e=this.geometry,t=this.count;null===this.boundingSphere&&(this.boundingSphere=new Et),null===e.boundingSphere&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(var n=0;n<t;n++)this.getMatrixAt(n,_o),To.copy(e.boundingSphere).applyMatrix4(_o),this.boundingSphere.union(To)}},{key:"copy",value:function(e,t){return _(c(n.prototype),"copy",this).call(this,e,t),this.instanceMatrix.copy(e.instanceMatrix),null!==e.instanceColor&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}},{key:"getColorAt",value:function(e,t){t.fromArray(this.instanceColor.array,3*e)}},{key:"getMatrixAt",value:function(e,t){t.fromArray(this.instanceMatrix.array,16*e)}},{key:"raycast",value:function(e,t){var n=this.matrixWorld,i=this.count;if(Eo.geometry=this.geometry,Eo.material=this.material,void 0!==Eo.material&&(null===this.boundingSphere&&this.computeBoundingSphere(),To.copy(this.boundingSphere),To.applyMatrix4(n),!1!==e.ray.intersectsSphere(To)))for(var r=0;r<i;r++){this.getMatrixAt(r,_o),xo.multiplyMatrices(n,_o),Eo.matrixWorld=xo,Eo.raycast(e,Mo);for(var a=0,o=Mo.length;a<o;a++){var s=Mo[a];s.instanceId=r,s.object=this,t.push(s)}Mo.length=0}}},{key:"setColorAt",value:function(e,t){null===this.instanceColor&&(this.instanceColor=new yo(new Float32Array(3*this.instanceMatrix.count),3)),t.toArray(this.instanceColor.array,3*e)}},{key:"setMatrixAt",value:function(e,t){t.toArray(this.instanceMatrix.array,16*e)}},{key:"updateMorphTargets",value:function(){}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}}]),n}(oi)),e("w",function(e){u(n,e);var t=g(n);function n(e){var i;return a(this,n),(i=t.call(this)).isLineBasicMaterial=!0,i.type="LineBasicMaterial",i.color=new En(16777215),i.map=null,i.linewidth=1,i.linecap="round",i.linejoin="round",i.fog=!0,i.setValues(e),i}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,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}}]),n}(_n))),Ao=new it,Ro=new it,Co=new Ut,Lo=new kt,Po=new Et,ko=e("J",function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Vn,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new wo;return a(this,n),(e=t.call(this)).isLine=!0,e.type="Line",e.geometry=i,e.material=r,e.updateMorphTargets(),e}return s(n,[{key:"copy",value:function(e,t){return _(c(n.prototype),"copy",this).call(this,e,t),this.material=e.material,this.geometry=e.geometry,this}},{key:"computeLineDistances",value:function(){var e=this.geometry;if(null===e.index){for(var t=e.attributes.position,n=[0],i=1,r=t.count;i<r;i++)Ao.fromBufferAttribute(t,i-1),Ro.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=Ao.distanceTo(Ro);e.setAttribute("lineDistance",new In(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}},{key:"raycast",value:function(e,t){var n=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),Po.copy(n.boundingSphere),Po.applyMatrix4(i),Po.radius+=r,!1!==e.ray.intersectsSphere(Po)){Co.copy(i).invert(),Lo.copy(e.ray).applyMatrix4(Co);var o=r/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,l=new it,u=new it,c=new it,h=new it,d=this.isLineSegments?2:1,f=n.index,p=n.attributes.position;if(null!==f)for(var v=Math.max(0,a.start),m=Math.min(f.count,a.start+a.count)-1;v<m;v+=d){var g=f.getX(v),y=f.getX(v+1);if(l.fromBufferAttribute(p,g),u.fromBufferAttribute(p,y),!(Lo.distanceSqToSegment(l,u,h,c)>s)){h.applyMatrix4(this.matrixWorld);var _=e.ray.origin.distanceTo(h);_<e.near||_>e.far||t.push({distance:_,point:c.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}}else for(var x=Math.max(0,a.start),M=Math.min(p.count,a.start+a.count)-1;x<M;x+=d)if(l.fromBufferAttribute(p,x),u.fromBufferAttribute(p,x+1),!(Lo.distanceSqToSegment(l,u,h,c)>s)){h.applyMatrix4(this.matrixWorld);var S=e.ray.origin.distanceTo(h);S<e.near||S>e.far||t.push({distance:S,point:c.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}},{key:"updateMorphTargets",value:function(){var e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){var n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var i=0,r=n.length;i<r;i++){var a=n[i].name||String(i);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=i}}}}}]),n}(an)),Uo=new it,Io=new it,No=e("H",function(e){u(n,e);var t=g(n);function n(e,i){var r;return a(this,n),(r=t.call(this,e,i)).isLineSegments=!0,r.type="LineSegments",r}return s(n,[{key:"computeLineDistances",value:function(){var e=this.geometry;if(null===e.index){for(var t=e.attributes.position,n=[],i=0,r=t.count;i<r;i+=2)Uo.fromBufferAttribute(t,i),Io.fromBufferAttribute(t,i+1),n[i]=0===i?0:n[i-1],n[i+1]=n[i]+Uo.distanceTo(Io);e.setAttribute("lineDistance",new In(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}]),n}(ko)),Do=(e("K",function(e){u(n,e);var t=g(n);function n(e,i){var r;return a(this,n),(r=t.call(this,e,i)).isLineLoop=!0,r.type="LineLoop",r}return s(n)}(ko)),e("u",function(e){u(n,e);var t=g(n);function n(e){var i;return a(this,n),(i=t.call(this)).isPointsMaterial=!0,i.type="PointsMaterial",i.color=new En(16777215),i.map=null,i.alphaMap=null,i.size=1,i.sizeAttenuation=!0,i.fog=!0,i.setValues(e),i}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}]),n}(_n))),Oo=new Ut,Fo=new kt,zo=new Et,Bo=new it;function Ho(e,t,n,i,r,a,o){var s=Fo.distanceSqToPoint(e);if(s<n){var l=new it;Fo.closestPointToPoint(e,l),l.applyMatrix4(i);var u=r.ray.origin.distanceTo(l);if(u<r.near||u>r.far)return;a.push({distance:u,distanceToRay:Math.sqrt(s),point:l,index:t,face:null,object:o})}}e("N",function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Vn,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Do;return a(this,n),(e=t.call(this)).isPoints=!0,e.type="Points",e.geometry=i,e.material=r,e.updateMorphTargets(),e}return s(n,[{key:"copy",value:function(e,t){return _(c(n.prototype),"copy",this).call(this,e,t),this.material=e.material,this.geometry=e.geometry,this}},{key:"raycast",value:function(e,t){var n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),zo.copy(n.boundingSphere),zo.applyMatrix4(i),zo.radius+=r,!1!==e.ray.intersectsSphere(zo)){Oo.copy(i).invert(),Fo.copy(e.ray).applyMatrix4(Oo);var o=r/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,l=n.index,u=n.attributes.position;if(null!==l)for(var c=Math.max(0,a.start),h=Math.min(l.count,a.start+a.count);c<h;c++){var d=l.getX(c);Bo.fromBufferAttribute(u,d),Ho(Bo,d,s,i,e,t,this)}else for(var f=Math.max(0,a.start),p=Math.min(u.count,a.start+a.count);f<p;f++)Bo.fromBufferAttribute(u,f),Ho(Bo,f,s,i,e,t,this)}}},{key:"updateMorphTargets",value:function(){var e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){var n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var i=0,r=n.length;i<r;i++){var a=n[i].name||String(i);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=i}}}}}]),n}(an));var Vo=function(){function e(){a(this,e),this.type="Curve",this.arcLengthDivisions=200}return s(e,[{key:"getPoint",value:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}},{key:"getPointAt",value:function(e,t){var n=this.getUtoTmapping(e);return this.getPoint(n,t)}},{key:"getPoints",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}},{key:"getSpacedPoints",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=[],n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}},{key:"getLength",value:function(){var e=this.getLengths();return e[e.length-1]}},{key:"getLengths",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.arcLengthDivisions;if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,n=[],i=this.getPoint(0),r=0;n.push(0);for(var a=1;a<=e;a++)r+=(t=this.getPoint(a/e)).distanceTo(i),n.push(r),i=t;return this.cacheArcLengths=n,n}},{key:"updateArcLengths",value:function(){this.needsUpdate=!0,this.getLengths()}},{key:"getUtoTmapping",value:function(e,t){var n,i=this.getLengths(),r=0,a=i.length;n=t||e*i[a-1];for(var o,s=0,l=a-1;s<=l;)if((o=i[r=Math.floor(s+(l-s)/2)]-n)<0)s=r+1;else{if(!(o>0)){l=r;break}l=r-1}if(i[r=l]===n)return r/(a-1);var u=i[r];return(r+(n-u)/(i[r+1]-u))/(a-1)}},{key:"getTangent",value:function(e,t){var n=e-1e-4,i=e+1e-4;n<0&&(n=0),i>1&&(i=1);var r=this.getPoint(n),a=this.getPoint(i),o=t||(r.isVector2?new Pe:new it);return o.copy(a).sub(r).normalize(),o}},{key:"getTangentAt",value:function(e,t){var n=this.getUtoTmapping(e);return this.getTangent(n,t)}},{key:"computeFrenetFrames",value:function(e,t){for(var n=new it,i=[],r=[],a=[],o=new it,s=new Ut,l=0;l<=e;l++){var u=l/e;i[l]=this.getTangentAt(u,new it)}r[0]=new it,a[0]=new it;var c=Number.MAX_VALUE,h=Math.abs(i[0].x),d=Math.abs(i[0].y),f=Math.abs(i[0].z);h<=c&&(c=h,n.set(1,0,0)),d<=c&&(c=d,n.set(0,1,0)),f<=c&&n.set(0,0,1),o.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],o),a[0].crossVectors(i[0],r[0]);for(var p=1;p<=e;p++){if(r[p]=r[p-1].clone(),a[p]=a[p-1].clone(),o.crossVectors(i[p-1],i[p]),o.length()>Number.EPSILON){o.normalize();var v=Math.acos(be(i[p-1].dot(i[p]),-1,1));r[p].applyMatrix4(s.makeRotationAxis(o,v))}a[p].crossVectors(i[p],r[p])}if(!0===t){var m=Math.acos(be(r[0].dot(r[e]),-1,1));m/=e,i[0].dot(o.crossVectors(r[0],r[e]))>0&&(m=-m);for(var g=1;g<=e;g++)r[g].applyMatrix4(s.makeRotationAxis(i[g],m*g)),a[g].crossVectors(i[g],r[g])}return{tangents:i,normals:r,binormals:a}}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},{key:"toJSON",value:function(){var e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}},{key:"fromJSON",value:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}]),e}(),Go=function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2*Math.PI,c=arguments.length>6&&void 0!==arguments[6]&&arguments[6],h=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0;return a(this,n),(e=t.call(this)).isEllipseCurve=!0,e.type="EllipseCurve",e.aX=i,e.aY=r,e.xRadius=o,e.yRadius=s,e.aStartAngle=l,e.aEndAngle=u,e.aClockwise=c,e.aRotation=h,e}return s(n,[{key:"getPoint",value:function(e,t){for(var n=t||new Pe,i=2*Math.PI,r=this.aEndAngle-this.aStartAngle,a=Math.abs(r)<Number.EPSILON;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(r=a?0:i),!0!==this.aClockwise||a||(r===i?r=-i:r-=i);var o=this.aStartAngle+e*r,s=this.aX+this.xRadius*Math.cos(o),l=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){var u=Math.cos(this.aRotation),c=Math.sin(this.aRotation),h=s-this.aX,d=l-this.aY;s=h*u-d*c+this.aX,l=h*c+d*u+this.aY}return n.set(s,l)}},{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,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}},{key:"toJSON",value:function(){var e=_(c(n.prototype),"toJSON",this).call(this);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}},{key:"fromJSON",value:function(e){return _(c(n.prototype),"fromJSON",this).call(this,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}}]),n}(Vo),Wo=function(e){u(n,e);var t=g(n);function n(e,i,r,o,s,l){var u;return a(this,n),(u=t.call(this,e,i,r,r,o,s,l)).isArcCurve=!0,u.type="ArcCurve",u}return s(n)}(Go);function Xo(){var e=0,t=0,n=0,i=0;function r(r,a,o,s){e=r,t=o,n=-3*r+3*a-2*o-s,i=2*r-2*a+o+s}return{initCatmullRom:function(e,t,n,i,a){r(t,n,a*(n-e),a*(i-t))},initNonuniformCatmullRom:function(e,t,n,i,a,o,s){var l=(t-e)/a-(n-e)/(a+o)+(n-t)/o,u=(n-t)/o-(i-t)/(o+s)+(i-n)/s;r(t,n,l*=o,u*=o)},calc:function(r){var a=r*r;return e+t*r+n*a+i*(a*r)}}}var jo=new it,Yo=new Xo,qo=new Xo,Zo=new Xo,Jo=function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"centripetal",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5;return a(this,n),(e=t.call(this)).isCatmullRomCurve3=!0,e.type="CatmullRomCurve3",e.points=i,e.closed=r,e.curveType=o,e.tension=s,e}return s(n,[{key:"getPoint",value:function(e){var t,n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new it,r=i,a=this.points,o=a.length,s=(o-(this.closed?0:1))*e,l=Math.floor(s),u=s-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/o)+1)*o:0===u&&l===o-1&&(l=o-2,u=1),this.closed||l>0?t=a[(l-1)%o]:(jo.subVectors(a[0],a[1]).add(a[0]),t=jo);var c=a[l%o],h=a[(l+1)%o];if(this.closed||l+2<o?n=a[(l+2)%o]:(jo.subVectors(a[o-1],a[o-2]).add(a[o-1]),n=jo),"centripetal"===this.curveType||"chordal"===this.curveType){var d="chordal"===this.curveType?.5:.25,f=Math.pow(t.distanceToSquared(c),d),p=Math.pow(c.distanceToSquared(h),d),v=Math.pow(h.distanceToSquared(n),d);p<1e-4&&(p=1),f<1e-4&&(f=p),v<1e-4&&(v=p),Yo.initNonuniformCatmullRom(t.x,c.x,h.x,n.x,f,p,v),qo.initNonuniformCatmullRom(t.y,c.y,h.y,n.y,f,p,v),Zo.initNonuniformCatmullRom(t.z,c.z,h.z,n.z,f,p,v)}else"catmullrom"===this.curveType&&(Yo.initCatmullRom(t.x,c.x,h.x,n.x,this.tension),qo.initCatmullRom(t.y,c.y,h.y,n.y,this.tension),Zo.initCatmullRom(t.z,c.z,h.z,n.z,this.tension));return r.set(Yo.calc(u),qo.calc(u),Zo.calc(u)),r}},{key:"copy",value:function(e){_(c(n.prototype),"copy",this).call(this,e),this.points=[];for(var t=0,i=e.points.length;t<i;t++){var r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}},{key:"toJSON",value:function(){var e=_(c(n.prototype),"toJSON",this).call(this);e.points=[];for(var t=0,i=this.points.length;t<i;t++){var r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}},{key:"fromJSON",value:function(e){_(c(n.prototype),"fromJSON",this).call(this,e),this.points=[];for(var t=0,i=e.points.length;t<i;t++){var r=e.points[t];this.points.push((new it).fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}]),n}(Vo);function Ko(e,t,n,i,r){var a=.5*(i-t),o=.5*(r-n),s=e*e;return(2*n-2*i+a+o)*(e*s)+(-3*n+3*i-2*a-o)*s+a*e+n}function Qo(e,t,n,i){return function(e,t){var n=1-e;return n*n*t}(e,t)+function(e,t){return 2*(1-e)*e*t}(e,n)+function(e,t){return e*e*t}(e,i)}function $o(e,t,n,i,r){return function(e,t){var n=1-e;return n*n*n*t}(e,t)+function(e,t){var n=1-e;return 3*n*n*e*t}(e,n)+function(e,t){return 3*(1-e)*e*e*t}(e,i)+function(e,t){return e*e*e*t}(e,r)}var es=function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Pe,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Pe,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Pe,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Pe;return a(this,n),(e=t.call(this)).isCubicBezierCurve=!0,e.type="CubicBezierCurve",e.v0=i,e.v1=r,e.v2=o,e.v3=s,e}return s(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Pe,n=t,i=this.v0,r=this.v1,a=this.v2,o=this.v3;return n.set($o(e,i.x,r.x,a.x,o.x),$o(e,i.y,r.y,a.y,o.y)),n}},{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}},{key:"toJSON",value:function(){var e=_(c(n.prototype),"toJSON",this).call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}},{key:"fromJSON",value:function(e){return _(c(n.prototype),"fromJSON",this).call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}]),n}(Vo),ts=function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new it,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new it,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new it,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new it;return a(this,n),(e=t.call(this)).isCubicBezierCurve3=!0,e.type="CubicBezierCurve3",e.v0=i,e.v1=r,e.v2=o,e.v3=s,e}return s(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new it,n=t,i=this.v0,r=this.v1,a=this.v2,o=this.v3;return n.set($o(e,i.x,r.x,a.x,o.x),$o(e,i.y,r.y,a.y,o.y),$o(e,i.z,r.z,a.z,o.z)),n}},{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}},{key:"toJSON",value:function(){var e=_(c(n.prototype),"toJSON",this).call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}},{key:"fromJSON",value:function(e){return _(c(n.prototype),"fromJSON",this).call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}]),n}(Vo),ns=function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Pe,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Pe;return a(this,n),(e=t.call(this)).isLineCurve=!0,e.type="LineCurve",e.v1=i,e.v2=r,e}return s(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Pe,n=t;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}},{key:"getPointAt",value:function(e,t){return this.getPoint(e,t)}},{key:"getTangent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Pe;return t.subVectors(this.v2,this.v1).normalize()}},{key:"getTangentAt",value:function(e,t){return this.getTangent(e,t)}},{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=_(c(n.prototype),"toJSON",this).call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return _(c(n.prototype),"fromJSON",this).call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}]),n}(Vo),is=function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new it,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new it;return a(this,n),(e=t.call(this)).isLineCurve3=!0,e.type="LineCurve3",e.v1=i,e.v2=r,e}return s(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new it,n=t;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}},{key:"getPointAt",value:function(e,t){return this.getPoint(e,t)}},{key:"getTangent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new it;return t.subVectors(this.v2,this.v1).normalize()}},{key:"getTangentAt",value:function(e,t){return this.getTangent(e,t)}},{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=_(c(n.prototype),"toJSON",this).call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return _(c(n.prototype),"fromJSON",this).call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}]),n}(Vo),rs=function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Pe,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Pe,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Pe;return a(this,n),(e=t.call(this)).isQuadraticBezierCurve=!0,e.type="QuadraticBezierCurve",e.v0=i,e.v1=r,e.v2=o,e}return s(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Pe,n=t,i=this.v0,r=this.v1,a=this.v2;return n.set(Qo(e,i.x,r.x,a.x),Qo(e,i.y,r.y,a.y)),n}},{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=_(c(n.prototype),"toJSON",this).call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return _(c(n.prototype),"fromJSON",this).call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}]),n}(Vo),as=function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new it,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new it,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new it;return a(this,n),(e=t.call(this)).isQuadraticBezierCurve3=!0,e.type="QuadraticBezierCurve3",e.v0=i,e.v1=r,e.v2=o,e}return s(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new it,n=t,i=this.v0,r=this.v1,a=this.v2;return n.set(Qo(e,i.x,r.x,a.x),Qo(e,i.y,r.y,a.y),Qo(e,i.z,r.z,a.z)),n}},{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=_(c(n.prototype),"toJSON",this).call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return _(c(n.prototype),"fromJSON",this).call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}]),n}(Vo),os=function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return a(this,n),(e=t.call(this)).isSplineCurve=!0,e.type="SplineCurve",e.points=i,e}return s(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Pe,n=t,i=this.points,r=(i.length-1)*e,a=Math.floor(r),o=r-a,s=i[0===a?a:a-1],l=i[a],u=i[a>i.length-2?i.length-1:a+1],c=i[a>i.length-3?i.length-1:a+2];return n.set(Ko(o,s.x,l.x,u.x,c.x),Ko(o,s.y,l.y,u.y,c.y)),n}},{key:"copy",value:function(e){_(c(n.prototype),"copy",this).call(this,e),this.points=[];for(var t=0,i=e.points.length;t<i;t++){var r=e.points[t];this.points.push(r.clone())}return this}},{key:"toJSON",value:function(){var e=_(c(n.prototype),"toJSON",this).call(this);e.points=[];for(var t=0,i=this.points.length;t<i;t++){var r=this.points[t];e.points.push(r.toArray())}return e}},{key:"fromJSON",value:function(e){_(c(n.prototype),"fromJSON",this).call(this,e),this.points=[];for(var t=0,i=e.points.length;t<i;t++){var r=e.points[t];this.points.push((new Pe).fromArray(r))}return this}}]),n}(Vo),ss=Object.freeze({__proto__:null,ArcCurve:Wo,CatmullRomCurve3:Jo,CubicBezierCurve:es,CubicBezierCurve3:ts,EllipseCurve:Go,LineCurve:ns,LineCurve3:is,QuadraticBezierCurve:rs,QuadraticBezierCurve3:as,SplineCurve:os}),ls=e("bO",function(e){u(n,e);var t=g(n);function n(e){var i;return a(this,n),(i=t.call(this)).type="Path",i.currentPoint=new Pe,e&&i.setFromPoints(e),i}return s(n,[{key:"setFromPoints",value:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}},{key:"moveTo",value:function(e,t){return this.currentPoint.set(e,t),this}},{key:"lineTo",value:function(e,t){var n=new ns(this.currentPoint.clone(),new Pe(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}},{key:"quadraticCurveTo",value:function(e,t,n,i){var r=new rs(this.currentPoint.clone(),new Pe(e,t),new Pe(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this}},{key:"bezierCurveTo",value:function(e,t,n,i,r,a){var o=new es(this.currentPoint.clone(),new Pe(e,t),new Pe(n,i),new Pe(r,a));return this.curves.push(o),this.currentPoint.set(r,a),this}},{key:"splineThru",value:function(e){var t=[this.currentPoint.clone()].concat(e),n=new os(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}},{key:"arc",value:function(e,t,n,i,r,a){var o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(e+o,t+s,n,i,r,a),this}},{key:"absarc",value:function(e,t,n,i,r,a){return this.absellipse(e,t,n,n,i,r,a),this}},{key:"ellipse",value:function(e,t,n,i,r,a,o,s){var l=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+l,t+u,n,i,r,a,o,s),this}},{key:"absellipse",value:function(e,t,n,i,r,a,o,s){var l=new Go(e,t,n,i,r,a,o,s);if(this.curves.length>0){var u=l.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(l);var c=l.getPoint(1);return this.currentPoint.copy(c),this}},{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.currentPoint.copy(e.currentPoint),this}},{key:"toJSON",value:function(){var e=_(c(n.prototype),"toJSON",this).call(this);return e.currentPoint=this.currentPoint.toArray(),e}},{key:"fromJSON",value:function(e){return _(c(n.prototype),"fromJSON",this).call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}]),n}(function(e){u(n,e);var t=g(n);function n(){var e;return a(this,n),(e=t.call(this)).type="CurvePath",e.curves=[],e.autoClose=!1,e}return s(n,[{key:"add",value:function(e){this.curves.push(e)}},{key:"closePath",value:function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new ns(t,e))}},{key:"getPoint",value:function(e,t){for(var n=e*this.getLength(),i=this.getCurveLengths(),r=0;r<i.length;){if(i[r]>=n){var a=i[r]-n,o=this.curves[r],s=o.getLength(),l=0===s?0:1-a/s;return o.getPointAt(l,t)}r++}return null}},{key:"getLength",value:function(){var e=this.getCurveLengths();return e[e.length-1]}},{key:"updateArcLengths",value:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}},{key:"getCurveLengths",value:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}},{key:"getSpacedPoints",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:40,t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}},{key:"getPoints",value:function(){for(var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:12,n=[],i=0,r=this.curves;i<r.length;i++)for(var a=r[i],o=a.isEllipseCurve?2*t:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?t*a.points.length:t,s=a.getPoints(o),l=0;l<s.length;l++){var u=s[l];e&&e.equals(u)||(n.push(u),e=u)}return this.autoClose&&n.length>1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n}},{key:"copy",value:function(e){_(c(n.prototype),"copy",this).call(this,e),this.curves=[];for(var t=0,i=e.curves.length;t<i;t++){var r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this}},{key:"toJSON",value:function(){var e=_(c(n.prototype),"toJSON",this).call(this);e.autoClose=this.autoClose,e.curves=[];for(var t=0,i=this.curves.length;t<i;t++){var r=this.curves[t];e.curves.push(r.toJSON())}return e}},{key:"fromJSON",value:function(e){_(c(n.prototype),"fromJSON",this).call(this,e),this.autoClose=e.autoClose,this.curves=[];for(var t=0,i=e.curves.length;t<i;t++){var r=e.curves[t];this.curves.push((new ss[r.type]).fromJSON(r))}return this}}]),n}(Vo))),us=(e("bS",function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:32,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2*Math.PI;a(this,n),(e=t.call(this)).type="CircleGeometry",e.parameters={radius:i,segments:r,thetaStart:o,thetaLength:s},r=Math.max(3,r);var l=[],u=[],c=[],h=[],d=new it,f=new Pe;u.push(0,0,0),c.push(0,0,1),h.push(.5,.5);for(var p=0,v=3;p<=r;p++,v+=3){var m=o+p/r*s;d.x=i*Math.cos(m),d.y=i*Math.sin(m),u.push(d.x,d.y,d.z),c.push(0,0,1),f.x=(u[v]/i+1)/2,f.y=(u[v+1]/i+1)/2,h.push(f.x,f.y)}for(var g=1;g<=r;g++)l.push(g,g+1,0);return e.setIndex(l),e.setAttribute("position",new In(u,3)),e.setAttribute("normal",new In(c,3)),e.setAttribute("uv",new In(h,2)),e}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}}],[{key:"fromJSON",value:function(e){return new n(e.radius,e.segments,e.thetaStart,e.thetaLength)}}]),n}(Vn)),e("aR",function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:32,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,u=arguments.length>5&&void 0!==arguments[5]&&arguments[5],c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,h=arguments.length>7&&void 0!==arguments[7]?arguments[7]:2*Math.PI;a(this,n),(e=t.call(this)).type="CylinderGeometry",e.parameters={radiusTop:i,radiusBottom:r,height:o,radialSegments:s,heightSegments:l,openEnded:u,thetaStart:c,thetaLength:h};var d=v(e);s=Math.floor(s),l=Math.floor(l);var f=[],p=[],m=[],g=[],y=0,_=[],x=o/2,M=0;function S(){for(var e=new it,t=new it,n=0,a=(r-i)/o,u=0;u<=l;u++){for(var v=[],S=u/l,b=S*(r-i)+i,E=0;E<=s;E++){var T=E/s,w=T*h+c,A=Math.sin(w),R=Math.cos(w);t.x=b*A,t.y=-S*o+x,t.z=b*R,p.push(t.x,t.y,t.z),e.set(A,a,R).normalize(),m.push(e.x,e.y,e.z),g.push(T,1-S),v.push(y++)}_.push(v)}for(var C=0;C<s;C++)for(var L=0;L<l;L++){var P=_[L][C],k=_[L+1][C],U=_[L+1][C+1],I=_[L][C+1];f.push(P,k,I),f.push(k,U,I),n+=6}d.addGroup(M,n,0),M+=n}function b(e){for(var t=y,n=new Pe,a=new it,o=0,l=!0===e?i:r,u=!0===e?1:-1,v=1;v<=s;v++)p.push(0,x*u,0),m.push(0,u,0),g.push(.5,.5),y++;for(var _=y,S=0;S<=s;S++){var b=S/s*h+c,E=Math.cos(b),T=Math.sin(b);a.x=l*T,a.y=x*u,a.z=l*E,p.push(a.x,a.y,a.z),m.push(0,u,0),n.x=.5*E+.5,n.y=.5*T*u+.5,g.push(n.x,n.y),y++}for(var w=0;w<s;w++){var A=t+w,R=_+w;!0===e?f.push(R,R+1,A):f.push(R+1,R,A),o+=3}d.addGroup(M,o,!0===e?1:2),M+=o}return S(),!1===u&&(i>0&&b(!0),r>0&&b(!1)),e.setIndex(f),e.setAttribute("position",new In(p,3)),e.setAttribute("normal",new In(m,3)),e.setAttribute("uv",new In(g,2)),e}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}}],[{key:"fromJSON",value:function(e){return new n(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}]),n}(Vn))),cs=function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;a(this,n),(e=t.call(this)).type="PolyhedronGeometry",e.parameters={vertices:i,indices:r,radius:o,detail:s};var l=[],u=[];function c(e){for(var t=new it,n=new it,i=new it,a=0;a<r.length;a+=3)m(r[a+0],t),m(r[a+1],n),m(r[a+2],i),h(t,n,i,e)}function h(e,t,n,i){for(var r=i+1,a=[],o=0;o<=r;o++){a[o]=[];for(var s=e.clone().lerp(n,o/r),l=t.clone().lerp(n,o/r),u=r-o,c=0;c<=u;c++)a[o][c]=0===c&&o===r?s:s.clone().lerp(l,c/u)}for(var h=0;h<r;h++)for(var d=0;d<2*(r-h)-1;d++){var f=Math.floor(d/2);d%2==0?(v(a[h][f+1]),v(a[h+1][f]),v(a[h][f])):(v(a[h][f+1]),v(a[h+1][f+1]),v(a[h+1][f]))}}function d(e){for(var t=new it,n=0;n<l.length;n+=3)t.x=l[n+0],t.y=l[n+1],t.z=l[n+2],t.normalize().multiplyScalar(e),l[n+0]=t.x,l[n+1]=t.y,l[n+2]=t.z}function f(){for(var e=new it,t=0;t<l.length;t+=3){e.x=l[t+0],e.y=l[t+1],e.z=l[t+2];var n=_(e)/2/Math.PI+.5,i=x(e)/Math.PI+.5;u.push(n,1-i)}g(),p()}function p(){for(var e=0;e<u.length;e+=6){var t=u[e+0],n=u[e+2],i=u[e+4],r=Math.max(t,n,i),a=Math.min(t,n,i);r>.9&&a<.1&&(t<.2&&(u[e+0]+=1),n<.2&&(u[e+2]+=1),i<.2&&(u[e+4]+=1))}}function v(e){l.push(e.x,e.y,e.z)}function m(e,t){var n=3*e;t.x=i[n+0],t.y=i[n+1],t.z=i[n+2]}function g(){for(var e=new it,t=new it,n=new it,i=new it,r=new Pe,a=new Pe,o=new Pe,s=0,c=0;s<l.length;s+=9,c+=6){e.set(l[s+0],l[s+1],l[s+2]),t.set(l[s+3],l[s+4],l[s+5]),n.set(l[s+6],l[s+7],l[s+8]),r.set(u[c+0],u[c+1]),a.set(u[c+2],u[c+3]),o.set(u[c+4],u[c+5]),i.copy(e).add(t).add(n).divideScalar(3);var h=_(i);y(r,c+0,e,h),y(a,c+2,t,h),y(o,c+4,n,h)}}function y(e,t,n,i){i<0&&1===e.x&&(u[t]=e.x-1),0===n.x&&0===n.z&&(u[t]=i/2/Math.PI+.5)}function _(e){return Math.atan2(e.z,-e.x)}function x(e){return Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))}return c(s),d(o),f(),e.setAttribute("position",new In(l,3)),e.setAttribute("normal",new In(l.slice(),3)),e.setAttribute("uv",new In(u,2)),0===s?e.computeVertexNormals():e.normalizeNormals(),e}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}}],[{key:"fromJSON",value:function(e){return new n(e.vertices,e.indices,e.radius,e.details)}}]),n}(Vn),hs=new it,ds=new it,fs=new it,ps=new gn,vs=(e("aO",function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(a(this,n),(e=t.call(this)).type="EdgesGeometry",e.parameters={geometry:i,thresholdAngle:r},null!==i){for(var o=4,s=Math.pow(10,o),l=Math.cos(xe*r),u=i.getIndex(),c=i.getAttribute("position"),h=u?u.count:c.count,d=[0,0,0],f=["a","b","c"],p=new Array(3),v={},m=[],g=0;g<h;g+=3){u?(d[0]=u.getX(g),d[1]=u.getX(g+1),d[2]=u.getX(g+2)):(d[0]=g,d[1]=g+1,d[2]=g+2);var y=ps.a,_=ps.b,x=ps.c;if(y.fromBufferAttribute(c,d[0]),_.fromBufferAttribute(c,d[1]),x.fromBufferAttribute(c,d[2]),ps.getNormal(fs),p[0]="".concat(Math.round(y.x*s),",").concat(Math.round(y.y*s),",").concat(Math.round(y.z*s)),p[1]="".concat(Math.round(_.x*s),",").concat(Math.round(_.y*s),",").concat(Math.round(_.z*s)),p[2]="".concat(Math.round(x.x*s),",").concat(Math.round(x.y*s),",").concat(Math.round(x.z*s)),p[0]!==p[1]&&p[1]!==p[2]&&p[2]!==p[0])for(var M=0;M<3;M++){var S=(M+1)%3,b=p[M],E=p[S],T=ps[f[M]],w=ps[f[S]],A="".concat(b,"_").concat(E),R="".concat(E,"_").concat(b);R in v&&v[R]?(fs.dot(v[R].normal)<=l&&(m.push(T.x,T.y,T.z),m.push(w.x,w.y,w.z)),v[R]=null):A in v||(v[A]={index0:d[M],index1:d[S],normal:fs.clone()})}}for(var C in v)if(v[C]){var L=v[C],P=L.index0,k=L.index1;hs.fromBufferAttribute(c,P),ds.fromBufferAttribute(c,k),m.push(hs.x,hs.y,hs.z),m.push(ds.x,ds.y,ds.z)}e.setAttribute("position",new In(m,3))}return e}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}}]),n}(Vn)),e("bN",function(e){u(n,e);var t=g(n);function n(e){var i;return a(this,n),(i=t.call(this,e)).uuid=Se(),i.type="Shape",i.holes=[],i}return s(n,[{key:"getPointsHoles",value:function(e){for(var t=[],n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t}},{key:"extractPoints",value:function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}},{key:"copy",value:function(e){_(c(n.prototype),"copy",this).call(this,e),this.holes=[];for(var t=0,i=e.holes.length;t<i;t++){var r=e.holes[t];this.holes.push(r.clone())}return this}},{key:"toJSON",value:function(){var e=_(c(n.prototype),"toJSON",this).call(this);e.uuid=this.uuid,e.holes=[];for(var t=0,i=this.holes.length;t<i;t++){var r=this.holes[t];e.holes.push(r.toJSON())}return e}},{key:"fromJSON",value:function(e){_(c(n.prototype),"fromJSON",this).call(this,e),this.uuid=e.uuid,this.holes=[];for(var t=0,i=e.holes.length;t<i;t++){var r=e.holes[t];this.holes.push((new ls).fromJSON(r))}return this}}]),n}(ls)));function ms(e,t,n,i,r){var a,o;if(r===function(e,t,n,i){for(var r=0,a=t,o=n-i;a<n;a+=i)r+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return r}(e,t,n,i)>0)for(a=t;a<n;a+=i)o=Fs(a,e[a],e[a+1],o);else for(a=n-i;a>=t;a-=i)o=Fs(a,e[a],e[a+1],o);return o&&ks(o,o.next)&&(zs(o),o=o.next),o}function gs(e,t){if(!e)return e;t||(t=e);var n,i=e;do{if(n=!1,i.steiner||!ks(i,i.next)&&0!==Ps(i.prev,i,i.next))i=i.next;else{if(zs(i),(i=t=i.prev)===i.next)break;n=!0}}while(n||i!==t);return t}function ys(e,t,n,i,r,a,o){if(e){!o&&a&&function(e,t,n,i){var r=e;do{0===r.z&&(r.z=As(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){var t,n,i,r,a,o,s,l,u=1;do{for(n=e,e=null,a=null,o=0;n;){for(o++,i=n,s=0,t=0;t<u&&(s++,i=i.nextZ);t++);for(l=u;s>0||l>0&&i;)0!==s&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,s--):(r=i,i=i.nextZ,l--),a?a.nextZ=r:e=r,r.prevZ=a,a=r;n=i}a.nextZ=null,u*=2}while(o>1)}(r)}(e,i,r,a);for(var s,l,u=e;e.prev!==e.next;)if(s=e.prev,l=e.next,a?xs(e,i,r,a):_s(e))t.push(s.i/n|0),t.push(e.i/n|0),t.push(l.i/n|0),zs(e),e=l.next,u=l.next;else if((e=l)===u){o?1===o?ys(e=Ms(gs(e),t,n),t,n,i,r,a,2):2===o&&Ss(e,t,n,i,r,a):ys(gs(e),t,n,i,r,a,1);break}}}function _s(e){var t=e.prev,n=e,i=e.next;if(Ps(t,n,i)>=0)return!1;for(var r=t.x,a=n.x,o=i.x,s=t.y,l=n.y,u=i.y,c=r<a?r<o?r:o:a<o?a:o,h=s<l?s<u?s:u:l<u?l:u,d=r>a?r>o?r:o:a>o?a:o,f=s>l?s>u?s:u:l>u?l:u,p=i.next;p!==t;){if(p.x>=c&&p.x<=d&&p.y>=h&&p.y<=f&&Cs(r,s,a,l,o,u,p.x,p.y)&&Ps(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function xs(e,t,n,i){var r=e.prev,a=e,o=e.next;if(Ps(r,a,o)>=0)return!1;for(var s=r.x,l=a.x,u=o.x,c=r.y,h=a.y,d=o.y,f=s<l?s<u?s:u:l<u?l:u,p=c<h?c<d?c:d:h<d?h:d,v=s>l?s>u?s:u:l>u?l:u,m=c>h?c>d?c:d:h>d?h:d,g=As(f,p,t,n,i),y=As(v,m,t,n,i),_=e.prevZ,x=e.nextZ;_&&_.z>=g&&x&&x.z<=y;){if(_.x>=f&&_.x<=v&&_.y>=p&&_.y<=m&&_!==r&&_!==o&&Cs(s,c,l,h,u,d,_.x,_.y)&&Ps(_.prev,_,_.next)>=0)return!1;if(_=_.prevZ,x.x>=f&&x.x<=v&&x.y>=p&&x.y<=m&&x!==r&&x!==o&&Cs(s,c,l,h,u,d,x.x,x.y)&&Ps(x.prev,x,x.next)>=0)return!1;x=x.nextZ}for(;_&&_.z>=g;){if(_.x>=f&&_.x<=v&&_.y>=p&&_.y<=m&&_!==r&&_!==o&&Cs(s,c,l,h,u,d,_.x,_.y)&&Ps(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;x&&x.z<=y;){if(x.x>=f&&x.x<=v&&x.y>=p&&x.y<=m&&x!==r&&x!==o&&Cs(s,c,l,h,u,d,x.x,x.y)&&Ps(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function Ms(e,t,n){var i=e;do{var r=i.prev,a=i.next.next;!ks(r,a)&&Us(r,i,i.next,a)&&Ds(r,a)&&Ds(a,r)&&(t.push(r.i/n|0),t.push(i.i/n|0),t.push(a.i/n|0),zs(i),zs(i.next),i=e=a),i=i.next}while(i!==e);return gs(i)}function Ss(e,t,n,i,r,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&Ls(o,s)){var l=Os(o,s);return o=gs(o,o.next),l=gs(l,l.next),ys(o,t,n,i,r,a,0),void ys(l,t,n,i,r,a,0)}s=s.next}o=o.next}while(o!==e)}function bs(e,t,n,i){var r,a,o,s=[];for(r=0,a=t.length;r<a;r++)(o=ms(e,t[r]*i,r<a-1?t[r+1]*i:e.length,i,!1))===o.next&&(o.steiner=!0),s.push(Rs(o));for(s.sort(Es),r=0;r<s.length;r++)n=Ts(s[r],n);return n}function Es(e,t){return e.x-t.x}function Ts(e,t){var n=function(e,t){var n,i=t,r=-1/0,a=e.x,o=e.y;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){var s=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=a&&s>r&&(r=s,n=i.x<i.next.x?i:i.next,s===a))return n}i=i.next}while(i!==t);if(!n)return null;var l,u=n,c=n.x,h=n.y,d=1/0;i=n;do{a>=i.x&&i.x>=c&&a!==i.x&&Cs(o<h?a:r,o,c,h,o<h?r:a,o,i.x,i.y)&&(l=Math.abs(o-i.y)/(a-i.x),Ds(i,e)&&(l<d||l===d&&(i.x>n.x||i.x===n.x&&ws(n,i)))&&(n=i,d=l)),i=i.next}while(i!==u);return n}(e,t);if(!n)return t;var i=Os(n,e);return gs(i,i.next),gs(n,n.next)}function ws(e,t){return Ps(e.prev,e,t.prev)<0&&Ps(t.next,e,e.next)<0}function As(e,t,n,i,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Rs(e){var t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function Cs(e,t,n,i,r,a,o,s){return(r-o)*(t-s)>=(e-o)*(a-s)&&(e-o)*(i-s)>=(n-o)*(t-s)&&(n-o)*(a-s)>=(r-o)*(i-s)}function Ls(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&Us(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(Ds(e,t)&&Ds(t,e)&&function(e,t){var n=e,i=!1,r=(e.x+t.x)/2,a=(e.y+t.y)/2;do{n.y>a!=n.next.y>a&&n.next.y!==n.y&&r<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==e);return i}(e,t)&&(Ps(e.prev,e,t.prev)||Ps(e,t.prev,t))||ks(e,t)&&Ps(e.prev,e,e.next)>0&&Ps(t.prev,t,t.next)>0)}function Ps(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function ks(e,t){return e.x===t.x&&e.y===t.y}function Us(e,t,n,i){var r=Ns(Ps(e,t,n)),a=Ns(Ps(e,t,i)),o=Ns(Ps(n,i,e)),s=Ns(Ps(n,i,t));return r!==a&&o!==s||!(0!==r||!Is(e,n,t))||!(0!==a||!Is(e,i,t))||!(0!==o||!Is(n,e,i))||!(0!==s||!Is(n,t,i))}function Is(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function Ns(e){return e>0?1:e<0?-1:0}function Ds(e,t){return Ps(e.prev,e,e.next)<0?Ps(e,t,e.next)>=0&&Ps(e,e.prev,t)>=0:Ps(e,t,e.prev)<0||Ps(e,e.next,t)<0}function Os(e,t){var n=new Bs(e.i,e.x,e.y),i=new Bs(t.i,t.x,t.y),r=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,i.next=n,n.prev=i,a.next=i,i.prev=a,i}function Fs(e,t,n,i){var r=new Bs(e,t,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function zs(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Bs(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}var Hs=function(){function e(){a(this,e)}return s(e,null,[{key:"area",value:function(e){for(var t=e.length,n=0,i=t-1,r=0;r<t;i=r++)n+=e[i].x*e[r].y-e[r].x*e[i].y;return.5*n}},{key:"isClockWise",value:function(t){return e.area(t)<0}},{key:"triangulateShape",value:function(e,t){var n=[],i=[],r=[];Vs(e),Gs(n,e);var a=e.length;t.forEach(Vs);for(var o=0;o<t.length;o++)i.push(a),a+=t[o].length,Gs(n,t[o]);for(var s=function(e,t){var n,i,r,a,o,s,l,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2,c=t&&t.length,h=c?t[0]*u:e.length,d=ms(e,0,h,u,!0),f=[];if(!d||d.next===d.prev)return f;if(c&&(d=bs(e,t,d,u)),e.length>80*u){n=r=e[0],i=a=e[1];for(var p=u;p<h;p+=u)(o=e[p])<n&&(n=o),(s=e[p+1])<i&&(i=s),o>r&&(r=o),s>a&&(a=s);l=0!==(l=Math.max(r-n,a-i))?32767/l:0}return ys(d,f,u,n,i,l,0),f}(n,i),l=0;l<s.length;l+=3)r.push(s.slice(l,l+3));return r}}]),e}();function Vs(e){var t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function Gs(e,t){for(var n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}e("b$",function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new vs([new Pe(.5,.5),new Pe(-.5,.5),new Pe(-.5,-.5),new Pe(.5,-.5)]),r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};a(this,n),(e=t.call(this)).type="ExtrudeGeometry",e.parameters={shapes:i,options:r},i=Array.isArray(i)?i:[i];for(var o=v(e),s=[],l=[],u=0,c=i.length;u<c;u++){var h=i[u];d(h)}function d(e){var t,n,i,a,u,c=[],h=void 0!==r.curveSegments?r.curveSegments:12,d=void 0!==r.steps?r.steps:1,f=void 0!==r.depth?r.depth:1,p=void 0===r.bevelEnabled||r.bevelEnabled,v=void 0!==r.bevelThickness?r.bevelThickness:.2,m=void 0!==r.bevelSize?r.bevelSize:v-.1,g=void 0!==r.bevelOffset?r.bevelOffset:0,y=void 0!==r.bevelSegments?r.bevelSegments:3,_=r.extrudePath,x=void 0!==r.UVGenerator?r.UVGenerator:Ws,M=!1;_&&(t=_.getSpacedPoints(d),M=!0,p=!1,n=_.computeFrenetFrames(d,!1),i=new it,a=new it,u=new it),p||(y=0,v=0,m=0,g=0);var S=e.extractPoints(h),b=S.shape,E=S.holes;if(!Hs.isClockWise(b)){b=b.reverse();for(var T=0,w=E.length;T<w;T++){var A=E[T];Hs.isClockWise(A)&&(E[T]=A.reverse())}}for(var R=Hs.triangulateShape(b,E),C=b,L=0,P=E.length;L<P;L++){var k=E[L];b=b.concat(k)}function U(e,t,n){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().addScaledVector(t,n)}var I=b.length,N=R.length;function D(e,t,n){var i,r,a,o=e.x-t.x,s=e.y-t.y,l=n.x-e.x,u=n.y-e.y,c=o*o+s*s,h=o*u-s*l;if(Math.abs(h)>Number.EPSILON){var d=Math.sqrt(c),f=Math.sqrt(l*l+u*u),p=t.x-s/d,v=t.y+o/d,m=((n.x-u/f-p)*u-(n.y+l/f-v)*l)/(o*u-s*l),g=(i=p+o*m-e.x)*i+(r=v+s*m-e.y)*r;if(g<=2)return new Pe(i,r);a=Math.sqrt(g/2)}else{var y=!1;o>Number.EPSILON?l>Number.EPSILON&&(y=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(u)&&(y=!0),y?(i=-s,r=o,a=Math.sqrt(c)):(i=o,r=s,a=Math.sqrt(c/2))}return new Pe(i/a,r/a)}for(var O=[],F=0,z=C.length,B=z-1,H=F+1;F<z;F++,B++,H++)B===z&&(B=0),H===z&&(H=0),O[F]=D(C[F],C[B],C[H]);for(var V,G=[],W=O.concat(),X=0,j=E.length;X<j;X++){var Y=E[X];V=[];for(var q=0,Z=Y.length,J=Z-1,K=q+1;q<Z;q++,J++,K++)J===Z&&(J=0),K===Z&&(K=0),V[q]=D(Y[q],Y[J],Y[K]);G.push(V),W=W.concat(V)}for(var Q=0;Q<y;Q++){for(var $=Q/y,ee=v*Math.cos($*Math.PI/2),te=m*Math.sin($*Math.PI/2)+g,ne=0,ie=C.length;ne<ie;ne++){var re=U(C[ne],O[ne],te);ke(re.x,re.y,-ee)}for(var ae=0,oe=E.length;ae<oe;ae++){var se=E[ae];V=G[ae];for(var le=0,ue=se.length;le<ue;le++){var ce=U(se[le],V[le],te);ke(ce.x,ce.y,-ee)}}}for(var he=m+g,de=0;de<I;de++){var fe=p?U(b[de],W[de],he):b[de];M?(a.copy(n.normals[0]).multiplyScalar(fe.x),i.copy(n.binormals[0]).multiplyScalar(fe.y),u.copy(t[0]).add(a).add(i),ke(u.x,u.y,u.z)):ke(fe.x,fe.y,0)}for(var pe=1;pe<=d;pe++)for(var ve=0;ve<I;ve++){var me=p?U(b[ve],W[ve],he):b[ve];M?(a.copy(n.normals[pe]).multiplyScalar(me.x),i.copy(n.binormals[pe]).multiplyScalar(me.y),u.copy(t[pe]).add(a).add(i),ke(u.x,u.y,u.z)):ke(me.x,me.y,f/d*pe)}for(var ge=y-1;ge>=0;ge--){for(var ye=ge/y,_e=v*Math.cos(ye*Math.PI/2),xe=m*Math.sin(ye*Math.PI/2)+g,Me=0,Se=C.length;Me<Se;Me++){var be=U(C[Me],O[Me],xe);ke(be.x,be.y,f+_e)}for(var Ee=0,Te=E.length;Ee<Te;Ee++){var we=E[Ee];V=G[Ee];for(var Ae=0,Re=we.length;Ae<Re;Ae++){var Ce=U(we[Ae],V[Ae],xe);M?ke(Ce.x,Ce.y+t[d-1].y,t[d-1].x+_e):ke(Ce.x,Ce.y,f+_e)}}}function Le(e,t){for(var n=e.length;--n>=0;){var i=n,r=n-1;r<0&&(r=e.length-1);for(var a=0,o=d+2*y;a<o;a++){var s=I*a,l=I*(a+1);Ie(t+i+s,t+r+s,t+r+l,t+i+l)}}}function ke(e,t,n){c.push(e),c.push(t),c.push(n)}function Ue(e,t,n){Ne(e),Ne(t),Ne(n);var i=s.length/3,r=x.generateTopUV(o,s,i-3,i-2,i-1);De(r[0]),De(r[1]),De(r[2])}function Ie(e,t,n,i){Ne(e),Ne(t),Ne(i),Ne(t),Ne(n),Ne(i);var r=s.length/3,a=x.generateSideWallUV(o,s,r-6,r-3,r-2,r-1);De(a[0]),De(a[1]),De(a[3]),De(a[1]),De(a[2]),De(a[3])}function Ne(e){s.push(c[3*e+0]),s.push(c[3*e+1]),s.push(c[3*e+2])}function De(e){l.push(e.x),l.push(e.y)}!function(){var e=s.length/3;if(p){for(var t=0,n=I*t,i=0;i<N;i++){var r=R[i];Ue(r[2]+n,r[1]+n,r[0]+n)}n=I*(t=d+2*y);for(var a=0;a<N;a++){var l=R[a];Ue(l[0]+n,l[1]+n,l[2]+n)}}else{for(var u=0;u<N;u++){var c=R[u];Ue(c[2],c[1],c[0])}for(var h=0;h<N;h++){var f=R[h];Ue(f[0]+I*d,f[1]+I*d,f[2]+I*d)}}o.addGroup(e,s.length/3-e,0)}(),function(){var e=s.length/3,t=0;Le(C,t),t+=C.length;for(var n=0,i=E.length;n<i;n++){var r=E[n];Le(r,t),t+=r.length}o.addGroup(e,s.length/3-e,1)}()}return e.setAttribute("position",new In(s,3)),e.setAttribute("uv",new In(l,2)),e.computeVertexNormals(),e}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}},{key:"toJSON",value:function(){var e=_(c(n.prototype),"toJSON",this).call(this);return function(e,t,n){if(n.shapes=[],Array.isArray(e))for(var i=0,r=e.length;i<r;i++){var a=e[i];n.shapes.push(a.uuid)}else n.shapes.push(e.uuid);return n.options=Object.assign({},t),void 0!==t.extrudePath&&(n.options.extrudePath=t.extrudePath.toJSON()),n}(this.parameters.shapes,this.parameters.options,e)}}],[{key:"fromJSON",value:function(e,t){for(var i=[],r=0,a=e.shapes.length;r<a;r++){var o=t[e.shapes[r]];i.push(o)}var s=e.options.extrudePath;return void 0!==s&&(e.options.extrudePath=(new ss[s.type]).fromJSON(s)),new n(i,e.options)}}]),n}(Vn));var Ws={generateTopUV:function(e,t,n,i,r){var a=t[3*n],o=t[3*n+1],s=t[3*i],l=t[3*i+1],u=t[3*r],c=t[3*r+1];return[new Pe(a,o),new Pe(s,l),new Pe(u,c)]},generateSideWallUV:function(e,t,n,i,r,a){var o=t[3*n],s=t[3*n+1],l=t[3*n+2],u=t[3*i],c=t[3*i+1],h=t[3*i+2],d=t[3*r],f=t[3*r+1],p=t[3*r+2],v=t[3*a],m=t[3*a+1],g=t[3*a+2];return Math.abs(s-c)<Math.abs(o-u)?[new Pe(o,1-l),new Pe(u,1-h),new Pe(d,1-p),new Pe(v,1-g)]:[new Pe(s,1-l),new Pe(c,1-h),new Pe(f,1-p),new Pe(m,1-g)]}};e("bR",function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;a(this,n);var o=(1+Math.sqrt(5))/2,s=[-1,o,0,1,o,0,-1,-o,0,1,-o,0,0,-1,o,0,1,o,0,-1,-o,0,1,-o,o,0,-1,o,0,1,-o,0,-1,-o,0,1],l=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];return(e=t.call(this,s,l,i,r)).type="IcosahedronGeometry",e.parameters={radius:i,detail:r},e}return s(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.detail)}}]),n}(cs)),e("aU",function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.5,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:32,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2*Math.PI;a(this,n),(e=t.call(this)).type="RingGeometry",e.parameters={innerRadius:i,outerRadius:r,thetaSegments:o,phiSegments:s,thetaStart:l,thetaLength:u},o=Math.max(3,o);for(var c=[],h=[],d=[],f=[],p=i,v=(r-i)/(s=Math.max(1,s)),m=new it,g=new Pe,y=0;y<=s;y++){for(var _=0;_<=o;_++){var x=l+_/o*u;m.x=p*Math.cos(x),m.y=p*Math.sin(x),h.push(m.x,m.y,m.z),d.push(0,0,1),g.x=(m.x/r+1)/2,g.y=(m.y/r+1)/2,f.push(g.x,g.y)}p+=v}for(var M=0;M<s;M++)for(var S=M*(o+1),b=0;b<o;b++){var E=b+S,T=E,w=E+o+1,A=E+o+2,R=E+1;c.push(T,w,R),c.push(w,A,R)}return e.setIndex(c),e.setAttribute("position",new In(h,3)),e.setAttribute("normal",new In(d,3)),e.setAttribute("uv",new In(f,2)),e}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}}],[{key:"fromJSON",value:function(e){return new n(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}]),n}(Vn)),e("bP",function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new vs([new Pe(0,.5),new Pe(-.5,-.5),new Pe(.5,-.5)]),r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:12;a(this,n),(e=t.call(this)).type="ShapeGeometry",e.parameters={shapes:i,curveSegments:r};var o=[],s=[],l=[],u=[],c=0,h=0;if(!1===Array.isArray(i))f(i);else for(var d=0;d<i.length;d++)f(i[d]),e.addGroup(c,h,d),c+=h,h=0;function f(e){var t=s.length/3,n=e.extractPoints(r),i=n.shape,a=n.holes;!1===Hs.isClockWise(i)&&(i=i.reverse());for(var c=0,d=a.length;c<d;c++){var f=a[c];!0===Hs.isClockWise(f)&&(a[c]=f.reverse())}for(var p=Hs.triangulateShape(i,a),v=0,m=a.length;v<m;v++){var g=a[v];i=i.concat(g)}for(var y=0,_=i.length;y<_;y++){var x=i[y];s.push(x.x,x.y,0),l.push(0,0,1),u.push(x.x,x.y)}for(var M=0,S=p.length;M<S;M++){var b=p[M],E=b[0]+t,T=b[1]+t,w=b[2]+t;o.push(E,T,w),h+=3}}return e.setIndex(o),e.setAttribute("position",new In(s,3)),e.setAttribute("normal",new In(l,3)),e.setAttribute("uv",new In(u,2)),e}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}},{key:"toJSON",value:function(){var e=_(c(n.prototype),"toJSON",this).call(this);return function(e,t){if(t.shapes=[],Array.isArray(e))for(var n=0,i=e.length;n<i;n++){var r=e[n];t.shapes.push(r.uuid)}else t.shapes.push(e.uuid);return t}(this.parameters.shapes,e)}}],[{key:"fromJSON",value:function(e,t){for(var i=[],r=0,a=e.shapes.length;r<a;r++){var o=t[e.shapes[r]];i.push(o)}return new n(i,e.curveSegments)}}]),n}(Vn)),e("aT",function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:32,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:16,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2*Math.PI,u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:Math.PI;a(this,n),(e=t.call(this)).type="SphereGeometry",e.parameters={radius:i,widthSegments:r,heightSegments:o,phiStart:s,phiLength:l,thetaStart:u,thetaLength:c},r=Math.max(3,Math.floor(r)),o=Math.max(2,Math.floor(o));for(var h=Math.min(u+c,Math.PI),d=0,f=[],p=new it,v=new it,m=[],g=[],y=[],_=[],x=0;x<=o;x++){var M=[],S=x/o,b=0;0===x&&0===u?b=.5/r:x===o&&h===Math.PI&&(b=-.5/r);for(var E=0;E<=r;E++){var T=E/r;p.x=-i*Math.cos(s+T*l)*Math.sin(u+S*c),p.y=i*Math.cos(u+S*c),p.z=i*Math.sin(s+T*l)*Math.sin(u+S*c),g.push(p.x,p.y,p.z),v.copy(p).normalize(),y.push(v.x,v.y,v.z),_.push(T+b,1-S),M.push(d++)}f.push(M)}for(var w=0;w<o;w++)for(var A=0;A<r;A++){var R=f[w][A+1],C=f[w][A],L=f[w+1][A],P=f[w+1][A+1];(0!==w||u>0)&&m.push(R,C,P),(w!==o-1||h<Math.PI)&&m.push(C,L,P)}return e.setIndex(m),e.setAttribute("position",new In(g,3)),e.setAttribute("normal",new In(y,3)),e.setAttribute("uv",new In(_,2)),e}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}}],[{key:"fromJSON",value:function(e){return new n(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}]),n}(Vn)),e("bl",function(e){u(n,e);var t=g(n);function n(e){var i;return a(this,n),(i=t.call(this)).isShadowMaterial=!0,i.type="ShadowMaterial",i.color=new En(0),i.transparent=!0,i.fog=!0,i.setValues(e),i}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.color.copy(e.color),this.fog=e.fog,this}}]),n}(_n));var Xs=e("x",function(e){u(n,e);var t=g(n);function n(e){var i;return a(this,n),(i=t.call(this)).isMeshStandardMaterial=!0,i.defines={STANDARD:""},i.type="MeshStandardMaterial",i.color=new En(16777215),i.roughness=1,i.metalness=0,i.map=null,i.lightMap=null,i.lightMapIntensity=1,i.aoMap=null,i.aoMapIntensity=1,i.emissive=new En(0),i.emissiveIntensity=1,i.emissiveMap=null,i.bumpMap=null,i.bumpScale=1,i.normalMap=null,i.normalMapType=0,i.normalScale=new Pe(1,1),i.displacementMap=null,i.displacementScale=1,i.displacementBias=0,i.roughnessMap=null,i.metalnessMap=null,i.alphaMap=null,i.envMap=null,i.envMapIntensity=1,i.wireframe=!1,i.wireframeLinewidth=1,i.wireframeLinecap="round",i.wireframeLinejoin="round",i.flatShading=!1,i.fog=!0,i.setValues(e),i}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,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.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}}]),n}(_n));function js(e,t,n){return qs(e)?new e.constructor(e.subarray(t,void 0!==n?n:e.length)):e.slice(t,n)}function Ys(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)}function qs(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Zs(e){for(var t=e.length,n=new Array(t),i=0;i!==t;++i)n[i]=i;return n.sort((function(t,n){return e[t]-e[n]})),n}function Js(e,t,n){for(var i=e.length,r=new e.constructor(i),a=0,o=0;o!==i;++a)for(var s=n[a]*t,l=0;l!==t;++l)r[o++]=e[s+l];return r}function Ks(e,t,n,i){for(var r=1,a=e[0];void 0!==a&&void 0===a[i];)a=e[r++];if(void 0!==a){var o=a[i];if(void 0!==o)if(Array.isArray(o))do{void 0!==(o=a[i])&&(t.push(a.time),n.push.apply(n,o)),a=e[r++]}while(void 0!==a);else if(void 0!==o.toArray)do{void 0!==(o=a[i])&&(t.push(a.time),o.toArray(n,n.length)),a=e[r++]}while(void 0!==a);else do{void 0!==(o=a[i])&&(t.push(a.time),n.push(o)),a=e[r++]}while(void 0!==a)}}e("l",function(e){u(n,e);var t=g(n);function n(e){var i;return a(this,n),(i=t.call(this)).isMeshPhysicalMaterial=!0,i.defines={STANDARD:"",PHYSICAL:""},i.type="MeshPhysicalMaterial",i.anisotropyRotation=0,i.anisotropyMap=null,i.clearcoatMap=null,i.clearcoatRoughness=0,i.clearcoatRoughnessMap=null,i.clearcoatNormalScale=new Pe(1,1),i.clearcoatNormalMap=null,i.ior=1.5,Object.defineProperty(v(i),"reflectivity",{get:function(){return be(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),i.iridescenceMap=null,i.iridescenceIOR=1.3,i.iridescenceThicknessRange=[100,400],i.iridescenceThicknessMap=null,i.sheenColor=new En(0),i.sheenColorMap=null,i.sheenRoughness=1,i.sheenRoughnessMap=null,i.transmissionMap=null,i.thickness=0,i.thicknessMap=null,i.attenuationDistance=1/0,i.attenuationColor=new En(1,1,1),i.specularIntensity=1,i.specularIntensityMap=null,i.specularColor=new En(1,1,1),i.specularColorMap=null,i._anisotropy=0,i._clearcoat=0,i._iridescence=0,i._sheen=0,i._transmission=0,i.setValues(e),i}return s(n,[{key:"anisotropy",get:function(){return this._anisotropy},set:function(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}},{key:"clearcoat",get:function(){return this._clearcoat},set:function(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}},{key:"iridescence",get:function(){return this._iridescence},set:function(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}},{key:"sheen",get:function(){return this._sheen},set:function(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}},{key:"transmission",get:function(){return this._transmission},set:function(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}},{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=M(e.iridescenceThicknessRange),this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}]),n}(Xs)),e("bm",function(e){u(n,e);var t=g(n);function n(e){var i;return a(this,n),(i=t.call(this)).isMeshPhongMaterial=!0,i.type="MeshPhongMaterial",i.color=new En(16777215),i.specular=new En(1118481),i.shininess=30,i.map=null,i.lightMap=null,i.lightMapIntensity=1,i.aoMap=null,i.aoMapIntensity=1,i.emissive=new En(0),i.emissiveIntensity=1,i.emissiveMap=null,i.bumpMap=null,i.bumpScale=1,i.normalMap=null,i.normalMapType=0,i.normalScale=new Pe(1,1),i.displacementMap=null,i.displacementScale=1,i.displacementBias=0,i.specularMap=null,i.alphaMap=null,i.envMap=null,i.combine=0,i.reflectivity=1,i.refractionRatio=.98,i.wireframe=!1,i.wireframeLinewidth=1,i.wireframeLinecap="round",i.wireframeLinejoin="round",i.flatShading=!1,i.fog=!0,i.setValues(e),i}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,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.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.flatShading=e.flatShading,this.fog=e.fog,this}}]),n}(_n)),e("ba",function(e){u(n,e);var t=g(n);function n(e){var i;return a(this,n),(i=t.call(this)).isMeshNormalMaterial=!0,i.type="MeshNormalMaterial",i.bumpMap=null,i.bumpScale=1,i.normalMap=null,i.normalMapType=0,i.normalScale=new Pe(1,1),i.displacementMap=null,i.displacementScale=1,i.displacementBias=0,i.wireframe=!1,i.wireframeLinewidth=1,i.flatShading=!1,i.setValues(e),i}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),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.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}]),n}(_n)),e("bn",function(e){u(n,e);var t=g(n);function n(e){var i;return a(this,n),(i=t.call(this)).isMeshLambertMaterial=!0,i.type="MeshLambertMaterial",i.color=new En(16777215),i.map=null,i.lightMap=null,i.lightMapIntensity=1,i.aoMap=null,i.aoMapIntensity=1,i.emissive=new En(0),i.emissiveIntensity=1,i.emissiveMap=null,i.bumpMap=null,i.bumpScale=1,i.normalMap=null,i.normalMapType=0,i.normalScale=new Pe(1,1),i.displacementMap=null,i.displacementScale=1,i.displacementBias=0,i.specularMap=null,i.alphaMap=null,i.envMap=null,i.combine=0,i.reflectivity=1,i.refractionRatio=.98,i.wireframe=!1,i.wireframeLinewidth=1,i.wireframeLinecap="round",i.wireframeLinejoin="round",i.flatShading=!1,i.fog=!0,i.setValues(e),i}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,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.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.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.flatShading=e.flatShading,this.fog=e.fog,this}}]),n}(_n)),e("aP",function(e){u(n,e);var t=g(n);function n(e){var i;return a(this,n),(i=t.call(this)).isLineDashedMaterial=!0,i.type="LineDashedMaterial",i.scale=1,i.dashSize=3,i.gapSize=1,i.setValues(e),i}return s(n,[{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}]),n}(wo));var Qs=e("aj",function(){function e(t,n,i,r){a(this,e),this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new n.constructor(i),this.sampleValues=n,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}return s(e,[{key:"evaluate",value:function(e){var t=this.parameterPositions,n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{var a;n:{i:if(!(e<i)){for(var o=n+2;;){if(void 0===i){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(r=i,e<(i=t[++n]))break t}a=t.length;break n}if(e>=r)break e;var s=t[1];e<s&&(n=2,r=s);for(var l=n-2;;){if(void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(n===l)break;if(i=r,e>=(r=t[--n-1]))break t}a=n,n=0}for(;n<a;){var u=n+a>>>1;e<t[u]?a=u:n=u+1}if(i=t[n],void 0===(r=t[n-1]))return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===i)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)}},{key:"getSettings_",value:function(){return this.settings||this.DefaultSettings_}},{key:"copySampleValue_",value:function(e){for(var t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i,a=0;a!==i;++a)t[a]=n[r+a];return t}},{key:"interpolate_",value:function(){throw new Error("call to abstract method")}},{key:"intervalChanged_",value:function(){}}]),e}()),$s=function(e){u(n,e);var t=g(n);function n(e,i,r,o){var s;return a(this,n),(s=t.call(this,e,i,r,o))._weightPrev=-0,s._offsetPrev=-0,s._weightNext=-0,s._offsetNext=-0,s.DefaultSettings_={endingStart:2400,endingEnd:2400},s}return s(n,[{key:"intervalChanged_",value:function(e,t,n){var i=this.parameterPositions,r=e-2,a=e+1,o=i[r],s=i[a];if(void 0===o)switch(this.getSettings_().endingStart){case 2401:r=e,o=2*t-n;break;case 2402:o=t+i[r=i.length-2]-i[r+1];break;default:r=e,o=n}if(void 0===s)switch(this.getSettings_().endingEnd){case 2401:a=e,s=2*n-t;break;case 2402:a=1,s=n+i[1]-i[0];break;default:a=e-1,s=t}var l=.5*(n-t),u=this.valueSize;this._weightPrev=l/(t-o),this._weightNext=l/(s-n),this._offsetPrev=r*u,this._offsetNext=a*u}},{key:"interpolate_",value:function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=s-o,u=this._offsetPrev,c=this._offsetNext,h=this._weightPrev,d=this._weightNext,f=(n-t)/(i-t),p=f*f,v=p*f,m=-h*v+2*h*p-h*f,g=(1+h)*v+(-1.5-2*h)*p+(-.5+h)*f+1,y=(-1-d)*v+(1.5+d)*p+.5*f,_=d*v-d*p,x=0;x!==o;++x)r[x]=m*a[u+x]+g*a[l+x]+y*a[s+x]+_*a[c+x];return r}}]),n}(Qs),el=function(e){u(n,e);var t=g(n);function n(e,i,r,o){return a(this,n),t.call(this,e,i,r,o)}return s(n,[{key:"interpolate_",value:function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=s-o,u=(n-t)/(i-t),c=1-u,h=0;h!==o;++h)r[h]=a[l+h]*c+a[s+h]*u;return r}}]),n}(Qs),tl=function(e){u(n,e);var t=g(n);function n(e,i,r,o){return a(this,n),t.call(this,e,i,r,o)}return s(n,[{key:"interpolate_",value:function(e){return this.copySampleValue_(e-1)}}]),n}(Qs),nl=function(){function e(t,n,i,r){if(a(this,e),void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===n||0===n.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Ys(n,this.TimeBufferType),this.values=Ys(i,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}return s(e,[{key:"InterpolantFactoryMethodDiscrete",value:function(e){return new tl(this.times,this.values,this.getValueSize(),e)}},{key:"InterpolantFactoryMethodLinear",value:function(e){return new el(this.times,this.values,this.getValueSize(),e)}},{key:"InterpolantFactoryMethodSmooth",value:function(e){return new $s(this.times,this.values,this.getValueSize(),e)}},{key:"setInterpolation",value:function(e){var t;switch(e){case he:t=this.InterpolantFactoryMethodDiscrete;break;case de:t=this.InterpolantFactoryMethodLinear;break;case 2302:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){var n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(n);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}},{key:"getInterpolation",value:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return he;case this.InterpolantFactoryMethodLinear:return de;case this.InterpolantFactoryMethodSmooth:return 2302}}},{key:"getValueSize",value:function(){return this.values.length/this.times.length}},{key:"shift",value:function(e){if(0!==e)for(var t=this.times,n=0,i=t.length;n!==i;++n)t[n]+=e;return this}},{key:"scale",value:function(e){if(1!==e)for(var t=this.times,n=0,i=t.length;n!==i;++n)t[n]*=e;return this}},{key:"trim",value:function(e,t){for(var n=this.times,i=n.length,r=0,a=i-1;r!==i&&n[r]<e;)++r;for(;-1!==a&&n[a]>t;)--a;if(++a,0!==r||a!==i){r>=a&&(r=(a=Math.max(a,1))-1);var o=this.getValueSize();this.times=js(n,r,a),this.values=js(this.values,r*o,a*o)}return this}},{key:"validate",value:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);var n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var a=null,o=0;o!==r;o++){var s=n[o];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,s),e=!1;break}if(null!==a&&a>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,s,a),e=!1;break}a=s}if(void 0!==i&&qs(i))for(var l=0,u=i.length;l!==u;++l){var c=i[l];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,l,c),e=!1;break}}return e}},{key:"optimize",value:function(){for(var e=js(this.times),t=js(this.values),n=this.getValueSize(),i=2302===this.getInterpolation(),r=e.length-1,a=1,o=1;o<r;++o){var s=!1,l=e[o];if(l!==e[o+1]&&(1!==o||l!==e[0]))if(i)s=!0;else for(var u=o*n,c=u-n,h=u+n,d=0;d!==n;++d){var f=t[u+d];if(f!==t[c+d]||f!==t[h+d]){s=!0;break}}if(s){if(o!==a){e[a]=e[o];for(var p=o*n,v=a*n,m=0;m!==n;++m)t[v+m]=t[p+m]}++a}}if(r>0){e[a]=e[r];for(var g=r*n,y=a*n,_=0;_!==n;++_)t[y+_]=t[g+_];++a}return a!==e.length?(this.times=js(e,0,a),this.values=js(t,0,a*n)):(this.times=e,this.values=t),this}},{key:"clone",value:function(){var e=js(this.times,0),t=js(this.values,0),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}],[{key:"toJSON",value:function(e){var t,n=e.constructor;if(n.toJSON!==this.toJSON)t=n.toJSON(e);else{t={name:e.name,times:Ys(e.times,Array),values:Ys(e.values,Array)};var i=e.getInterpolation();i!==e.DefaultInterpolation&&(t.interpolation=i)}return t.type=e.ValueTypeName,t}}]),e}();nl.prototype.TimeBufferType=Float32Array,nl.prototype.ValueBufferType=Float32Array,nl.prototype.DefaultInterpolation=de;var il=function(e){u(n,e);var t=g(n);function n(){return a(this,n),t.apply(this,arguments)}return s(n)}(nl);il.prototype.ValueTypeName="bool",il.prototype.ValueBufferType=Array,il.prototype.DefaultInterpolation=he,il.prototype.InterpolantFactoryMethodLinear=void 0,il.prototype.InterpolantFactoryMethodSmooth=void 0;var rl=function(e){u(n,e);var t=g(n);function n(){return a(this,n),t.apply(this,arguments)}return s(n)}(nl);rl.prototype.ValueTypeName="color";var al=e("af",function(e){u(n,e);var t=g(n);function n(){return a(this,n),t.apply(this,arguments)}return s(n)}(nl));al.prototype.ValueTypeName="number";var ol=function(e){u(n,e);var t=g(n);function n(e,i,r,o){return a(this,n),t.call(this,e,i,r,o)}return s(n,[{key:"interpolate_",value:function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(n-t)/(i-t),l=e*o,u=l+o;l!==u;l+=4)nt.slerpFlat(r,0,a,l-o,a,l,s);return r}}]),n}(Qs),sl=e("ag",function(e){u(n,e);var t=g(n);function n(){return a(this,n),t.apply(this,arguments)}return s(n,[{key:"InterpolantFactoryMethodLinear",value:function(e){return new ol(this.times,this.values,this.getValueSize(),e)}}]),n}(nl));sl.prototype.ValueTypeName="quaternion",sl.prototype.DefaultInterpolation=de,sl.prototype.InterpolantFactoryMethodSmooth=void 0;var ll=function(e){u(n,e);var t=g(n);function n(){return a(this,n),t.apply(this,arguments)}return s(n)}(nl);ll.prototype.ValueTypeName="string",ll.prototype.ValueBufferType=Array,ll.prototype.DefaultInterpolation=he,ll.prototype.InterpolantFactoryMethodLinear=void 0,ll.prototype.InterpolantFactoryMethodSmooth=void 0;var ul=e("ae",function(e){u(n,e);var t=g(n);function n(){return a(this,n),t.apply(this,arguments)}return s(n)}(nl));function cl(e){if(void 0===e.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");var t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return al;case"vector":case"vector2":case"vector3":case"vector4":return ul;case"color":return rl;case"quaternion":return sl;case"bool":case"boolean":return il;case"string":return ll}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){var n=[],i=[];Ks(e.keys,n,i,"value"),e.times=n,e.values=i}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}ul.prototype.ValueTypeName="vector",e("$",function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,i=arguments.length>2?arguments[2]:void 0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2500;a(this,e),this.name=t,this.tracks=i,this.duration=n,this.blendMode=r,this.uuid=Se(),this.duration<0&&this.resetDuration()}return s(e,[{key:"resetDuration",value:function(){for(var e=0,t=0,n=this.tracks.length;t!==n;++t){var i=this.tracks[t];e=Math.max(e,i.times[i.times.length-1])}return this.duration=e,this}},{key:"trim",value:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}},{key:"validate",value:function(){for(var e=!0,t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}},{key:"optimize",value:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}},{key:"clone",value:function(){for(var e=[],t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}},{key:"toJSON",value:function(){return this.constructor.toJSON(this)}}],[{key:"parse",value:function(e){for(var t=[],n=e.tracks,i=1/(e.fps||1),r=0,a=n.length;r!==a;++r)t.push(cl(n[r]).scale(i));var o=new this(e.name,e.duration,t,e.blendMode);return o.uuid=e.uuid,o}},{key:"toJSON",value:function(e){for(var t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode},r=0,a=n.length;r!==a;++r)t.push(nl.toJSON(n[r]));return i}},{key:"CreateFromMorphTargetSequence",value:function(e,t,n,i){for(var r=t.length,a=[],o=0;o<r;o++){var s=[],l=[];s.push((o+r-1)%r,o,(o+1)%r),l.push(0,1,0);var u=Zs(s);s=Js(s,1,u),l=Js(l,1,u),i||0!==s[0]||(s.push(r),l.push(l[0])),a.push(new al(".morphTargetInfluences["+t[o].name+"]",s,l).scale(1/n))}return new this(e,-1,a)}},{key:"findByName",value:function(e,t){var n=e;if(!Array.isArray(e)){var i=e;n=i.geometry&&i.geometry.animations||i.animations}for(var r=0;r<n.length;r++)if(n[r].name===t)return n[r];return null}},{key:"CreateClipsFromMorphTargetSequences",value:function(e,t,n){for(var i={},r=/^([\w-]*?)([\d]+)$/,a=0,o=e.length;a<o;a++){var s=e[a],l=s.name.match(r);if(l&&l.length>1){var u=l[1],c=i[u];c||(i[u]=c=[]),c.push(s)}}var h=[];for(var d in i)h.push(this.CreateFromMorphTargetSequence(d,i[d],t,n));return h}},{key:"parseAnimation",value:function(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(e,t,n,i,r){if(0!==n.length){var a=[],o=[];Ks(n,a,o,i),0!==a.length&&r.push(new e(t,a,o))}},i=[],r=e.name||"default",a=e.fps||30,o=e.blendMode,s=e.length||-1,l=e.hierarchy||[],u=0;u<l.length;u++){var c=l[u].keys;if(c&&0!==c.length)if(c[0].morphTargets){var h={},d=void 0;for(d=0;d<c.length;d++)if(c[d].morphTargets)for(var f=0;f<c[d].morphTargets.length;f++)h[c[d].morphTargets[f]]=-1;for(var p in h){for(var v=[],m=[],g=0;g!==c[d].morphTargets.length;++g){var y=c[d];v.push(y.time),m.push(y.morphTarget===p?1:0)}i.push(new al(".morphTargetInfluence["+p+"]",v,m))}s=h.length*a}else{var _=".bones["+t[u].name+"]";n(ul,_+".position",c,"pos",i),n(sl,_+".quaternion",c,"rot",i),n(ul,_+".scale",c,"scl",i)}}return 0===i.length?null:new this(r,s,i,o)}}]),e}());var hl={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}},dl=new(s((function e(t,n,i){a(this,e);var r=this,o=!1,s=0,l=0,u=void 0,c=[];this.onStart=void 0,this.onLoad=t,this.onProgress=n,this.onError=i,this.itemStart=function(e){l++,!1===o&&void 0!==r.onStart&&r.onStart(e,s,l),o=!0},this.itemEnd=function(e){s++,void 0!==r.onProgress&&r.onProgress(e,s,l),s===l&&(o=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(e){void 0!==r.onError&&r.onError(e)},this.resolveURL=function(e){return u?u(e):e},this.setURLModifier=function(e){return u=e,this},this.addHandler=function(e,t){return c.push(e,t),this},this.removeHandler=function(e){var t=c.indexOf(e);return-1!==t&&c.splice(t,2),this},this.getHandler=function(e){for(var t=0,n=c.length;t<n;t+=2){var i=c[t],r=c[t+1];if(i.global&&(i.lastIndex=0),i.test(e))return r}return null}}))),fl=e("i",function(){function e(t){a(this,e),this.manager=void 0!==t?t:dl,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}return s(e,[{key:"load",value:function(){}},{key:"loadAsync",value:function(e,t){var n=this;return new Promise((function(i,r){n.load(e,i,t,r)}))}},{key:"parse",value:function(){}},{key:"setCrossOrigin",value:function(e){return this.crossOrigin=e,this}},{key:"setWithCredentials",value:function(e){return this.withCredentials=e,this}},{key:"setPath",value:function(e){return this.path=e,this}},{key:"setResourcePath",value:function(e){return this.resourcePath=e,this}},{key:"setRequestHeader",value:function(e){return this.requestHeader=e,this}}]),e}());fl.DEFAULT_MATERIAL_NAME="__DEFAULT";var pl={},vl=function(e){u(n,e);var t=g(n);function n(e,i){var r;return a(this,n),(r=t.call(this,e)).response=i,r}return s(n)}(p(Error)),ml=e("F",function(e){u(n,e);var t=g(n);function n(e){return a(this,n),t.call(this,e)}return s(n,[{key:"load",value:function(e,t,n,i){var r=this;void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var a=hl.get(e);if(void 0!==a)return this.manager.itemStart(e),setTimeout((function(){t&&t(a),r.manager.itemEnd(e)}),0),a;if(void 0===pl[e]){pl[e]=[],pl[e].push({onLoad:t,onProgress:n,onError:i});var o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),s=this.mimeType,l=this.responseType;fetch(o).then((function(t){if(200===t.status||0===t.status){if(0===t.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;var n=pl[e],i=t.body.getReader(),r=t.headers.get("Content-Length")||t.headers.get("X-File-Size"),a=r?parseInt(r):0,o=0!==a,s=0,l=new ReadableStream({start:function(e){!function t(){i.read().then((function(i){var r=i.done,l=i.value;if(r)e.close();else{s+=l.byteLength;for(var u=new ProgressEvent("progress",{lengthComputable:o,loaded:s,total:a}),c=0,h=n.length;c<h;c++){var d=n[c];d.onProgress&&d.onProgress(u)}e.enqueue(l),t()}}))}()}});return new Response(l)}throw new vl('fetch for "'.concat(t.url,'" responded with ').concat(t.status,": ").concat(t.statusText),t)})).then((function(e){switch(l){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then((function(e){return(new DOMParser).parseFromString(e,s)}));case"json":return e.json();default:if(void 0===s)return e.text();var t=/charset="?([^;"\s]*)"?/i.exec(s),n=t&&t[1]?t[1].toLowerCase():void 0,i=new TextDecoder(n);return e.arrayBuffer().then((function(e){return i.decode(e)}))}})).then((function(t){hl.add(e,t);var n=pl[e];delete pl[e];for(var i=0,r=n.length;i<r;i++){var a=n[i];a.onLoad&&a.onLoad(t)}})).catch((function(t){var n=pl[e];if(void 0===n)throw r.manager.itemError(e),t;delete pl[e];for(var i=0,a=n.length;i<a;i++){var o=n[i];o.onError&&o.onError(t)}r.manager.itemError(e)})).finally((function(){r.manager.itemEnd(e)})),this.manager.itemStart(e)}else pl[e].push({onLoad:t,onProgress:n,onError:i})}},{key:"setResponseType",value:function(e){return this.responseType=e,this}},{key:"setMimeType",value:function(e){return this.mimeType=e,this}}]),n}(fl)),gl=function(e){u(n,e);var t=g(n);function n(e){return a(this,n),t.call(this,e)}return s(n,[{key:"load",value:function(e,t,n,i){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var r=this,a=hl.get(e);if(void 0!==a)return r.manager.itemStart(e),setTimeout((function(){t&&t(a),r.manager.itemEnd(e)}),0),a;var o=Ne("img");function s(){u(),hl.add(e,this),t&&t(this),r.manager.itemEnd(e)}function l(t){u(),i&&i(t),r.manager.itemError(e),r.manager.itemEnd(e)}function u(){o.removeEventListener("load",s,!1),o.removeEventListener("error",l,!1)}return o.addEventListener("load",s,!1),o.addEventListener("error",l,!1),"data:"!==e.slice(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),r.manager.itemStart(e),o.src=e,o}}]),n}(fl),yl=(e("aX",function(e){u(n,e);var t=g(n);function n(e){return a(this,n),t.call(this,e)}return s(n,[{key:"load",value:function(e,t,n,i){var r=this,a=new vo,o=new ml(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(r.withCredentials),o.load(e,(function(e){var n;try{n=r.parse(e)}catch(e){if(void 0===i)return void console.error(e);i(e)}if(!n)return i();void 0!==n.image?a.image=n.image:void 0!==n.data&&(a.image.width=n.width,a.image.height=n.height,a.image.data=n.data),a.wrapS=void 0!==n.wrapS?n.wrapS:J,a.wrapT=void 0!==n.wrapT?n.wrapT:J,a.magFilter=void 0!==n.magFilter?n.magFilter:te,a.minFilter=void 0!==n.minFilter?n.minFilter:te,a.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.colorSpace?a.colorSpace=n.colorSpace:void 0!==n.encoding&&(a.encoding=n.encoding),void 0!==n.flipY&&(a.flipY=n.flipY),void 0!==n.format&&(a.format=n.format),void 0!==n.type&&(a.type=n.type),void 0!==n.mipmaps&&(a.mipmaps=n.mipmaps,a.minFilter=ie),1===n.mipmapCount&&(a.minFilter=te),void 0!==n.generateMipmaps&&(a.generateMipmaps=n.generateMipmaps),a.needsUpdate=!0,t&&t(a,n)}),n,i),a}}]),n}(fl)),e("aa",function(e){u(n,e);var t=g(n);function n(e){return a(this,n),t.call(this,e)}return s(n,[{key:"load",value:function(e,t,n,i){var r=new Ke,a=new gl(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,(function(e){r.image=e,r.needsUpdate=!0,void 0!==t&&t(r)}),n,i),r}}]),n}(fl)),function(e){u(n,e);var t=g(n);function n(e){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return a(this,n),(i=t.call(this)).isLight=!0,i.type="Light",i.color=new En(e),i.intensity=r,i}return s(n,[{key:"dispose",value:function(){}},{key:"copy",value:function(e,t){return _(c(n.prototype),"copy",this).call(this,e,t),this.color.copy(e.color),this.intensity=e.intensity,this}},{key:"toJSON",value:function(e){var t=_(c(n.prototype),"toJSON",this).call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}]),n}(an)),_l=new Ut,xl=new it,Ml=new it,Sl=function(){function e(t){a(this,e),this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Pe(512,512),this.map=null,this.mapPass=null,this.matrix=new Ut,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Ti,this._frameExtents=new Pe(1,1),this._viewportCount=1,this._viewports=[new Qe(0,0,1,1)]}return s(e,[{key:"getViewportCount",value:function(){return this._viewportCount}},{key:"getFrustum",value:function(){return this._frustum}},{key:"updateMatrices",value:function(e){var t=this.camera,n=this.matrix;xl.setFromMatrixPosition(e.matrixWorld),t.position.copy(xl),Ml.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Ml),t.updateMatrixWorld(),_l.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(_l),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(_l)}},{key:"getViewport",value:function(e){return this._viewports[e]}},{key:"getFrameExtents",value:function(){return this._frameExtents}},{key:"dispose",value:function(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}},{key:"copy",value:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"toJSON",value:function(){var e={};return 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}}]),e}(),bl=function(e){u(n,e);var t=g(n);function n(){var e;return a(this,n),(e=t.call(this,new vi(50,1,.5,500))).isSpotLightShadow=!0,e.focus=1,e}return s(n,[{key:"updateMatrices",value:function(e){var t=this.camera,i=2*Me*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height,a=e.distance||t.far;i===t.fov&&r===t.aspect&&a===t.far||(t.fov=i,t.aspect=r,t.far=a,t.updateProjectionMatrix()),_(c(n.prototype),"updateMatrices",this).call(this,e)}},{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.focus=e.focus,this}}]),n}(Sl),El=(e("S",function(e){u(n,e);var t=g(n);function n(e,i){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Math.PI/3,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2;return a(this,n),(r=t.call(this,e,i)).isSpotLight=!0,r.type="SpotLight",r.position.copy(an.DEFAULT_UP),r.updateMatrix(),r.target=new an,r.distance=o,r.angle=s,r.penumbra=l,r.decay=u,r.map=null,r.shadow=new bl,r}return s(n,[{key:"power",get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}},{key:"dispose",value:function(){this.shadow.dispose()}},{key:"copy",value:function(e,t){return _(c(n.prototype),"copy",this).call(this,e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}]),n}(yl)),new Ut),Tl=new it,wl=new it,Al=function(e){u(n,e);var t=g(n);function n(){var e;return a(this,n),(e=t.call(this,new vi(90,1,.5,500))).isPointLightShadow=!0,e._frameExtents=new Pe(4,2),e._viewportCount=6,e._viewports=[new Qe(2,1,1,1),new Qe(0,1,1,1),new Qe(3,1,1,1),new Qe(1,1,1,1),new Qe(3,0,1,1),new Qe(1,0,1,1)],e._cubeDirections=[new it(1,0,0),new it(-1,0,0),new it(0,0,1),new it(0,0,-1),new it(0,1,0),new it(0,-1,0)],e._cubeUps=[new it(0,1,0),new it(0,1,0),new it(0,1,0),new it(0,1,0),new it(0,0,1),new it(0,0,-1)],e}return s(n,[{key:"updateMatrices",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.camera,i=this.matrix,r=e.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),Tl.setFromMatrixPosition(e.matrixWorld),n.position.copy(Tl),wl.copy(n.position),wl.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(wl),n.updateMatrixWorld(),i.makeTranslation(-Tl.x,-Tl.y,-Tl.z),El.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(El)}}]),n}(Sl),Rl=(e("P",function(e){u(n,e);var t=g(n);function n(e,i){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2;return a(this,n),(r=t.call(this,e,i)).isPointLight=!0,r.type="PointLight",r.distance=o,r.decay=s,r.shadow=new Al,r}return s(n,[{key:"power",get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}},{key:"dispose",value:function(){this.shadow.dispose()}},{key:"copy",value:function(e,t){return _(c(n.prototype),"copy",this).call(this,e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}]),n}(yl)),function(e){u(n,e);var t=g(n);function n(){var e;return a(this,n),(e=t.call(this,new zi(-5,5,5,-5,.5,500))).isDirectionalLightShadow=!0,e}return s(n)}(Sl));function Cl(){return("undefined"==typeof performance?Date:performance).now()}e("D",function(e){u(n,e);var t=g(n);function n(e,i){var r;return a(this,n),(r=t.call(this,e,i)).isDirectionalLight=!0,r.type="DirectionalLight",r.position.copy(an.DEFAULT_UP),r.updateMatrix(),r.target=new an,r.shadow=new Rl,r}return s(n,[{key:"dispose",value:function(){this.shadow.dispose()}},{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}]),n}(yl)),e("A",function(e){u(n,e);var t=g(n);function n(e,i){var r;return a(this,n),(r=t.call(this,e,i)).isAmbientLight=!0,r.type="AmbientLight",r}return s(n)}(yl)),e("R",function(e){u(n,e);var t=g(n);function n(e,i){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10;return a(this,n),(r=t.call(this,e,i)).isRectAreaLight=!0,r.type="RectAreaLight",r.width=o,r.height=s,r}return s(n,[{key:"power",get:function(){return this.intensity*this.width*this.height*Math.PI},set:function(e){this.intensity=e/(this.width*this.height*Math.PI)}},{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e),this.width=e.width,this.height=e.height,this}},{key:"toJSON",value:function(e){var t=_(c(n.prototype),"toJSON",this).call(this,e);return t.object.width=this.width,t.object.height=this.height,t}}]),n}(yl)),e("L",function(){function e(){a(this,e)}return s(e,null,[{key:"decodeText",value:function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var t="",n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(e){return t}}},{key:"extractUrlBase",value:function(e){var t=e.lastIndexOf("/");return-1===t?"./":e.slice(0,t+1)}},{key:"resolveURL",value:function(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}]),e}()),e("ab",function(e){u(n,e);var t=g(n);function n(e){var i;return a(this,n),(i=t.call(this,e)).isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),i.options={premultiplyAlpha:"none"},i}return s(n,[{key:"setOptions",value:function(e){return this.options=e,this}},{key:"load",value:function(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var r=this,a=hl.get(e);if(void 0!==a)return r.manager.itemStart(e),setTimeout((function(){t&&t(a),r.manager.itemEnd(e)}),0),a;var o={};o.credentials="anonymous"===this.crossOrigin?"same-origin":"include",o.headers=this.requestHeader,fetch(e,o).then((function(e){return e.blob()})).then((function(e){return createImageBitmap(e,Object.assign(r.options,{colorSpaceConversion:"none"}))})).then((function(n){hl.add(e,n),t&&t(n),r.manager.itemEnd(e)})).catch((function(t){i&&i(t),r.manager.itemError(e),r.manager.itemEnd(e)})),r.manager.itemStart(e)}}]),n}(fl)),e("bU",function(){function e(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];a(this,e),this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}return s(e,[{key:"start",value:function(){this.startTime=Cl(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}},{key:"stop",value:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}},{key:"getElapsedTime",value:function(){return this.getDelta(),this.elapsedTime}},{key:"getDelta",value:function(){var e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var t=Cl();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}]),e}());var Ll=new RegExp("[\\[\\]\\.:\\/]","g"),Pl="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",kl=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]")+/(WCOD+)?/.source.replace("WCOD",Pl)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]")+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]")+"$"),Ul=["material","materials","bones","map"],Il=function(){function e(t,n,i){a(this,e);var r=i||Nl.parseTrackName(n);this._targetGroup=t,this._bindings=t.subscribe_(n,r)}return s(e,[{key:"getValue",value:function(e,t){this.bind();var n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(e,t)}},{key:"setValue",value:function(e,t){for(var n=this._bindings,i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)}},{key:"bind",value:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}},{key:"unbind",value:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}]),e}(),Nl=e("z",function(){function e(t,n,i){a(this,e),this.path=n,this.parsedPath=i||e.parseTrackName(n),this.node=e.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}return s(e,[{key:"_getValue_unavailable",value:function(){}},{key:"_setValue_unavailable",value:function(){}},{key:"_getValue_direct",value:function(e,t){e[t]=this.targetObject[this.propertyName]}},{key:"_getValue_array",value:function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)e[t++]=n[i]}},{key:"_getValue_arrayElement",value:function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}},{key:"_getValue_toArray",value:function(e,t){this.resolvedProperty.toArray(e,t)}},{key:"_setValue_direct",value:function(e,t){this.targetObject[this.propertyName]=e[t]}},{key:"_setValue_direct_setNeedsUpdate",value:function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}},{key:"_setValue_direct_setMatrixWorldNeedsUpdate",value:function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_setValue_array",value:function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=e[t++]}},{key:"_setValue_array_setNeedsUpdate",value:function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}},{key:"_setValue_array_setMatrixWorldNeedsUpdate",value:function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_setValue_arrayElement",value:function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}},{key:"_setValue_arrayElement_setNeedsUpdate",value:function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}},{key:"_setValue_arrayElement_setMatrixWorldNeedsUpdate",value:function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_setValue_fromArray",value:function(e,t){this.resolvedProperty.fromArray(e,t)}},{key:"_setValue_fromArray_setNeedsUpdate",value:function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}},{key:"_setValue_fromArray_setMatrixWorldNeedsUpdate",value:function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_getValue_unbound",value:function(e,t){this.bind(),this.getValue(e,t)}},{key:"_setValue_unbound",value:function(e,t){this.bind(),this.setValue(e,t)}},{key:"bind",value:function(){var t=this.node,n=this.parsedPath,i=n.objectName,r=n.propertyName,a=n.propertyIndex;if(t||(t=e.findNode(this.rootNode,n.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,t){if(i){var o=n.objectIndex;switch(i){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(var s=0;s<t.length;s++)if(t[s].name===o){o=s;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.map)return void console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);t=t.material.map;break;default:if(void 0===t[i])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[i]}if(void 0!==o){if(void 0===t[o])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[o]}}var l=t[r];if(void 0!==l){var u=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?u=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(u=this.Versioning.MatrixWorldNeedsUpdate);var c=this.BindingType.Direct;if(void 0!==a){if("morphTargetInfluences"===r){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[a]&&(a=t.morphTargetDictionary[a])}c=this.BindingType.ArrayElement,this.resolvedProperty=l,this.propertyIndex=a}else void 0!==l.fromArray&&void 0!==l.toArray?(c=this.BindingType.HasFromToArray,this.resolvedProperty=l):Array.isArray(l)?(c=this.BindingType.EntireArray,this.resolvedProperty=l):this.propertyName=r;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][u]}else{var h=n.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+h+"."+r+" but it wasn't found.",t)}}else console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".")}},{key:"unbind",value:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}],[{key:"create",value:function(t,n,i){return t&&t.isAnimationObjectGroup?new e.Composite(t,n,i):new e(t,n,i)}},{key:"sanitizeNodeName",value:function(e){return e.replace(/\s/g,"_").replace(Ll,"")}},{key:"parseTrackName",value:function(e){var t=kl.exec(e);if(null===t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);var n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){var r=n.nodeName.substring(i+1);-1!==Ul.indexOf(r)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=r)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}},{key:"findNode",value:function(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){var n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){var i=function e(n){for(var i=0;i<n.length;i++){var r=n[i];if(r.name===t||r.uuid===t)return r;var a=e(r.children);if(a)return a}return null}(e.children);if(i)return i}return null}}]),e}());function Dl(e,t){return e.distance-t.distance}function Ol(e,t,n,i){if(e.layers.test(t.layers)&&e.raycast(t,n),!0===i)for(var r=e.children,a=0,o=r.length;a<o;a++)Ol(r[a],t,n,!0)}Nl.Composite=Il,Nl.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Nl.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Nl.prototype.GetterByBindingType=[Nl.prototype._getValue_direct,Nl.prototype._getValue_array,Nl.prototype._getValue_arrayElement,Nl.prototype._getValue_toArray],Nl.prototype.SetterByBindingTypeAndVersioning=[[Nl.prototype._setValue_direct,Nl.prototype._setValue_direct_setNeedsUpdate,Nl.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Nl.prototype._setValue_array,Nl.prototype._setValue_array_setNeedsUpdate,Nl.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Nl.prototype._setValue_arrayElement,Nl.prototype._setValue_arrayElement_setNeedsUpdate,Nl.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Nl.prototype._setValue_fromArray,Nl.prototype._setValue_fromArray_setNeedsUpdate,Nl.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]],e("bH",function(){function e(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1/0;a(this,e),this.ray=new kt(t,n),this.near=i,this.far=r,this.camera=null,this.layers=new Wt,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}return s(e,[{key:"set",value:function(e,t){this.ray.set(e,t)}},{key:"setFromCamera",value:function(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):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}},{key:"intersectObject",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return Ol(e,this,n,t),n.sort(Dl),n}},{key:"intersectObjects",value:function(e){for(var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=0,r=e.length;i<r;i++)Ol(e[i],this,n,t);return n.sort(Dl),n}}]),e}());var Fl=new it,zl=new it,Bl=(e("aS",function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new it,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new it;a(this,e),this.start=t,this.end=n}return s(e,[{key:"set",value:function(e,t){return this.start.copy(e),this.end.copy(t),this}},{key:"copy",value:function(e){return this.start.copy(e.start),this.end.copy(e.end),this}},{key:"getCenter",value:function(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}},{key:"delta",value:function(e){return e.subVectors(this.end,this.start)}},{key:"distanceSq",value:function(){return this.start.distanceToSquared(this.end)}},{key:"distance",value:function(){return this.start.distanceTo(this.end)}},{key:"at",value:function(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}},{key:"closestPointToPointParameter",value:function(e,t){Fl.subVectors(e,this.start),zl.subVectors(this.end,this.start);var n=zl.dot(zl),i=zl.dot(Fl)/n;return t&&(i=be(i,0,1)),i}},{key:"closestPointToPoint",value:function(e,t,n){var i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}},{key:"applyMatrix4",value:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}},{key:"equals",value:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}()),new it),Hl=new pi;function Vl(e,t,n,i,r,a,o){Bl.set(r,a,o).unproject(i);var s=t[e];if(void 0!==s)for(var l=n.getAttribute("position"),u=0,c=s.length;u<c;u++)l.setXYZ(s[u],Bl.x,Bl.y,Bl.z)}e("bh",function(e){u(n,e);var t=g(n);function n(e){var i;a(this,n);var r=new Vn,o=new wo({color:16777215,vertexColors:!0,toneMapped:!1}),s=[],l=[],u={};function c(e,t){h(e),h(t)}function h(e){s.push(0,0,0),l.push(0,0,0),void 0===u[e]&&(u[e]=[]),u[e].push(s.length/3-1)}c("n1","n2"),c("n2","n4"),c("n4","n3"),c("n3","n1"),c("f1","f2"),c("f2","f4"),c("f4","f3"),c("f3","f1"),c("n1","f1"),c("n2","f2"),c("n3","f3"),c("n4","f4"),c("p","n1"),c("p","n2"),c("p","n3"),c("p","n4"),c("u1","u2"),c("u2","u3"),c("u3","u1"),c("c","t"),c("p","c"),c("cn1","cn2"),c("cn3","cn4"),c("cf1","cf2"),c("cf3","cf4"),r.setAttribute("position",new In(s,3)),r.setAttribute("color",new In(l,3)),(i=t.call(this,r,o)).type="CameraHelper",i.camera=e,i.camera.updateProjectionMatrix&&i.camera.updateProjectionMatrix(),i.matrix=e.matrixWorld,i.matrixAutoUpdate=!1,i.pointMap=u,i.update();var d=new En(16755200),f=new En(16711680),p=new En(43775),v=new En(16777215),m=new En(3355443);return i.setColors(d,f,p,v,m),i}return s(n,[{key:"setColors",value:function(e,t,n,i,r){var a=this.geometry.getAttribute("color");a.setXYZ(0,e.r,e.g,e.b),a.setXYZ(1,e.r,e.g,e.b),a.setXYZ(2,e.r,e.g,e.b),a.setXYZ(3,e.r,e.g,e.b),a.setXYZ(4,e.r,e.g,e.b),a.setXYZ(5,e.r,e.g,e.b),a.setXYZ(6,e.r,e.g,e.b),a.setXYZ(7,e.r,e.g,e.b),a.setXYZ(8,e.r,e.g,e.b),a.setXYZ(9,e.r,e.g,e.b),a.setXYZ(10,e.r,e.g,e.b),a.setXYZ(11,e.r,e.g,e.b),a.setXYZ(12,e.r,e.g,e.b),a.setXYZ(13,e.r,e.g,e.b),a.setXYZ(14,e.r,e.g,e.b),a.setXYZ(15,e.r,e.g,e.b),a.setXYZ(16,e.r,e.g,e.b),a.setXYZ(17,e.r,e.g,e.b),a.setXYZ(18,e.r,e.g,e.b),a.setXYZ(19,e.r,e.g,e.b),a.setXYZ(20,e.r,e.g,e.b),a.setXYZ(21,e.r,e.g,e.b),a.setXYZ(22,e.r,e.g,e.b),a.setXYZ(23,e.r,e.g,e.b),a.setXYZ(24,t.r,t.g,t.b),a.setXYZ(25,t.r,t.g,t.b),a.setXYZ(26,t.r,t.g,t.b),a.setXYZ(27,t.r,t.g,t.b),a.setXYZ(28,t.r,t.g,t.b),a.setXYZ(29,t.r,t.g,t.b),a.setXYZ(30,t.r,t.g,t.b),a.setXYZ(31,t.r,t.g,t.b),a.setXYZ(32,n.r,n.g,n.b),a.setXYZ(33,n.r,n.g,n.b),a.setXYZ(34,n.r,n.g,n.b),a.setXYZ(35,n.r,n.g,n.b),a.setXYZ(36,n.r,n.g,n.b),a.setXYZ(37,n.r,n.g,n.b),a.setXYZ(38,i.r,i.g,i.b),a.setXYZ(39,i.r,i.g,i.b),a.setXYZ(40,r.r,r.g,r.b),a.setXYZ(41,r.r,r.g,r.b),a.setXYZ(42,r.r,r.g,r.b),a.setXYZ(43,r.r,r.g,r.b),a.setXYZ(44,r.r,r.g,r.b),a.setXYZ(45,r.r,r.g,r.b),a.setXYZ(46,r.r,r.g,r.b),a.setXYZ(47,r.r,r.g,r.b),a.setXYZ(48,r.r,r.g,r.b),a.setXYZ(49,r.r,r.g,r.b),a.needsUpdate=!0}},{key:"update",value:function(){var e=this.geometry,t=this.pointMap;Hl.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),Vl("c",t,e,Hl,0,0,-1),Vl("t",t,e,Hl,0,0,1),Vl("n1",t,e,Hl,-1,-1,-1),Vl("n2",t,e,Hl,1,-1,-1),Vl("n3",t,e,Hl,-1,1,-1),Vl("n4",t,e,Hl,1,1,-1),Vl("f1",t,e,Hl,-1,-1,1),Vl("f2",t,e,Hl,1,-1,1),Vl("f3",t,e,Hl,-1,1,1),Vl("f4",t,e,Hl,1,1,1),Vl("u1",t,e,Hl,.7,1.1,-1),Vl("u2",t,e,Hl,-.7,1.1,-1),Vl("u3",t,e,Hl,0,2,-1),Vl("cf1",t,e,Hl,-1,0,1),Vl("cf2",t,e,Hl,1,0,1),Vl("cf3",t,e,Hl,0,-1,1),Vl("cf4",t,e,Hl,0,1,1),Vl("cn1",t,e,Hl,-1,0,-1),Vl("cn2",t,e,Hl,1,0,-1),Vl("cn3",t,e,Hl,0,-1,-1),Vl("cn4",t,e,Hl,0,1,-1),e.getAttribute("position").needsUpdate=!0}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}}]),n}(No));var Gl,Wl,Xl=new it;e("aQ",function(e){u(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new it(0,0,1),r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new it(0,0,0),o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:16776960,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.2*o,u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:.2*l;return a(this,n),(e=t.call(this)).type="ArrowHelper",void 0===Gl&&((Gl=new Vn).setAttribute("position",new In([0,0,0,0,1,0],3)),(Wl=new us(0,.5,1,5,1)).translate(0,-.5,0)),e.position.copy(r),e.line=new ko(Gl,new wo({color:s,toneMapped:!1})),e.line.matrixAutoUpdate=!1,e.add(e.line),e.cone=new oi(Wl,new wn({color:s,toneMapped:!1})),e.cone.matrixAutoUpdate=!1,e.add(e.cone),e.setDirection(i),e.setLength(o,l,u),e}return s(n,[{key:"setDirection",value:function(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{Xl.set(e.z,0,-e.x).normalize();var t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Xl,t)}}},{key:"setLength",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.2*e,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.2*t;this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}},{key:"setColor",value:function(e){this.line.material.color.set(e),this.cone.material.color.set(e)}},{key:"copy",value:function(e){return _(c(n.prototype),"copy",this).call(this,e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}},{key:"dispose",value:function(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}]),n}(an)),e("aD",function(){function e(){a(this,e),this.type="ShapePath",this.color=new En,this.subPaths=[],this.currentPath=null}return s(e,[{key:"moveTo",value:function(e,t){return this.currentPath=new ls,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}},{key:"lineTo",value:function(e,t){return this.currentPath.lineTo(e,t),this}},{key:"quadraticCurveTo",value:function(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}},{key:"bezierCurveTo",value:function(e,t,n,i,r,a){return this.currentPath.bezierCurveTo(e,t,n,i,r,a),this}},{key:"splineThru",value:function(e){return this.currentPath.splineThru(e),this}},{key:"toShapes",value:function(e){function t(e,t){for(var n=t.length,i=!1,r=n-1,a=0;a<n;r=a++){var o=t[r],s=t[a],l=s.x-o.x,u=s.y-o.y;if(Math.abs(u)>Number.EPSILON){if(u<0&&(o=t[a],l=-l,s=t[r],u=-u),e.y<o.y||e.y>s.y)continue;if(e.y===o.y){if(e.x===o.x)return!0}else{var c=u*(e.x-o.x)-l*(e.y-o.y);if(0===c)return!0;if(c<0)continue;i=!i}}else{if(e.y!==o.y)continue;if(s.x<=e.x&&e.x<=o.x||o.x<=e.x&&e.x<=s.x)return!0}}return i}var n,i,r,a=Hs.isClockWise,o=this.subPaths;if(0===o.length)return[];var s=[];if(1===o.length)return i=o[0],(r=new vs).curves=i.curves,s.push(r),s;var l=!a(o[0].getPoints());l=e?!l:l;var u,c,h=[],d=[],f=[],p=0;d[p]=void 0,f[p]=[];for(var v=0,m=o.length;v<m;v++)n=a(u=(i=o[v]).getPoints()),(n=e?!n:n)?(!l&&d[p]&&p++,d[p]={s:new vs,p:u},d[p].s.curves=i.curves,l&&p++,f[p]=[]):f[p].push({h:i,p:u[0]});if(!d[0])return function(e){for(var t=[],n=0,i=e.length;n<i;n++){var r=e[n],a=new vs;a.curves=r.curves,t.push(a)}return t}(o);if(d.length>1){for(var g=!1,y=0,_=0,x=d.length;_<x;_++)h[_]=[];for(var M=0,S=d.length;M<S;M++)for(var b=f[M],E=0;E<b.length;E++){for(var T=b[E],w=!0,A=0;A<d.length;A++)t(T.p,d[A].p)&&(M!==A&&y++,w?(w=!1,h[A].push(T)):g=!0);w&&h[M].push(T)}y>0&&!1===g&&(f=h)}for(var R=0,C=d.length;R<C;R++){r=d[R].s,s.push(r);for(var L=0,P=(c=f[R]).length;L<P;L++)r.holes.push(c[L].h)}return s}}]),e}()),"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"155"}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="155"),e("at",{PRIMARY:14352384,ON_PRIMARY:16777215,DEFAULT_BACKGROUND:16250871,SELECTION:16777215,PREVIEW_DOCKING_COLOR:266198493}),e("au",{SMART:"smart",OFF:"off",ALWAYS:"always"}),e("aN",e=>{document.body.style.cursor=e}),e("aM",e=>{const t=e.headers.get("content-type");if(t&&t.includes("application/json"))return e.json();throw new TypeError("No JSON returned")}),e("g",()=>window.__RML__ENV__&&window.__RML__ENV__.assetPath?window.__RML__ENV__.assetPath:"");const jl=e("aL",(e=null)=>e?(parseInt(e,10)^16*Math.random()>>parseInt(e,10)/4).toString(16):(1e7.toString()+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,jl)),Yl=(e("aw",(e,t,n)=>{Yl(e,t,{writable:n})}),e("ax",(e,t,n)=>{const i=Object.getOwnPropertyDescriptor(e,t);for(let e in n)n.hasOwnProperty(e)&&(i[e]=n[e]);Object.defineProperty(e,t,i)})),ql=(e("aA",e=>({id:e,name:e,externalIdentifier:"test-identifier",group:"test-group",groupLabel:"test-group-label",color:"#"+new En(.5,.5,.5).getHexString(),thumbnail:ql(e,15),label:"test-label",textures:[1,2,3],shading:{alpha:1,metallic:.5,basecolor:{r:.5,g:.5,b:.5},roughness:.5,doubleSided:!1,alphaCutoff:.5},active:!0,tags:[]})),e("aB",e=>{const t=e.split("_"),n=parseInt(t[1],10);return{mapping:"RGB",id:e,material:e,image:ql(e),url:ql(e),height:n,width:n,mmHeight:1,mmWidth:1,tileable:!0}}),(e,t)=>{const n=e.split("_");return t||(t=parseInt(n[1],10)),"https://loremflickr.com/"+t+"/"+t+"?lock="+Math.abs(parseFloat(n[2]))}),Zl=(e("aV",e=>"string"==typeof e||e instanceof String),e("aJ",(e,t)=>e.reduce((e,n)=>{if("object"!=typeof n)return console.warn("objectArrayToMap only works for arrays of objects"),e;const i=n[t];return i?(e.has(i)||e.set(i,n),e):(console.warn('Object has no key "'+t.toString()+'" therefore we do not know where to put it'),e)},new Map)),e("bW",(e,t=16)=>{let n,i=!1,r=0,a=null;return function(...o){n||(n=Date.now()),!i||n+t-Date.now()<0?(e.apply(this,[...arguments]),n=Date.now(),i=!0):r++,a||(a=setInterval(()=>{r&&e.apply(this,[...arguments]),r=0,clearInterval(a),a=null},t))}}),e("bJ",(e,t=16)=>{let n,i=!1;return function(...r){!i||n+t-Date.now()<0?(n=Date.now(),e.apply(this,[...arguments]),i=!0):n=Date.now()}}),e("bK",(e,t)=>{let n;return(...i)=>{clearTimeout(n),n=setTimeout(()=>{e(...i)},t)}}),e("aI",async e=>new Promise(t=>setTimeout(t,e))),e("aK",(e,t)=>{if(-1===t)return e;const n=Math.pow(10,t);return Math.round(e*n)/n}),new RegExp(/\/3d\/[0-9]+\//)),Jl=(e("aG",e=>{var t;if(null===(t=e.assets.glb)||void 0===t?void 0:t.url)return e.assets.glb.url;if(e.threeDimensionalAsset)return e.threeDimensionalAsset;const n=e.threeDimensionalAssetWeb;return n&&"string"==typeof n?n.match(Zl)?n.replace(Zl,"/3d/glb/").replace(".flash.u3d",".glb"):n:null}),e("av",(e,t)=>{for(const n in t)try{t[n].constructor===Object?e[n]=Jl(e[n],t[n]):e[n]=t[n]}catch(i){e[n]=t[n]}return e})),Kl=(e("ar",(e,t)=>void 0===e?t:e),e("aE",(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)}),e("bY",e=>e?JSON.parse(JSON.stringify(e)):e),e("bL",e=>"string"==typeof e&&Kl(e)?new En(Number(e)):new En(e)),e=>Boolean(e.match(/^0x[0-9a-f]+$/i)));e("bZ",(e,t)=>{var n;return t.materialId?e.materialId=t.materialId:t.color?e.rgbValue=(n=t.color)?Number("0x"+n.substring(1)):-1:t.rgbValue?e.rgbValue=t.rgbValue:e.catalogItemId?e.catalogItemId=t.catalogItemId:t.id?e.materialId=t.id:console.warn("Can not set material because neither a texture nor a RGB value was found"),e}),e("bV",(e,t)=>{const n=document.createElement("a");n.setAttribute("href",t),n.setAttribute("download",e),n.style.display="none",document.body.appendChild(n),n.click(),document.body.removeChild(n)}),e("bM",(e,t)=>!(!e||!t||Math.abs(e.targetX-t.targetX)>.01||Math.abs(e.targetY-t.targetY)>.01||Math.abs(e.targetZ-t.targetZ)>.01||Math.abs(e.yaw-t.yaw)>.01||Math.abs(e.distance-t.distance)>.01)),e("aH",(e,t,n,i,r)=>(e-t)*(r-i)/(n-t)+i);let Ql=0;e("M",class extends class{get eventPoster(){return this._eventPoster&&this._eventPoster.postMessage?this._eventPoster:this.eventListener&&this.eventListener.postMessage?this.eventListener:{postMessage:()=>{}}}hasEventPoster(){return!!this._eventPoster}constructor(e,t){this._callbacks=e,this.eventListener=t,this.eventListener.addEventListener("message",this,!1)}nextConversationId(){return Ql++}setEventPoster(e){this._eventPoster=e}handleEvent(e){if(!e||!e.data)return;const[t,n,i]=JSON.parse(e.data);if(!t||0!==t.indexOf("rml"))return;const[r,a]=t.split("."),o=parseInt(a,10);this._callbacks.onCommand(o,parseInt(n,10),i)}}{constructor(e,t){super(e,t),this._promiseCallbacks=new Map}sendToWorker(e,t=null,n,i){const r=this.nextConversationId(),a=()=>!1;!n&&i&&(n=a),n&&!i&&(i=a),n&&i&&this._promiseCallbacks.set(r,{resolve:n,reject:i}),this.eventPoster.postMessage(JSON.stringify(["rml."+e,r,t]))}resolvePromises(e,t){const n=this._promiseCallbacks.get(e);n&&(n.resolve.apply(n,[t]),this._promiseCallbacks.delete(e))}})}}}));
7
+ //# sourceMappingURL=main-thread-to-worker-88746ef2.legacy.js.map