@roomle/web-sdk 2.20.0 → 2.21.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 (197) hide show
  1. package/lib/{banana-for-scale-5f9ad0e3.nomodule.js → banana-for-scale-b9868da9.nomodule.js} +2 -2
  2. package/lib/{banana-for-scale-5f9ad0e3.nomodule.js.map → banana-for-scale-b9868da9.nomodule.js.map} +1 -1
  3. package/lib/{banana-for-scale-a8541870.js → banana-for-scale-c464bcaf.js} +2 -2
  4. package/lib/{banana-for-scale-a8541870.js.map → banana-for-scale-c464bcaf.js.map} +1 -1
  5. package/lib/{budgeteer-measure-5fd28189.js → budgeteer-measure-a6f7fd55.js} +2 -2
  6. package/lib/{budgeteer-measure-5fd28189.js.map → budgeteer-measure-a6f7fd55.js.map} +1 -1
  7. package/lib/budgeteer-measure.nomodule.js +1 -1
  8. package/lib/{component-dimensioning-15849d03.js → component-dimensioning-0d089d5d.js} +2 -2
  9. package/lib/component-dimensioning-0d089d5d.js.map +1 -0
  10. package/lib/{component-dimensioning-3816fed6.nomodule.js → component-dimensioning-aac668c8.nomodule.js} +2 -2
  11. package/lib/component-dimensioning-aac668c8.nomodule.js.map +1 -0
  12. package/lib/configurator-7915999f.js +2 -0
  13. package/lib/{configurator-02c1a087.js.map → configurator-7915999f.js.map} +1 -1
  14. package/lib/configurator-d6e39b21.nomodule.js +2 -0
  15. package/lib/{configurator-b94915ee.nomodule.js.map → configurator-d6e39b21.nomodule.js.map} +1 -1
  16. package/lib/configurator-main-cf5bb9fe.js +2 -0
  17. package/lib/configurator-main-cf5bb9fe.js.map +1 -0
  18. package/lib/configurator-main.nomodule.js +1 -1
  19. package/lib/configurator-mesh-generator-bf1a5b3c.nomodule.js +2 -0
  20. package/lib/configurator-mesh-generator-bf1a5b3c.nomodule.js.map +1 -0
  21. package/lib/configurator-mesh-generator-ec0e9982.js +2 -0
  22. package/lib/configurator-mesh-generator-ec0e9982.js.map +1 -0
  23. package/lib/{default-light-setting-0d38ca56.nomodule.js → default-light-setting-76d539f8.nomodule.js} +2 -2
  24. package/lib/default-light-setting-76d539f8.nomodule.js.map +1 -0
  25. package/lib/{default-light-setting-740fe05f.js → default-light-setting-fe844872.js} +2 -2
  26. package/lib/default-light-setting-fe844872.js.map +1 -0
  27. package/lib/definitions/common-core/mock/mock-pixotron.d.ts +3 -0
  28. package/lib/definitions/common-core/src/cameracontrol/camera-control-3d.d.ts +2 -2
  29. package/lib/definitions/common-core/src/utils/common-utils.d.ts +1 -0
  30. package/lib/definitions/common-core/src/utils/init-data.d.ts +4 -0
  31. package/lib/definitions/common-core/src/utils/shims.d.ts +5 -0
  32. package/lib/definitions/common-core/src/view-model/configurator-view-model.d.ts +1 -1
  33. package/lib/definitions/common-core/src/webgl/mesh-generator.d.ts +1 -1
  34. package/lib/definitions/configurator-core/src/webgl/configurator-mesh-generator.d.ts +1 -1
  35. package/lib/definitions/configurator-core/src/webgl/scene-helper.d.ts +3 -1
  36. package/lib/definitions/typings/pixotron.d.ts +2 -0
  37. package/lib/{dimensioning-helper-df61f3e4.nomodule.js → dimensioning-helper-9a706cfd.nomodule.js} +2 -2
  38. package/lib/dimensioning-helper-9a706cfd.nomodule.js.map +1 -0
  39. package/lib/{dimensioning-helper-67518ab9.js → dimensioning-helper-f7e39056.js} +2 -2
  40. package/lib/dimensioning-helper-f7e39056.js.map +1 -0
  41. package/lib/glb-viewer-0d92b638.js +2 -0
  42. package/lib/{glb-viewer-0a44ad1e.js.map → glb-viewer-0d92b638.js.map} +1 -1
  43. package/lib/glb-viewer-d278030c.nomodule.js +2 -0
  44. package/lib/{glb-viewer-a7947024.nomodule.js.map → glb-viewer-d278030c.nomodule.js.map} +1 -1
  45. package/lib/glb-viewer-main-ae7df6ed.js +2 -0
  46. package/lib/glb-viewer-main-ae7df6ed.js.map +1 -0
  47. package/lib/glb-viewer-main.nomodule.js +1 -1
  48. package/lib/{image-renderer-32588b0f.js → image-renderer-a3e7c1a5.js} +2 -2
  49. package/lib/{image-renderer-32588b0f.js.map → image-renderer-a3e7c1a5.js.map} +1 -1
  50. package/lib/{image-renderer-58be56f9.nomodule.js → image-renderer-b1e31df3.nomodule.js} +2 -2
  51. package/lib/{image-renderer-58be56f9.nomodule.js.map → image-renderer-b1e31df3.nomodule.js.map} +1 -1
  52. package/lib/legacy/{banana-for-scale-7fe6982a.legacy.js → banana-for-scale-07c4ef73.legacy.js} +2 -2
  53. package/lib/legacy/{banana-for-scale-7fe6982a.legacy.js.map → banana-for-scale-07c4ef73.legacy.js.map} +1 -1
  54. package/lib/legacy/budgeteer-measure.legacy.js +1 -1
  55. package/lib/legacy/{component-dimensioning-474e71c0.legacy.js → component-dimensioning-d17748a9.legacy.js} +2 -2
  56. package/lib/legacy/component-dimensioning-d17748a9.legacy.js.map +1 -0
  57. package/lib/legacy/configurator-4672929e.legacy.js +2 -0
  58. package/lib/legacy/{configurator-e33d83c7.legacy.js.map → configurator-4672929e.legacy.js.map} +1 -1
  59. package/lib/legacy/configurator-main.legacy.js +1 -1
  60. package/lib/legacy/configurator-mesh-generator-b171f5d8.legacy.js +2 -0
  61. package/lib/legacy/configurator-mesh-generator-b171f5d8.legacy.js.map +1 -0
  62. package/lib/legacy/{default-light-setting-e5427dcc.legacy.js → default-light-setting-3fcc55d4.legacy.js} +2 -2
  63. package/lib/legacy/default-light-setting-3fcc55d4.legacy.js.map +1 -0
  64. package/lib/legacy/{dimensioning-helper-b6b2fae5.legacy.js → dimensioning-helper-25f07743.legacy.js} +2 -2
  65. package/lib/legacy/dimensioning-helper-25f07743.legacy.js.map +1 -0
  66. package/lib/legacy/glb-viewer-9b9d37a8.legacy.js +2 -0
  67. package/lib/legacy/{glb-viewer-8cd61b1e.legacy.js.map → glb-viewer-9b9d37a8.legacy.js.map} +1 -1
  68. package/lib/legacy/glb-viewer-main.legacy.js +1 -1
  69. package/lib/legacy/{image-renderer-06f566f5.legacy.js → image-renderer-04df50a7.legacy.js} +2 -2
  70. package/lib/legacy/{image-renderer-06f566f5.legacy.js.map → image-renderer-04df50a7.legacy.js.map} +1 -1
  71. package/lib/legacy/{main-thread-to-worker-45106055.legacy.js → main-thread-to-worker-46ba1413.legacy.js} +2 -2
  72. package/lib/legacy/main-thread-to-worker-46ba1413.legacy.js.map +1 -0
  73. package/lib/legacy/{material-viewer-c853ad32.legacy.js → material-viewer-6cddff1d.legacy.js} +2 -2
  74. package/lib/legacy/material-viewer-6cddff1d.legacy.js.map +1 -0
  75. package/lib/legacy/material-viewer-main.legacy.js +1 -1
  76. package/lib/legacy/mesh-generator-572ad2f8.legacy.js +2 -0
  77. package/lib/legacy/mesh-generator-572ad2f8.legacy.js.map +1 -0
  78. package/lib/legacy/pixotron-66b4f690.legacy.js +2 -0
  79. package/lib/legacy/{pixotron-84b6fe67.legacy.js.map → pixotron-66b4f690.legacy.js.map} +1 -1
  80. package/lib/legacy/{planner-90ac969a.legacy.js → planner-2cc59b21.legacy.js} +2 -2
  81. package/lib/legacy/{planner-90ac969a.legacy.js.map → planner-2cc59b21.legacy.js.map} +1 -1
  82. package/lib/legacy/planner-main.legacy.js +1 -1
  83. package/lib/legacy/{rapi-access-21dc9ae2.legacy.js → rapi-access-a73fc03b.legacy.js} +3 -3
  84. package/lib/legacy/{rapi-access-21dc9ae2.legacy.js.map → rapi-access-a73fc03b.legacy.js.map} +1 -1
  85. package/lib/legacy/roomle-sdk.legacy.js +1 -1
  86. package/lib/legacy/scene-manager-47b24f6e.legacy.js +2 -0
  87. package/lib/legacy/scene-manager-47b24f6e.legacy.js.map +1 -0
  88. package/lib/legacy/static/pi.min-0272f873b3a4380a.js +1 -0
  89. package/lib/legacy/static/{rthree-9a98e3318d68245d.js → rthree-508a6ceb9a1516ce.js} +1 -1
  90. package/lib/legacy/static/shaders-d304d03a461ead46.json +1 -0
  91. package/lib/legacy/{stats-helper-e04ccf23.legacy.js → stats-helper-ef9054e8.legacy.js} +2 -2
  92. package/lib/legacy/{stats-helper-e04ccf23.legacy.js.map → stats-helper-ef9054e8.legacy.js.map} +1 -1
  93. package/lib/main-thread-to-worker-4c9942ce.js +2 -0
  94. package/lib/main-thread-to-worker-4c9942ce.js.map +1 -0
  95. package/lib/{main-thread-to-worker-2526203d.nomodule.js → main-thread-to-worker-4f826ab0.nomodule.js} +2 -2
  96. package/lib/main-thread-to-worker-4f826ab0.nomodule.js.map +1 -0
  97. package/lib/{material-viewer-d3c453fc.js → material-viewer-590448c5.js} +2 -2
  98. package/lib/material-viewer-590448c5.js.map +1 -0
  99. package/lib/{material-viewer-7c63aa7f.nomodule.js → material-viewer-8b280e30.nomodule.js} +2 -2
  100. package/lib/material-viewer-8b280e30.nomodule.js.map +1 -0
  101. package/lib/material-viewer-main-e776f7e5.js +2 -0
  102. package/lib/material-viewer-main-e776f7e5.js.map +1 -0
  103. package/lib/material-viewer-main.nomodule.js +1 -1
  104. package/lib/mesh-generator-55c80a53.nomodule.js +2 -0
  105. package/lib/mesh-generator-55c80a53.nomodule.js.map +1 -0
  106. package/lib/mesh-generator-a718d07a.js +2 -0
  107. package/lib/mesh-generator-a718d07a.js.map +1 -0
  108. package/lib/pixotron-9df61cfe.js +2 -0
  109. package/lib/{pixotron-0b81eb7c.js.map → pixotron-9df61cfe.js.map} +1 -1
  110. package/lib/pixotron-e40b75d2.nomodule.js +2 -0
  111. package/lib/{pixotron-7a1f9ec8.nomodule.js.map → pixotron-e40b75d2.nomodule.js.map} +1 -1
  112. package/lib/{planner-fab4fbbe.js → planner-0bdfa18a.js} +2 -2
  113. package/lib/{planner-fab4fbbe.js.map → planner-0bdfa18a.js.map} +1 -1
  114. package/lib/{planner-77af0a69.nomodule.js → planner-fb33bbd5.nomodule.js} +2 -2
  115. package/lib/{planner-77af0a69.nomodule.js.map → planner-fb33bbd5.nomodule.js.map} +1 -1
  116. package/lib/planner-main-cd1ee6e0.js +2 -0
  117. package/lib/planner-main-cd1ee6e0.js.map +1 -0
  118. package/lib/planner-main.nomodule.js +1 -1
  119. package/lib/{rapi-access-d3bc3ce4.nomodule.js → rapi-access-c8981c13.nomodule.js} +3 -3
  120. package/lib/{rapi-access-d3bc3ce4.nomodule.js.map → rapi-access-c8981c13.nomodule.js.map} +1 -1
  121. package/lib/{rapi-access-ff57cd9e.js → rapi-access-d433b66a.js} +3 -3
  122. package/lib/{rapi-access-ff57cd9e.js.map → rapi-access-d433b66a.js.map} +1 -1
  123. package/lib/{roomle-sdk-6e4fd2d6.js → roomle-sdk-8fee3247.js} +2 -2
  124. package/lib/roomle-sdk-8fee3247.js.map +1 -0
  125. package/lib/roomle-sdk.nomodule.js +1 -1
  126. package/lib/scene-manager-b3bd3bed.js +2 -0
  127. package/lib/scene-manager-b3bd3bed.js.map +1 -0
  128. package/lib/scene-manager-cbf9f557.nomodule.js +2 -0
  129. package/lib/scene-manager-cbf9f557.nomodule.js.map +1 -0
  130. package/lib/static/pi.min-0272f873b3a4380a.js +1 -0
  131. package/lib/static/pi.min-0272f873b3a4380a.js.map +1 -0
  132. package/lib/static/{rthree-9a98e3318d68245d.js → rthree-508a6ceb9a1516ce.js} +1 -1
  133. package/lib/static/rthree-508a6ceb9a1516ce.js.map +1 -0
  134. package/lib/static/shaders-d304d03a461ead46.json +1 -0
  135. package/lib/{stats-helper-670aea9b.js → stats-helper-5fadbfc2.js} +2 -2
  136. package/lib/{stats-helper-670aea9b.js.map → stats-helper-5fadbfc2.js.map} +1 -1
  137. package/lib/{stats-helper-b294fd7a.nomodule.js → stats-helper-efa282ca.nomodule.js} +2 -2
  138. package/lib/{stats-helper-b294fd7a.nomodule.js.map → stats-helper-efa282ca.nomodule.js.map} +1 -1
  139. package/package.json +2 -2
  140. package/lib/component-dimensioning-15849d03.js.map +0 -1
  141. package/lib/component-dimensioning-3816fed6.nomodule.js.map +0 -1
  142. package/lib/configurator-02c1a087.js +0 -2
  143. package/lib/configurator-b94915ee.nomodule.js +0 -2
  144. package/lib/configurator-main-31ba572b.js +0 -2
  145. package/lib/configurator-main-31ba572b.js.map +0 -1
  146. package/lib/configurator-mesh-generator-2b2535f8.js +0 -2
  147. package/lib/configurator-mesh-generator-2b2535f8.js.map +0 -1
  148. package/lib/configurator-mesh-generator-470760e6.nomodule.js +0 -2
  149. package/lib/configurator-mesh-generator-470760e6.nomodule.js.map +0 -1
  150. package/lib/default-light-setting-0d38ca56.nomodule.js.map +0 -1
  151. package/lib/default-light-setting-740fe05f.js.map +0 -1
  152. package/lib/dimensioning-helper-67518ab9.js.map +0 -1
  153. package/lib/dimensioning-helper-df61f3e4.nomodule.js.map +0 -1
  154. package/lib/glb-viewer-0a44ad1e.js +0 -2
  155. package/lib/glb-viewer-a7947024.nomodule.js +0 -2
  156. package/lib/glb-viewer-main-c9ea66e6.js +0 -2
  157. package/lib/glb-viewer-main-c9ea66e6.js.map +0 -1
  158. package/lib/legacy/component-dimensioning-474e71c0.legacy.js.map +0 -1
  159. package/lib/legacy/configurator-e33d83c7.legacy.js +0 -2
  160. package/lib/legacy/configurator-mesh-generator-7c2a1b65.legacy.js +0 -2
  161. package/lib/legacy/configurator-mesh-generator-7c2a1b65.legacy.js.map +0 -1
  162. package/lib/legacy/default-light-setting-e5427dcc.legacy.js.map +0 -1
  163. package/lib/legacy/dimensioning-helper-b6b2fae5.legacy.js.map +0 -1
  164. package/lib/legacy/glb-viewer-8cd61b1e.legacy.js +0 -2
  165. package/lib/legacy/main-thread-to-worker-45106055.legacy.js.map +0 -1
  166. package/lib/legacy/material-viewer-c853ad32.legacy.js.map +0 -1
  167. package/lib/legacy/mesh-generator-c9c5cf92.legacy.js +0 -2
  168. package/lib/legacy/mesh-generator-c9c5cf92.legacy.js.map +0 -1
  169. package/lib/legacy/pixotron-84b6fe67.legacy.js +0 -2
  170. package/lib/legacy/scene-manager-c1df3327.legacy.js +0 -2
  171. package/lib/legacy/scene-manager-c1df3327.legacy.js.map +0 -1
  172. package/lib/legacy/static/pi.min-6875d25247d9711b.js +0 -1
  173. package/lib/legacy/static/shaders-695d00691ea12f08.json +0 -1
  174. package/lib/main-thread-to-worker-2526203d.nomodule.js.map +0 -1
  175. package/lib/main-thread-to-worker-815feb19.js +0 -2
  176. package/lib/main-thread-to-worker-815feb19.js.map +0 -1
  177. package/lib/material-viewer-7c63aa7f.nomodule.js.map +0 -1
  178. package/lib/material-viewer-d3c453fc.js.map +0 -1
  179. package/lib/material-viewer-main-43691932.js +0 -2
  180. package/lib/material-viewer-main-43691932.js.map +0 -1
  181. package/lib/mesh-generator-0b2ac98c.js +0 -2
  182. package/lib/mesh-generator-0b2ac98c.js.map +0 -1
  183. package/lib/mesh-generator-739f8058.nomodule.js +0 -2
  184. package/lib/mesh-generator-739f8058.nomodule.js.map +0 -1
  185. package/lib/pixotron-0b81eb7c.js +0 -2
  186. package/lib/pixotron-7a1f9ec8.nomodule.js +0 -2
  187. package/lib/planner-main-1426a336.js +0 -2
  188. package/lib/planner-main-1426a336.js.map +0 -1
  189. package/lib/roomle-sdk-6e4fd2d6.js.map +0 -1
  190. package/lib/scene-manager-1c0fa594.js +0 -2
  191. package/lib/scene-manager-1c0fa594.js.map +0 -1
  192. package/lib/scene-manager-e7cf547f.nomodule.js +0 -2
  193. package/lib/scene-manager-e7cf547f.nomodule.js.map +0 -1
  194. package/lib/static/pi.min-6875d25247d9711b.js +0 -1
  195. package/lib/static/pi.min-6875d25247d9711b.js.map +0 -1
  196. package/lib/static/rthree-9a98e3318d68245d.js.map +0 -1
  197. package/lib/static/shaders-695d00691ea12f08.json +0 -1
@@ -1 +1 @@
1
- var THREE=function(t){const e=[];for(let t=0;t<256;t++)e[t]=(t<16?"0":"")+t.toString(16);let i=1234567;const n={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){const t=4294967295*Math.random()|0,i=4294967295*Math.random()|0,n=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return(e[255&t]+e[t>>8&255]+e[t>>16&255]+e[t>>24&255]+"-"+e[255&i]+e[i>>8&255]+"-"+e[i>>16&15|64]+e[i>>24&255]+"-"+e[63&n|128]+e[n>>8&255]+"-"+e[n>>16&255]+e[n>>24&255]+e[255&r]+e[r>>8&255]+e[r>>16&255]+e[r>>24&255]).toUpperCase()},clamp:function(t,e,i){return Math.max(e,Math.min(i,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,i,n,r){return n+(t-e)*(r-n)/(i-e)},lerp:function(t,e,i){return(1-i)*t+i*e},smoothstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*(3-2*t)},smootherstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){return void 0!==t&&(i=t%2147483647),i=16807*i%2147483647,(i-1)/2147483646},degToRad:function(t){return t*n.DEG2RAD},radToDeg:function(t){return t*n.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},setQuaternionFromProperEuler:function(t,e,i,n,r){const s=Math.cos,o=Math.sin,a=s(i/2),h=o(i/2),l=s((e+n)/2),c=o((e+n)/2),u=s((e-n)/2),p=o((e-n)/2),d=s((n-e)/2),m=o((n-e)/2);switch(r){case"XYX":t.set(a*c,h*u,h*p,a*l);break;case"YZY":t.set(h*p,a*c,h*u,a*l);break;case"ZXZ":t.set(h*u,h*p,a*c,a*l);break;case"XZX":t.set(a*c,h*m,h*d,a*l);break;case"YXY":t.set(h*d,a*c,h*m,a*l);break;case"ZYZ":t.set(h*m,h*d,a*c,a*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}};function r(){}Object.assign(r.prototype,{addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});const i=this._listeners;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;const i=this._listeners;return void 0!==i[t]&&-1!==i[t].indexOf(e)},removeEventListener:function(t,e){if(void 0===this._listeners)return;const i=this._listeners[t];if(void 0!==i){const t=i.indexOf(e);-1!==t&&i.splice(t,1)}},dispatchEvent:function(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const i=e.slice(0);for(let e=0,n=i.length;e<n;e++)i[e].call(this,t)}}});class s{constructor(t=0,e=0){Object.defineProperty(this,"isVector2",{value:!0}),this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,i=this.y,n=t.elements;return this.x=n[0]*e+n[3]*i+n[6],this.y=n[1]*e+n[4]*i+n[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=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}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e,i){return void 0!==i&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const i=Math.cos(e),n=Math.sin(e),r=this.x-t.x,s=this.y-t.y;return this.x=r*i-s*n+t.x,this.y=r*n+s*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}}class o{constructor(){Object.defineProperty(this,"isMatrix3",{value:!0}),this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(t,e,i,n,r,s,o,a,h){const l=this.elements;return l[0]=t,l[1]=n,l[2]=o,l[3]=e,l[4]=r,l[5]=a,l[6]=i,l[7]=s,l[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}clone(){return(new this.constructor).fromArray(this.elements)}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,r=this.elements,s=i[0],o=i[3],a=i[6],h=i[1],l=i[4],c=i[7],u=i[2],p=i[5],d=i[8],m=n[0],f=n[3],g=n[6],y=n[1],x=n[4],v=n[7],b=n[2],M=n[5],w=n[8];return r[0]=s*m+o*y+a*b,r[3]=s*f+o*x+a*M,r[6]=s*g+o*v+a*w,r[1]=h*m+l*y+c*b,r[4]=h*f+l*x+c*M,r[7]=h*g+l*v+c*w,r[2]=u*m+p*y+d*b,r[5]=u*f+p*x+d*M,r[8]=u*g+p*v+d*w,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],s=t[4],o=t[5],a=t[6],h=t[7],l=t[8];return e*s*l-e*o*h-i*r*l+i*o*a+n*r*h-n*s*a}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],s=t[4],o=t[5],a=t[6],h=t[7],l=t[8],c=l*s-o*h,u=o*a-l*r,p=h*r-s*a,d=e*c+i*u+n*p;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);const m=1/d;return t[0]=c*m,t[1]=(n*h-l*i)*m,t[2]=(o*i-n*s)*m,t[3]=u*m,t[4]=(l*e-n*a)*m,t[5]=(n*r-o*e)*m,t[6]=p*m,t[7]=(i*a-h*e)*m,t[8]=(s*e-i*r)*m,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).copy(this).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,i,n,r,s,o){const a=Math.cos(r),h=Math.sin(r);return this.set(i*a,i*h,-i*(a*s+h*o)+s+t,-n*h,n*a,-n*(-h*s+a*o)+o+e,0,0,1),this}scale(t,e){const i=this.elements;return i[0]*=t,i[3]*=t,i[6]*=t,i[1]*=e,i[4]*=e,i[7]*=e,this}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.elements,r=n[0],s=n[3],o=n[6],a=n[1],h=n[4],l=n[7];return n[0]=e*r+i*a,n[3]=e*s+i*h,n[6]=e*o+i*l,n[1]=-i*r+e*a,n[4]=-i*s+e*h,n[7]=-i*o+e*l,this}translate(t,e){const i=this.elements;return i[0]+=t*i[2],i[3]+=t*i[5],i[6]+=t*i[8],i[1]+=e*i[2],i[4]+=e*i[5],i[7]+=e*i[8],this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<9;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}}let a,h=0;function l(t=l.DEFAULT_IMAGE,e=l.DEFAULT_MAPPING,i=1001,r=1001,a=1006,c=1008,u=1023,p=1009,d=1,m=3e3){Object.defineProperty(this,"id",{value:h++}),this.uuid=n.generateUUID(),this.name="",this.image=t,this.mipmaps=[],this.mapping=e,this.wrapS=i,this.wrapT=r,this.magFilter=a,this.minFilter=c,this.anisotropy=d,this.format=u,this.internalFormat=null,this.type=p,this.offset=new s(0,0),this.repeat=new s(1,1),this.center=new s(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new o,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=m,this.version=0,this.onUpdate=null}function c(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?function(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===a&&(a=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),a.width=t.width,a.height=t.height;const i=a.getContext("2d");t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0,t.width,t.height),e=a}return e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}(t):t.data?{data:Array.prototype.slice.call(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}function u(t,e,i,n,r,s,o,a,h,c,u,p){l.call(this,null,s,o,a,h,c,n,r,u,p),this.image={data:t||null,width:e||1,height:i||1},this.magFilter=void 0!==h?h:1003,this.minFilter=void 0!==c?c:1003,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}l.DEFAULT_IMAGE=void 0,l.DEFAULT_MAPPING=300,l.prototype=Object.assign(Object.create(r.prototype),{constructor:l,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const i={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,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,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){const r=this.image;if(void 0===r.uuid&&(r.uuid=n.generateUUID()),!e&&void 0===t.images[r.uuid]){let e;if(Array.isArray(r)){e=[];for(let t=0,i=r.length;t<i;t++)r[t].isDataTexture?e.push(c(r[t].image)):e.push(c(r[t]))}else e=c(r);t.images[r.uuid]={uuid:r.uuid,url:e}}i.image=r.uuid}return e||(t.textures[this.uuid]=i),i},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case 1e3:t.x=t.x-Math.floor(t.x);break;case 1001:t.x=t.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case 1e3:t.y=t.y-Math.floor(t.y);break;case 1001:t.y=t.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}}),Object.defineProperty(l.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),u.prototype=Object.create(l.prototype),u.prototype.constructor=u,u.prototype.isDataTexture=!0;class p{constructor(t=0,e=0,i=0,n=1){Object.defineProperty(this,"isQuaternion",{value:!0}),this._x=t,this._y=e,this._z=i,this._w=n}static slerp(t,e,i,n){return i.copy(t).slerp(e,n)}static slerpFlat(t,e,i,n,r,s,o){let a=i[n+0],h=i[n+1],l=i[n+2],c=i[n+3];const u=r[s+0],p=r[s+1],d=r[s+2],m=r[s+3];if(c!==m||a!==u||h!==p||l!==d){let t=1-o;const e=a*u+h*p+l*d+c*m,i=e>=0?1:-1,n=1-e*e;if(n>Number.EPSILON){const r=Math.sqrt(n),s=Math.atan2(r,e*i);t=Math.sin(t*s)/r,o=Math.sin(o*s)/r}const r=o*i;if(a=a*t+u*r,h=h*t+p*r,l=l*t+d*r,c=c*t+m*r,t===1-o){const t=1/Math.sqrt(a*a+h*h+l*l+c*c);a*=t,h*=t,l*=t,c*=t}}t[e]=a,t[e+1]=h,t[e+2]=l,t[e+3]=c}static multiplyQuaternionsFlat(t,e,i,n,r,s){const o=i[n],a=i[n+1],h=i[n+2],l=i[n+3],c=r[s],u=r[s+1],p=r[s+2],d=r[s+3];return t[e]=o*d+l*c+a*p-h*u,t[e+1]=a*d+l*u+h*c-o*p,t[e+2]=h*d+l*p+o*u-a*c,t[e+3]=l*d-o*c-a*u-h*p,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._w=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const i=t._x,n=t._y,r=t._z,s=t._order,o=Math.cos,a=Math.sin,h=o(i/2),l=o(n/2),c=o(r/2),u=a(i/2),p=a(n/2),d=a(r/2);switch(s){case"XYZ":this._x=u*l*c+h*p*d,this._y=h*p*c-u*l*d,this._z=h*l*d+u*p*c,this._w=h*l*c-u*p*d;break;case"YXZ":this._x=u*l*c+h*p*d,this._y=h*p*c-u*l*d,this._z=h*l*d-u*p*c,this._w=h*l*c+u*p*d;break;case"ZXY":this._x=u*l*c-h*p*d,this._y=h*p*c+u*l*d,this._z=h*l*d+u*p*c,this._w=h*l*c-u*p*d;break;case"ZYX":this._x=u*l*c-h*p*d,this._y=h*p*c+u*l*d,this._z=h*l*d-u*p*c,this._w=h*l*c+u*p*d;break;case"YZX":this._x=u*l*c+h*p*d,this._y=h*p*c+u*l*d,this._z=h*l*d-u*p*c,this._w=h*l*c-u*p*d;break;case"XZY":this._x=u*l*c-h*p*d,this._y=h*p*c-u*l*d,this._z=h*l*d+u*p*c,this._w=h*l*c+u*p*d;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!1!==e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const i=e/2,n=Math.sin(i);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,i=e[0],n=e[4],r=e[8],s=e[1],o=e[5],a=e[9],h=e[2],l=e[6],c=e[10],u=i+o+c;if(u>0){const t=.5/Math.sqrt(u+1);this._w=.25/t,this._x=(l-a)*t,this._y=(r-h)*t,this._z=(s-n)*t}else if(i>o&&i>c){const t=2*Math.sqrt(1+i-o-c);this._w=(l-a)/t,this._x=.25*t,this._y=(n+s)/t,this._z=(r+h)/t}else if(o>c){const t=2*Math.sqrt(1+o-i-c);this._w=(r-h)/t,this._x=(n+s)/t,this._y=.25*t,this._z=(a+l)/t}else{const t=2*Math.sqrt(1+c-i-o);this._w=(s-n)/t,this._x=(r+h)/t,this._y=(a+l)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<1e-6?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(n.clamp(this.dot(t),-1,1)))}rotateTowards(t,e){const i=this.angleTo(t);if(0===i)return this;const n=Math.min(1,e/i);return this.slerp(t,n),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const i=t._x,n=t._y,r=t._z,s=t._w,o=e._x,a=e._y,h=e._z,l=e._w;return this._x=i*l+s*o+n*h-r*a,this._y=n*l+s*a+r*o-i*h,this._z=r*l+s*h+i*a-n*o,this._w=s*l-i*o-n*a-r*h,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const i=this._x,n=this._y,r=this._z,s=this._w;let o=s*t._w+i*t._x+n*t._y+r*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=s,this._x=i,this._y=n,this._z=r,this;const a=1-o*o;if(a<=Number.EPSILON){const t=1-e;return this._w=t*s+e*this._w,this._x=t*i+e*this._x,this._y=t*n+e*this._y,this._z=t*r+e*this._z,this.normalize(),this._onChangeCallback(),this}const h=Math.sqrt(a),l=Math.atan2(h,o),c=Math.sin((1-e)*l)/h,u=Math.sin(e*l)/h;return this._w=s*c+this._w*u,this._x=i*c+this._x*u,this._y=n*c+this._y*u,this._z=r*c+this._z*u,this._onChangeCallback(),this}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}class d{constructor(t=0,e=0,i=0){Object.defineProperty(this,"isVector3",{value:!0}),this.x=t,this.y=e,this.z=i}set(t,e,i){return void 0===i&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(f.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(f.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*n,this.y=r[1]*e+r[4]*i+r[7]*n,this.z=r[2]*e+r[5]*i+r[8]*n,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,i=this.y,n=this.z,r=t.elements,s=1/(r[3]*e+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*n+r[12])*s,this.y=(r[1]*e+r[5]*i+r[9]*n+r[13])*s,this.z=(r[2]*e+r[6]*i+r[10]*n+r[14])*s,this}applyQuaternion(t){const e=this.x,i=this.y,n=this.z,r=t.x,s=t.y,o=t.z,a=t.w,h=a*e+s*n-o*i,l=a*i+o*e-r*n,c=a*n+r*i-s*e,u=-r*e-s*i-o*n;return this.x=h*a+u*-r+l*-o-c*-s,this.y=l*a+u*-s+c*-r-h*-o,this.z=c*a+u*-o+h*-s-l*-r,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*n,this.y=r[1]*e+r[5]*i+r[9]*n,this.z=r[2]*e+r[6]*i+r[10]*n,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=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}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)}crossVectors(t,e){const i=t.x,n=t.y,r=t.z,s=e.x,o=e.y,a=e.z;return this.x=n*a-r*o,this.y=r*s-i*a,this.z=i*o-n*s,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return m.copy(this).projectOnVector(t),this.sub(m)}reflect(t){return this.sub(m.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(n.clamp(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return e*e+i*i+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,i){const n=Math.sin(e)*t;return this.x=n*Math.sin(i),this.y=Math.cos(e)*t,this.z=n*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=n,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e,i){return void 0!==i&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}}const m=new d,f=new p;class g{constructor(t,e){Object.defineProperty(this,"isBox3",{value:!0}),this.min=void 0!==t?t:new d(1/0,1/0,1/0),this.max=void 0!==e?e:new d(-1/0,-1/0,-1/0)}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){let e=1/0,i=1/0,n=1/0,r=-1/0,s=-1/0,o=-1/0;for(let a=0,h=t.length;a<h;a+=3){const h=t[a],l=t[a+1],c=t[a+2];h<e&&(e=h),l<i&&(i=l),c<n&&(n=c),h>r&&(r=h),l>s&&(s=l),c>o&&(o=c)}return this.min.set(e,i,n),this.max.set(r,s,o),this}setFromBufferAttribute(t){let e=1/0,i=1/0,n=1/0,r=-1/0,s=-1/0,o=-1/0;for(let a=0,h=t.count;a<h;a++){const h=t.getX(a),l=t.getY(a),c=t.getZ(a);h<e&&(e=h),l<i&&(i=l),c<n&&(n=c),h>r&&(r=h),l>s&&(s=l),c>o&&(o=c)}return this.min.set(e,i,n),this.max.set(r,s,o),this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=v.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}setFromObject(t){return this.makeEmpty(),this.expandByObject(t)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return void 0===t&&(console.warn("THREE.Box3: .getCenter() target is now required"),t=new d),this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return void 0===t&&(console.warn("THREE.Box3: .getSize() target is now required"),t=new d),this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t){t.updateWorldMatrix(!1,!1);const e=t.geometry;void 0!==e&&(null===e.boundingBox&&e.computeBoundingBox(),b.copy(e.boundingBox),b.applyMatrix4(t.matrixWorld),this.union(b));const i=t.children;for(let t=0,e=i.length;t<e;t++)this.expandByObject(i[t]);return this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return void 0===e&&(console.warn("THREE.Box3: .getParameter() target is now required"),e=new d),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsSphere(t){return this.clampPoint(t.center,v),v.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(A),L.subVectors(this.max,A),M.subVectors(t.a,A),w.subVectors(t.b,A),_.subVectors(t.c,A),S.subVectors(w,M),T.subVectors(_,w),E.subVectors(M,_);let e=[0,-S.z,S.y,0,-T.z,T.y,0,-E.z,E.y,S.z,0,-S.x,T.z,0,-T.x,E.z,0,-E.x,-S.y,S.x,0,-T.y,T.x,0,-E.y,E.x,0];return!!y(e,M,w,_,L)&&(e=[1,0,0,0,1,0,0,0,1],!!y(e,M,w,_,L)&&(R.crossVectors(S,T),e=[R.x,R.y,R.z],y(e,M,w,_,L)))}clampPoint(t,e){return void 0===e&&(console.warn("THREE.Box3: .clampPoint() target is now required"),e=new d),e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return v.copy(t).clamp(this.min,this.max).sub(t).length()}getBoundingSphere(t){return void 0===t&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(t.center),t.radius=.5*this.getSize(v).length(),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(x[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),x[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),x[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),x[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),x[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),x[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),x[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),x[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(x)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}function y(t,e,i,n,r){for(let s=0,o=t.length-3;s<=o;s+=3){P.fromArray(t,s);const o=r.x*Math.abs(P.x)+r.y*Math.abs(P.y)+r.z*Math.abs(P.z),a=e.dot(P),h=i.dot(P),l=n.dot(P);if(Math.max(-Math.max(a,h,l),Math.min(a,h,l))>o)return!1}return!0}const x=[new d,new d,new d,new d,new d,new d,new d,new d],v=new d,b=new g,M=new d,w=new d,_=new d,S=new d,T=new d,E=new d,A=new d,L=new d,R=new d,P=new d,C=new g;class O{constructor(t,e){this.center=void 0!==t?t:new d,this.radius=void 0!==e?e:-1}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const i=this.center;void 0!==e?i.copy(e):C.setFromPoints(t).getCenter(i);let n=0;for(let e=0,r=t.length;e<r;e++)n=Math.max(n,i.distanceToSquared(t[e]));return this.radius=Math.sqrt(n),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const i=this.center.distanceToSquared(t);return void 0===e&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),e=new d),e.copy(t),i>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return void 0===t&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),t=new g),this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}}const z=new d,N=new d,B=new o;class F{constructor(t,e){Object.defineProperty(this,"isPlane",{value:!0}),this.normal=void 0!==t?t:new d(1,0,0),this.constant=void 0!==e?e:0}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,i,n){return this.normal.set(t,e,i),this.constant=n,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,i){const n=z.subVectors(i,e).cross(N.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(n,t),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return void 0===e&&(console.warn("THREE.Plane: .projectPoint() target is now required"),e=new d),e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)}intersectLine(t,e){void 0===e&&(console.warn("THREE.Plane: .intersectLine() target is now required"),e=new d);const i=t.delta(z),n=this.normal.dot(i);if(0===n)return 0===this.distanceToPoint(t.start)?e.copy(t.start):void 0;const r=-(t.start.dot(this.normal)+this.constant)/n;return r<0||r>1?void 0:e.copy(i).multiplyScalar(r).add(t.start)}intersectsLine(t){const e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return void 0===t&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),t=new d),t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const i=e||B.getNormalMatrix(t),n=this.coplanarPoint(z).applyMatrix4(t),r=this.normal.applyMatrix3(i).normalize();return this.constant=-n.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}}const D=new O,G=new d;class I{constructor(t,e,i,n,r,s){this.planes=[void 0!==t?t:new F,void 0!==e?e:new F,void 0!==i?i:new F,void 0!==n?n:new F,void 0!==r?r:new F,void 0!==s?s:new F]}set(t,e,i,n,r,s){const o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(i),o[3].copy(n),o[4].copy(r),o[5].copy(s),this}clone(){return(new this.constructor).copy(this)}copy(t){const e=this.planes;for(let i=0;i<6;i++)e[i].copy(t.planes[i]);return this}setFromProjectionMatrix(t){const e=this.planes,i=t.elements,n=i[0],r=i[1],s=i[2],o=i[3],a=i[4],h=i[5],l=i[6],c=i[7],u=i[8],p=i[9],d=i[10],m=i[11],f=i[12],g=i[13],y=i[14],x=i[15];return e[0].setComponents(o-n,c-a,m-u,x-f).normalize(),e[1].setComponents(o+n,c+a,m+u,x+f).normalize(),e[2].setComponents(o+r,c+h,m+p,x+g).normalize(),e[3].setComponents(o-r,c-h,m-p,x-g).normalize(),e[4].setComponents(o-s,c-l,m-d,x-y).normalize(),e[5].setComponents(o+s,c+l,m+d,x+y).normalize(),this}intersectsObject(t){const e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),D.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(D)}intersectsSprite(t){return D.center.set(0,0,0),D.radius=.7071067811865476,D.applyMatrix4(t.matrixWorld),this.intersectsSphere(D)}intersectsSphere(t){const e=this.planes,i=t.center,n=-t.radius;for(let t=0;t<6;t++)if(e[t].distanceToPoint(i)<n)return!1;return!0}intersectsBox(t){const e=this.planes;for(let i=0;i<6;i++){const n=e[i];if(G.x=n.normal.x>0?t.max.x:t.min.x,G.y=n.normal.y>0?t.max.y:t.min.y,G.z=n.normal.z>0?t.max.z:t.min.z,n.distanceToPoint(G)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}}class k{constructor(){Object.defineProperty(this,"isMatrix4",{value:!0}),this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(t,e,i,n,r,s,o,a,h,l,c,u,p,d,m,f){const g=this.elements;return g[0]=t,g[4]=e,g[8]=i,g[12]=n,g[1]=r,g[5]=s,g[9]=o,g[13]=a,g[2]=h,g[6]=l,g[10]=c,g[14]=u,g[3]=p,g[7]=d,g[11]=m,g[15]=f,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new k).fromArray(this.elements)}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){const e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}extractBasis(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,i=t.elements,n=1/U.setFromMatrixColumn(t,0).length(),r=1/U.setFromMatrixColumn(t,1).length(),s=1/U.setFromMatrixColumn(t,2).length();return e[0]=i[0]*n,e[1]=i[1]*n,e[2]=i[2]*n,e[3]=0,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=0,e[8]=i[8]*s,e[9]=i[9]*s,e[10]=i[10]*s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const e=this.elements,i=t.x,n=t.y,r=t.z,s=Math.cos(i),o=Math.sin(i),a=Math.cos(n),h=Math.sin(n),l=Math.cos(r),c=Math.sin(r);if("XYZ"===t.order){const t=s*l,i=s*c,n=o*l,r=o*c;e[0]=a*l,e[4]=-a*c,e[8]=h,e[1]=i+n*h,e[5]=t-r*h,e[9]=-o*a,e[2]=r-t*h,e[6]=n+i*h,e[10]=s*a}else if("YXZ"===t.order){const t=a*l,i=a*c,n=h*l,r=h*c;e[0]=t+r*o,e[4]=n*o-i,e[8]=s*h,e[1]=s*c,e[5]=s*l,e[9]=-o,e[2]=i*o-n,e[6]=r+t*o,e[10]=s*a}else if("ZXY"===t.order){const t=a*l,i=a*c,n=h*l,r=h*c;e[0]=t-r*o,e[4]=-s*c,e[8]=n+i*o,e[1]=i+n*o,e[5]=s*l,e[9]=r-t*o,e[2]=-s*h,e[6]=o,e[10]=s*a}else if("ZYX"===t.order){const t=s*l,i=s*c,n=o*l,r=o*c;e[0]=a*l,e[4]=n*h-i,e[8]=t*h+r,e[1]=a*c,e[5]=r*h+t,e[9]=i*h-n,e[2]=-h,e[6]=o*a,e[10]=s*a}else if("YZX"===t.order){const t=s*a,i=s*h,n=o*a,r=o*h;e[0]=a*l,e[4]=r-t*c,e[8]=n*c+i,e[1]=c,e[5]=s*l,e[9]=-o*l,e[2]=-h*l,e[6]=i*c+n,e[10]=t-r*c}else if("XZY"===t.order){const t=s*a,i=s*h,n=o*a,r=o*h;e[0]=a*l,e[4]=-c,e[8]=h*l,e[1]=t*c+r,e[5]=s*l,e[9]=i*c-n,e[2]=n*c-i,e[6]=o*l,e[10]=r*c+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(W,t,j)}lookAt(t,e,i){const n=this.elements;return X.subVectors(t,e),0===X.lengthSq()&&(X.z=1),X.normalize(),H.crossVectors(i,X),0===H.lengthSq()&&(1===Math.abs(i.z)?X.x+=1e-4:X.z+=1e-4,X.normalize(),H.crossVectors(i,X)),H.normalize(),q.crossVectors(X,H),n[0]=H.x,n[4]=q.x,n[8]=X.x,n[1]=H.y,n[5]=q.y,n[9]=X.y,n[2]=H.z,n[6]=q.z,n[10]=X.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,r=this.elements,s=i[0],o=i[4],a=i[8],h=i[12],l=i[1],c=i[5],u=i[9],p=i[13],d=i[2],m=i[6],f=i[10],g=i[14],y=i[3],x=i[7],v=i[11],b=i[15],M=n[0],w=n[4],_=n[8],S=n[12],T=n[1],E=n[5],A=n[9],L=n[13],R=n[2],P=n[6],C=n[10],O=n[14],z=n[3],N=n[7],B=n[11],F=n[15];return r[0]=s*M+o*T+a*R+h*z,r[4]=s*w+o*E+a*P+h*N,r[8]=s*_+o*A+a*C+h*B,r[12]=s*S+o*L+a*O+h*F,r[1]=l*M+c*T+u*R+p*z,r[5]=l*w+c*E+u*P+p*N,r[9]=l*_+c*A+u*C+p*B,r[13]=l*S+c*L+u*O+p*F,r[2]=d*M+m*T+f*R+g*z,r[6]=d*w+m*E+f*P+g*N,r[10]=d*_+m*A+f*C+g*B,r[14]=d*S+m*L+f*O+g*F,r[3]=y*M+x*T+v*R+b*z,r[7]=y*w+x*E+v*P+b*N,r[11]=y*_+x*A+v*C+b*B,r[15]=y*S+x*L+v*O+b*F,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[4],n=t[8],r=t[12],s=t[1],o=t[5],a=t[9],h=t[13],l=t[2],c=t[6],u=t[10],p=t[14];return t[3]*(+r*a*c-n*h*c-r*o*u+i*h*u+n*o*p-i*a*p)+t[7]*(+e*a*p-e*h*u+r*s*u-n*s*p+n*h*l-r*a*l)+t[11]*(+e*h*c-e*o*p-r*s*c+i*s*p+r*o*l-i*h*l)+t[15]*(-n*o*l-e*a*c+e*o*u+n*s*c-i*s*u+i*a*l)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,i){const n=this.elements;return t.isVector3?(n[12]=t.x,n[13]=t.y,n[14]=t.z):(n[12]=t,n[13]=e,n[14]=i),this}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],s=t[4],o=t[5],a=t[6],h=t[7],l=t[8],c=t[9],u=t[10],p=t[11],d=t[12],m=t[13],f=t[14],g=t[15],y=c*f*h-m*u*h+m*a*p-o*f*p-c*a*g+o*u*g,x=d*u*h-l*f*h-d*a*p+s*f*p+l*a*g-s*u*g,v=l*m*h-d*c*h+d*o*p-s*m*p-l*o*g+s*c*g,b=d*c*a-l*m*a-d*o*u+s*m*u+l*o*f-s*c*f,M=e*y+i*x+n*v+r*b;if(0===M)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/M;return t[0]=y*w,t[1]=(m*u*r-c*f*r-m*n*p+i*f*p+c*n*g-i*u*g)*w,t[2]=(o*f*r-m*a*r+m*n*h-i*f*h-o*n*g+i*a*g)*w,t[3]=(c*a*r-o*u*r-c*n*h+i*u*h+o*n*p-i*a*p)*w,t[4]=x*w,t[5]=(l*f*r-d*u*r+d*n*p-e*f*p-l*n*g+e*u*g)*w,t[6]=(d*a*r-s*f*r-d*n*h+e*f*h+s*n*g-e*a*g)*w,t[7]=(s*u*r-l*a*r+l*n*h-e*u*h-s*n*p+e*a*p)*w,t[8]=v*w,t[9]=(d*c*r-l*m*r-d*i*p+e*m*p+l*i*g-e*c*g)*w,t[10]=(s*m*r-d*o*r+d*i*h-e*m*h-s*i*g+e*o*g)*w,t[11]=(l*o*r-s*c*r-l*i*h+e*c*h+s*i*p-e*o*p)*w,t[12]=b*w,t[13]=(l*m*n-d*c*n+d*i*u-e*m*u-l*i*f+e*c*f)*w,t[14]=(d*o*n-s*m*n-d*i*a+e*m*a+s*i*f-e*o*f)*w,t[15]=(s*c*n-l*o*n+l*i*a-e*c*a-s*i*u+e*o*u)*w,this}scale(t){const e=this.elements,i=t.x,n=t.y,r=t.z;return e[0]*=i,e[4]*=n,e[8]*=r,e[1]*=i,e[5]*=n,e[9]*=r,e[2]*=i,e[6]*=n,e[10]*=r,e[3]*=i,e[7]*=n,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,n))}makeTranslation(t,e,i){return this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const i=Math.cos(e),n=Math.sin(e),r=1-i,s=t.x,o=t.y,a=t.z,h=r*s,l=r*o;return this.set(h*s+i,h*o-n*a,h*a+n*o,0,h*o+n*a,l*o+i,l*a-n*s,0,h*a-n*o,l*a+n*s,r*a*a+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i){return this.set(1,e,i,0,t,1,i,0,t,e,1,0,0,0,0,1),this}compose(t,e,i){const n=this.elements,r=e._x,s=e._y,o=e._z,a=e._w,h=r+r,l=s+s,c=o+o,u=r*h,p=r*l,d=r*c,m=s*l,f=s*c,g=o*c,y=a*h,x=a*l,v=a*c,b=i.x,M=i.y,w=i.z;return n[0]=(1-(m+g))*b,n[1]=(p+v)*b,n[2]=(d-x)*b,n[3]=0,n[4]=(p-v)*M,n[5]=(1-(u+g))*M,n[6]=(f+y)*M,n[7]=0,n[8]=(d+x)*w,n[9]=(f-y)*w,n[10]=(1-(u+m))*w,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this}decompose(t,e,i){const n=this.elements;let r=U.set(n[0],n[1],n[2]).length();const s=U.set(n[4],n[5],n[6]).length(),o=U.set(n[8],n[9],n[10]).length();this.determinant()<0&&(r=-r),t.x=n[12],t.y=n[13],t.z=n[14],V.copy(this);const a=1/r,h=1/s,l=1/o;return V.elements[0]*=a,V.elements[1]*=a,V.elements[2]*=a,V.elements[4]*=h,V.elements[5]*=h,V.elements[6]*=h,V.elements[8]*=l,V.elements[9]*=l,V.elements[10]*=l,e.setFromRotationMatrix(V),i.x=r,i.y=s,i.z=o,this}makePerspective(t,e,i,n,r,s){void 0===s&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const o=this.elements,a=2*r/(e-t),h=2*r/(i-n),l=(e+t)/(e-t),c=(i+n)/(i-n),u=-(s+r)/(s-r),p=-2*s*r/(s-r);return o[0]=a,o[4]=0,o[8]=l,o[12]=0,o[1]=0,o[5]=h,o[9]=c,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(t,e,i,n,r,s){const o=this.elements,a=1/(e-t),h=1/(i-n),l=1/(s-r),c=(e+t)*a,u=(i+n)*h,p=(s+r)*l;return o[0]=2*a,o[4]=0,o[8]=0,o[12]=-c,o[1]=0,o[5]=2*h,o[9]=0,o[13]=-u,o[2]=0,o[6]=0,o[10]=-2*l,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<16;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}}const U=new d,V=new k,W=new d(0,0,0),j=new d(1,1,1),H=new d,q=new d,X=new d;class J{constructor(t=0,e=0,i=0,n=1){Object.defineProperty(this,"isVector4",{value:!0}),this.x=t,this.y=e,this.z=i,this.w=n}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,i,n){return this.x=t,this.y=e,this.z=i,this.w=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){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: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,i=this.y,n=this.z,r=this.w,s=t.elements;return this.x=s[0]*e+s[4]*i+s[8]*n+s[12]*r,this.y=s[1]*e+s[5]*i+s[9]*n+s[13]*r,this.z=s[2]*e+s[6]*i+s[10]*n+s[14]*r,this.w=s[3]*e+s[7]*i+s[11]*n+s[15]*r,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,i,n,r;const s=t.elements,o=s[0],a=s[4],h=s[8],l=s[1],c=s[5],u=s[9],p=s[2],d=s[6],m=s[10];if(Math.abs(a-l)<.01&&Math.abs(h-p)<.01&&Math.abs(u-d)<.01){if(Math.abs(a+l)<.1&&Math.abs(h+p)<.1&&Math.abs(u+d)<.1&&Math.abs(o+c+m-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;const t=(o+1)/2,s=(c+1)/2,f=(m+1)/2,g=(a+l)/4,y=(h+p)/4,x=(u+d)/4;return t>s&&t>f?t<.01?(i=0,n=.707106781,r=.707106781):(i=Math.sqrt(t),n=g/i,r=y/i):s>f?s<.01?(i=.707106781,n=0,r=.707106781):(n=Math.sqrt(s),i=g/n,r=x/n):f<.01?(i=.707106781,n=.707106781,r=0):(r=Math.sqrt(f),i=y/r,n=x/r),this.set(i,n,r,e),this}let f=Math.sqrt((d-u)*(d-u)+(h-p)*(h-p)+(l-a)*(l-a));return Math.abs(f)<.001&&(f=1),this.x=(d-u)/f,this.y=(h-p)/f,this.z=(l-a)/f,this.w=Math.acos((o+c+m-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=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}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e,i){return void 0!==i&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}}const Y={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},Z={h:0,s:0,l:0},Q={h:0,s:0,l:0};function K(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}function $(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function tt(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class et{constructor(t,e,i){return Object.defineProperty(this,"isColor",{value:!0}),void 0===e&&void 0===i?this.set(t):this.setRGB(t,e,i)}set(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this}setRGB(t,e,i){return this.r=t,this.g=e,this.b=i,this}setHSL(t,e,i){if(t=n.euclideanModulo(t,1),e=n.clamp(e,0,1),i=n.clamp(i,0,1),0===e)this.r=this.g=this.b=i;else{const n=i<=.5?i*(1+e):i+e-i*e,r=2*i-n;this.r=K(r,n,t+1/3),this.g=K(r,n,t),this.b=K(r,n,t-1/3)}return this}setStyle(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let i;if(i=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){let t;const n=i[1],r=i[2];switch(n){case"rgb":case"rgba":if(t=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,e(t[4]),this;if(t=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,e(t[4]),this;break;case"hsl":case"hsla":if(t=/^(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r)){const i=parseFloat(t[1])/360,n=parseInt(t[2],10)/100,r=parseInt(t[3],10)/100;return e(t[4]),this.setHSL(i,n,r)}}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=i[1],e=t.length;if(3===e)return this.r=parseInt(t.charAt(0)+t.charAt(0),16)/255,this.g=parseInt(t.charAt(1)+t.charAt(1),16)/255,this.b=parseInt(t.charAt(2)+t.charAt(2),16)/255,this;if(6===e)return this.r=parseInt(t.charAt(0)+t.charAt(1),16)/255,this.g=parseInt(t.charAt(2)+t.charAt(3),16)/255,this.b=parseInt(t.charAt(4)+t.charAt(5),16)/255,this}return t&&t.length>0?this.setColorName(t):this}setColorName(t){const e=Y[t];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copyGammaToLinear(t,e=2){return this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this}copyLinearToGamma(t,e=2){const i=e>0?1/e:1;return this.r=Math.pow(t.r,i),this.g=Math.pow(t.g,i),this.b=Math.pow(t.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.r=$(t.r),this.g=$(t.g),this.b=$(t.b),this}copyLinearToSRGB(t){return this.r=tt(t.r),this.g=tt(t.g),this.b=tt(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(t){void 0===t&&(console.warn("THREE.Color: .getHSL() target is now required"),t={h:0,s:0,l:0});const e=this.r,i=this.g,n=this.b,r=Math.max(e,i,n),s=Math.min(e,i,n);let o,a;const h=(s+r)/2;if(s===r)o=0,a=0;else{const t=r-s;switch(a=h<=.5?t/(r+s):t/(2-r-s),r){case e:o=(i-n)/t+(i<n?6:0);break;case i:o=(n-e)/t+2;break;case n:o=(e-i)/t+4}o/=6}return t.h=o,t.s=a,t.l=h,t}getStyle(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"}offsetHSL(t,e,i){return this.getHSL(Z),Z.h+=t,Z.s+=e,Z.l+=i,this.setHSL(Z.h,Z.s,Z.l),this}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpHSL(t,e){this.getHSL(Z),t.getHSL(Q);const i=n.lerp(Z.h,Q.h,e),r=n.lerp(Z.s,Q.s,e),s=n.lerp(Z.l,Q.l,e);return this.setHSL(i,r,s),this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),!0===t.normalized&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}}function it(){let t=null,e=!1,i=null,n=null;function r(e,s){i(e,s),n=t.requestAnimationFrame(r)}return{start:function(){!0!==e&&null!==i&&(n=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(t){i=t},setContext:function(e){t=e}}}function nt(t,e){const i=e.isWebGL2,n=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),n.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const i=n.get(e);i&&(t.deleteBuffer(i.buffer),n.delete(e))},update:function(e,r){if(e.isGLBufferAttribute){const t=n.get(e);return void((!t||t.version<e.version)&&n.set(e,{buffer:e.buffer,type:e.type,bytesPerElement:e.elementSize,version:e.version}))}e.isInterleavedBufferAttribute&&(e=e.data);const s=n.get(e);void 0===s?n.set(e,function(e,n){const r=e.array,s=e.usage,o=t.createBuffer();t.bindBuffer(n,o),t.bufferData(n,r,s),e.onUploadCallback();let a=5126;return r instanceof Float32Array?a=5126:r instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):r instanceof Uint16Array?e.isFloat16BufferAttribute?i?a=5131:console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2."):a=5123:r instanceof Int16Array?a=5122:r instanceof Uint32Array?a=5125:r instanceof Int32Array?a=5124:r instanceof Int8Array?a=5120:r instanceof Uint8Array&&(a=5121),{buffer:o,type:a,bytesPerElement:r.BYTES_PER_ELEMENT,version:e.version}}(e,r)):s.version<e.version&&(function(e,n,r){const s=n.array,o=n.updateRange;t.bindBuffer(r,e),-1===o.count?t.bufferSubData(r,0,s):(i?t.bufferSubData(r,o.offset*s.BYTES_PER_ELEMENT,s,o.offset,o.count):t.bufferSubData(r,o.offset*s.BYTES_PER_ELEMENT,s.subarray(o.offset,o.offset+o.count)),o.count=-1)}(s.buffer,e,r),s.version=e.version)}}}et.NAMES=Y,et.prototype.r=1,et.prototype.g=1,et.prototype.b=1;const rt=new d,st=new s;function ot(t,e,i){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===i,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0}function at(t,e,i){ot.call(this,new Int8Array(t),e,i)}function ht(t,e,i){ot.call(this,new Uint8Array(t),e,i)}function lt(t,e,i){ot.call(this,new Uint8ClampedArray(t),e,i)}function ct(t,e,i){ot.call(this,new Int16Array(t),e,i)}function ut(t,e,i){ot.call(this,new Uint16Array(t),e,i)}function pt(t,e,i){ot.call(this,new Int32Array(t),e,i)}function dt(t,e,i){ot.call(this,new Uint32Array(t),e,i)}function mt(t,e,i){ot.call(this,new Uint16Array(t),e,i)}function ft(t,e,i){ot.call(this,new Float32Array(t),e,i)}function gt(t,e,i){ot.call(this,new Float64Array(t),e,i)}Object.defineProperty(ot.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(ot.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this},copyAt:function(t,e,i){t*=this.itemSize,i*=e.itemSize;for(let n=0,r=this.itemSize;n<r;n++)this.array[t+n]=e.array[i+n];return this},copyArray:function(t){return this.array.set(t),this},copyColorsArray:function(t){const e=this.array;let i=0;for(let n=0,r=t.length;n<r;n++){let r=t[n];void 0===r&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",n),r=new et),e[i++]=r.r,e[i++]=r.g,e[i++]=r.b}return this},copyVector2sArray:function(t){const e=this.array;let i=0;for(let n=0,r=t.length;n<r;n++){let r=t[n];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",n),r=new s),e[i++]=r.x,e[i++]=r.y}return this},copyVector3sArray:function(t){const e=this.array;let i=0;for(let n=0,r=t.length;n<r;n++){let r=t[n];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",n),r=new d),e[i++]=r.x,e[i++]=r.y,e[i++]=r.z}return this},copyVector4sArray:function(t){const e=this.array;let i=0;for(let n=0,r=t.length;n<r;n++){let r=t[n];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",n),r=new J),e[i++]=r.x,e[i++]=r.y,e[i++]=r.z,e[i++]=r.w}return this},applyMatrix3:function(t){if(2===this.itemSize)for(let e=0,i=this.count;e<i;e++)st.fromBufferAttribute(this,e),st.applyMatrix3(t),this.setXY(e,st.x,st.y);else if(3===this.itemSize)for(let e=0,i=this.count;e<i;e++)rt.fromBufferAttribute(this,e),rt.applyMatrix3(t),this.setXYZ(e,rt.x,rt.y,rt.z);return this},applyMatrix4:function(t){for(let e=0,i=this.count;e<i;e++)rt.x=this.getX(e),rt.y=this.getY(e),rt.z=this.getZ(e),rt.applyMatrix4(t),this.setXYZ(e,rt.x,rt.y,rt.z);return this},applyNormalMatrix:function(t){for(let e=0,i=this.count;e<i;e++)rt.x=this.getX(e),rt.y=this.getY(e),rt.z=this.getZ(e),rt.applyNormalMatrix(t),this.setXYZ(e,rt.x,rt.y,rt.z);return this},transformDirection:function(t){for(let e=0,i=this.count;e<i;e++)rt.x=this.getX(e),rt.y=this.getY(e),rt.z=this.getZ(e),rt.transformDirection(t),this.setXYZ(e,rt.x,rt.y,rt.z);return this},set:function(t,e=0){return this.array.set(t,e),this},getX:function(t){return this.array[t*this.itemSize]},setX:function(t,e){return this.array[t*this.itemSize]=e,this},getY:function(t){return this.array[t*this.itemSize+1]},setY:function(t,e){return this.array[t*this.itemSize+1]=e,this},getZ:function(t){return this.array[t*this.itemSize+2]},setZ:function(t,e){return this.array[t*this.itemSize+2]=e,this},getW:function(t){return this.array[t*this.itemSize+3]},setW:function(t,e){return this.array[t*this.itemSize+3]=e,this},setXY:function(t,e,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this},setXYZ:function(t,e,i,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this},setXYZW:function(t,e,i,n,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this.array[t+3]=r,this},onUpload:function(t){return this.onUploadCallback=t,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)},toJSON:function(){return{itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized}}}),at.prototype=Object.create(ot.prototype),at.prototype.constructor=at,ht.prototype=Object.create(ot.prototype),ht.prototype.constructor=ht,lt.prototype=Object.create(ot.prototype),lt.prototype.constructor=lt,ct.prototype=Object.create(ot.prototype),ct.prototype.constructor=ct,ut.prototype=Object.create(ot.prototype),ut.prototype.constructor=ut,pt.prototype=Object.create(ot.prototype),pt.prototype.constructor=pt,dt.prototype=Object.create(ot.prototype),dt.prototype.constructor=dt,mt.prototype=Object.create(ot.prototype),mt.prototype.constructor=mt,mt.prototype.isFloat16BufferAttribute=!0,ft.prototype=Object.create(ot.prototype),ft.prototype.constructor=ft,gt.prototype=Object.create(ot.prototype),gt.prototype.constructor=gt;class yt{constructor(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}computeGroups(t){const e=[];let i,n,r=void 0;const s=t.faces;for(n=0;n<s.length;n++){const t=s[n];t.materialIndex!==r&&(r=t.materialIndex,void 0!==i&&(i.count=3*n-i.start,e.push(i)),i={start:3*n,materialIndex:r})}void 0!==i&&(i.count=3*n-i.start,e.push(i)),this.groups=e}fromGeometry(t){const e=t.faces,i=t.vertices,n=t.faceVertexUvs,r=n[0]&&n[0].length>0,o=n[1]&&n[1].length>0,a=t.morphTargets,h=a.length;let l;if(h>0){l=[];for(let t=0;t<h;t++)l[t]={name:a[t].name,data:[]};this.morphTargets.position=l}const c=t.morphNormals,u=c.length;let p;if(u>0){p=[];for(let t=0;t<u;t++)p[t]={name:c[t].name,data:[]};this.morphTargets.normal=p}const d=t.skinIndices,m=t.skinWeights,f=d.length===i.length,g=m.length===i.length;i.length>0&&0===e.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(let t=0;t<e.length;t++){const y=e[t];this.vertices.push(i[y.a],i[y.b],i[y.c]);const x=y.vertexNormals;if(3===x.length)this.normals.push(x[0],x[1],x[2]);else{const t=y.normal;this.normals.push(t,t,t)}const v=y.vertexColors;if(3===v.length)this.colors.push(v[0],v[1],v[2]);else{const t=y.color;this.colors.push(t,t,t)}if(!0===r){const e=n[0][t];void 0!==e?this.uvs.push(e[0],e[1],e[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",t),this.uvs.push(new s,new s,new s))}if(!0===o){const e=n[1][t];void 0!==e?this.uvs2.push(e[0],e[1],e[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",t),this.uvs2.push(new s,new s,new s))}for(let t=0;t<h;t++){const e=a[t].vertices;l[t].data.push(e[y.a],e[y.b],e[y.c])}for(let e=0;e<u;e++){const i=c[e].vertexNormals[t];p[e].data.push(i.a,i.b,i.c)}f&&this.skinIndices.push(d[y.a],d[y.b],d[y.c]),g&&this.skinWeights.push(m[y.a],m[y.b],m[y.c])}return this.computeGroups(t),this.verticesNeedUpdate=t.verticesNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this}}class xt{constructor(t=0,e=0,i=0,n=xt.DefaultOrder){Object.defineProperty(this,"isEuler",{value:!0}),this._x=t,this._y=e,this._z=i,this._order=n}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._order=n||this._order,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e,i){const r=n.clamp,s=t.elements,o=s[0],a=s[4],h=s[8],l=s[1],c=s[5],u=s[9],p=s[2],d=s[6],m=s[10];switch(e=e||this._order){case"XYZ":this._y=Math.asin(r(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(-u,m),this._z=Math.atan2(-a,o)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-r(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(h,m),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-p,o),this._z=0);break;case"ZXY":this._x=Math.asin(r(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-p,m),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,o));break;case"ZYX":this._y=Math.asin(-r(p,-1,1)),Math.abs(p)<.9999999?(this._x=Math.atan2(d,m),this._z=Math.atan2(l,o)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(r(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-p,o)):(this._x=0,this._y=Math.atan2(h,m));break;case"XZY":this._z=Math.asin(-r(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(h,o)):(this._x=Math.atan2(-u,m),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!1!==i&&this._onChangeCallback(),this}setFromQuaternion(t,e,i){return vt.makeRotationFromQuaternion(t),this.setFromRotationMatrix(vt,e,i)}setFromVector3(t,e){return this.set(t.x,t.y,t.z,e||this._order)}reorder(t){return bt.setFromEuler(this),this.setFromQuaternion(bt,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}toVector3(t){return t?t.set(this._x,this._y,this._z):new d(this._x,this._y,this._z)}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}xt.DefaultOrder="XYZ",xt.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];const vt=new k,bt=new p;class Mt{constructor(){this.mask=1}set(t){this.mask=1<<t|0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return 0!=(this.mask&t.mask)}}let wt=0;const _t=new d,St=new p,Tt=new k,Et=new d,At=new d,Lt=new d,Rt=new p,Pt=new d(1,0,0),Ct=new d(0,1,0),Ot=new d(0,0,1),zt={type:"added"},Nt={type:"removed"};function Bt(){Object.defineProperty(this,"id",{value:wt++}),this.uuid=n.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Bt.DefaultUp.clone();const t=new d,e=new xt,i=new p,r=new d(1,1,1);e._onChange((function(){i.setFromEuler(e,!1)})),i._onChange((function(){e.setFromQuaternion(i,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new k},normalMatrix:{value:new o}}),this.matrix=new k,this.matrixWorld=new k,this.matrixAutoUpdate=Bt.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new Mt,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}function Ft(t){if(0===t.length)return-1/0;let e=t[0];for(let i=1,n=t.length;i<n;++i)t[i]>e&&(e=t[i]);return e}Bt.DefaultUp=new d(0,1,0),Bt.DefaultMatrixAutoUpdate=!0,Bt.prototype=Object.assign(Object.create(r.prototype),{constructor:Bt,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix4:function(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(t){return this.quaternion.premultiply(t),this},setRotationFromAxisAngle:function(t,e){this.quaternion.setFromAxisAngle(t,e)},setRotationFromEuler:function(t){this.quaternion.setFromEuler(t,!0)},setRotationFromMatrix:function(t){this.quaternion.setFromRotationMatrix(t)},setRotationFromQuaternion:function(t){this.quaternion.copy(t)},rotateOnAxis:function(t,e){return St.setFromAxisAngle(t,e),this.quaternion.multiply(St),this},rotateOnWorldAxis:function(t,e){return St.setFromAxisAngle(t,e),this.quaternion.premultiply(St),this},rotateX:function(t){return this.rotateOnAxis(Pt,t)},rotateY:function(t){return this.rotateOnAxis(Ct,t)},rotateZ:function(t){return this.rotateOnAxis(Ot,t)},translateOnAxis:function(t,e){return _t.copy(t).applyQuaternion(this.quaternion),this.position.add(_t.multiplyScalar(e)),this},translateX:function(t){return this.translateOnAxis(Pt,t)},translateY:function(t){return this.translateOnAxis(Ct,t)},translateZ:function(t){return this.translateOnAxis(Ot,t)},localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:function(t){return t.applyMatrix4(Tt.copy(this.matrixWorld).invert())},lookAt:function(t,e,i){t.isVector3?Et.copy(t):Et.set(t,e,i);const n=this.parent;this.updateWorldMatrix(!0,!1),At.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Tt.lookAt(At,Et,this.up):Tt.lookAt(Et,At,this.up),this.quaternion.setFromRotationMatrix(Tt),n&&(Tt.extractRotation(n.matrixWorld),St.setFromRotationMatrix(Tt),this.quaternion.premultiply(St.invert()))},add:function(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(zt)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)},remove:function(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(Nt)),this},clear:function(){for(let t=0;t<this.children.length;t++){const e=this.children[t];e.parent=null,e.dispatchEvent(Nt)}return this.children.length=0,this},attach:function(t){return this.updateWorldMatrix(!0,!1),Tt.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),Tt.multiply(t.parent.matrixWorld)),t.applyMatrix4(Tt),t.updateWorldMatrix(!1,!1),this.add(t),this},getObjectById:function(t){return this.getObjectByProperty("id",t)},getObjectByName:function(t){return this.getObjectByProperty("name",t)},getObjectByProperty:function(t,e){if(this[t]===e)return this;for(let i=0,n=this.children.length;i<n;i++){const n=this.children[i].getObjectByProperty(t,e);if(void 0!==n)return n}},getWorldPosition:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),t=new d),this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),t=new p),this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(At,t,Lt),t},getWorldScale:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),t=new d),this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(At,Rt,t),t},getWorldDirection:function(t){void 0===t&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),t=new d),this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()},raycast:function(){},traverse:function(t){t(this);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverse(t)},traverseVisible:function(t){if(!1===this.visible)return;t(this);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverseVisible(t)},traverseAncestors:function(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].updateMatrixWorld(t)},updateWorldMatrix:function(t,e){const i=this.parent;if(!0===t&&null!==i&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===e){const t=this.children;for(let e=0,i=t.length;e<i;e++)t[e].updateWorldMatrix(!1,!0)}},toJSON:function(t){const e=void 0===t||"string"==typeof t,i={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{}},i.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const n={};function r(e,i){return void 0===e[i.uuid]&&(e[i.uuid]=i.toJSON(t)),i.uuid}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),!0===this.castShadow&&(n.castShadow=!0),!0===this.receiveShadow&&(n.receiveShadow=!0),!1===this.visible&&(n.visible=!1),!1===this.frustumCulled&&(n.frustumCulled=!1),0!==this.renderOrder&&(n.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(n.matrixAutoUpdate=!1),this.isInstancedMesh&&(n.type="InstancedMesh",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON()),this.isMesh||this.isLine||this.isPoints){n.geometry=r(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const i=e.shapes;if(Array.isArray(i))for(let e=0,n=i.length;e<n;e++){const n=i[e];r(t.shapes,n)}else r(t.shapes,i)}}if(this.isSkinnedMesh&&(n.bindMode=this.bindMode,n.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(t.skeletons,this.skeleton),n.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let i=0,n=this.material.length;i<n;i++)e.push(r(t.materials,this.material[i]));n.material=e}else n.material=r(t.materials,this.material);if(this.children.length>0){n.children=[];for(let e=0;e<this.children.length;e++)n.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){n.animations=[];for(let e=0;e<this.animations.length;e++){const i=this.animations[e];n.animations.push(r(t.animations,i))}}if(e){const e=s(t.geometries),n=s(t.materials),r=s(t.textures),o=s(t.images),a=s(t.shapes),h=s(t.skeletons),l=s(t.animations);e.length>0&&(i.geometries=e),n.length>0&&(i.materials=n),r.length>0&&(i.textures=r),o.length>0&&(i.images=o),a.length>0&&(i.shapes=a),h.length>0&&(i.skeletons=h),l.length>0&&(i.animations=l)}return i.object=n,i;function s(t){const e=[];for(const i in t){const n=t[i];delete n.metadata,e.push(n)}return e}},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e<t.children.length;e++){const i=t.children[e];this.add(i.clone())}return this}});let Dt=1;const Gt=new k,It=new Bt,kt=new d,Ut=new g,Vt=new g,Wt=new d;function jt(){Object.defineProperty(this,"id",{value:Dt+=2}),this.uuid=n.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}jt.prototype=Object.assign(Object.create(r.prototype),{constructor:jt,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(t){return Array.isArray(t)?this.index=new(Ft(t)>65535?dt:ut)(t,1):this.index=t,this},getAttribute:function(t){return this.attributes[t]},setAttribute:function(t,e){return this.attributes[t]=e,this},deleteAttribute:function(t){return delete this.attributes[t],this},hasAttribute:function(t){return void 0!==this.attributes[t]},addGroup:function(t,e,i=0){this.groups.push({start:t,count:e,materialIndex:i})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix4:function(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const i=this.attributes.normal;if(void 0!==i){const e=(new o).getNormalMatrix(t);i.applyNormalMatrix(e),i.needsUpdate=!0}const n=this.attributes.tangent;return void 0!==n&&(n.transformDirection(t),n.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(t){return Gt.makeRotationX(t),this.applyMatrix4(Gt),this},rotateY:function(t){return Gt.makeRotationY(t),this.applyMatrix4(Gt),this},rotateZ:function(t){return Gt.makeRotationZ(t),this.applyMatrix4(Gt),this},translate:function(t,e,i){return Gt.makeTranslation(t,e,i),this.applyMatrix4(Gt),this},scale:function(t,e,i){return Gt.makeScale(t,e,i),this.applyMatrix4(Gt),this},lookAt:function(t){return It.lookAt(t),It.updateMatrix(),this.applyMatrix4(It.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(kt).negate(),this.translate(kt.x,kt.y,kt.z),this},setFromObject:function(t){const e=t.geometry;if(t.isPoints||t.isLine){const t=new ft(3*e.vertices.length,3),i=new ft(3*e.colors.length,3);if(this.setAttribute("position",t.copyVector3sArray(e.vertices)),this.setAttribute("color",i.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length){const t=new ft(e.lineDistances.length,1);this.setAttribute("lineDistance",t.copyArray(e.lineDistances))}null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone())}else t.isMesh&&e&&e.isGeometry&&this.fromGeometry(e);return this},setFromPoints:function(t){const e=[];for(let i=0,n=t.length;i<n;i++){const n=t[i];e.push(n.x,n.y,n.z||0)}return this.setAttribute("position",new ft(e,3)),this},updateFromObject:function(t){let e=t.geometry;if(t.isMesh){let t=e.__directGeometry;if(!0===e.elementsNeedUpdate&&(t=void 0,e.elementsNeedUpdate=!1),void 0===t)return this.fromGeometry(e);t.verticesNeedUpdate=e.verticesNeedUpdate,t.normalsNeedUpdate=e.normalsNeedUpdate,t.colorsNeedUpdate=e.colorsNeedUpdate,t.uvsNeedUpdate=e.uvsNeedUpdate,t.groupsNeedUpdate=e.groupsNeedUpdate,e.verticesNeedUpdate=!1,e.normalsNeedUpdate=!1,e.colorsNeedUpdate=!1,e.uvsNeedUpdate=!1,e.groupsNeedUpdate=!1,e=t}if(!0===e.verticesNeedUpdate){const t=this.attributes.position;void 0!==t&&(t.copyVector3sArray(e.vertices),t.needsUpdate=!0),e.verticesNeedUpdate=!1}if(!0===e.normalsNeedUpdate){const t=this.attributes.normal;void 0!==t&&(t.copyVector3sArray(e.normals),t.needsUpdate=!0),e.normalsNeedUpdate=!1}if(!0===e.colorsNeedUpdate){const t=this.attributes.color;void 0!==t&&(t.copyColorsArray(e.colors),t.needsUpdate=!0),e.colorsNeedUpdate=!1}if(e.uvsNeedUpdate){const t=this.attributes.uv;void 0!==t&&(t.copyVector2sArray(e.uvs),t.needsUpdate=!0),e.uvsNeedUpdate=!1}if(e.lineDistancesNeedUpdate){const t=this.attributes.lineDistance;void 0!==t&&(t.copyArray(e.lineDistances),t.needsUpdate=!0),e.lineDistancesNeedUpdate=!1}return e.groupsNeedUpdate&&(e.computeGroups(t.geometry),this.groups=e.groups,e.groupsNeedUpdate=!1),this},fromGeometry:function(t){return t.__directGeometry=(new yt).fromGeometry(t),this.fromDirectGeometry(t.__directGeometry)},fromDirectGeometry:function(t){const e=new Float32Array(3*t.vertices.length);if(this.setAttribute("position",new ot(e,3).copyVector3sArray(t.vertices)),t.normals.length>0){const e=new Float32Array(3*t.normals.length);this.setAttribute("normal",new ot(e,3).copyVector3sArray(t.normals))}if(t.colors.length>0){const e=new Float32Array(3*t.colors.length);this.setAttribute("color",new ot(e,3).copyColorsArray(t.colors))}if(t.uvs.length>0){const e=new Float32Array(2*t.uvs.length);this.setAttribute("uv",new ot(e,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){const e=new Float32Array(2*t.uvs2.length);this.setAttribute("uv2",new ot(e,2).copyVector2sArray(t.uvs2))}this.groups=t.groups;for(const e in t.morphTargets){const i=[],n=t.morphTargets[e];for(let t=0,e=n.length;t<e;t++){const e=n[t],r=new ft(3*e.data.length,3);r.name=e.name,i.push(r.copyVector3sArray(e.data))}this.morphAttributes[e]=i}if(t.skinIndices.length>0){const e=new ft(4*t.skinIndices.length,4);this.setAttribute("skinIndex",e.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){const e=new ft(4*t.skinWeights.length,4);this.setAttribute("skinWeight",e.copyVector4sArray(t.skinWeights))}return null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new g);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.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 d(-1/0,-1/0,-1/0),new d(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const i=e[t];Ut.setFromBufferAttribute(i),this.morphTargetsRelative?(Wt.addVectors(this.boundingBox.min,Ut.min),this.boundingBox.expandByPoint(Wt),Wt.addVectors(this.boundingBox.max,Ut.max),this.boundingBox.expandByPoint(Wt)):(this.boundingBox.expandByPoint(Ut.min),this.boundingBox.expandByPoint(Ut.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)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new O);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.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 d,1/0);if(t){const i=this.boundingSphere.center;if(Ut.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const i=e[t];Vt.setFromBufferAttribute(i),this.morphTargetsRelative?(Wt.addVectors(Ut.min,Vt.min),Ut.expandByPoint(Wt),Wt.addVectors(Ut.max,Vt.max),Ut.expandByPoint(Wt)):(Ut.expandByPoint(Vt.min),Ut.expandByPoint(Vt.max))}Ut.getCenter(i);let n=0;for(let e=0,r=t.count;e<r;e++)Wt.fromBufferAttribute(t,e),n=Math.max(n,i.distanceToSquared(Wt));if(e)for(let r=0,s=e.length;r<s;r++){const s=e[r],o=this.morphTargetsRelative;for(let e=0,r=s.count;e<r;e++)Wt.fromBufferAttribute(s,e),o&&(kt.fromBufferAttribute(t,e),Wt.add(kt)),n=Math.max(n,i.distanceToSquared(Wt))}this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}},computeFaceNormals:function(){},computeVertexNormals:function(){const t=this.index,e=this.getAttribute("position");if(void 0!==e){let i=this.getAttribute("normal");if(void 0===i)i=new ot(new Float32Array(3*e.count),3),this.setAttribute("normal",i);else for(let t=0,e=i.count;t<e;t++)i.setXYZ(t,0,0,0);const n=new d,r=new d,s=new d,o=new d,a=new d,h=new d,l=new d,c=new d;if(t)for(let u=0,p=t.count;u<p;u+=3){const p=t.getX(u+0),d=t.getX(u+1),m=t.getX(u+2);n.fromBufferAttribute(e,p),r.fromBufferAttribute(e,d),s.fromBufferAttribute(e,m),l.subVectors(s,r),c.subVectors(n,r),l.cross(c),o.fromBufferAttribute(i,p),a.fromBufferAttribute(i,d),h.fromBufferAttribute(i,m),o.add(l),a.add(l),h.add(l),i.setXYZ(p,o.x,o.y,o.z),i.setXYZ(d,a.x,a.y,a.z),i.setXYZ(m,h.x,h.y,h.z)}else for(let t=0,o=e.count;t<o;t+=3)n.fromBufferAttribute(e,t+0),r.fromBufferAttribute(e,t+1),s.fromBufferAttribute(e,t+2),l.subVectors(s,r),c.subVectors(n,r),l.cross(c),i.setXYZ(t+0,l.x,l.y,l.z),i.setXYZ(t+1,l.x,l.y,l.z),i.setXYZ(t+2,l.x,l.y,l.z);this.normalizeNormals(),i.needsUpdate=!0}},merge:function(t,e){if(!t||!t.isBufferGeometry)return void console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t);void 0===e&&(e=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));const i=this.attributes;for(const n in i){if(void 0===t.attributes[n])continue;const r=i[n].array,s=t.attributes[n],o=s.array,a=s.itemSize*e,h=Math.min(o.length,r.length-a);for(let t=0,e=a;t<h;t++,e++)r[e]=o[t]}return this},normalizeNormals:function(){const t=this.attributes.normal;for(let e=0,i=t.count;e<i;e++)Wt.fromBufferAttribute(t,e),Wt.normalize(),t.setXYZ(e,Wt.x,Wt.y,Wt.z)},toNonIndexed:function(){function t(t,e){const i=t.array,n=t.itemSize,r=t.normalized,s=new i.constructor(e.length*n);let o=0,a=0;for(let t=0,r=e.length;t<r;t++){o=e[t]*n;for(let t=0;t<n;t++)s[a++]=i[o++]}return new ot(s,n,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;const e=new jt,i=this.index.array,n=this.attributes;for(const r in n){const s=t(n[r],i);e.setAttribute(r,s)}const r=this.morphAttributes;for(const n in r){const s=[],o=r[n];for(let e=0,n=o.length;e<n;e++){const n=t(o[e],i);s.push(n)}e.morphAttributes[n]=s}e.morphTargetsRelative=this.morphTargetsRelative;const s=this.groups;for(let t=0,i=s.length;t<i;t++){const i=s[t];e.addGroup(i.start,i.count,i.materialIndex)}return e},toJSON:function(){const t={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const i in e)void 0!==e[i]&&(t[i]=e[i]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const i=this.attributes;for(const e in i){const n=i[e],r=n.toJSON(t.data);""!==n.name&&(r.name=n.name),t.data.attributes[e]=r}const n={};let r=!1;for(const e in this.morphAttributes){const i=this.morphAttributes[e],s=[];for(let e=0,n=i.length;e<n;e++){const n=i[e],r=n.toJSON(t.data);""!==n.name&&(r.name=n.name),s.push(r)}s.length>0&&(n[e]=s,r=!0)}r&&(t.data.morphAttributes=n,t.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));const o=this.boundingSphere;return null!==o&&(t.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),t},clone:function(){return(new jt).copy(this)},copy:function(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const i=t.index;null!==i&&this.setIndex(i.clone(e));const n=t.attributes;for(const t in n){const i=n[t];this.setAttribute(t,i.clone(e))}const r=t.morphAttributes;for(const t in r){const i=[],n=r[t];for(let t=0,r=n.length;t<r;t++)i.push(n[t].clone(e));this.morphAttributes[t]=i}this.morphTargetsRelative=t.morphTargetsRelative;const s=t.groups;for(let t=0,e=s.length;t<e;t++){const e=s[t];this.addGroup(e.start,e.count,e.materialIndex)}const o=t.boundingBox;null!==o&&(this.boundingBox=o.clone());const a=t.boundingSphere;return null!==a&&(this.boundingSphere=a.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});class Ht extends jt{constructor(t=1,e=1,i=1,n=1,r=1,s=1){super(),this.type="BoxBufferGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:n,heightSegments:r,depthSegments:s};const o=this;n=Math.floor(n),r=Math.floor(r),s=Math.floor(s);const a=[],h=[],l=[],c=[];let u=0,p=0;function m(t,e,i,n,r,s,m,f,g,y,x){const v=s/g,b=m/y,M=s/2,w=m/2,_=f/2,S=g+1,T=y+1;let E=0,A=0;const L=new d;for(let s=0;s<T;s++){const o=s*b-w;for(let a=0;a<S;a++){const u=a*v-M;L[t]=u*n,L[e]=o*r,L[i]=_,h.push(L.x,L.y,L.z),L[t]=0,L[e]=0,L[i]=f>0?1:-1,l.push(L.x,L.y,L.z),c.push(a/g),c.push(1-s/y),E+=1}}for(let t=0;t<y;t++)for(let e=0;e<g;e++){const i=u+e+S*t,n=u+e+S*(t+1),r=u+(e+1)+S*(t+1),s=u+(e+1)+S*t;a.push(i,n,s),a.push(n,r,s),A+=6}o.addGroup(p,A,x),p+=A,u+=E}m("z","y","x",-1,-1,i,e,t,s,r,0),m("z","y","x",1,-1,i,e,-t,s,r,1),m("x","z","y",1,1,t,i,e,n,s,2),m("x","z","y",1,-1,t,i,-e,n,s,3),m("x","y","z",1,-1,t,e,i,n,r,4),m("x","y","z",-1,-1,t,e,-i,n,r,5),this.setIndex(a),this.setAttribute("position",new ft(h,3)),this.setAttribute("normal",new ft(l,3)),this.setAttribute("uv",new ft(c,2))}}class qt extends jt{constructor(t=1,e=1,i=1,n=1){super(),this.type="PlaneBufferGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:n};const r=t/2,s=e/2,o=Math.floor(i),a=Math.floor(n),h=o+1,l=a+1,c=t/o,u=e/a,p=[],d=[],m=[],f=[];for(let t=0;t<l;t++){const e=t*u-s;for(let i=0;i<h;i++){const n=i*c-r;d.push(n,-e,0),m.push(0,0,1),f.push(i/o),f.push(1-t/a)}}for(let t=0;t<a;t++)for(let e=0;e<o;e++){const i=e+h*t,n=e+h*(t+1),r=e+1+h*(t+1),s=e+1+h*t;p.push(i,n,s),p.push(n,r,s)}this.setIndex(p),this.setAttribute("position",new ft(d,3)),this.setAttribute("normal",new ft(m,3)),this.setAttribute("uv",new ft(f,2))}}let Xt=0;function Jt(){Object.defineProperty(this,"id",{value:Xt++}),this.uuid=n.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.blending=1,this.side=0,this.flatShading=!1,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}function Yt(t){const e={};for(const i in t){e[i]={};for(const n in t[i]){const r=t[i][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture)?e[i][n]=r.clone():Array.isArray(r)?e[i][n]=r.slice():e[i][n]=r}}return e}function Zt(t){const e={};for(let i=0;i<t.length;i++){const n=Yt(t[i]);for(const t in n)e[t]=n[t]}return e}Jt.prototype=Object.assign(Object.create(r.prototype),{constructor:Jt,isMaterial:!0,onBeforeCompile:function(){},customProgramCacheKey:function(){return this.onBeforeCompile.toString()},setValues:function(t){if(void 0!==t)for(const e in t){const i=t[e];if(void 0===i){console.warn("THREE.Material: '"+e+"' parameter is undefined.");continue}if("shading"===e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===i;continue}const n=this[e];void 0!==n?n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[e]=i:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}},toJSON:function(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function n(t){const e=[];for(const i in t){const n=t[i];delete n.metadata,e.push(n)}return e}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(i.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(t).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,i.reflectivity=this.reflectivity,i.refractionRatio=this.refractionRatio,void 0!==this.combine&&(i.combine=this.combine),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.size&&(i.size=this.size),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(i.blending=this.blending),!0===this.flatShading&&(i.flatShading=this.flatShading),0!==this.side&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(i.morphTargets=!0),!0===this.morphNormals&&(i.morphNormals=!0),!0===this.skinning&&(i.skinning=!0),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),e){const e=n(t.textures),r=n(t.images);e.length>0&&(i.textures=e),r.length>0&&(i.images=r)}return i},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.blending=t.blending,this.side=t.side,this.flatShading=t.flatShading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let i=null;if(null!==e){const t=e.length;i=new Array(t);for(let n=0;n!==t;++n)i[n]=e[n].clone()}return this.clippingPlanes=i,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(Jt.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}});const Qt={clone:Yt,merge:Zt};var Kt=_rsl.default_vertex,$t=_rsl.default_fragment;function te(t){Jt.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader=Kt,this.fragmentShader=$t,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}te.prototype=Object.create(Jt.prototype),te.prototype.constructor=te,te.prototype.isShaderMaterial=!0,te.prototype.copy=function(t){return Jt.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Yt(t.uniforms),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this},te.prototype.toJSON=function(t){const e=Jt.prototype.toJSON.call(this,t);e.glslVersion=this.glslVersion,e.uniforms={};for(const i in this.uniforms){const n=this.uniforms[i].value;n&&n.isTexture?e.uniforms[i]={type:"t",value:n.toJSON(t).uuid}:n&&n.isColor?e.uniforms[i]={type:"c",value:n.getHex()}:n&&n.isVector2?e.uniforms[i]={type:"v2",value:n.toArray()}:n&&n.isVector3?e.uniforms[i]={type:"v3",value:n.toArray()}:n&&n.isVector4?e.uniforms[i]={type:"v4",value:n.toArray()}:n&&n.isMatrix3?e.uniforms[i]={type:"m3",value:n.toArray()}:n&&n.isMatrix4?e.uniforms[i]={type:"m4",value:n.toArray()}:e.uniforms[i]={value:n}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;const i={};for(const t in this.extensions)!0===this.extensions[t]&&(i[t]=!0);return Object.keys(i).length>0&&(e.extensions=i),e};const ee=new d,ie=new d,ne=new d,re=new d,se=new d,oe=new d,ae=new d;class he{constructor(t,e){this.origin=void 0!==t?t:new d,this.direction=void 0!==e?e:new d(0,0,-1)}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return void 0===e&&(console.warn("THREE.Ray: .at() target is now required"),e=new d),e.copy(this.direction).multiplyScalar(t).add(this.origin)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,ee)),this}closestPointToPoint(t,e){void 0===e&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),e=new d),e.subVectors(t,this.origin);const i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(i).add(this.origin)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=ee.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(ee.copy(this.direction).multiplyScalar(e).add(this.origin),ee.distanceToSquared(t))}distanceSqToSegment(t,e,i,n){ie.copy(t).add(e).multiplyScalar(.5),ne.copy(e).sub(t).normalize(),re.copy(this.origin).sub(ie);const r=.5*t.distanceTo(e),s=-this.direction.dot(ne),o=re.dot(this.direction),a=-re.dot(ne),h=re.lengthSq(),l=Math.abs(1-s*s);let c,u,p,d;if(l>0)if(c=s*a-o,u=s*o-a,d=r*l,c>=0)if(u>=-d)if(u<=d){const t=1/l;c*=t,u*=t,p=c*(c+s*u+2*o)+u*(s*c+u+2*a)+h}else u=r,c=Math.max(0,-(s*u+o)),p=-c*c+u*(u+2*a)+h;else u=-r,c=Math.max(0,-(s*u+o)),p=-c*c+u*(u+2*a)+h;else u<=-d?(c=Math.max(0,-(-s*r+o)),u=c>0?-r:Math.min(Math.max(-r,-a),r),p=-c*c+u*(u+2*a)+h):u<=d?(c=0,u=Math.min(Math.max(-r,-a),r),p=u*(u+2*a)+h):(c=Math.max(0,-(s*r+o)),u=c>0?r:Math.min(Math.max(-r,-a),r),p=-c*c+u*(u+2*a)+h);else u=s>0?-r:r,c=Math.max(0,-(s*u+o)),p=-c*c+u*(u+2*a)+h;return i&&i.copy(this.direction).multiplyScalar(c).add(this.origin),n&&n.copy(ne).multiplyScalar(u).add(ie),p}intersectSphere(t,e){ee.subVectors(t.center,this.origin);const i=ee.dot(this.direction),n=ee.dot(ee)-i*i,r=t.radius*t.radius;if(n>r)return null;const s=Math.sqrt(r-n),o=i-s,a=i+s;return o<0&&a<0?null:o<0?this.at(a,e):this.at(o,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null}intersectPlane(t,e){const i=this.distanceToPlane(t);return null===i?null:this.at(i,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let i,n,r,s,o,a;const h=1/this.direction.x,l=1/this.direction.y,c=1/this.direction.z,u=this.origin;return h>=0?(i=(t.min.x-u.x)*h,n=(t.max.x-u.x)*h):(i=(t.max.x-u.x)*h,n=(t.min.x-u.x)*h),l>=0?(r=(t.min.y-u.y)*l,s=(t.max.y-u.y)*l):(r=(t.max.y-u.y)*l,s=(t.min.y-u.y)*l),i>s||r>n?null:((r>i||i!=i)&&(i=r),(s<n||n!=n)&&(n=s),c>=0?(o=(t.min.z-u.z)*c,a=(t.max.z-u.z)*c):(o=(t.max.z-u.z)*c,a=(t.min.z-u.z)*c),i>a||o>n?null:((o>i||i!=i)&&(i=o),(a<n||n!=n)&&(n=a),n<0?null:this.at(i>=0?i:n,e)))}intersectsBox(t){return null!==this.intersectBox(t,ee)}intersectTriangle(t,e,i,n,r){se.subVectors(e,t),oe.subVectors(i,t),ae.crossVectors(se,oe);let s,o=this.direction.dot(ae);if(o>0){if(n)return null;s=1}else{if(!(o<0))return null;s=-1,o=-o}re.subVectors(this.origin,t);const a=s*this.direction.dot(oe.crossVectors(re,oe));if(a<0)return null;const h=s*this.direction.dot(se.cross(re));if(h<0)return null;if(a+h>o)return null;const l=-s*re.dot(ae);return l<0?null:this.at(l/o,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}}const le=new d,ce=new d,ue=new d,pe=new d,de=new d,me=new d,fe=new d,ge=new d,ye=new d,xe=new d;class ve{constructor(t,e,i){this.a=void 0!==t?t:new d,this.b=void 0!==e?e:new d,this.c=void 0!==i?i:new d}static getNormal(t,e,i,n){void 0===n&&(console.warn("THREE.Triangle: .getNormal() target is now required"),n=new d),n.subVectors(i,e),le.subVectors(t,e),n.cross(le);const r=n.lengthSq();return r>0?n.multiplyScalar(1/Math.sqrt(r)):n.set(0,0,0)}static getBarycoord(t,e,i,n,r){le.subVectors(n,e),ce.subVectors(i,e),ue.subVectors(t,e);const s=le.dot(le),o=le.dot(ce),a=le.dot(ue),h=ce.dot(ce),l=ce.dot(ue),c=s*h-o*o;if(void 0===r&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),r=new d),0===c)return r.set(-2,-1,-1);const u=1/c,p=(h*a-o*l)*u,m=(s*l-o*a)*u;return r.set(1-p-m,m,p)}static containsPoint(t,e,i,n){return this.getBarycoord(t,e,i,n,pe),pe.x>=0&&pe.y>=0&&pe.x+pe.y<=1}static getUV(t,e,i,n,r,s,o,a){return this.getBarycoord(t,e,i,n,pe),a.set(0,0),a.addScaledVector(r,pe.x),a.addScaledVector(s,pe.y),a.addScaledVector(o,pe.z),a}static isFrontFacing(t,e,i,n){return le.subVectors(i,e),ce.subVectors(t,e),le.cross(ce).dot(n)<0}set(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this}setFromPointsAndIndices(t,e,i,n){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[n]),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return le.subVectors(this.c,this.b),ce.subVectors(this.a,this.b),.5*le.cross(ce).length()}getMidpoint(t){return void 0===t&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),t=new d),t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return ve.getNormal(this.a,this.b,this.c,t)}getPlane(t){return void 0===t&&(console.warn("THREE.Triangle: .getPlane() target is now required"),t=new F),t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return ve.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,i,n,r){return ve.getUV(t,this.a,this.b,this.c,e,i,n,r)}containsPoint(t){return ve.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return ve.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){void 0===e&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),e=new d);const i=this.a,n=this.b,r=this.c;let s,o;de.subVectors(n,i),me.subVectors(r,i),ge.subVectors(t,i);const a=de.dot(ge),h=me.dot(ge);if(a<=0&&h<=0)return e.copy(i);ye.subVectors(t,n);const l=de.dot(ye),c=me.dot(ye);if(l>=0&&c<=l)return e.copy(n);const u=a*c-l*h;if(u<=0&&a>=0&&l<=0)return s=a/(a-l),e.copy(i).addScaledVector(de,s);xe.subVectors(t,r);const p=de.dot(xe),m=me.dot(xe);if(m>=0&&p<=m)return e.copy(r);const f=p*h-a*m;if(f<=0&&h>=0&&m<=0)return o=h/(h-m),e.copy(i).addScaledVector(me,o);const g=l*m-p*c;if(g<=0&&c-l>=0&&p-m>=0)return fe.subVectors(r,n),o=(c-l)/(c-l+(p-m)),e.copy(n).addScaledVector(fe,o);const y=1/(g+f+u);return s=f*y,o=u*y,e.copy(i).addScaledVector(de,s).addScaledVector(me,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}class be{constructor(t,e,i,n,r,s=0){this.a=t,this.b=e,this.c=i,this.normal=n&&n.isVector3?n:new d,this.vertexNormals=Array.isArray(n)?n:[],this.color=r&&r.isColor?r:new et,this.vertexColors=Array.isArray(r)?r:[],this.materialIndex=s}clone(){return(new this.constructor).copy(this)}copy(t){this.a=t.a,this.b=t.b,this.c=t.c,this.normal.copy(t.normal),this.color.copy(t.color),this.materialIndex=t.materialIndex;for(let e=0,i=t.vertexNormals.length;e<i;e++)this.vertexNormals[e]=t.vertexNormals[e].clone();for(let e=0,i=t.vertexColors.length;e<i;e++)this.vertexColors[e]=t.vertexColors[e].clone();return this}}function Me(t){Jt.call(this),this.type="MeshBasicMaterial",this.color=new et(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.setValues(t)}Me.prototype=Object.create(Jt.prototype),Me.prototype.constructor=Me,Me.prototype.isMeshBasicMaterial=!0,Me.prototype.copy=function(t){return Jt.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this};const we=new k,_e=new he,Se=new O,Te=new d,Ee=new d,Ae=new d,Le=new d,Re=new d,Pe=new d,Ce=new d,Oe=new d,ze=new d,Ne=new s,Be=new s,Fe=new s,De=new d,Ge=new d;function Ie(t=new jt,e=new Me){Bt.call(this),this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}function ke(t,e,i,n,r,s,o,a){let h;if(h=1===e.side?n.intersectTriangle(o,s,r,!0,a):n.intersectTriangle(r,s,o,2!==e.side,a),null===h)return null;Ge.copy(a),Ge.applyMatrix4(t.matrixWorld);const l=i.ray.origin.distanceTo(Ge);return l<i.near||l>i.far?null:{distance:l,point:Ge.clone(),object:t}}function Ue(t,e,i,n,r,o,a,h,l,c,u,p){Te.fromBufferAttribute(r,c),Ee.fromBufferAttribute(r,u),Ae.fromBufferAttribute(r,p);const d=t.morphTargetInfluences;if(e.morphTargets&&o&&d){Ce.set(0,0,0),Oe.set(0,0,0),ze.set(0,0,0);for(let t=0,e=o.length;t<e;t++){const e=d[t],i=o[t];0!==e&&(Le.fromBufferAttribute(i,c),Re.fromBufferAttribute(i,u),Pe.fromBufferAttribute(i,p),a?(Ce.addScaledVector(Le,e),Oe.addScaledVector(Re,e),ze.addScaledVector(Pe,e)):(Ce.addScaledVector(Le.sub(Te),e),Oe.addScaledVector(Re.sub(Ee),e),ze.addScaledVector(Pe.sub(Ae),e)))}Te.add(Ce),Ee.add(Oe),Ae.add(ze)}t.isSkinnedMesh&&(t.boneTransform(c,Te),t.boneTransform(u,Ee),t.boneTransform(p,Ae));const m=ke(t,e,i,n,Te,Ee,Ae,De);if(m){h&&(Ne.fromBufferAttribute(h,c),Be.fromBufferAttribute(h,u),Fe.fromBufferAttribute(h,p),m.uv=ve.getUV(De,Te,Ee,Ae,Ne,Be,Fe,new s)),l&&(Ne.fromBufferAttribute(l,c),Be.fromBufferAttribute(l,u),Fe.fromBufferAttribute(l,p),m.uv2=ve.getUV(De,Te,Ee,Ae,Ne,Be,Fe,new s));const t=new be(c,u,p);ve.getNormal(Te,Ee,Ae,t.normal),m.face=t}return m}Ie.prototype=Object.assign(Object.create(Bt.prototype),{constructor:Ie,isMesh:!0,copy:function(t){return Bt.prototype.copy.call(this,t),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=t.material,this.geometry=t.geometry,this},updateMorphTargets:function(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,i=Object.keys(e);if(i.length>0){const t=e[i[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,i=t.length;e<i;e++){const i=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(t,e){const i=this.geometry,n=this.material,r=this.matrixWorld;if(void 0===n)return;if(null===i.boundingSphere&&i.computeBoundingSphere(),Se.copy(i.boundingSphere),Se.applyMatrix4(r),!1===t.ray.intersectsSphere(Se))return;if(we.copy(r).invert(),_e.copy(t.ray).applyMatrix4(we),null!==i.boundingBox&&!1===_e.intersectsBox(i.boundingBox))return;let o;if(i.isBufferGeometry){const r=i.index,s=i.attributes.position,a=i.morphAttributes.position,h=i.morphTargetsRelative,l=i.attributes.uv,c=i.attributes.uv2,u=i.groups,p=i.drawRange;if(null!==r)if(Array.isArray(n))for(let i=0,d=u.length;i<d;i++){const d=u[i],m=n[d.materialIndex];for(let i=Math.max(d.start,p.start),n=Math.min(d.start+d.count,p.start+p.count);i<n;i+=3){const n=r.getX(i),u=r.getX(i+1),p=r.getX(i+2);o=Ue(this,m,t,_e,s,a,h,l,c,n,u,p),o&&(o.faceIndex=Math.floor(i/3),o.face.materialIndex=d.materialIndex,e.push(o))}}else for(let i=Math.max(0,p.start),u=Math.min(r.count,p.start+p.count);i<u;i+=3){const u=r.getX(i),p=r.getX(i+1),d=r.getX(i+2);o=Ue(this,n,t,_e,s,a,h,l,c,u,p,d),o&&(o.faceIndex=Math.floor(i/3),e.push(o))}else if(void 0!==s)if(Array.isArray(n))for(let i=0,r=u.length;i<r;i++){const r=u[i],d=n[r.materialIndex];for(let i=Math.max(r.start,p.start),n=Math.min(r.start+r.count,p.start+p.count);i<n;i+=3)o=Ue(this,d,t,_e,s,a,h,l,c,i,i+1,i+2),o&&(o.faceIndex=Math.floor(i/3),o.face.materialIndex=r.materialIndex,e.push(o))}else for(let i=Math.max(0,p.start),r=Math.min(s.count,p.start+p.count);i<r;i+=3)o=Ue(this,n,t,_e,s,a,h,l,c,i,i+1,i+2),o&&(o.faceIndex=Math.floor(i/3),e.push(o))}else if(i.isGeometry){const r=Array.isArray(n),a=i.vertices,h=i.faces;let l;const c=i.faceVertexUvs[0];c.length>0&&(l=c);for(let i=0,c=h.length;i<c;i++){const c=h[i],u=r?n[c.materialIndex]:n;if(void 0===u)continue;const p=a[c.a],d=a[c.b],m=a[c.c];if(o=ke(this,u,t,_e,p,d,m,De),o){if(l&&l[i]){const t=l[i];Ne.copy(t[0]),Be.copy(t[1]),Fe.copy(t[2]),o.uv=ve.getUV(De,p,d,m,Ne,Be,Fe,new s)}o.face=c,o.faceIndex=i,e.push(o)}}}}});var Ve=_rsl.alphamap_fragment,We=_rsl.alphamap_pars_fragment,je=_rsl.alphatest_fragment,He=_rsl.aomap_fragment,qe=_rsl.aomap_pars_fragment,Xe=_rsl.apply_accumulative_buffers_fragment,Je=_rsl.apply_accumulative_buffers_pars_fragment,Ye=_rsl.begin_vertex,Ze=_rsl.beginnormal_vertex,Qe=_rsl.bsdfs,Ke=_rsl.bumpmap_pars_fragment,$e=_rsl.clipping_planes_fragment,ti=_rsl.clipping_planes_pars_fragment,ei=_rsl.clipping_planes_pars_vertex,ii=_rsl.clipping_planes_vertex,ni=_rsl.color_fragment,ri=_rsl.color_pars_fragment,si=_rsl.color_pars_vertex,oi=_rsl.color_vertex,ai=_rsl.common,hi=_rsl.cube_uv_reflection_fragment,li=_rsl.defaultnormal_vertex,ci=_rsl.displacementmap_pars_vertex,ui=_rsl.displacementmap_vertex,pi=_rsl.emissivemap_fragment,di=_rsl.emissivemap_pars_fragment,mi=_rsl.encodings_fragment,fi=_rsl.encodings_pars_fragment,gi=_rsl.envmap_fragment,yi=_rsl.envmap_common_pars_fragment,xi=_rsl.envmap_pars_fragment,vi=_rsl.envmap_pars_vertex,bi=_rsl.envmap_vertex,Mi=_rsl.fog_vertex,wi=_rsl.fog_pars_vertex,_i=_rsl.fog_fragment,Si=_rsl.fog_pars_fragment,Ti=_rsl.gradientmap_pars_fragment,Ei=_rsl.lightmap_fragment,Ai=_rsl.lightmap_pars_fragment,Li=_rsl.lights_lambert_vertex,Ri=_rsl.lights_pars_begin;const Pi={alphamap_fragment:Ve,alphamap_pars_fragment:We,alphatest_fragment:je,aomap_fragment:He,aomap_pars_fragment:qe,apply_accumulative_buffers_fragment:Xe,apply_accumulative_buffers_pars_fragment:Je,begin_vertex:Ye,beginnormal_vertex:Ze,bsdfs:Qe,bumpmap_pars_fragment:Ke,clipping_planes_fragment:$e,clipping_planes_pars_fragment:ti,clipping_planes_pars_vertex:ei,clipping_planes_vertex:ii,color_fragment:ni,color_pars_fragment:ri,color_pars_vertex:si,color_vertex:oi,common:ai,cube_uv_reflection_fragment:hi,defaultnormal_vertex:li,displacementmap_pars_vertex:ci,displacementmap_vertex:ui,emissivemap_fragment:pi,emissivemap_pars_fragment:di,encodings_fragment:mi,encodings_pars_fragment:fi,envmap_fragment:gi,envmap_common_pars_fragment:yi,envmap_pars_fragment:xi,envmap_pars_vertex:vi,envmap_physical_pars_fragment:_rsl.envmap_physical_pars_fragment,envmap_vertex:bi,fog_vertex:Mi,fog_pars_vertex:wi,fog_fragment:_i,fog_pars_fragment:Si,gradientmap_pars_fragment:Ti,lightmap_fragment:Ei,lightmap_pars_fragment:Ai,lights_lambert_vertex:Li,lights_pars_begin:Ri,lights_toon_fragment:_rsl.lights_toon_fragment,lights_toon_pars_fragment:_rsl.lights_toon_pars_fragment,lights_phong_fragment:_rsl.lights_phong_fragment,lights_phong_pars_fragment:_rsl.lights_phong_pars_fragment,lights_physical_fragment:_rsl.lights_physical_fragment,lights_physical_pars_fragment:_rsl.lights_physical_pars_fragment,lights_fragment_begin:_rsl.lights_fragment_begin,lights_fragment_maps:_rsl.lights_fragment_maps,lights_fragment_end:_rsl.lights_fragment_end,logdepthbuf_fragment:_rsl.logdepthbuf_fragment,logdepthbuf_pars_fragment:_rsl.logdepthbuf_pars_fragment,logdepthbuf_pars_vertex:_rsl.logdepthbuf_pars_vertex,logdepthbuf_vertex:_rsl.logdepthbuf_vertex,map_fragment:_rsl.map_fragment,map_pars_fragment:_rsl.map_pars_fragment,map_particle_fragment:_rsl.map_particle_fragment,map_particle_pars_fragment:_rsl.map_particle_pars_fragment,metalnessmap_fragment:_rsl.metalnessmap_fragment,metalnessmap_pars_fragment:_rsl.metalnessmap_pars_fragment,morphnormal_vertex:_rsl.morphnormal_vertex,morphtarget_pars_vertex:_rsl.morphtarget_pars_vertex,morphtarget_vertex:_rsl.morphtarget_vertex,normal_fragment_begin:_rsl.normal_fragment_begin,normal_fragment_maps:_rsl.normal_fragment_maps,normalmap_pars_fragment:_rsl.normalmap_pars_fragment,clearcoat_normal_fragment_begin:_rsl.clearcoat_normal_fragment_begin,clearcoat_normal_fragment_maps:_rsl.clearcoat_normal_fragment_maps,clearcoat_pars_fragment:_rsl.clearcoat_pars_fragment,packing:_rsl.packing,premultiplied_alpha_fragment:_rsl.premultiplied_alpha_fragment,project_vertex:_rsl.project_vertex,dithering_fragment:_rsl.dithering_fragment,dithering_pars_fragment:_rsl.dithering_pars_fragment,roughnessmap_fragment:_rsl.roughnessmap_fragment,roughnessmap_pars_fragment:_rsl.roughnessmap_pars_fragment,shadowmap_pars_fragment:_rsl.shadowmap_pars_fragment,shadowmap_pars_vertex:_rsl.shadowmap_pars_vertex,shadowmap_vertex:_rsl.shadowmap_vertex,shadowmask_pars_fragment:_rsl.shadowmask_pars_fragment,skinbase_vertex:_rsl.skinbase_vertex,skinning_pars_vertex:_rsl.skinning_pars_vertex,skinning_vertex:_rsl.skinning_vertex,skinnormal_vertex:_rsl.skinnormal_vertex,specularmap_fragment:_rsl.specularmap_fragment,specularmap_pars_fragment:_rsl.specularmap_pars_fragment,tonemapping_fragment:_rsl.tonemapping_fragment,tonemapping_pars_fragment:_rsl.tonemapping_pars_fragment,transmissionmap_fragment:_rsl.transmissionmap_fragment,transmissionmap_pars_fragment:_rsl.transmissionmap_pars_fragment,uv_pars_fragment:_rsl.uv_pars_fragment,uv_pars_vertex:_rsl.uv_pars_vertex,uv_vertex:_rsl.uv_vertex,uv2_pars_fragment:_rsl.uv2_pars_fragment,uv2_pars_vertex:_rsl.uv2_pars_vertex,uv2_vertex:_rsl.uv2_vertex,worldpos_vertex:_rsl.worldpos_vertex,background_frag:_rsl.background_frag,background_vert:_rsl.background_vert,cube_frag:_rsl.cube_frag,cube_vert:_rsl.cube_vert,depth_frag:_rsl.depth_frag,depth_vert:_rsl.depth_vert,distanceRGBA_frag:_rsl.distanceRGBA_frag,distanceRGBA_vert:_rsl.distanceRGBA_vert,equirect_frag:_rsl.equirect_frag,equirect_vert:_rsl.equirect_vert,linedashed_frag:_rsl.linedashed_frag,linedashed_vert:_rsl.linedashed_vert,meshbasic_frag:_rsl.meshbasic_frag,meshbasic_vert:_rsl.meshbasic_vert,meshlambert_frag:_rsl.meshlambert_frag,meshlambert_vert:_rsl.meshlambert_vert,meshmatcap_frag:_rsl.meshmatcap_frag,meshmatcap_vert:_rsl.meshmatcap_vert,meshtoon_frag:_rsl.meshtoon_frag,meshtoon_vert:_rsl.meshtoon_vert,meshphong_frag:_rsl.meshphong_frag,meshphong_vert:_rsl.meshphong_vert,meshphysical_frag:_rsl.meshphysical_frag,meshphysical_vert:_rsl.meshphysical_vert,normal_frag:_rsl.normal_frag,normal_vert:_rsl.normal_vert,points_frag:_rsl.points_frag,points_vert:_rsl.points_vert,shadow_frag:_rsl.shadow_frag,shadow_vert:_rsl.shadow_vert,sprite_frag:_rsl.sprite_frag,sprite_vert:_rsl.sprite_vert},Ci={common:{diffuse:{value:new et(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new o},uv2Transform:{value:new o},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0},maxCubeSize:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new s(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new et(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:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},spotPosition:{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:{},shadow:{},useAreaTexture:{}}},ltc_1:{value:null},ltc_2:{value:null},rectAreaTexture:{value:[]},rectShadowMap:{value:[]}},points:{diffuse:{value:new et(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new o}},sprite:{diffuse:{value:new et(15658734)},opacity:{value:1},center:{value:new s(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new o}}},Oi={basic:{uniforms:Zt([Ci.common,Ci.specularmap,Ci.envmap,Ci.aomap,Ci.lightmap,Ci.fog]),vertexShader:Pi.meshbasic_vert,fragmentShader:Pi.meshbasic_frag},lambert:{uniforms:Zt([Ci.common,Ci.specularmap,Ci.envmap,Ci.aomap,Ci.lightmap,Ci.emissivemap,Ci.fog,Ci.lights,{emissive:{value:new et(0)}}]),vertexShader:Pi.meshlambert_vert,fragmentShader:Pi.meshlambert_frag},phong:{uniforms:Zt([Ci.common,Ci.specularmap,Ci.envmap,Ci.aomap,Ci.lightmap,Ci.emissivemap,Ci.bumpmap,Ci.normalmap,Ci.displacementmap,Ci.fog,Ci.lights,{emissive:{value:new et(0)},specular:{value:new et(1118481)},shininess:{value:30}}]),vertexShader:Pi.meshphong_vert,fragmentShader:Pi.meshphong_frag},standard:{uniforms:Zt([Ci.common,Ci.envmap,Ci.aomap,Ci.lightmap,Ci.emissivemap,Ci.bumpmap,Ci.normalmap,Ci.displacementmap,Ci.roughnessmap,Ci.metalnessmap,Ci.fog,Ci.lights,{emissive:{value:new et(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Pi.meshphysical_vert,fragmentShader:Pi.meshphysical_frag},toon:{uniforms:Zt([Ci.common,Ci.aomap,Ci.lightmap,Ci.emissivemap,Ci.bumpmap,Ci.normalmap,Ci.displacementmap,Ci.gradientmap,Ci.fog,Ci.lights,{emissive:{value:new et(0)}}]),vertexShader:Pi.meshtoon_vert,fragmentShader:Pi.meshtoon_frag},matcap:{uniforms:Zt([Ci.common,Ci.bumpmap,Ci.normalmap,Ci.displacementmap,Ci.fog,{matcap:{value:null}}]),vertexShader:Pi.meshmatcap_vert,fragmentShader:Pi.meshmatcap_frag},points:{uniforms:Zt([Ci.points,Ci.fog]),vertexShader:Pi.points_vert,fragmentShader:Pi.points_frag},dashed:{uniforms:Zt([Ci.common,Ci.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Pi.linedashed_vert,fragmentShader:Pi.linedashed_frag},depth:{uniforms:Zt([Ci.common,Ci.displacementmap]),vertexShader:Pi.depth_vert,fragmentShader:Pi.depth_frag},normal:{uniforms:Zt([Ci.common,Ci.bumpmap,Ci.normalmap,Ci.displacementmap,{opacity:{value:1}}]),vertexShader:Pi.normal_vert,fragmentShader:Pi.normal_frag},sprite:{uniforms:Zt([Ci.sprite,Ci.fog]),vertexShader:Pi.sprite_vert,fragmentShader:Pi.sprite_frag},background:{uniforms:{uvTransform:{value:new o},t2D:{value:null}},vertexShader:Pi.background_vert,fragmentShader:Pi.background_frag},cube:{uniforms:Zt([Ci.envmap,{opacity:{value:1}}]),vertexShader:Pi.cube_vert,fragmentShader:Pi.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Pi.equirect_vert,fragmentShader:Pi.equirect_frag},distanceRGBA:{uniforms:Zt([Ci.common,Ci.displacementmap,{referencePosition:{value:new d},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Pi.distanceRGBA_vert,fragmentShader:Pi.distanceRGBA_frag},shadow:{uniforms:Zt([Ci.lights,Ci.fog,{color:{value:new et(0)},opacity:{value:1}}]),vertexShader:Pi.shadow_vert,fragmentShader:Pi.shadow_frag}};function zi(t,e,i,n,r){const s=new et(0);let o,a,h=0,l=null,c=0,u=null;function p(t,e){i.buffers.color.setClear(t.r,t.g,t.b,e,r)}return{getClearColor:function(){return s},setClearColor:function(t,e=1){s.set(t),h=e,p(s,h)},getClearAlpha:function(){return h},setClearAlpha:function(t){h=t,p(s,h)},render:function(i,r,d,m){let f=!0===r.isScene?r.background:null;f&&f.isTexture&&(f=e.get(f));const g=t.xr,y=g.getSession&&g.getSession();y&&"additive"===y.environmentBlendMode&&(f=null),null===f?p(s,h):f&&f.isColor&&(p(f,1),m=!0),(t.autoClear||m)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),f&&(f.isCubeTexture||f.isWebGLCubeRenderTarget||306===f.mapping)?(void 0===a&&(a=new Ie(new Ht(1,1,1),new te({name:"BackgroundCubeMaterial",uniforms:Yt(Oi.cube.uniforms),vertexShader:Oi.cube.vertexShader,fragmentShader:Oi.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),a.geometry.deleteAttribute("normal"),a.geometry.deleteAttribute("uv"),a.onBeforeRender=function(t,e,i){this.matrixWorld.copyPosition(i.matrixWorld)},Object.defineProperty(a.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(a)),f.isWebGLCubeRenderTarget&&(f=f.texture),a.material.uniforms.envMap.value=f,a.material.uniforms.flipEnvMap.value=f.isCubeTexture&&f._needsFlipEnvMap?-1:1,l===f&&c===f.version&&u===t.toneMapping||(a.material.needsUpdate=!0,l=f,c=f.version,u=t.toneMapping),i.unshift(a,a.geometry,a.material,0,0,null)):f&&f.isTexture&&(void 0===o&&(o=new Ie(new qt(2,2),new te({name:"BackgroundMaterial",uniforms:Yt(Oi.background.uniforms),vertexShader:Oi.background.vertexShader,fragmentShader:Oi.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),o.geometry.deleteAttribute("normal"),Object.defineProperty(o.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(o)),o.material.uniforms.t2D.value=f,!0===f.matrixAutoUpdate&&f.updateMatrix(),o.material.uniforms.uvTransform.value.copy(f.matrix),l===f&&c===f.version&&u===t.toneMapping||(o.material.needsUpdate=!0,l=f,c=f.version,u=t.toneMapping),i.unshift(o,o.geometry,o.material,0,0,null))}}}function Ni(t,e,i,n){const r=t.getParameter(34921),s=n.isWebGL2?null:e.get("OES_vertex_array_object"),o=n.isWebGL2||null!==s,a={},h=p(null);let l=h;function c(e){return n.isWebGL2?t.bindVertexArray(e):s.bindVertexArrayOES(e)}function u(e){return n.isWebGL2?t.deleteVertexArray(e):s.deleteVertexArrayOES(e)}function p(t){const e=[],i=[],n=[];for(let t=0;t<r;t++)e[t]=0,i[t]=0,n[t]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:i,attributeDivisors:n,object:t,attributes:{},index:null}}function d(){const t=l.newAttributes;for(let e=0,i=t.length;e<i;e++)t[e]=0}function m(t){f(t,0)}function f(i,r){const s=l.newAttributes,o=l.enabledAttributes,a=l.attributeDivisors;s[i]=1,0===o[i]&&(t.enableVertexAttribArray(i),o[i]=1),a[i]!==r&&((n.isWebGL2?t:e.get("ANGLE_instanced_arrays"))[n.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](i,r),a[i]=r)}function g(){const e=l.newAttributes,i=l.enabledAttributes;for(let n=0,r=i.length;n<r;n++)i[n]!==e[n]&&(t.disableVertexAttribArray(n),i[n]=0)}function y(e,i,r,s,o,a){!0!==n.isWebGL2||5124!==r&&5125!==r?t.vertexAttribPointer(e,i,r,s,o,a):t.vertexAttribIPointer(e,i,r,o,a)}function x(){v(),l!==h&&(l=h,c(l.object))}function v(){h.geometry=null,h.program=null,h.wireframe=!1}return{setup:function(r,h,u,x,v){let b=!1;if(o){const e=function(e,i,r){const o=!0===r.wireframe;let h=a[e.id];void 0===h&&(h={},a[e.id]=h);let l=h[i.id];void 0===l&&(l={},h[i.id]=l);let c=l[o];return void 0===c&&(c=p(n.isWebGL2?t.createVertexArray():s.createVertexArrayOES()),l[o]=c),c}(x,u,h);l!==e&&(l=e,c(l.object)),b=function(t,e){const i=l.attributes,n=t.attributes;let r=0;for(const t in n){const e=i[t],s=n[t];if(void 0===e)return!0;if(e.attribute!==s)return!0;if(e.data!==s.data)return!0;r++}return l.attributesNum!==r||l.index!==e}(x,v),b&&function(t,e){const i={},n=t.attributes;let r=0;for(const t in n){const e=n[t],s={};s.attribute=e,e.data&&(s.data=e.data),i[t]=s,r++}l.attributes=i,l.attributesNum=r,l.index=e}(x,v)}else{const t=!0===h.wireframe;l.geometry===x.id&&l.program===u.id&&l.wireframe===t||(l.geometry=x.id,l.program=u.id,l.wireframe=t,b=!0)}!0===r.isInstancedMesh&&(b=!0),null!==v&&i.update(v,34963),b&&(function(r,s,o,a){if(!1===n.isWebGL2&&(r.isInstancedMesh||a.isInstancedBufferGeometry)&&null===e.get("ANGLE_instanced_arrays"))return;d();const h=a.attributes,l=o.getAttributes(),c=s.defaultAttributeValues;for(const e in l){const n=l[e];if(n>=0){const s=h[e];if(void 0!==s){const e=s.normalized,r=s.itemSize,o=i.get(s);if(void 0===o)continue;const h=o.buffer,l=o.type,c=o.bytesPerElement;if(s.isInterleavedBufferAttribute){const i=s.data,o=i.stride,u=s.offset;i&&i.isInstancedInterleavedBuffer?(f(n,i.meshPerAttribute),void 0===a._maxInstanceCount&&(a._maxInstanceCount=i.meshPerAttribute*i.count)):m(n),t.bindBuffer(34962,h),y(n,r,l,e,o*c,u*c)}else s.isInstancedBufferAttribute?(f(n,s.meshPerAttribute),void 0===a._maxInstanceCount&&(a._maxInstanceCount=s.meshPerAttribute*s.count)):m(n),t.bindBuffer(34962,h),y(n,r,l,e,0,0)}else if("instanceMatrix"===e){const e=i.get(r.instanceMatrix);if(void 0===e)continue;const s=e.buffer,o=e.type;f(n+0,1),f(n+1,1),f(n+2,1),f(n+3,1),t.bindBuffer(34962,s),t.vertexAttribPointer(n+0,4,o,!1,64,0),t.vertexAttribPointer(n+1,4,o,!1,64,16),t.vertexAttribPointer(n+2,4,o,!1,64,32),t.vertexAttribPointer(n+3,4,o,!1,64,48)}else if("instanceColor"===e){const e=i.get(r.instanceColor);if(void 0===e)continue;const s=e.buffer,o=e.type;f(n,1),t.bindBuffer(34962,s),t.vertexAttribPointer(n,3,o,!1,12,0)}else if(void 0!==c){const i=c[e];if(void 0!==i)switch(i.length){case 2:t.vertexAttrib2fv(n,i);break;case 3:t.vertexAttrib3fv(n,i);break;case 4:t.vertexAttrib4fv(n,i);break;default:t.vertexAttrib1fv(n,i)}}}}g()}(r,h,u,x),null!==v&&t.bindBuffer(34963,i.get(v).buffer))},reset:x,resetDefaultState:v,dispose:function(){x();for(const t in a){const e=a[t];for(const t in e){const i=e[t];for(const t in i)u(i[t].object),delete i[t];delete e[t]}delete a[t]}},releaseStatesOfGeometry:function(t){if(void 0===a[t.id])return;const e=a[t.id];for(const t in e){const i=e[t];for(const t in i)u(i[t].object),delete i[t];delete e[t]}delete a[t.id]},releaseStatesOfProgram:function(t){for(const e in a){const i=a[e];if(void 0===i[t.id])continue;const n=i[t.id];for(const t in n)u(n[t].object),delete n[t];delete i[t.id]}},initAttributes:d,enableAttribute:m,disableUnusedAttributes:g}}function Bi(t,e,i,n){const r=n.isWebGL2;let s;this.setMode=function(t){s=t},this.render=function(e,n){t.drawArrays(s,e,n),i.update(n,s,1)},this.renderInstances=function(n,o,a){if(0===a)return;let h,l;if(r)h=t,l="drawArraysInstanced";else if(h=e.get("ANGLE_instanced_arrays"),l="drawArraysInstancedANGLE",null===h)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");h[l](s,n,o,a),i.update(o,s,a)}}function Fi(t,e,i){let n;function r(e){if("highp"===e){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const s="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext;let o=void 0!==i.precision?i.precision:"highp";const a=r(o);a!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",a,"instead."),o=a);const h=!0===i.logarithmicDepthBuffer,l=t.getParameter(34930),c=t.getParameter(35660),u=t.getParameter(3379),p=t.getParameter(34076),d=t.getParameter(34921),m=t.getParameter(36347),f=t.getParameter(36348),g=t.getParameter(36349),y=c>0,x=s||!!e.get("OES_texture_float");return{isWebGL2:s,getMaxAnisotropy:function(){if(void 0!==n)return n;const i=e.get("EXT_texture_filter_anisotropic");return n=null!==i?t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,n},getMaxPrecision:r,precision:o,logarithmicDepthBuffer:h,maxTextures:l,maxVertexTextures:c,maxTextureSize:u,maxCubemapSize:p,maxAttributes:d,maxVertexUniforms:m,maxVaryings:f,maxFragmentUniforms:g,vertexTextures:y,floatFragmentTextures:x,floatVertexTextures:y&&x,maxSamples:s?t.getParameter(36183):0}}function Di(t){const e=this;let i=null,n=0,r=!1,s=!1;const a=new F,h=new o,l={value:null,needsUpdate:!1};function c(){l.value!==i&&(l.value=i,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(t,i,n,r){const s=null!==t?t.length:0;let o=null;if(0!==s){if(o=l.value,!0!==r||null===o){const e=n+4*s,r=i.matrixWorldInverse;h.getNormalMatrix(r),(null===o||o.length<e)&&(o=new Float32Array(e));for(let e=0,i=n;e!==s;++e,i+=4)a.copy(t[e]).applyMatrix4(r,h),a.normal.toArray(o,i),o[i+3]=a.constant}l.value=o,l.needsUpdate=!0}return e.numPlanes=s,e.numIntersection=0,o}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e,s){const o=0!==t.length||e||0!==n||r;return r=e,i=u(t,s,0),n=t.length,o},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1,c()},this.setState=function(e,o,a){const h=e.clippingPlanes,p=e.clipIntersection,d=e.clipShadows,m=t.get(e);if(!r||null===h||0===h.length||s&&!d)s?u(null):c();else{const t=s?0:n,e=4*t;let r=m.clippingState||null;l.value=r,r=u(h,o,e,a);for(let t=0;t!==e;++t)r[t]=i[t];m.clippingState=r,this.numIntersection=p?this.numPlanes:0,this.numPlanes+=t}}}function Gi(t,e,i){this.width=t,this.height=e,this.scissor=new J(0,0,t,e),this.scissorTest=!1,this.viewport=new J(0,0,t,e),i=i||{},this.texture=new l(void 0,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),this.texture.image={},this.texture.image.width=t,this.texture.image.height=e,this.texture.generateMipmaps=void 0!==i.generateMipmaps&&i.generateMipmaps,this.texture.minFilter=void 0!==i.minFilter?i.minFilter:1006,this.depthBuffer=void 0===i.depthBuffer||i.depthBuffer,this.stencilBuffer=void 0!==i.stencilBuffer&&i.stencilBuffer,this.depthTexture=void 0!==i.depthTexture?i.depthTexture:null}function Ii(){Bt.call(this),this.type="Camera",this.matrixWorldInverse=new k,this.projectionMatrix=new k,this.projectionMatrixInverse=new k}function ki(t=50,e=1,i=.1,n=2e3){Ii.call(this),this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=i,this.far=n,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function Ui(t,e,i){if(Bt.call(this),this.type="CubeCamera",!0!==i.isWebGLCubeRenderTarget)return void console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");this.renderTarget=i;const n=new ki(90,1,t,e);n.layers=this.layers,n.up.set(0,-1,0),n.lookAt(new d(1,0,0)),this.add(n);const r=new ki(90,1,t,e);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new d(-1,0,0)),this.add(r);const s=new ki(90,1,t,e);s.layers=this.layers,s.up.set(0,0,1),s.lookAt(new d(0,1,0)),this.add(s);const o=new ki(90,1,t,e);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(new d(0,-1,0)),this.add(o);const a=new ki(90,1,t,e);a.layers=this.layers,a.up.set(0,-1,0),a.lookAt(new d(0,0,1)),this.add(a);const h=new ki(90,1,t,e);h.layers=this.layers,h.up.set(0,-1,0),h.lookAt(new d(0,0,-1)),this.add(h),this.update=function(t,e){null===this.parent&&this.updateMatrixWorld();const l=t.xr.enabled,c=t.getRenderTarget();t.xr.enabled=!1;const u=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,t.setRenderTarget(i,0),t.render(e,n),t.setRenderTarget(i,1),t.render(e,r),t.setRenderTarget(i,2),t.render(e,s),t.setRenderTarget(i,3),t.render(e,o),t.setRenderTarget(i,4),t.render(e,a),i.texture.generateMipmaps=u,t.setRenderTarget(i,5),t.render(e,h),t.setRenderTarget(c),t.xr.enabled=l}}function Vi(t,e,i,n,r,s,o,a,h,c){t=void 0!==t?t:[],e=void 0!==e?e:301,o=void 0!==o?o:1022,l.call(this,t,e,i,n,r,s,o,a,h,c),this.flipY=!1,this.maxLod=-1,this._needsFlipEnvMap=!0}function Wi(t,e,i){Number.isInteger(e)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),e=i),Gi.call(this,t,t,e),e=e||{},this.texture=new Vi(void 0,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.encoding),this.texture._needsFlipEnvMap=!1}function ji(t){let e=new WeakMap;function i(t,e){return 303===e?t.mapping=301:304===e&&(t.mapping=302),t}function n(t){const i=t.target;i.removeEventListener("dispose",n);const r=e.get(i);void 0!==r&&(e.delete(i),r.dispose())}return{get:function(r){if(r&&r.isTexture){const s=r.mapping;if(303===s||304===s){if(e.has(r))return i(e.get(r).texture,r.mapping);{const s=r.image;if(s&&s.height>0){const o=t.getRenderList(),a=t.getRenderTarget(),h=new Wi(s.height/2);return h.fromEquirectangularTexture(t,r),e.set(r,h),t.setRenderTarget(a),t.setRenderList(o),r.addEventListener("dispose",n),i(h.texture,r.mapping)}return null}}}return r},dispose:function(){e=new WeakMap}}}function Hi(t){const e={};return{has:function(i){if(void 0!==e[i])return null!==e[i];let n;switch(i){case"WEBGL_depth_texture":n=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:n=t.getExtension(i)}return e[i]=n,null!==n},get:function(t){return this.has(t)||console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),e[t]}}}function qi(t,e,i,n){const r=new WeakMap,s=new WeakMap;function o(t){const a=t.target,h=r.get(a);null!==h.index&&e.remove(h.index);for(const t in h.attributes)e.remove(h.attributes[t]);a.removeEventListener("dispose",o),r.delete(a);const l=s.get(h);l&&(e.remove(l),s.delete(h)),n.releaseStatesOfGeometry(h),!0===a.isInstancedBufferGeometry&&delete a._maxInstanceCount,i.memory.geometries--}function a(t){const i=[],n=t.index,r=t.attributes.position;let o=0;if(null!==n){const t=n.array;o=n.version;for(let e=0,n=t.length;e<n;e+=3){const n=t[e+0],r=t[e+1],s=t[e+2];i.push(n,r,r,s,s,n)}}else{const t=r.array;o=r.version;for(let e=0,n=t.length/3-1;e<n;e+=3){const t=e+0,n=e+1,r=e+2;i.push(t,n,n,r,r,t)}}const a=new(Ft(i)>65535?dt:ut)(i,1);a.version=o;const h=s.get(t);h&&e.remove(h),s.set(t,a)}return{get:function(t,e){let n=r.get(e);return n||(e.addEventListener("dispose",o),e.isBufferGeometry?n=e:e.isGeometry&&(void 0===e._bufferGeometry&&(e._bufferGeometry=(new jt).setFromObject(t)),n=e._bufferGeometry),r.set(e,n),i.memory.geometries++,n)},update:function(t){const i=t.attributes;for(const t in i)e.update(i[t],34962);const n=t.morphAttributes;for(const t in n){const i=n[t];for(let t=0,n=i.length;t<n;t++)e.update(i[t],34962)}},getWireframeAttribute:function(t){const e=s.get(t);if(e){const i=t.index;null!==i&&e.version<i.version&&a(t)}else a(t);return s.get(t)}}}function Xi(t,e,i,n){const r=n.isWebGL2;let s,o,a;this.setMode=function(t){s=t},this.setIndex=function(t){o=t.type,a=t.bytesPerElement},this.render=function(e,n){t.drawElements(s,n,o,e*a),i.update(n,s,1)},this.renderInstances=function(n,h,l){if(0===l)return;let c,u;if(r)c=t,u="drawElementsInstanced";else if(c=e.get("ANGLE_instanced_arrays"),u="drawElementsInstancedANGLE",null===c)return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");c[u](s,h,o,n*a,l),i.update(h,s,l)}}function Ji(t){const e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.frame++,e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(t,i,n){switch(e.calls++,i){case 4:e.triangles+=n*(t/3);break;case 1:e.lines+=n*(t/2);break;case 3:e.lines+=n*(t-1);break;case 2:e.lines+=n*t;break;case 0:e.points+=n*t;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",i)}}}}function Yi(t,e){return t[0]-e[0]}function Zi(t,e){return Math.abs(e[1])-Math.abs(t[1])}function Qi(t){const e={},i=new Float32Array(8),n=[];for(let t=0;t<8;t++)n[t]=[t,0];return{update:function(r,s,o,a){const h=r.morphTargetInfluences,l=void 0===h?0:h.length;let c=e[s.id];if(void 0===c){c=[];for(let t=0;t<l;t++)c[t]=[t,0];e[s.id]=c}for(let t=0;t<l;t++){const e=c[t];e[0]=t,e[1]=h[t]}c.sort(Zi);for(let t=0;t<8;t++)t<l&&c[t][1]?(n[t][0]=c[t][0],n[t][1]=c[t][1]):(n[t][0]=Number.MAX_SAFE_INTEGER,n[t][1]=0);n.sort(Yi);const u=o.morphTargets&&s.morphAttributes.position,p=o.morphNormals&&s.morphAttributes.normal;let d=0;for(let t=0;t<8;t++){const e=n[t],r=e[0],o=e[1];r!==Number.MAX_SAFE_INTEGER&&o?(u&&s.getAttribute("morphTarget"+t)!==u[r]&&s.setAttribute("morphTarget"+t,u[r]),p&&s.getAttribute("morphNormal"+t)!==p[r]&&s.setAttribute("morphNormal"+t,p[r]),i[t]=o,d+=o):(u&&!0===s.hasAttribute("morphTarget"+t)&&s.deleteAttribute("morphTarget"+t),p&&!0===s.hasAttribute("morphNormal"+t)&&s.deleteAttribute("morphNormal"+t),i[t]=0)}const m=s.morphTargetsRelative?1:1-d;a.getUniforms().setValue(t,"morphTargetBaseInfluence",m),a.getUniforms().setValue(t,"morphTargetInfluences",i)}}}function Ki(t,e,i,n){let r=new WeakMap;function s(t){const e=t.target;e.removeEventListener("dispose",s),i.remove(e.instanceMatrix),null!==e.instanceColor&&i.remove(e.instanceColor)}return{update:function(t){const o=n.render.frame,a=t.geometry,h=e.get(t,a);return r.get(h)!==o&&(a.isGeometry&&h.updateFromObject(t),e.update(h),r.set(h,o)),t.isInstancedMesh&&(!1===t.hasEventListener("dispose",s)&&t.addEventListener("dispose",s),i.update(t.instanceMatrix,34962),null!==t.instanceColor&&i.update(t.instanceColor,34962)),h},dispose:function(){r=new WeakMap}}}function $i(t=null,e=1,i=1,n=1){l.call(this,null),this.image={data:t,width:e,height:i,depth:n},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}function tn(t=null,e=1,i=1,n=1){l.call(this,null),this.image={data:t,width:e,height:i,depth:n},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}Oi.physical={uniforms:Zt([Oi.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new s(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new et(0)},transmission:{value:0},transmissionMap:{value:null}}]),vertexShader:Pi.meshphysical_vert,fragmentShader:Pi.meshphysical_frag},Gi.prototype=Object.assign(Object.create(r.prototype),{constructor:Gi,isWebGLRenderTarget:!0,setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.texture.image.width=t,this.texture.image.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Ii.prototype=Object.assign(Object.create(Bt.prototype),{constructor:Ii,isCamera:!0,copy:function(t,e){return Bt.prototype.copy.call(this,t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this},getWorldDirection:function(t){void 0===t&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),t=new d),this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()},updateMatrixWorld:function(t){Bt.prototype.updateMatrixWorld.call(this,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()},updateWorldMatrix:function(t,e){Bt.prototype.updateWorldMatrix.call(this,t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()},clone:function(){return(new this.constructor).copy(this)}}),ki.prototype=Object.assign(Object.create(Ii.prototype),{constructor:ki,isPerspectiveCamera:!0,copy:function(t,e){return Ii.prototype.copy.call(this,t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this},setFocalLength:function(t){const e=.5*this.getFilmHeight()/t;this.fov=2*n.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){const t=Math.tan(.5*n.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*n.RAD2DEG*Math.atan(Math.tan(.5*n.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(t,e,i,n,r,s){this.aspect=t/e,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=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){const t=this.near;let e=t*Math.tan(.5*n.DEG2RAD*this.fov)/this.zoom,i=2*e,r=this.aspect*i,s=-.5*r;const o=this.view;if(null!==this.view&&this.view.enabled){const t=o.fullWidth,n=o.fullHeight;s+=o.offsetX*r/t,e-=o.offsetY*i/n,r*=o.width/t,i*=o.height/n}const a=this.filmOffset;0!==a&&(s+=t*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,e,e-i,t,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()},toJSON:function(t){const e=Bt.prototype.toJSON.call(this,t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}),Ui.prototype=Object.create(Bt.prototype),Ui.prototype.constructor=Ui,Vi.prototype=Object.create(l.prototype),Vi.prototype.constructor=Vi,Vi.prototype.isCubeTexture=!0,Object.defineProperty(Vi.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}}),Wi.prototype=Object.create(Gi.prototype),Wi.prototype.constructor=Wi,Wi.prototype.isWebGLCubeRenderTarget=!0,Wi.prototype.fromEquirectangularTexture=function(t,e){this.texture.type=e.type,this.texture.format=1023,this.texture.encoding=e.encoding,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const i=new Ht(5,5,5),n=new te({name:"CubemapFromEquirect",uniforms:Yt({tEquirect:{value:null}}),vertexShader:"\n\n\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t#include <begin_vertex>\n\t\t\t\t#include <project_vertex>\n\n\t\t\t}\n\t\t",fragmentShader:"\n\n\t\t\tuniform sampler2D tEquirect;\n\n\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t}\n\t\t",side:1,blending:0});n.uniforms.tEquirect.value=e;const r=new Ie(i,n),s=e.minFilter;return 1008===e.minFilter&&(e.minFilter=1006),new Ui(1,10,this).update(t,r),e.minFilter=s,r.geometry.dispose(),r.material.dispose(),this},Wi.prototype.clear=function(t,e,i,n){const r=t.getRenderTarget();for(let r=0;r<6;r++)t.setRenderTarget(this,r),t.clear(e,i,n);t.setRenderTarget(r)},$i.prototype=Object.create(l.prototype),$i.prototype.constructor=$i,$i.prototype.isDataTexture2DArray=!0,tn.prototype=Object.create(l.prototype),tn.prototype.constructor=tn,tn.prototype.isDataTexture3D=!0;const en=new l,nn=new $i,rn=new tn,sn=new Vi,on=[],an=[],hn=new Float32Array(16),ln=new Float32Array(9),cn=new Float32Array(4);function un(t,e,i){const n=t[0];if(n<=0||n>0)return t;const r=e*i;let s=on[r];if(void 0===s&&(s=new Float32Array(r),on[r]=s),0!==e){n.toArray(s,0);for(let n=1,r=0;n!==e;++n)r+=i,t[n].toArray(s,r)}return s}function pn(t,e){if(t.length!==e.length)return!1;for(let i=0,n=t.length;i<n;i++)if(t[i]!==e[i])return!1;return!0}function dn(t,e){for(let i=0,n=e.length;i<n;i++)t[i]=e[i]}function mn(t,e){let i=an[e];void 0===i&&(i=new Int32Array(e),an[e]=i);for(let n=0;n!==e;++n)i[n]=t.allocateTextureUnit();return i}function fn(t,e){const i=this.cache;i[0]!==e&&(t.uniform1f(this.addr,e),i[0]=e)}function gn(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),i[0]=e.x,i[1]=e.y);else{if(pn(i,e))return;t.uniform2fv(this.addr,e),dn(i,e)}}function yn(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),i[0]=e.x,i[1]=e.y,i[2]=e.z);else if(void 0!==e.r)i[0]===e.r&&i[1]===e.g&&i[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),i[0]=e.r,i[1]=e.g,i[2]=e.b);else{if(pn(i,e))return;t.uniform3fv(this.addr,e),dn(i,e)}}function xn(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z&&i[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),i[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=e.w);else{if(pn(i,e))return;t.uniform4fv(this.addr,e),dn(i,e)}}function vn(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(pn(i,e))return;t.uniformMatrix2fv(this.addr,!1,e),dn(i,e)}else{if(pn(i,n))return;cn.set(n),t.uniformMatrix2fv(this.addr,!1,cn),dn(i,n)}}function bn(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(pn(i,e))return;t.uniformMatrix3fv(this.addr,!1,e),dn(i,e)}else{if(pn(i,n))return;ln.set(n),t.uniformMatrix3fv(this.addr,!1,ln),dn(i,n)}}function Mn(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(pn(i,e))return;t.uniformMatrix4fv(this.addr,!1,e),dn(i,e)}else{if(pn(i,n))return;hn.set(n),t.uniformMatrix4fv(this.addr,!1,hn),dn(i,n)}}function wn(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.safeSetTexture2D(e||en,r)}function _n(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTexture2DArray(e||nn,r)}function Sn(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTexture3D(e||rn,r)}function Tn(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.safeSetTextureCube(e||sn,r)}function En(t,e){const i=this.cache;i[0]!==e&&(t.uniform1i(this.addr,e),i[0]=e)}function An(t,e){const i=this.cache;pn(i,e)||(t.uniform2iv(this.addr,e),dn(i,e))}function Ln(t,e){const i=this.cache;pn(i,e)||(t.uniform3iv(this.addr,e),dn(i,e))}function Rn(t,e){const i=this.cache;pn(i,e)||(t.uniform4iv(this.addr,e),dn(i,e))}function Pn(t,e){const i=this.cache;i[0]!==e&&(t.uniform1ui(this.addr,e),i[0]=e)}function Cn(t,e){t.uniform1fv(this.addr,e)}function On(t,e){t.uniform1iv(this.addr,e)}function zn(t,e){t.uniform2iv(this.addr,e)}function Nn(t,e){t.uniform3iv(this.addr,e)}function Bn(t,e){t.uniform4iv(this.addr,e)}function Fn(t,e){const i=un(e,this.size,2);t.uniform2fv(this.addr,i)}function Dn(t,e){const i=un(e,this.size,3);t.uniform3fv(this.addr,i)}function Gn(t,e){const i=un(e,this.size,4);t.uniform4fv(this.addr,i)}function In(t,e){const i=un(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,i)}function kn(t,e){const i=un(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,i)}function Un(t,e){const i=un(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,i)}function Vn(t,e,i){const n=e.length,r=mn(i,n);t.uniform1iv(this.addr,r);for(let t=0;t!==n;++t)i.safeSetTexture2D(e[t]||en,r[t])}function Wn(t,e,i){const n=e.length,r=mn(i,n);t.uniform1iv(this.addr,r);for(let t=0;t!==n;++t)i.safeSetTextureCube(e[t]||sn,r[t])}function jn(t,e,i){this.id=t,this.addr=i,this.cache=[],this.setValue=function(t){switch(t){case 5126:return fn;case 35664:return gn;case 35665:return yn;case 35666:return xn;case 35674:return vn;case 35675:return bn;case 35676:return Mn;case 5124:case 35670:return En;case 35667:case 35671:return An;case 35668:case 35672:return Ln;case 35669:case 35673:return Rn;case 5125:return Pn;case 35678:case 36198:case 36298:case 36306:case 35682:return wn;case 35679:case 36299:case 36307:return Sn;case 35680:case 36300:case 36308:case 36293:return Tn;case 36289:case 36303:case 36311:case 36292:return _n}}(e.type)}function Hn(t,e,i){this.id=t,this.addr=i,this.cache=[],this.size=e.size,this.setValue=function(t){switch(t){case 5126:return Cn;case 35664:return Fn;case 35665:return Dn;case 35666:return Gn;case 35674:return In;case 35675:return kn;case 35676:return Un;case 5124:case 35670:return On;case 35667:case 35671:return zn;case 35668:case 35672:return Nn;case 35669:case 35673:return Bn;case 35678:case 36198:case 36298:case 36306:case 35682:return Vn;case 35680:case 36300:case 36308:case 36293:return Wn}}(e.type)}function qn(t){this.id=t,this.seq=[],this.map={}}Hn.prototype.updateCache=function(t){const e=this.cache;t instanceof Float32Array&&e.length!==t.length&&(this.cache=new Float32Array(t.length)),dn(e,t)},qn.prototype.setValue=function(t,e,i){const n=this.seq;for(let r=0,s=n.length;r!==s;++r){const s=n[r];s.setValue(t,e[s.id],i)}};const Xn=/(\w+)(\])?(\[|\.)?/g;function Jn(t,e){t.seq.push(e),t.map[e.id]=e}function Yn(t,e,i){const n=t.name,r=n.length;for(Xn.lastIndex=0;;){const s=Xn.exec(n),o=Xn.lastIndex;let a=s[1];const h="]"===s[2],l=s[3];if(h&&(a|=0),void 0===l||"["===l&&o+2===r){Jn(i,void 0===l?new jn(a,t,e):new Hn(a,t,e));break}{let t=i.map[a];void 0===t&&(t=new qn(a),Jn(i,t)),i=t}}}function Zn(t,e){this.seq=[],this.map={};const i=t.getProgramParameter(e,35718);for(let n=0;n<i;++n){const i=t.getActiveUniform(e,n);Yn(i,t.getUniformLocation(e,i.name),this)}}function Qn(t,e,i){const n=t.createShader(e);return t.shaderSource(n,i),t.compileShader(n),n}Zn.prototype.setValue=function(t,e,i,n){const r=this.map[e];void 0!==r&&r.setValue(t,i,n)},Zn.prototype.setOptional=function(t,e,i){const n=e[i];void 0!==n&&this.setValue(t,i,n)},Zn.upload=function(t,e,i,n){for(let r=0,s=e.length;r!==s;++r){const s=e[r],o=i[s.id];!1!==o.needsUpdate&&s.setValue(t,o.value,n)}},Zn.seqWithValue=function(t,e){const i=[];for(let n=0,r=t.length;n!==r;++n){const r=t[n];r.id in e&&i.push(r)}return i};let Kn=0;function $n(t){switch(t){case 3e3:return["Linear","( value )"];case 3001:return["sRGB","( value )"];case 3002:return["RGBE","( value )"];case 3004:return["RGBM","( value, 7.0 )"];case 3005:return["RGBM","( value, 16.0 )"];case 3006:return["RGBD","( value, 256.0 )"];case 3007:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case 3003:return["LogLuv","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",t),["Linear","( value )"]}}function tr(t,e,i){const n=t.getShaderParameter(e,35713),r=t.getShaderInfoLog(e).trim();return n&&""===r?"":"THREE.WebGLShader: gl.getShaderInfoLog() "+i+"\n"+r+function(t){const e=t.split("\n");for(let t=0;t<e.length;t++)e[t]=t+1+": "+e[t];return e.join("\n")}(t.getShaderSource(e))}function er(t,e){const i=$n(e);return"vec4 "+t+"( vec4 value ) { return "+i[0]+"ToLinear"+i[1]+"; }"}function ir(t,e){const i=$n(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+i[0]+i[1]+"; }"}function nr(t,e){let i;switch(e){case 1:i="Linear";break;case 2:i="Reinhard";break;case 3:i="OptimizedCineon";break;case 4:i="ACESFilmic";break;case 5:i="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),i="Linear"}return"vec3 "+t+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}function rr(t){return""!==t}function sr(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function or(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const ar=/^[ \t]*#include +<([\w\d./]+)>/gm;function hr(t){return t.replace(ar,lr)}function lr(t,e){const i=Pi[e];if(void 0===i)throw new Error("Can not resolve #include <"+e+">");return hr(i)}const cr=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,ur=/#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 pr(t){return t.replace(ur,mr).replace(cr,dr)}function dr(t,e,i,n){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),mr(0,e,i,n)}function mr(t,e,i,n){let r="";for(let t=parseInt(e);t<parseInt(i);t++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+t+" ]").replace(/UNROLLED_LOOP_INDEX/g,t);return r}function fr(t){let e="precision "+t.precision+" float;\nprecision "+t.precision+" int;";return"highp"===t.precision?e+="\n#define HIGH_PRECISION":"mediump"===t.precision?e+="\n#define MEDIUM_PRECISION":"lowp"===t.precision&&(e+="\n#define LOW_PRECISION"),e}function gr(t,e,i,n){const r=t.getContext(),s=i.defines;let o=i.vertexShader,a=i.fragmentShader;const h=function(t){let e="SHADOWMAP_TYPE_BASIC";return 1===t.shadowMapType?e="SHADOWMAP_TYPE_PCF":2===t.shadowMapType?e="SHADOWMAP_TYPE_PCF_SOFT":3===t.shadowMapType&&(e="SHADOWMAP_TYPE_VSM"),e}(i),l=function(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case 301:case 302:e="ENVMAP_TYPE_CUBE";break;case 306:case 307:e="ENVMAP_TYPE_CUBE_UV"}return e}(i),c=function(t){let e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case 302:case 307:e="ENVMAP_MODE_REFRACTION"}return e}(i),u=function(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case 0:e="ENVMAP_BLENDING_MULTIPLY";break;case 1:e="ENVMAP_BLENDING_MIX";break;case 2:e="ENVMAP_BLENDING_ADD"}return e}(i),p=t.gammaFactor>0?t.gammaFactor:1,d=i.isWebGL2?"":function(t){return[t.extensionDerivatives||t.envMapCubeUV||t.bumpMap||t.tangentSpaceNormalMap||t.clearcoatNormalMap||t.flatShading||"physical"===t.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(rr).join("\n")}(i),m=function(t){const e=[];for(const i in t){const n=t[i];!1!==n&&e.push("#define "+i+" "+n)}return e.join("\n")}(s),f=r.createProgram();let g,y,x=i.glslVersion?"#version "+i.glslVersion+"\n":"";i.isRawShaderMaterial?(g=[m].filter(rr).join("\n"),g.length>0&&(g+="\n"),y=[d,m].filter(rr).join("\n"),y.length>0&&(y+="\n")):(g=[fr(i),"#define SHADER_NAME "+i.shaderName,m,i.instancing?"#define USE_INSTANCING":"",i.instancingColor?"#define USE_INSTANCING_COLOR":"",i.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+p,"#define MAX_BONES "+i.maxBones,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+c:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMap&&i.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",i.normalMap&&i.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.displacementMap&&i.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.vertexTangents?"#define USE_TANGENT":"",i.vertexColors?"#define USE_COLOR":"",i.vertexUvs?"#define USE_UV":"",i.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.useVertexTexture?"#define BONE_TEXTURE":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&!1===i.flatShading?"#define USE_MORPHNORMALS":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+h:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.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_TANGENT","\tattribute vec4 tangent;","#endif","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\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(rr).join("\n"),y=[d,fr(i),"#define SHADER_NAME "+i.shaderName,m,i.alphaTest?"#define ALPHATEST "+i.alphaTest+(i.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+p,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.matcap?"#define USE_MATCAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+l:"",i.envMap?"#define "+c:"",i.envMap?"#define "+u:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMap&&i.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",i.normalMap&&i.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.sheen?"#define USE_SHEEN":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.vertexTangents?"#define USE_TANGENT":"",i.vertexColors||i.instancingColor?"#define USE_COLOR":"",i.vertexUvs?"#define USE_UV":"",i.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+h:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",i.envMap&&i.extensionShaderTextureLOD||i.envMap&&i.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==i.toneMapping?"#define TONE_MAPPING":"",0!==i.toneMapping?Pi.tonemapping_pars_fragment:"",0!==i.toneMapping?nr("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",Pi.encodings_pars_fragment,i.map?er("mapTexelToLinear",i.mapEncoding):"",i.matcap?er("matcapTexelToLinear",i.matcapEncoding):"",i.envMap?er("envMapTexelToLinear",i.envMapEncoding):"",i.emissiveMap?er("emissiveMapTexelToLinear",i.emissiveMapEncoding):"",i.lightMap?er("lightMapTexelToLinear",i.lightMapEncoding):"",ir("linearToOutputTexel",i.outputEncoding),i.depthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(rr).join("\n")),o=hr(o),o=sr(o,i),o=or(o,i),a=hr(a),a=sr(a,i),a=or(a,i),o=pr(o),a=pr(a),i.isWebGL2&&!0!==i.isRawShaderMaterial&&(x="#version 300 es\n",g=["#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,y=["#define varying in","300 es"===i.glslVersion?"":"out highp vec4 pc_fragColor;","300 es"===i.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"+y);const v=x+y+a,b=Qn(r,35633,x+g+o),M=Qn(r,35632,v);if(r.attachShader(f,b),r.attachShader(f,M),void 0!==i.index0AttributeName?r.bindAttribLocation(f,0,i.index0AttributeName):!0===i.morphTargets&&r.bindAttribLocation(f,0,"position"),r.linkProgram(f),t.debug.checkShaderErrors){const t=r.getProgramInfoLog(f).trim(),e=r.getShaderInfoLog(b).trim(),i=r.getShaderInfoLog(M).trim();let n=!0,s=!0;if(!1===r.getProgramParameter(f,35714)){n=!1;const e=tr(r,b,"vertex"),i=tr(r,M,"fragment");console.error("THREE.WebGLProgram: shader error: ",r.getError(),"35715",r.getProgramParameter(f,35715),"gl.getProgramInfoLog",t,e,i)}else""!==t?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",t):""!==e&&""!==i||(s=!1);s&&(this.diagnostics={runnable:n,programLog:t,vertexShader:{log:e,prefix:g},fragmentShader:{log:i,prefix:y}})}let w,_;return r.deleteShader(b),r.deleteShader(M),this.getUniforms=function(){return void 0===w&&(w=new Zn(r,f)),w},this.getAttributes=function(){return void 0===_&&(_=function(t,e){const i={},n=t.getProgramParameter(e,35721);for(let r=0;r<n;r++){const n=t.getActiveAttrib(e,r).name;i[n]=t.getAttribLocation(e,n)}return i}(r,f)),_},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(f),this.program=void 0},this.name=i.shaderName,this.id=Kn++,this.cacheKey=e,this.usedTimes=1,this.program=f,this.vertexShader=b,this.fragmentShader=M,this}function yr(t,e,i,n,r,s){const o=[],a=n.isWebGL2,h=n.logarithmicDepthBuffer,l=n.floatVertexTextures,c=n.maxVertexUniforms,u=n.vertexTextures;let p=n.precision;const d={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"},m=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","instancingColor","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","sheen","transmissionMap"];function f(t){let e;return t&&t.isTexture?e=t.encoding:t&&t.isWebGLRenderTarget?(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),e=t.texture.encoding):e=3e3,e}return{getParameters:function(r,o,m,g,y){const x=g.fog,v=r.isMeshStandardMaterial?g.environment:null,b=e.get(r.envMap||v),M=d[r.type],w=y.isSkinnedMesh?function(t){const e=t.skeleton.bones;if(l)return 1024;{const t=c,i=Math.floor((t-20)/4),n=Math.min(i,e.length);return n<e.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+e.length+" bones. This GPU supports "+n+"."),0):n}}(y):0;let _,S;if(null!==r.precision&&(p=n.getMaxPrecision(r.precision),p!==r.precision&&console.warn("THREE.WebGLProgram.getParameters:",r.precision,"not supported, using",p,"instead.")),M){const t=Oi[M];_=t.vertexShader,S=t.fragmentShader}else _=r.vertexShader,S=r.fragmentShader;const T=t.getRenderTarget();return{isWebGL2:a,shaderID:M,shaderName:r.type,vertexShader:_,fragmentShader:S,defines:r.defines,isRawShaderMaterial:!0===r.isRawShaderMaterial,glslVersion:r.glslVersion,precision:p,instancing:!0===y.isInstancedMesh,instancingColor:!0===y.isInstancedMesh&&null!==y.instanceColor,supportsVertexTextures:u,outputEncoding:null!==T?f(T.texture):t.outputEncoding,map:!!r.map,mapEncoding:f(r.map),matcap:!!r.matcap,matcapEncoding:f(r.matcap),envMap:!!b,envMapMode:b&&b.mapping,envMapEncoding:f(b),envMapCubeUV:!!b&&(306===b.mapping||307===b.mapping),lightMap:!!r.lightMap,lightMapEncoding:f(r.lightMap),aoMap:!!r.aoMap,emissiveMap:!!r.emissiveMap,emissiveMapEncoding:f(r.emissiveMap),bumpMap:!!r.bumpMap,normalMap:!!r.normalMap,objectSpaceNormalMap:1===r.normalMapType,tangentSpaceNormalMap:0===r.normalMapType,clearcoatMap:!!r.clearcoatMap,clearcoatRoughnessMap:!!r.clearcoatRoughnessMap,clearcoatNormalMap:!!r.clearcoatNormalMap,displacementMap:!!r.displacementMap,roughnessMap:!!r.roughnessMap,metalnessMap:!!r.metalnessMap,specularMap:!!r.specularMap,alphaMap:!!r.alphaMap,gradientMap:!!r.gradientMap,sheen:!!r.sheen,transmissionMap:!!r.transmissionMap,combine:r.combine,vertexTangents:r.normalMap&&r.vertexTangents,vertexColors:r.vertexColors,vertexUvs:!!(r.map||r.bumpMap||r.normalMap||r.specularMap||r.alphaMap||r.emissiveMap||r.roughnessMap||r.metalnessMap||r.clearcoatMap||r.clearcoatRoughnessMap||r.clearcoatNormalMap||r.displacementMap||r.transmissionMap),uvsVertexOnly:!(r.map||r.bumpMap||r.normalMap||r.specularMap||r.alphaMap||r.emissiveMap||r.roughnessMap||r.metalnessMap||r.clearcoatNormalMap||r.transmissionMap||!r.displacementMap),fog:!!x,useFog:r.fog,fogExp2:x&&x.isFogExp2,flatShading:r.flatShading,sizeAttenuation:r.sizeAttenuation,logarithmicDepthBuffer:h,skinning:r.skinning&&w>0,maxBones:w,useVertexTexture:l,morphTargets:r.morphTargets,morphNormals:r.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:r.dithering,shadowMapEnabled:t.shadowMap.enabled&&m.length>0,shadowMapType:t.shadowMap.type,toneMapping:r.toneMapped?t.toneMapping:0,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:r.premultipliedAlpha,alphaTest:r.alphaTest,doubleSided:2===r.side,flipSided:1===r.side,depthPacking:void 0!==r.depthPacking&&r.depthPacking,index0AttributeName:r.index0AttributeName,extensionDerivatives:r.extensions&&r.extensions.derivatives,extensionFragDepth:r.extensions&&r.extensions.fragDepth,extensionDrawBuffers:r.extensions&&r.extensions.drawBuffers,extensionShaderTextureLOD:r.extensions&&r.extensions.shaderTextureLOD,rendererExtensionFragDepth:a||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:a||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:a||i.has("EXT_shader_texture_lod"),customProgramCacheKey:r.customProgramCacheKey()}},getProgramCacheKey:function(e){const i=[];if(e.shaderID?i.push(e.shaderID):(i.push(e.fragmentShader),i.push(e.vertexShader)),void 0!==e.defines)for(const t in e.defines)i.push(t),i.push(e.defines[t]);if(!1===e.isRawShaderMaterial){for(let t=0;t<m.length;t++)i.push(e[m[t]]);i.push(t.outputEncoding),i.push(t.gammaFactor)}return i.push(e.customProgramCacheKey),i.join()},getUniforms:function(t){const e=d[t.type];let i;if(e){const t=Oi[e];i=Qt.clone(t.uniforms)}else i=t.uniforms;return i},acquireProgram:function(e,i){let n;for(let t=0,e=o.length;t<e;t++){const e=o[t];if(e.cacheKey===i){n=e,++n.usedTimes;break}}return void 0===n&&(n=new gr(t,i,e,r),o.push(n)),n},releaseProgram:function(t){if(0==--t.usedTimes){const e=o.indexOf(t);o[e]=o[o.length-1],o.pop(),t.destroy()}},programs:o}}function xr(){let t=new WeakMap;return{get:function(e){let i=t.get(e);return void 0===i&&(i={},t.set(e,i)),i},remove:function(e){t.delete(e)},update:function(e,i,n){t.get(e)[i]=n},dispose:function(){t=new WeakMap}}}function vr(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.program!==e.program?t.program.id-e.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function br(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function Mr(t){const e=[];let i=0;const n=[],r=[],s={id:-1};function o(n,r,o,a,h,l){let c=e[i];const u=t.get(o);return void 0===c?(c={id:n.id,object:n,geometry:r,material:o,program:u.program||s,groupOrder:a,renderOrder:n.renderOrder,z:h,group:l},e[i]=c):(c.id=n.id,c.object=n,c.geometry=r,c.material=o,c.program=u.program||s,c.groupOrder=a,c.renderOrder=n.renderOrder,c.z=h,c.group=l),i++,c}return{opaque:n,transparent:r,init:function(){i=0,n.length=0,r.length=0},push:function(t,e,i,s,a,h){const l=o(t,e,i,s,a,h);(!0===i.transparent?r:n).push(l)},unshift:function(t,e,i,s,a,h){const l=o(t,e,i,s,a,h);(!0===i.transparent?r:n).unshift(l)},finish:function(){for(let t=i,n=e.length;t<n;t++){const i=e[t];if(null===i.id)break;i.id=null,i.object=null,i.geometry=null,i.material=null,i.program=null,i.group=null}},sort:function(t,e){n.length>1&&n.sort(t||vr),r.length>1&&r.sort(e||br)}}}function wr(t){let e=new WeakMap;return{get:function(i,n){const r=e.get(i);let s;return void 0===r?(s=new Mr(t),e.set(i,new WeakMap),e.get(i).set(n,s)):(s=r.get(n),void 0===s&&(s=new Mr(t),r.set(n,s))),s},dispose:function(){e=new WeakMap}}}function _r(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let i;switch(e.type){case"DirectionalLight":i={direction:new d,color:new et};break;case"SpotLight":i={position:new d,direction:new d,color:new et,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new d,color:new et,distance:0,decay:0};break;case"HemisphereLight":i={direction:new d,skyColor:new et,groundColor:new et};break;case"RectAreaLight":i={color:new et,position:new d,halfWidth:new d,halfHeight:new d}}return t[e.id]=i,i}}}let Sr=0;function Tr(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function Er(t,e){const i=new _r,n=function(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let i;switch(e.type){case"DirectionalLight":case"SpotLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new s};break;case"PointLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new s,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=i,i}}}(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],spotPosition:[],rectArea:[],rectAreaTexture:[],rectShadowMap:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let t=0;t<9;t++)r.probe.push(new d);const o=new d,a=new k,h=new k;return{setup:function(s){let o=0,a=0,l=0;for(let t=0;t<9;t++)r.probe[t].set(0,0,0);let c=0,u=0,p=0,d=0,m=0,f=0,g=0,y=0;s.sort(Tr);for(let t=0,e=s.length;t<e;t++){const e=s[t],x=e.color,v=e.intensity,b=e.distance,M=e.shadow&&e.shadow.map?e.shadow.map.texture:null;if(e.isAmbientLight)o+=x.r*v,a+=x.g*v,l+=x.b*v;else if(e.isLightProbe)for(let t=0;t<9;t++)r.probe[t].addScaledVector(e.sh.coefficients[t],v);else if(e.isDirectionalLight){const t=i.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity),e.castShadow){const t=e.shadow,i=n.get(e);i.shadowBias=t.bias,i.shadowNormalBias=t.normalBias,i.shadowRadius=t.radius,i.shadowMapSize=t.mapSize,r.directionalShadow[c]=i,r.directionalShadowMap[c]=M,r.directionalShadowMatrix[c]=e.shadow.matrix,f++}r.directional[c]=t,c++}else if(e.isSpotLight){const t=i.get(e);if(t.position.setFromMatrixPosition(e.matrixWorld),t.color.copy(x).multiplyScalar(v),t.distance=b,t.coneCos=Math.cos(e.angle),t.penumbraCos=Math.cos(e.angle*(1-e.penumbra)),t.decay=e.decay,e.castShadow){const t=e.shadow,i=n.get(e);i.shadowBias=t.bias,i.shadowNormalBias=t.normalBias,i.shadowRadius=t.radius,i.shadowMapSize=t.mapSize,r.spotShadow[p]=i,r.spotShadowMap[p]=M,r.spotShadowMatrix[p]=e.shadow.matrix,y++}r.spotPosition[p]=t.position,r.spot[p]=t,p++}else if(e.isRectAreaLight){const t=i.get(e);t.color.copy(x).multiplyScalar(v),t.halfWidth.set(.5*e.width,0,0),t.halfHeight.set(0,.5*e.height,0),t.halfWidth.applyMatrix4(h),t.halfHeight.applyMatrix4(h),t.shadow=e.castShadow,e.castShadow&&(r.rectShadowMap[d]=M),t.useAreaTexture=!1,e.areaTexture&&(t.useAreaTexture=!0),r.rectArea[d]=t,r.rectAreaTexture[d]=e.areaTexture,d++}else if(e.isPointLight){const t=i.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity),t.distance=e.distance,t.decay=e.decay,e.castShadow){const t=e.shadow,i=n.get(e);i.shadowBias=t.bias,i.shadowNormalBias=t.normalBias,i.shadowRadius=t.radius,i.shadowMapSize=t.mapSize,i.shadowCameraNear=t.camera.near,i.shadowCameraFar=t.camera.far,r.pointShadow[u]=i,r.pointShadowMap[u]=M,r.pointShadowMatrix[u]=e.shadow.matrix,g++}r.point[u]=t,u++}else if(e.isHemisphereLight){const t=i.get(e);t.skyColor.copy(e.color).multiplyScalar(v),t.groundColor.copy(e.groundColor).multiplyScalar(v),r.hemi[m]=t,m++}}d>0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(r.rectAreaLTC1=Ci.LTC_FLOAT_1,r.rectAreaLTC2=Ci.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=Ci.LTC_HALF_1,r.rectAreaLTC2=Ci.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=o,r.ambient[1]=a,r.ambient[2]=l;const x=r.hash;x.directionalLength===c&&x.pointLength===u&&x.spotLength===p&&x.rectAreaLength===d&&x.hemiLength===m&&x.numDirectionalShadows===f&&x.numPointShadows===g&&x.numSpotShadows===y||(r.directional.length=c,r.spot.length=p,r.rectArea.length=d,r.point.length=u,r.hemi.length=m,r.directionalShadow.length=f,r.directionalShadowMap.length=f,r.pointShadow.length=g,r.pointShadowMap.length=g,r.spotShadow.length=y,r.spotShadowMap.length=y,r.directionalShadowMatrix.length=f,r.pointShadowMatrix.length=g,r.spotShadowMatrix.length=y,x.directionalLength=c,x.pointLength=u,x.spotLength=p,x.rectAreaLength=d,x.hemiLength=m,x.numDirectionalShadows=f,x.numPointShadows=g,x.numSpotShadows=y,r.version=Sr++)},setupView:function(t,e){let i=0,n=0,s=0,l=0,c=0;const u=e.matrixWorldInverse;for(let e=0,p=t.length;e<p;e++){const p=t[e];if(p.isDirectionalLight){const t=r.directional[i];t.direction.setFromMatrixPosition(p.matrixWorld),o.setFromMatrixPosition(p.target.matrixWorld),t.direction.sub(o),t.direction.transformDirection(u),i++}else if(p.isSpotLight){const t=r.spot[s];t.position.setFromMatrixPosition(p.matrixWorld),t.position.applyMatrix4(u),t.direction.setFromMatrixPosition(p.matrixWorld),o.setFromMatrixPosition(p.target.matrixWorld),t.direction.sub(o),t.direction.transformDirection(u),s++}else if(p.isRectAreaLight){const t=r.rectArea[l];t.position.setFromMatrixPosition(p.matrixWorld),t.position.applyMatrix4(u),h.identity(),a.copy(p.matrixWorld),a.premultiply(u),h.extractRotation(a),t.halfWidth.set(.5*p.width,0,0),t.halfHeight.set(0,.5*p.height,0),t.halfWidth.applyMatrix4(h),t.halfHeight.applyMatrix4(h),l++}else if(p.isPointLight){const t=r.point[n];t.position.setFromMatrixPosition(p.matrixWorld),t.position.applyMatrix4(u),n++}else if(p.isHemisphereLight){const t=r.hemi[c];t.direction.setFromMatrixPosition(p.matrixWorld),t.direction.transformDirection(u),t.direction.normalize(),c++}}},state:r}}function Ar(t,e){const i=new Er(t,e),n=[],r=[];return{init:function(){n.length=0,r.length=0},state:{lightsArray:n,shadowsArray:r,lights:i},setupLights:function(){i.setup(n)},setupLightsView:function(t){i.setupView(n,t)},pushLight:function(t){n.push(t)},pushShadow:function(t){r.push(t)}}}function Lr(t,e){let i=new WeakMap;return{get:function(n,r=0){let s;return!1===i.has(n)?(s=new Ar(t,e),i.set(n,[]),i.get(n).push(s)):r>=i.get(n).length?(s=new Ar(t,e),i.get(n).push(s)):s=i.get(n)[r],s},dispose:function(){i=new WeakMap}}}function Rr(t){Jt.call(this),this.type="MeshDepthMaterial",this.depthPacking=3200,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(t)}function Pr(t){Jt.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new d,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(t)}Rr.prototype=Object.create(Jt.prototype),Rr.prototype.constructor=Rr,Rr.prototype.isMeshDepthMaterial=!0,Rr.prototype.copy=function(t){return Jt.prototype.copy.call(this,t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},Pr.prototype=Object.create(Jt.prototype),Pr.prototype.constructor=Pr,Pr.prototype.isMeshDistanceMaterial=!0,Pr.prototype.copy=function(t){return Jt.prototype.copy.call(this,t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this};var Cr=_rsl.vsm_frag,Or=_rsl.vsm_vert;function zr(t,e,i){let n=new I;const r=new s,o=new s,a=new J,h=[],l=[],c={},u={0:1,1:0,2:2},p=new te({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new s},radius:{value:4}},vertexShader:Or,fragmentShader:Cr}),d=p.clone();d.defines.HORIZONTAL_PASS=1;const m=new jt;m.setAttribute("position",new ot(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const f=new Ie(m,p),g=this;function y(i,n){const r=e.update(f);p.uniforms.shadow_pass.value=i.map.texture,p.uniforms.resolution.value=i.mapSize,p.uniforms.radius.value=i.radius,t.setRenderTarget(i.mapPass),t.clear(),t.renderBufferDirect(n,null,r,p,f,null),d.uniforms.shadow_pass.value=i.mapPass.texture,d.uniforms.resolution.value=i.mapSize,d.uniforms.radius.value=i.radius,t.setRenderTarget(i.map),t.clear(),t.renderBufferDirect(n,null,r,d,f,null)}function x(t,e,i){const n=t<<0|e<<1|i<<2;let r=h[n];return void 0===r&&(r=new Rr({depthPacking:3201,morphTargets:t,skinning:e}),h[n]=r),r}function v(t,e,i){const n=t<<0|e<<1|i<<2;let r=l[n];return void 0===r&&(r=new Pr({morphTargets:t,skinning:e}),l[n]=r),r}function b(e,i,n,r,s,o,a){let h=null,l=x,p=e.customDepthMaterial;if(!0===r.isPointLight&&(l=v,p=e.customDistanceMaterial),void 0===p){let t=!1;!0===n.morphTargets&&(t=i.morphAttributes&&i.morphAttributes.position&&i.morphAttributes.position.length>0);let r=!1;!0===e.isSkinnedMesh&&(!0===n.skinning?r=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e)),h=l(t,r,!0===e.isInstancedMesh)}else h=p;if(t.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length){const t=h.uuid,e=n.uuid;let i=c[t];void 0===i&&(i={},c[t]=i);let r=i[e];void 0===r&&(r=h.clone(),i[e]=r),h=r}return h.visible=n.visible,h.wireframe=n.wireframe,h.side=3===a?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:u[n.side],h.clipShadows=n.clipShadows,h.clippingPlanes=n.clippingPlanes,h.clipIntersection=n.clipIntersection,h.wireframeLinewidth=n.wireframeLinewidth,h.linewidth=n.linewidth,!0===r.isPointLight&&!0===h.isMeshDistanceMaterial&&(h.referencePosition.setFromMatrixPosition(r.matrixWorld),h.nearDistance=s,h.farDistance=o),h}function M(i,r,s,o,a){if(!1===i.visible)return;if(i.layers.test(r.layers)&&(i.isMesh||i.isLine||i.isPoints)&&(i.castShadow||i.receiveShadow&&3===a)&&(!i.frustumCulled||n.intersectsObject(i))){i.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,i.matrixWorld);const n=e.update(i),r=i.material;if(Array.isArray(r)){const e=n.groups;for(let h=0,l=e.length;h<l;h++){const l=e[h],c=r[l.materialIndex];if(c&&c.visible){const e=b(i,n,c,o,s.near,s.far,a);t.renderBufferDirect(s,null,n,e,i,l)}}}else if(r.visible){const e=b(i,n,r,o,s.near,s.far,a);t.renderBufferDirect(s,null,n,e,i,null)}}const h=i.children;for(let t=0,e=h.length;t<e;t++)M(h[t],r,s,o,a)}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.render=function(e,s,h){if(!1===g.enabled)return;if(!1===g.autoUpdate&&!1===g.needsUpdate)return;if(0===e.length)return;const l=t.getRenderTarget(),c=t.getActiveCubeFace(),u=t.getActiveMipmapLevel(),p=t.state;p.setBlending(0),p.buffers.color.setClear(1,1,1,1),p.buffers.depth.setTest(!0),p.setScissorTest(!1);for(let l=0,c=e.length;l<c;l++){var d=e[l];if(d.isRectAreaLight)continue;var m=d.shadow;if(void 0===m){console.warn("THREE.WebGLShadowMap:",d,"has no shadow.");continue}if(!1===m.autoUpdate&&!1===m.needsUpdate)continue;r.copy(m.mapSize);const c=m.getFrameExtents();if(r.multiply(c),o.copy(m.mapSize),(r.x>i||r.y>i)&&(r.x>i&&(o.x=Math.floor(i/c.x),r.x=o.x*c.x,m.mapSize.x=o.x),r.y>i&&(o.y=Math.floor(i/c.y),r.y=o.y*c.y,m.mapSize.y=o.y)),null===m.map&&!m.isPointLightShadow&&3===this.type){const t={minFilter:1006,magFilter:1006,format:1023};m.map=new Gi(r.x,r.y,t),m.map.texture.name=d.name+".shadowMap",m.mapPass=new Gi(r.x,r.y,t),m.camera.updateProjectionMatrix()}if(null===m.map){const t={minFilter:1003,magFilter:1003,format:1023};m.map=new Gi(r.x,r.y,t),m.map.texture.name=d.name+".shadowMap",m.camera.updateProjectionMatrix()}t.setRenderTarget(m.map),t.clear();const u=m.getViewportCount();for(let t=0;t<u;t++){const e=m.getViewport(t);a.set(o.x*e.x,o.y*e.y,o.x*e.z,o.y*e.w),p.viewport(a),m.updateMatrices(d,t),n=m.getFrustum(),M(s,h,m.camera,d,this.type)}m.isPointLightShadow||3!==this.type||y(m,h),m.needsUpdate=!1}g.needsUpdate=!1,t.setRenderTarget(l,c,u)}}function Nr(t,e,i){const n=i.isWebGL2,r=new function(){let e=!1;const i=new J;let n=null;const r=new J(0,0,0,0);return{setMask:function(i){n===i||e||(t.colorMask(i,i,i,i),n=i)},setLocked:function(t){e=t},setClear:function(e,n,s,o,a){!0===a&&(e*=o,n*=o,s*=o),i.set(e,n,s,o),!1===r.equals(i)&&(t.clearColor(e,n,s,o),r.copy(i))},reset:function(){e=!1,n=null,r.set(-1,0,0,0)}}},s=new function(){let e=!1,i=null,n=null,r=null;return{setTest:function(t){t?z(2929):N(2929)},setMask:function(n){i===n||e||(t.depthMask(n),i=n)},setFunc:function(e){if(n!==e){if(e)switch(e){case 0:t.depthFunc(512);break;case 1:t.depthFunc(519);break;case 2:t.depthFunc(513);break;case 3:t.depthFunc(515);break;case 4:t.depthFunc(514);break;case 5:t.depthFunc(518);break;case 6:t.depthFunc(516);break;case 7:t.depthFunc(517);break;default:t.depthFunc(515)}else t.depthFunc(515);n=e}},setLocked:function(t){e=t},setClear:function(e){r!==e&&(t.clearDepth(e),r=e)},reset:function(){e=!1,i=null,n=null,r=null}}},o=new function(){let e=!1,i=null,n=null,r=null,s=null,o=null,a=null,h=null,l=null;return{setTest:function(t){e||(t?z(2960):N(2960))},setMask:function(n){i===n||e||(t.stencilMask(n),i=n)},setFunc:function(e,i,o){n===e&&r===i&&s===o||(t.stencilFunc(e,i,o),n=e,r=i,s=o)},setOp:function(e,i,n){o===e&&a===i&&h===n||(t.stencilOp(e,i,n),o=e,a=i,h=n)},setLocked:function(t){e=t},setClear:function(e){l!==e&&(t.clearStencil(e),l=e)},reset:function(){e=!1,i=null,n=null,r=null,s=null,o=null,a=null,h=null,l=null}}};let a={},h=null,l=null,c=null,u=null,p=null,d=null,m=null,f=null,g=null,y=!1,x=null,v=null,b=null,M=null,w=null;const _=t.getParameter(35661);let S=!1,T=0;const E=t.getParameter(7938);-1!==E.indexOf("WebGL")?(T=parseFloat(/^WebGL (\d)/.exec(E)[1]),S=T>=1):-1!==E.indexOf("OpenGL ES")&&(T=parseFloat(/^OpenGL ES (\d)/.exec(E)[1]),S=T>=2);let A=null,L={};const R=new J,P=new J;function C(e,i,n){const r=new Uint8Array(4),s=t.createTexture();t.bindTexture(e,s),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(let e=0;e<n;e++)t.texImage2D(i+e,0,6408,1,1,0,6408,5121,r);return s}const O={};function z(e){!0!==a[e]&&(t.enable(e),a[e]=!0)}function N(e){!1!==a[e]&&(t.disable(e),a[e]=!1)}O[3553]=C(3553,3553,1),O[34067]=C(34067,34069,6),r.setClear(0,0,0,1),s.setClear(1),o.setClear(0),z(2929),s.setFunc(3),G(!1),I(1),z(2884),D(0);const B={100:32774,101:32778,102:32779};if(n)B[103]=32775,B[104]=32776;else{const t=e.get("EXT_blend_minmax");null!==t&&(B[103]=t.MIN_EXT,B[104]=t.MAX_EXT)}const F={200:0,201:1,202:768,204:770,210:776,208:774,206:772,203:769,205:771,209:775,207:773};function D(e,i,n,r,s,o,a,h){if(0!==e){if(l||(z(3042),l=!0),5===e)s=s||i,o=o||n,a=a||r,i===u&&s===m||(t.blendEquationSeparate(B[i],B[s]),u=i,m=s),n===p&&r===d&&o===f&&a===g||(t.blendFuncSeparate(F[n],F[r],F[o],F[a]),p=n,d=r,f=o,g=a),c=e,y=null;else if(e!==c||h!==y){if(100===u&&100===m||(t.blendEquation(32774),u=100,m=100),h)switch(e){case 1:t.blendFuncSeparate(1,771,1,771);break;case 2:t.blendFunc(1,1);break;case 3:t.blendFuncSeparate(0,0,769,771);break;case 4:t.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case 1:t.blendFuncSeparate(770,771,1,771);break;case 2:t.blendFunc(770,1);break;case 3:t.blendFunc(0,769);break;case 4:t.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}p=null,d=null,f=null,g=null,c=e,y=h}}else l&&(N(3042),l=!1)}function G(e){x!==e&&(e?t.frontFace(2304):t.frontFace(2305),x=e)}function I(e){0!==e?(z(2884),e!==v&&(1===e?t.cullFace(1029):2===e?t.cullFace(1028):t.cullFace(1032))):N(2884),v=e}function k(e,i,n){e?(z(32823),M===i&&w===n||(t.polygonOffset(i,n),M=i,w=n)):N(32823)}function U(e){void 0===e&&(e=33984+_-1),A!==e&&(t.activeTexture(e),A=e)}return{buffers:{color:r,depth:s,stencil:o},enable:z,disable:N,useProgram:function(e){return h!==e&&(t.useProgram(e),h=e,!0)},setBlending:D,setMaterial:function(t,e){2===t.side?N(2884):z(2884);let i=1===t.side;e&&(i=!i),G(i),1===t.blending&&!1===t.transparent?D(0):D(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),r.setMask(t.colorWrite);const n=t.stencilWrite;o.setTest(n),n&&(o.setMask(t.stencilWriteMask),o.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),o.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),k(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)},setFlipSided:G,setCullFace:I,setLineWidth:function(e){e!==b&&(S&&t.lineWidth(e),b=e)},setPolygonOffset:k,setScissorTest:function(t){t?z(3089):N(3089)},activeTexture:U,bindTexture:function(e,i){null===A&&U();let n=L[A];void 0===n&&(n={type:void 0,texture:void 0},L[A]=n),n.type===e&&n.texture===i||(t.bindTexture(e,i||O[e]),n.type=e,n.texture=i)},unbindTexture:function(){const e=L[A];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage3D:function(){try{t.texImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(e){!1===R.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),R.copy(e))},viewport:function(e){!1===P.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),P.copy(e))},reset:function(){a={},A=null,L={},h=null,l=null,c=null,u=null,p=null,d=null,m=null,f=null,g=null,y=!1,x=null,v=null,b=null,M=null,w=null,r.reset(),s.reset(),o.reset()}}}function Br(t,e,i,r,s,o,a){const h=s.isWebGL2,l=s.maxTextures,c=s.maxCubemapSize,u=s.maxTextureSize,p=s.maxSamples,d=new WeakMap;let m,f=!1;try{f="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(t){}function g(t,e){return f?new OffscreenCanvas(t,e):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function y(t,e,i,r){let s=1;if((t.width>r||t.height>r)&&(s=r/Math.max(t.width,t.height)),s<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const r=e?n.floorPowerOfTwo:Math.floor,o=r(s*t.width),a=r(s*t.height);void 0===m&&(m=g(o,a));const h=i?g(o,a):m;return h.width=o,h.height=a,h.getContext("2d").drawImage(t,0,0,o,a),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+o+"x"+a+")."),h}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function x(t){return n.isPowerOfTwo(t.width)&&n.isPowerOfTwo(t.height)}function v(t,e){return t.generateMipmaps&&e&&1003!==t.minFilter&&1006!==t.minFilter}function b(e,i,n,s){t.generateMipmap(e),r.get(i).__maxMipLevel=Math.log(Math.max(n,s))*Math.LOG2E}function M(i,n,r){if(!1===h)return n;if(null!==i){if(void 0!==t[i])return t[i];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+i+"'")}let s=n;return 6403===n&&(5126===r&&(s=33326),5131===r&&(s=33325),5121===r&&(s=33321)),6407===n&&(5126===r&&(s=34837),5131===r&&(s=34843),5121===r&&(s=32849)),6408===n&&(5126===r&&(s=34836),5131===r&&(s=34842),5121===r&&(s=32856)),33325!==s&&33326!==s&&34842!==s&&34836!==s||e.get("EXT_color_buffer_float"),s}function w(t){return 1003===t||1004===t||1005===t?9728:9729}function _(e){const i=e.target;i.removeEventListener("dispose",_),function(e){const i=r.get(e);void 0!==i.__webglInit&&(t.deleteTexture(i.__webglTexture),r.remove(e))}(i),i.isVideoTexture&&d.delete(i),a.memory.textures--}function S(e){const i=e.target;i.removeEventListener("dispose",S),function(e){const i=r.get(e),n=r.get(e.texture);if(e){if(void 0!==n.__webglTexture&&t.deleteTexture(n.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++)t.deleteFramebuffer(i.__webglFramebuffer[e]),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer[e]);else t.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&t.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer&&t.deleteRenderbuffer(i.__webglColorRenderbuffer),i.__webglDepthRenderbuffer&&t.deleteRenderbuffer(i.__webglDepthRenderbuffer);r.remove(e.texture),r.remove(e)}}(i),a.memory.textures--}let T=0;function E(t,e){const n=r.get(t);if(t.isVideoTexture&&function(t){const e=a.render.frame;d.get(t)!==e&&(d.set(t,e),t.update())}(t),t.version>0&&n.__version!==t.version){const i=t.image;if(void 0===i)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==i.complete)return void O(n,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.__maxMipLevel=t.maxLod?t.maxLod:t.mipmaps.length-1,n.__maxCubeSize=t.image?t.image.width:1,i.activeTexture(33984+e),i.bindTexture(3553,n.__webglTexture)}function A(e,n){const s=r.get(e);e.version>0&&s.__version!==e.version?function(e,n,r){if(6!==n.image.length)return;C(e,n),i.activeTexture(33984+r),i.bindTexture(34067,e.__webglTexture),t.pixelStorei(37440,n.flipY);const s=n&&(n.isCompressedTexture||n.image[0].isCompressedTexture),a=n.image[0]&&n.image[0].isDataTexture,l=[];for(let t=0;t<6;t++)l[t]=s||a?a?n.image[t].image:n.image[t]:y(n.image[t],!1,!0,c);const u=l[0],p=x(u)||h,d=o.convert(n.format),m=o.convert(n.type),f=M(n.internalFormat,d,m);let g;if(P(34067,n,p),s){for(let t=0;t<6;t++){g=l[t].mipmaps;for(let e=0;e<g.length;e++){const r=g[e];1023!==n.format&&1022!==n.format?null!==d?i.compressedTexImage2D(34069+t,e,f,r.width,r.height,0,r.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):i.texImage2D(34069+t,e,f,r.width,r.height,0,d,m,r.data)}}e.__maxMipLevel=g.length-1}else{g=n.mipmaps;for(let t=0;t<6;t++)if(a){i.texImage2D(34069+t,0,f,l[t].width,l[t].height,0,d,m,l[t].data);for(let e=0;e<g.length;e++){const n=g[e].image[t].image;i.texImage2D(34069+t,e+1,f,n.width,n.height,0,d,m,n.data)}}else{i.texImage2D(34069+t,0,f,d,m,l[t]);for(let e=0;e<g.length;e++){const n=g[e];i.texImage2D(34069+t,e+1,f,d,m,n.image[t])}}e.__maxMipLevel=n.maxLod>0?n.maxLod:g.length,e.__maxCubeSize=u.width}v(n,p)&&b(34067,n,u.width,u.height),e.__version=n.version,n.onUpdate&&n.onUpdate(n)}(s,e,n):(i.activeTexture(33984+n),i.bindTexture(34067,s.__webglTexture))}const L={1e3:10497,1001:33071,1002:33648},R={1003:9728,1004:9984,1005:9986,1006:9729,1007:9985,1008:9987};function P(i,n,o){o?(t.texParameteri(i,10242,L[n.wrapS]),t.texParameteri(i,10243,L[n.wrapT]),32879!==i&&35866!==i||t.texParameteri(i,32882,L[n.wrapR]),t.texParameteri(i,10240,R[n.magFilter]),t.texParameteri(i,10241,R[n.minFilter])):(t.texParameteri(i,10242,33071),t.texParameteri(i,10243,33071),32879!==i&&35866!==i||t.texParameteri(i,32882,33071),1001===n.wrapS&&1001===n.wrapT||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(i,10240,w(n.magFilter)),t.texParameteri(i,10241,w(n.minFilter)),1003!==n.minFilter&&1006!==n.minFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter."));const a=e.get("EXT_texture_filter_anisotropic");if(a){if(1015===n.type&&null===e.get("OES_texture_float_linear"))return;if(1016===n.type&&null===(h||e.get("OES_texture_half_float_linear")))return;(n.anisotropy>1||r.get(n).__currentAnisotropy)&&(t.texParameterf(i,a.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(n.anisotropy,s.getMaxAnisotropy())),r.get(n).__currentAnisotropy=n.anisotropy)}}function C(e,i){void 0===e.__webglInit&&(e.__webglInit=!0,i.addEventListener("dispose",_),e.__webglTexture=t.createTexture(),a.memory.textures++)}function O(e,n,r){let s=3553;n.isDataTexture2DArray&&(s=35866),n.isDataTexture3D&&(s=32879),C(e,n),i.activeTexture(33984+r),i.bindTexture(s,e.__webglTexture),t.pixelStorei(37440,n.flipY),t.pixelStorei(37441,n.premultiplyAlpha),t.pixelStorei(3317,n.unpackAlignment);const a=function(t){return!h&&(1001!==t.wrapS||1001!==t.wrapT||1003!==t.minFilter&&1006!==t.minFilter)}(n)&&!1===x(n.image),l=y(n.image,a,!1,u),c=x(l)||h,p=o.convert(n.format);let d,m=o.convert(n.type),f=M(n.internalFormat,p,m);P(s,n,c);const g=n.mipmaps;if(n.isDepthTexture)f=6402,h?f=1015===n.type?36012:1014===n.type?33190:1020===n.type?35056:33189:1015===n.type&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),1026===n.format&&6402===f&&1012!==n.type&&1014!==n.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),n.type=1012,m=o.convert(n.type)),1027===n.format&&6402===f&&(f=34041,1020!==n.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),n.type=1020,m=o.convert(n.type))),i.texImage2D(3553,0,f,l.width,l.height,0,p,m,null);else if(n.isDataTexture)if(g.length>0&&c){for(let t=0,e=g.length;t<e;t++)d=g[t],i.texImage2D(3553,t,f,d.width,d.height,0,p,m,d.data);n.generateMipmaps=!1,e.__maxMipLevel=g.length-1}else i.texImage2D(3553,0,f,l.width,l.height,0,p,m,l.data),e.__maxMipLevel=0;else if(n.isCompressedTexture){for(let t=0,e=g.length;t<e;t++)d=g[t],1023!==n.format&&1022!==n.format?null!==p?i.compressedTexImage2D(3553,t,f,d.width,d.height,0,d.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):i.texImage2D(3553,t,f,d.width,d.height,0,p,m,d.data);e.__maxMipLevel=g.length-1}else if(n.isDataTexture2DArray)i.texImage3D(35866,0,f,l.width,l.height,l.depth,0,p,m,l.data),e.__maxMipLevel=0;else if(n.isDataTexture3D)i.texImage3D(32879,0,f,l.width,l.height,l.depth,0,p,m,l.data),e.__maxMipLevel=0;else if(g.length>0&&c){for(let t=0,e=g.length;t<e;t++)d=g[t],i.texImage2D(3553,t,f,p,m,d);n.generateMipmaps=!1,e.__maxMipLevel=g.length-1}else i.texImage2D(3553,0,f,p,m,l),e.__maxMipLevel=0;v(n,c)&&b(s,n,l.width,l.height),e.__version=n.version,n.onUpdate&&n.onUpdate(n)}function z(e,n,s,a){const h=o.convert(n.texture.format),l=o.convert(n.texture.type),c=M(n.texture.internalFormat,h,l);i.texImage2D(a,0,c,n.width,n.height,0,h,l,null),t.bindFramebuffer(36160,e),t.framebufferTexture2D(36160,s,a,r.get(n.texture).__webglTexture,0),t.bindFramebuffer(36160,null)}function N(e,i,n){if(t.bindRenderbuffer(36161,e),i.depthBuffer&&!i.stencilBuffer){let r=33189;if(n){const e=i.depthTexture;e&&e.isDepthTexture&&(1015===e.type?r=36012:1014===e.type&&(r=33190));const n=B(i);t.renderbufferStorageMultisample(36161,n,r,i.width,i.height)}else t.renderbufferStorage(36161,r,i.width,i.height);t.framebufferRenderbuffer(36160,36096,36161,e)}else if(i.depthBuffer&&i.stencilBuffer){if(n){const e=B(i);t.renderbufferStorageMultisample(36161,e,35056,i.width,i.height)}else t.renderbufferStorage(36161,34041,i.width,i.height);t.framebufferRenderbuffer(36160,33306,36161,e)}else{const e=o.convert(i.texture.format),r=o.convert(i.texture.type),s=M(i.texture.internalFormat,e,r);if(n){const e=B(i);t.renderbufferStorageMultisample(36161,e,s,i.width,i.height)}else t.renderbufferStorage(36161,s,i.width,i.height)}t.bindRenderbuffer(36161,null)}function B(t){return h&&t.isWebGLMultisampleRenderTarget?Math.min(p,t.samples):0}let F=!1,D=!1;this.allocateTextureUnit=function(){const t=T;return t>=l&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+l),T+=1,t},this.resetTextureUnits=function(){T=0},this.setTexture2D=E,this.setTexture2DArray=function(t,e){const n=r.get(t);t.version>0&&n.__version!==t.version?O(n,t,e):(i.activeTexture(33984+e),i.bindTexture(35866,n.__webglTexture))},this.setTexture3D=function(t,e){const n=r.get(t);t.version>0&&n.__version!==t.version?O(n,t,e):(i.activeTexture(33984+e),i.bindTexture(32879,n.__webglTexture))},this.setTextureCube=A,this.setupRenderTarget=function(e){const n=r.get(e),s=r.get(e.texture);e.addEventListener("dispose",S),s.__webglTexture=t.createTexture(),a.memory.textures++;const l=!0===e.isWebGLCubeRenderTarget,c=!0===e.isWebGLMultisampleRenderTarget,u=x(e)||h;if(!h||1022!==e.texture.format||1015!==e.texture.type&&1016!==e.texture.type||(e.texture.format=1023,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),l){n.__webglFramebuffer=[];for(let e=0;e<6;e++)n.__webglFramebuffer[e]=t.createFramebuffer()}else if(n.__webglFramebuffer=t.createFramebuffer(),c)if(h){n.__webglMultisampledFramebuffer=t.createFramebuffer(),n.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,n.__webglColorRenderbuffer);const i=o.convert(e.texture.format),r=o.convert(e.texture.type),s=M(e.texture.internalFormat,i,r),a=B(e);t.renderbufferStorageMultisample(36161,a,s,e.width,e.height),t.bindFramebuffer(36160,n.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,n.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),e.depthBuffer&&(n.__webglDepthRenderbuffer=t.createRenderbuffer(),N(n.__webglDepthRenderbuffer,e,!0)),t.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(l){i.bindTexture(34067,s.__webglTexture),P(34067,e.texture,u);for(let t=0;t<6;t++)z(n.__webglFramebuffer[t],e,36064,34069+t);v(e.texture,u)&&b(34067,e.texture,e.width,e.height),i.bindTexture(34067,null)}else i.bindTexture(3553,s.__webglTexture),P(3553,e.texture,u),z(n.__webglFramebuffer,e,36064,3553),v(e.texture,u)&&b(3553,e.texture,e.width,e.height),i.bindTexture(3553,null);e.depthBuffer&&function(e){const i=r.get(e),n=!0===e.isWebGLCubeRenderTarget;if(e.depthTexture){if(n)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,i){if(i&&i.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,e),!i.depthTexture||!i.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");r.get(i.depthTexture).__webglTexture&&i.depthTexture.image.width===i.width&&i.depthTexture.image.height===i.height||(i.depthTexture.image.width=i.width,i.depthTexture.image.height=i.height,i.depthTexture.needsUpdate=!0),E(i.depthTexture,0);const n=r.get(i.depthTexture).__webglTexture;if(1026===i.depthTexture.format)t.framebufferTexture2D(36160,36096,3553,n,0);else{if(1027!==i.depthTexture.format)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(36160,33306,3553,n,0)}}(i.__webglFramebuffer,e)}else if(n){i.__webglDepthbuffer=[];for(let n=0;n<6;n++)t.bindFramebuffer(36160,i.__webglFramebuffer[n]),i.__webglDepthbuffer[n]=t.createRenderbuffer(),N(i.__webglDepthbuffer[n],e,!1)}else t.bindFramebuffer(36160,i.__webglFramebuffer),i.__webglDepthbuffer=t.createRenderbuffer(),N(i.__webglDepthbuffer,e,!1);t.bindFramebuffer(36160,null)}(e)},this.updateRenderTargetMipmap=function(t){const e=t.texture;if(v(e,x(t)||h)){const n=t.isWebGLCubeRenderTarget?34067:3553,s=r.get(e).__webglTexture;i.bindTexture(n,s),b(n,e,t.width,t.height),i.bindTexture(n,null)}},this.updateMultisampleRenderTarget=function(e){if(e.isWebGLMultisampleRenderTarget)if(h){const i=r.get(e);t.bindFramebuffer(36008,i.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,i.__webglFramebuffer);const n=e.width,s=e.height;let o=16384;e.depthBuffer&&(o|=256),e.stencilBuffer&&(o|=1024),t.blitFramebuffer(0,0,n,s,0,0,n,s,o,9728),t.bindFramebuffer(36160,i.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(t,e){t&&t.isWebGLRenderTarget&&(!1===F&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),F=!0),t=t.texture),E(t,e)},this.safeSetTextureCube=function(t,e){t&&t.isWebGLCubeRenderTarget&&(!1===D&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),D=!0),t=t.texture),A(t,e)}}function Fr(t,e,i){const n=i.isWebGL2;return{convert:function(t){let i;if(1009===t)return 5121;if(1017===t)return 32819;if(1018===t)return 32820;if(1019===t)return 33635;if(1010===t)return 5120;if(1011===t)return 5122;if(1012===t)return 5123;if(1013===t)return 5124;if(1014===t)return 5125;if(1015===t)return 5126;if(1016===t)return n?5131:(i=e.get("OES_texture_half_float"),null!==i?i.HALF_FLOAT_OES:null);if(1021===t)return 6406;if(1022===t)return 6407;if(1023===t)return 6408;if(1024===t)return 6409;if(1025===t)return 6410;if(1026===t)return 6402;if(1027===t)return 34041;if(1028===t)return 6403;if(1029===t)return 36244;if(1030===t)return 33319;if(1031===t)return 33320;if(1032===t)return 36248;if(1033===t)return 36249;if(33776===t||33777===t||33778===t||33779===t){if(i=e.get("WEBGL_compressed_texture_s3tc"),null===i)return null;if(33776===t)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===t)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===t)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===t)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===t||35841===t||35842===t||35843===t){if(i=e.get("WEBGL_compressed_texture_pvrtc"),null===i)return null;if(35840===t)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===t)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===t)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===t)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===t)return i=e.get("WEBGL_compressed_texture_etc1"),null!==i?i.COMPRESSED_RGB_ETC1_WEBGL:null;if((37492===t||37496===t)&&(i=e.get("WEBGL_compressed_texture_etc"),null!==i)){if(37492===t)return i.COMPRESSED_RGB8_ETC2;if(37496===t)return i.COMPRESSED_RGBA8_ETC2_EAC}return 37808===t||37809===t||37810===t||37811===t||37812===t||37813===t||37814===t||37815===t||37816===t||37817===t||37818===t||37819===t||37820===t||37821===t||37840===t||37841===t||37842===t||37843===t||37844===t||37845===t||37846===t||37847===t||37848===t||37849===t||37850===t||37851===t||37852===t||37853===t?(i=e.get("WEBGL_compressed_texture_astc"),null!==i?t:null):36492===t?(i=e.get("EXT_texture_compression_bptc"),null!==i?t:null):1020===t?n?34042:(i=e.get("WEBGL_depth_texture"),null!==i?i.UNSIGNED_INT_24_8_WEBGL:null):void 0}}}function Dr(t=[]){ki.call(this),this.cameras=t}function Gr(){Bt.call(this),this.type="Group"}function Ir(){this._targetRay=null,this._grip=null,this._hand=null}function kr(t,e){const i=this;let n=null,r=1,s=null,o="local-floor",a=null;const h=[],l=new Map,c=new ki;c.layers.enable(1),c.viewport=new J;const u=new ki;u.layers.enable(2),u.viewport=new J;const p=[c,u],m=new Dr;m.layers.enable(1),m.layers.enable(2);let f=null,g=null;function y(t){const e=l.get(t.inputSource);e&&e.dispatchEvent({type:t.type,data:t.inputSource})}function x(){l.forEach((function(t,e){t.disconnect(e)})),l.clear(),t.setFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),T.stop(),i.isPresenting=!1,i.dispatchEvent({type:"sessionend"})}function v(t){s=t,T.setContext(n),T.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}function b(t){const e=n.inputSources;for(let t=0;t<h.length;t++)l.set(e[t],h[t]);for(let e=0;e<t.removed.length;e++){const i=t.removed[e],n=l.get(i);n&&(n.dispatchEvent({type:"disconnected",data:i}),l.delete(i))}for(let e=0;e<t.added.length;e++){const i=t.added[e],n=l.get(i);n&&n.dispatchEvent({type:"connected",data:i})}}this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=h[t];return void 0===e&&(e=new Ir,h[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=h[t];return void 0===e&&(e=new Ir,h[t]=e),e.getGripSpace()},this.getHand=function(t){let e=h[t];return void 0===e&&(e=new Ir,h[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){r=t,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){o=t,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return s},this.getSession=function(){return n},this.setSession=function(t){if(n=t,null!==n){n.addEventListener("select",y),n.addEventListener("selectstart",y),n.addEventListener("selectend",y),n.addEventListener("squeeze",y),n.addEventListener("squeezestart",y),n.addEventListener("squeezeend",y),n.addEventListener("end",x);const t=e.getContextAttributes();!0!==t.xrCompatible&&e.makeXRCompatible();const i={antialias:t.antialias,alpha:t.alpha,depth:t.depth,stencil:t.stencil,framebufferScaleFactor:r},s=new XRWebGLLayer(n,e,i);n.updateRenderState({baseLayer:s}),n.requestReferenceSpace(o).then(v),n.addEventListener("inputsourceschange",b)}};const M=new d,w=new d;function _(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.getCamera=function(t){m.near=u.near=c.near=t.near,m.far=u.far=c.far=t.far,f===m.near&&g===m.far||(n.updateRenderState({depthNear:m.near,depthFar:m.far}),f=m.near,g=m.far);const e=t.parent,i=m.cameras;_(m,e);for(let t=0;t<i.length;t++)_(i[t],e);t.matrixWorld.copy(m.matrixWorld);const r=t.children;for(let t=0,e=r.length;t<e;t++)r[t].updateMatrixWorld(!0);return 2===i.length?function(t,e,i){M.setFromMatrixPosition(e.matrixWorld),w.setFromMatrixPosition(i.matrixWorld);const n=M.distanceTo(w),r=e.projectionMatrix.elements,s=i.projectionMatrix.elements,o=r[14]/(r[10]-1),a=r[14]/(r[10]+1),h=(r[9]+1)/r[5],l=(r[9]-1)/r[5],c=(r[8]-1)/r[0],u=(s[8]+1)/s[0],p=o*c,d=o*u,m=n/(-c+u),f=m*-c;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(f),t.translateZ(m),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert();const g=o+m,y=a+m,x=p-f,v=d+(n-f),b=h*a/y*g,_=l*a/y*g;t.projectionMatrix.makePerspective(x,v,b,_,g,y)}(m,c,u):m.projectionMatrix.copy(c.projectionMatrix),m};let S=null;const T=new it;T.setAnimationLoop((function(e,i){if(a=i.getViewerPose(s),null!==a){const e=a.views,i=n.renderState.baseLayer;t.setFramebuffer(i.framebuffer);let r=!1;e.length!==m.cameras.length&&(m.cameras.length=0,r=!0);for(let t=0;t<e.length;t++){const n=e[t],s=i.getViewport(n),o=p[t];o.matrix.fromArray(n.transform.matrix),o.projectionMatrix.fromArray(n.projectionMatrix),o.viewport.set(s.x,s.y,s.width,s.height),0===t&&m.matrix.copy(o.matrix),!0===r&&m.cameras.push(o)}}const r=n.inputSources;for(let t=0;t<h.length;t++){const e=h[t],n=r[t];e.update(n,i,s)}S&&S(e,i)})),this.setAnimationLoop=function(t){S=t},this.dispose=function(){}}function Ur(t){function e(e,i){e.opacity.value=i.opacity,i.color&&e.diffuse.value.copy(i.color),i.emissive&&e.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),i.map&&(e.map.value=i.map),i.alphaMap&&(e.alphaMap.value=i.alphaMap),i.specularMap&&(e.specularMap.value=i.specularMap);const n=t.get(i).envMap;if(n){e.envMap.value=n,e.flipEnvMap.value=n.isCubeTexture&&n._needsFlipEnvMap?-1:1,e.reflectivity.value=i.reflectivity,e.refractionRatio.value=i.refractionRatio;const r=t.get(n).__maxMipLevel,s=t.get(n).__maxCubeSize;void 0!==r&&(e.maxMipLevel.value=r),void 0!==s&&(e.maxCubeSize.value=s)}let r,s;i.lightMap&&(e.lightMap.value=i.lightMap,e.lightMapIntensity.value=i.lightMapIntensity),i.aoMap&&(e.aoMap.value=i.aoMap,e.aoMapIntensity.value=i.aoMapIntensity),i.map?r=i.map:i.specularMap?r=i.specularMap:i.displacementMap?r=i.displacementMap:i.normalMap?r=i.normalMap:i.bumpMap?r=i.bumpMap:i.roughnessMap?r=i.roughnessMap:i.metalnessMap?r=i.metalnessMap:i.alphaMap?r=i.alphaMap:i.emissiveMap?r=i.emissiveMap:i.clearcoatMap?r=i.clearcoatMap:i.clearcoatNormalMap?r=i.clearcoatNormalMap:i.clearcoatRoughnessMap&&(r=i.clearcoatRoughnessMap),void 0!==r&&(r.isWebGLRenderTarget&&(r=r.texture),!0===r.matrixAutoUpdate&&r.updateMatrix(),e.uvTransform.value.copy(r.matrix)),i.aoMap?s=i.aoMap:i.lightMap&&(s=i.lightMap),void 0!==s&&(s.isWebGLRenderTarget&&(s=s.texture),!0===s.matrixAutoUpdate&&s.updateMatrix(),e.uv2Transform.value.copy(s.matrix))}function i(e,i){e.roughness.value=i.roughness,e.metalness.value=i.metalness,i.roughnessMap&&(e.roughnessMap.value=i.roughnessMap),i.metalnessMap&&(e.metalnessMap.value=i.metalnessMap),i.emissiveMap&&(e.emissiveMap.value=i.emissiveMap),i.bumpMap&&(e.bumpMap.value=i.bumpMap,e.bumpScale.value=i.bumpScale,1===i.side&&(e.bumpScale.value*=-1)),i.normalMap&&(e.normalMap.value=i.normalMap,e.normalScale.value.copy(i.normalScale),1===i.side&&e.normalScale.value.negate()),i.displacementMap&&(e.displacementMap.value=i.displacementMap,e.displacementScale.value=i.displacementScale,e.displacementBias.value=i.displacementBias),t.get(i).envMap&&(e.envMapIntensity.value=i.envMapIntensity)}return{refreshFogUniforms:function(t,e){t.fogColor.value.copy(e.color),e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)},refreshMaterialUniforms:function(t,n,r,s){n.isMeshBasicMaterial?e(t,n):n.isMeshLambertMaterial?(e(t,n),function(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}(t,n)):n.isMeshToonMaterial?(e(t,n),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isMeshPhongMaterial?(e(t,n),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isMeshStandardMaterial?(e(t,n),n.isMeshPhysicalMaterial?function(t,e){i(t,e),t.reflectivity.value=e.reflectivity,t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.sheen&&t.sheen.value.copy(e.sheen),e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap),e.clearcoatNormalMap&&(t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),t.clearcoatNormalMap.value=e.clearcoatNormalMap,1===e.side&&t.clearcoatNormalScale.value.negate()),t.transmission.value=e.transmission,e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap)}(t,n):i(t,n)):n.isMeshMatcapMaterial?(e(t,n),function(t,e){e.matcap&&(t.matcap.value=e.matcap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isMeshDepthMaterial?(e(t,n),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isMeshDistanceMaterial?(e(t,n),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}(t,n)):n.isMeshNormalMaterial?(e(t,n),function(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity}(t,n),n.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,n)):n.isPointsMaterial?function(t,e,i,n){let r;t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*i,t.scale.value=.5*n,e.map&&(t.map.value=e.map),e.alphaMap&&(t.alphaMap.value=e.alphaMap),e.map?r=e.map:e.alphaMap&&(r=e.alphaMap),void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),t.uvTransform.value.copy(r.matrix))}(t,n,r,s):n.isSpriteMaterial?function(t,e){let i;t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map),e.alphaMap&&(t.alphaMap.value=e.alphaMap),e.map?i=e.map:e.alphaMap&&(i=e.alphaMap),void 0!==i&&(!0===i.matrixAutoUpdate&&i.updateMatrix(),t.uvTransform.value.copy(i.matrix))}(t,n):n.isShadowMaterial?(t.color.value.copy(n.color),t.opacity.value=n.opacity):n.isShaderMaterial&&(n.uniformsNeedUpdate=!1)}}}Dr.prototype=Object.assign(Object.create(ki.prototype),{constructor:Dr,isArrayCamera:!0}),Gr.prototype=Object.assign(Object.create(Bt.prototype),{constructor:Gr,isGroup:!0}),Object.assign(Ir.prototype,{constructor:Ir,getHandSpace:function(){if(null===this._hand&&(this._hand=new Gr,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints=[],this._hand.inputState={pinching:!1},window.XRHand))for(let t=0;t<=window.XRHand.LITTLE_PHALANX_TIP;t++){const t=new Gr;t.matrixAutoUpdate=!1,t.visible=!1,this._hand.joints.push(t),this._hand.add(t)}return this._hand},getTargetRaySpace:function(){return null===this._targetRay&&(this._targetRay=new Gr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1),this._targetRay},getGripSpace:function(){return null===this._grip&&(this._grip=new Gr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1),this._grip},dispatchEvent:function(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this},disconnect:function(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this},update:function(t,e,i){let n=null,r=null,s=null;const o=this._targetRay,a=this._grip,h=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState)if(h&&t.hand){s=!0;for(let n=0;n<=window.XRHand.LITTLE_PHALANX_TIP;n++)if(t.hand[n]){const r=e.getJointPose(t.hand[n],i),s=h.joints[n];null!==r&&(s.matrix.fromArray(r.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.jointRadius=r.radius),s.visible=null!==r;const o=h.joints[window.XRHand.INDEX_PHALANX_TIP],a=h.joints[window.XRHand.THUMB_PHALANX_TIP],l=o.position.distanceTo(a.position),c=.02,u=.005;h.inputState.pinching&&l>c+u?(h.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!h.inputState.pinching&&l<=c-u&&(h.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}}else null!==o&&(n=e.getPose(t.targetRaySpace,i),null!==n&&(o.matrix.fromArray(n.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale))),null!==a&&t.gripSpace&&(r=e.getPose(t.gripSpace,i),null!==r&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale)));return null!==o&&(o.visible=null!==n),null!==a&&(a.visible=null!==r),null!==h&&(h.visible=null!==s),this}}),Object.assign(kr.prototype,r.prototype);let Vr=0;const Wr=new k,jr=new Bt,Hr=new d;function qr(){Object.defineProperty(this,"id",{value:Vr+=2}),this.uuid=n.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}qr.prototype=Object.assign(Object.create(r.prototype),{constructor:qr,isGeometry:!0,applyMatrix4:function(t){const e=(new o).getNormalMatrix(t);for(let e=0,i=this.vertices.length;e<i;e++)this.vertices[e].applyMatrix4(t);for(let t=0,i=this.faces.length;t<i;t++){const i=this.faces[t];i.normal.applyMatrix3(e).normalize();for(let t=0,n=i.vertexNormals.length;t<n;t++)i.vertexNormals[t].applyMatrix3(e).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(t){return Wr.makeRotationX(t),this.applyMatrix4(Wr),this},rotateY:function(t){return Wr.makeRotationY(t),this.applyMatrix4(Wr),this},rotateZ:function(t){return Wr.makeRotationZ(t),this.applyMatrix4(Wr),this},translate:function(t,e,i){return Wr.makeTranslation(t,e,i),this.applyMatrix4(Wr),this},scale:function(t,e,i){return Wr.makeScale(t,e,i),this.applyMatrix4(Wr),this},lookAt:function(t){return jr.lookAt(t),jr.updateMatrix(),this.applyMatrix4(jr.matrix),this},fromBufferGeometry:function(t){const e=this,i=null!==t.index?t.index:void 0,n=t.attributes;if(void 0===n.position)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;const r=n.position,o=n.normal,a=n.color,h=n.uv,l=n.uv2;void 0!==l&&(this.faceVertexUvs[1]=[]);for(let t=0;t<r.count;t++)e.vertices.push((new d).fromBufferAttribute(r,t)),void 0!==a&&e.colors.push((new et).fromBufferAttribute(a,t));function c(t,i,n,r){const c=void 0===a?[]:[e.colors[t].clone(),e.colors[i].clone(),e.colors[n].clone()],u=void 0===o?[]:[(new d).fromBufferAttribute(o,t),(new d).fromBufferAttribute(o,i),(new d).fromBufferAttribute(o,n)],p=new be(t,i,n,u,c,r);e.faces.push(p),void 0!==h&&e.faceVertexUvs[0].push([(new s).fromBufferAttribute(h,t),(new s).fromBufferAttribute(h,i),(new s).fromBufferAttribute(h,n)]),void 0!==l&&e.faceVertexUvs[1].push([(new s).fromBufferAttribute(l,t),(new s).fromBufferAttribute(l,i),(new s).fromBufferAttribute(l,n)])}const u=t.groups;if(u.length>0)for(let t=0;t<u.length;t++){const e=u[t],n=e.start;for(let t=n,r=n+e.count;t<r;t+=3)void 0!==i?c(i.getX(t),i.getX(t+1),i.getX(t+2),e.materialIndex):c(t,t+1,t+2,e.materialIndex)}else if(void 0!==i)for(let t=0;t<i.count;t+=3)c(i.getX(t),i.getX(t+1),i.getX(t+2));else for(let t=0;t<r.count;t+=3)c(t,t+1,t+2);return this.computeFaceNormals(),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(Hr).negate(),this.translate(Hr.x,Hr.y,Hr.z),this},normalize:function(){this.computeBoundingSphere();const t=this.boundingSphere.center,e=this.boundingSphere.radius,i=0===e?1:1/e,n=new k;return n.set(i,0,0,-i*t.x,0,i,0,-i*t.y,0,0,i,-i*t.z,0,0,0,1),this.applyMatrix4(n),this},computeFaceNormals:function(){const t=new d,e=new d;for(let i=0,n=this.faces.length;i<n;i++){const n=this.faces[i],r=this.vertices[n.a],s=this.vertices[n.b],o=this.vertices[n.c];t.subVectors(o,s),e.subVectors(r,s),t.cross(e),t.normalize(),n.normal.copy(t)}},computeVertexNormals:function(t=!0){const e=new Array(this.vertices.length);for(let t=0,i=this.vertices.length;t<i;t++)e[t]=new d;if(t){const t=new d,i=new d;for(let n=0,r=this.faces.length;n<r;n++){const r=this.faces[n],s=this.vertices[r.a],o=this.vertices[r.b],a=this.vertices[r.c];t.subVectors(a,o),i.subVectors(s,o),t.cross(i),e[r.a].add(t),e[r.b].add(t),e[r.c].add(t)}}else{this.computeFaceNormals();for(let t=0,i=this.faces.length;t<i;t++){const i=this.faces[t];e[i.a].add(i.normal),e[i.b].add(i.normal),e[i.c].add(i.normal)}}for(let t=0,i=this.vertices.length;t<i;t++)e[t].normalize();for(let t=0,i=this.faces.length;t<i;t++){const i=this.faces[t],n=i.vertexNormals;3===n.length?(n[0].copy(e[i.a]),n[1].copy(e[i.b]),n[2].copy(e[i.c])):(n[0]=e[i.a].clone(),n[1]=e[i.b].clone(),n[2]=e[i.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){this.computeFaceNormals();for(let t=0,e=this.faces.length;t<e;t++){const e=this.faces[t],i=e.vertexNormals;3===i.length?(i[0].copy(e.normal),i[1].copy(e.normal),i[2].copy(e.normal)):(i[0]=e.normal.clone(),i[1]=e.normal.clone(),i[2]=e.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){for(let t=0,e=this.faces.length;t<e;t++){const e=this.faces[t];e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone(),e.__originalVertexNormals||(e.__originalVertexNormals=[]);for(let t=0,i=e.vertexNormals.length;t<i;t++)e.__originalVertexNormals[t]?e.__originalVertexNormals[t].copy(e.vertexNormals[t]):e.__originalVertexNormals[t]=e.vertexNormals[t].clone()}const t=new qr;t.faces=this.faces;for(let e=0,i=this.morphTargets.length;e<i;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];const t=this.morphNormals[e].faceNormals,i=this.morphNormals[e].vertexNormals;for(let e=0,n=this.faces.length;e<n;e++){const e=new d,n={a:new d,b:new d,c:new d};t.push(e),i.push(n)}}const i=this.morphNormals[e];t.vertices=this.morphTargets[e].vertices,t.computeFaceNormals(),t.computeVertexNormals();for(let t=0,e=this.faces.length;t<e;t++){const e=this.faces[t],n=i.faceNormals[t],r=i.vertexNormals[t];n.copy(e.normal),r.a.copy(e.vertexNormals[0]),r.b.copy(e.vertexNormals[1]),r.c.copy(e.vertexNormals[2])}}for(let t=0,e=this.faces.length;t<e;t++){const e=this.faces[t];e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals}},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new g),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new O),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,i=0){if(!t||!t.isGeometry)return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t);let n;const r=this.vertices.length,s=this.vertices,a=t.vertices,h=this.faces,l=t.faces,c=this.colors,u=t.colors;void 0!==e&&(n=(new o).getNormalMatrix(e));for(let t=0,i=a.length;t<i;t++){const i=a[t].clone();void 0!==e&&i.applyMatrix4(e),s.push(i)}for(let t=0,e=u.length;t<e;t++)c.push(u[t].clone());for(let t=0,e=l.length;t<e;t++){const e=l[t];let s,o;const a=e.vertexNormals,c=e.vertexColors,u=new be(e.a+r,e.b+r,e.c+r);u.normal.copy(e.normal),void 0!==n&&u.normal.applyMatrix3(n).normalize();for(let t=0,e=a.length;t<e;t++)s=a[t].clone(),void 0!==n&&s.applyMatrix3(n).normalize(),u.vertexNormals.push(s);u.color.copy(e.color);for(let t=0,e=c.length;t<e;t++)o=c[t],u.vertexColors.push(o.clone());u.materialIndex=e.materialIndex+i,h.push(u)}for(let e=0,i=t.faceVertexUvs.length;e<i;e++){const i=t.faceVertexUvs[e];void 0===this.faceVertexUvs[e]&&(this.faceVertexUvs[e]=[]);for(let t=0,n=i.length;t<n;t++){const n=i[t],r=[];for(let t=0,e=n.length;t<e;t++)r.push(n[t].clone());this.faceVertexUvs[e].push(r)}}},mergeMesh:function(t){t&&t.isMesh?(t.matrixAutoUpdate&&t.updateMatrix(),this.merge(t.geometry,t.matrix)):console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",t)},mergeVertices:function(t=4){const e={},i=[],n=[],r=Math.pow(10,t);for(let t=0,s=this.vertices.length;t<s;t++){const s=this.vertices[t],o=Math.round(s.x*r)+"_"+Math.round(s.y*r)+"_"+Math.round(s.z*r);void 0===e[o]?(e[o]=t,i.push(this.vertices[t]),n[t]=i.length-1):n[t]=n[e[o]]}const s=[];for(let t=0,e=this.faces.length;t<e;t++){const e=this.faces[t];e.a=n[e.a],e.b=n[e.b],e.c=n[e.c];const i=[e.a,e.b,e.c];for(let e=0;e<3;e++)if(i[e]===i[(e+1)%3]){s.push(t);break}}for(let t=s.length-1;t>=0;t--){const e=s[t];this.faces.splice(e,1);for(let t=0,i=this.faceVertexUvs.length;t<i;t++)this.faceVertexUvs[t].splice(e,1)}const o=this.vertices.length-i.length;return this.vertices=i,o},setFromPoints:function(t){this.vertices=[];for(let e=0,i=t.length;e<i;e++){const i=t[e];this.vertices.push(new d(i.x,i.y,i.z||0))}return this},sortFacesByMaterialIndex:function(){const t=this.faces,e=t.length;for(let i=0;i<e;i++)t[i]._id=i;t.sort((function(t,e){return t.materialIndex-e.materialIndex}));const i=this.faceVertexUvs[0],n=this.faceVertexUvs[1];let r,s;i&&i.length===e&&(r=[]),n&&n.length===e&&(s=[]);for(let o=0;o<e;o++){const e=t[o]._id;r&&r.push(i[e]),s&&s.push(n[e])}r&&(this.faceVertexUvs[0]=r),s&&(this.faceVertexUvs[1]=s)},toJSON:function(){const t={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),void 0!==this.parameters){const e=this.parameters;for(const i in e)void 0!==e[i]&&(t[i]=e[i]);return t}const e=[];for(let t=0;t<this.vertices.length;t++){const i=this.vertices[t];e.push(i.x,i.y,i.z)}const i=[],n=[],r={},s=[],o={},a=[],h={};for(let t=0;t<this.faces.length;t++){const e=this.faces[t],n=!0,r=!1,s=void 0!==this.faceVertexUvs[0][t],o=e.normal.length()>0,a=e.vertexNormals.length>0,h=1!==e.color.r||1!==e.color.g||1!==e.color.b,d=e.vertexColors.length>0;let m=0;if(m=l(m,0,0),m=l(m,1,n),m=l(m,2,r),m=l(m,3,s),m=l(m,4,o),m=l(m,5,a),m=l(m,6,h),m=l(m,7,d),i.push(m),i.push(e.a,e.b,e.c),i.push(e.materialIndex),s){const e=this.faceVertexUvs[0][t];i.push(p(e[0]),p(e[1]),p(e[2]))}if(o&&i.push(c(e.normal)),a){const t=e.vertexNormals;i.push(c(t[0]),c(t[1]),c(t[2]))}if(h&&i.push(u(e.color)),d){const t=e.vertexColors;i.push(u(t[0]),u(t[1]),u(t[2]))}}function l(t,e,i){return i?t|1<<e:t&~(1<<e)}function c(t){const e=t.x.toString()+t.y.toString()+t.z.toString();return void 0!==r[e]||(r[e]=n.length/3,n.push(t.x,t.y,t.z)),r[e]}function u(t){const e=t.r.toString()+t.g.toString()+t.b.toString();return void 0!==o[e]||(o[e]=s.length,s.push(t.getHex())),o[e]}function p(t){const e=t.x.toString()+t.y.toString();return void 0!==h[e]||(h[e]=a.length/2,a.push(t.x,t.y)),h[e]}return t.data={},t.data.vertices=e,t.data.normals=n,s.length>0&&(t.data.colors=s),a.length>0&&(t.data.uvs=[a]),t.data.faces=i,t},clone:function(){return(new qr).copy(this)},copy:function(t){this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;const e=t.vertices;for(let t=0,i=e.length;t<i;t++)this.vertices.push(e[t].clone());const i=t.colors;for(let t=0,e=i.length;t<e;t++)this.colors.push(i[t].clone());const n=t.faces;for(let t=0,e=n.length;t<e;t++)this.faces.push(n[t].clone());for(let e=0,i=t.faceVertexUvs.length;e<i;e++){const i=t.faceVertexUvs[e];void 0===this.faceVertexUvs[e]&&(this.faceVertexUvs[e]=[]);for(let t=0,n=i.length;t<n;t++){const n=i[t],r=[];for(let t=0,e=n.length;t<e;t++){const e=n[t];r.push(e.clone())}this.faceVertexUvs[e].push(r)}}const r=t.morphTargets;for(let t=0,e=r.length;t<e;t++){const e={};if(e.name=r[t].name,void 0!==r[t].vertices){e.vertices=[];for(let i=0,n=r[t].vertices.length;i<n;i++)e.vertices.push(r[t].vertices[i].clone())}if(void 0!==r[t].normals){e.normals=[];for(let i=0,n=r[t].normals.length;i<n;i++)e.normals.push(r[t].normals[i].clone())}this.morphTargets.push(e)}const s=t.morphNormals;for(let t=0,e=s.length;t<e;t++){const e={};if(void 0!==s[t].vertexNormals){e.vertexNormals=[];for(let i=0,n=s[t].vertexNormals.length;i<n;i++){const n=s[t].vertexNormals[i],r={};r.a=n.a.clone(),r.b=n.b.clone(),r.c=n.c.clone(),e.vertexNormals.push(r)}}if(void 0!==s[t].faceNormals){e.faceNormals=[];for(let i=0,n=s[t].faceNormals.length;i<n;i++)e.faceNormals.push(s[t].faceNormals[i].clone())}this.morphNormals.push(e)}const o=t.skinWeights;for(let t=0,e=o.length;t<e;t++)this.skinWeights.push(o[t].clone());const a=t.skinIndices;for(let t=0,e=a.length;t<e;t++)this.skinIndices.push(a[t].clone());const h=t.lineDistances;for(let t=0,e=h.length;t<e;t++)this.lineDistances.push(h[t]);const l=t.boundingBox;null!==l&&(this.boundingBox=l.clone());const c=t.boundingSphere;return null!==c&&(this.boundingSphere=c.clone()),this.elementsNeedUpdate=t.elementsNeedUpdate,this.verticesNeedUpdate=t.verticesNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.lineDistancesNeedUpdate=t.lineDistancesNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});const Xr=new d,Jr=new d,Yr=new d,Zr=new ve;class Qr extends jt{constructor(t=1,e=1,i=1,n=8,r=1,o=!1,a=0,h=2*Math.PI){super(),this.type="CylinderBufferGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:i,radialSegments:n,heightSegments:r,openEnded:o,thetaStart:a,thetaLength:h};const l=this;n=Math.floor(n),r=Math.floor(r);const c=[],u=[],p=[],m=[];let f=0;const g=[],y=i/2;let x=0;function v(i){const r=f,o=new s,g=new d;let v=0;const b=!0===i?t:e,M=!0===i?1:-1;for(let t=1;t<=n;t++)u.push(0,y*M,0),p.push(0,M,0),m.push(.5,.5),f++;const w=f;for(let t=0;t<=n;t++){const e=t/n*h+a,i=Math.cos(e),r=Math.sin(e);g.x=b*r,g.y=y*M,g.z=b*i,u.push(g.x,g.y,g.z),p.push(0,M,0),o.x=.5*i+.5,o.y=.5*r*M+.5,m.push(o.x,o.y),f++}for(let t=0;t<n;t++){const e=r+t,n=w+t;!0===i?c.push(n,n+1,e):c.push(n+1,n,e),v+=3}l.addGroup(x,v,!0===i?1:2),x+=v}!function(){const s=new d,o=new d;let v=0;const b=(e-t)/i;for(let l=0;l<=r;l++){const c=[],d=l/r,x=d*(e-t)+t;for(let t=0;t<=n;t++){const e=t/n,r=e*h+a,l=Math.sin(r),g=Math.cos(r);o.x=x*l,o.y=-d*i+y,o.z=x*g,u.push(o.x,o.y,o.z),s.set(l,b,g).normalize(),p.push(s.x,s.y,s.z),m.push(e,1-d),c.push(f++)}g.push(c)}for(let t=0;t<n;t++)for(let e=0;e<r;e++){const i=g[e][t],n=g[e+1][t],r=g[e+1][t+1],s=g[e][t+1];c.push(i,n,s),c.push(n,r,s),v+=6}l.addGroup(x,v,0),x+=v}(),!1===o&&(t>0&&v(!0),e>0&&v(!1)),this.setIndex(c),this.setAttribute("position",new ft(u,3)),this.setAttribute("normal",new ft(p,3)),this.setAttribute("uv",new ft(m,2))}}function Kr(){return("undefined"==typeof performance?Date:performance).now()}function $r(t,e,i,n){this.ray=new he(t,e),this.near=i||0,this.far=n||1/0,this.camera=null,this.layers=new Mt,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function ts(t,e){return t.distance-e.distance}function es(t,e,i,n){if(t.layers.test(e.layers)&&t.raycast(e,i),!0===n){const n=t.children;for(let t=0,r=n.length;t<r;t++)es(n[t],e,i,!0)}}function is(t){Jt.call(this),this.type="LineBasicMaterial",this.color=new et(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.morphTargets=!1,this.setValues(t)}Object.assign($r.prototype,{set:function(t,e){this.ray.set(t,e)},setFromCamera:function(t,e){e&&e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e&&e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):console.error("THREE.Raycaster: Unsupported camera type: "+e.type)},intersectObject:function(t,e,i){const n=i||[];return es(t,this,n,e),n.sort(ts),n},intersectObjects:function(t,e,i){const n=i||[];if(!1===Array.isArray(t))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),n;for(let i=0,r=t.length;i<r;i++)es(t[i],this,n,e);return n.sort(ts),n}}),is.prototype=Object.create(Jt.prototype),is.prototype.constructor=is,is.prototype.isLineBasicMaterial=!0,is.prototype.copy=function(t){return Jt.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.morphTargets=t.morphTargets,this};const ns=new d,rs=new d,ss=new k,os=new he,as=new O;function hs(t=new jt,e=new is){Bt.call(this),this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}hs.prototype=Object.assign(Object.create(Bt.prototype),{constructor:hs,isLine:!0,copy:function(t){return Bt.prototype.copy.call(this,t),this.material=t.material,this.geometry=t.geometry,this},computeLineDistances:function(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,i=[0];for(let t=1,n=e.count;t<n;t++)ns.fromBufferAttribute(e,t-1),rs.fromBufferAttribute(e,t),i[t]=i[t-1],i[t]+=ns.distanceTo(rs);t.setAttribute("lineDistance",new ft(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(t.isGeometry){const e=t.vertices,i=t.lineDistances;i[0]=0;for(let t=1,n=e.length;t<n;t++)i[t]=i[t-1],i[t]+=e[t-1].distanceTo(e[t])}return this},raycast:function(t,e){const i=this.geometry,n=this.matrixWorld,r=t.params.Line.threshold;if(null===i.boundingSphere&&i.computeBoundingSphere(),as.copy(i.boundingSphere),as.applyMatrix4(n),as.radius+=r,!1===t.ray.intersectsSphere(as))return;ss.copy(n).invert(),os.copy(t.ray).applyMatrix4(ss);const s=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s,a=new d,h=new d,l=new d,c=new d,u=this.isLineSegments?2:1;if(i.isBufferGeometry){const n=i.index,r=i.attributes.position;if(null!==n){const i=n.array;for(let n=0,s=i.length-1;n<s;n+=u){const s=i[n],u=i[n+1];if(a.fromBufferAttribute(r,s),h.fromBufferAttribute(r,u),os.distanceSqToSegment(a,h,c,l)>o)continue;c.applyMatrix4(this.matrixWorld);const p=t.ray.origin.distanceTo(c);p<t.near||p>t.far||e.push({distance:p,point:l.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else for(let i=0,n=r.count-1;i<n;i+=u){if(a.fromBufferAttribute(r,i),h.fromBufferAttribute(r,i+1),os.distanceSqToSegment(a,h,c,l)>o)continue;c.applyMatrix4(this.matrixWorld);const n=t.ray.origin.distanceTo(c);n<t.near||n>t.far||e.push({distance:n,point:l.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this})}}else if(i.isGeometry){const n=i.vertices,r=n.length;for(let i=0;i<r-1;i+=u){if(os.distanceSqToSegment(n[i],n[i+1],c,l)>o)continue;c.applyMatrix4(this.matrixWorld);const r=t.ray.origin.distanceTo(c);r<t.near||r>t.far||e.push({distance:r,point:l.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this})}}},updateMorphTargets:function(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,i=Object.keys(e);if(i.length>0){const t=e[i[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,i=t.length;e<i;e++){const i=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}});const ls=new d,cs=new d;function us(t,e){hs.call(this,t,e),this.type="LineSegments"}function ps(t){Jt.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new et(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new et(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new s(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.vertexTangents=!1,this.setValues(t)}function ds(t){ps.call(this),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new s(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,Object.defineProperty(this,"ior",{get:function(){return(1+.4*this.reflectivity)/(1-.4*this.reflectivity)},set:function(t){this.reflectivity=n.clamp(2.5*(t-1)/(t+1),0,1)}}),this.sheen=null,this.transmission=0,this.transmissionMap=null,this.setValues(t)}function ms(t){Jt.call(this),this.type="ShadowMaterial",this.color=new et(0),this.transparent=!0,this.setValues(t)}function fs(t){is.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}us.prototype=Object.assign(Object.create(hs.prototype),{constructor:us,isLineSegments:!0,computeLineDistances:function(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,i=[];for(let t=0,n=e.count;t<n;t+=2)ls.fromBufferAttribute(e,t),cs.fromBufferAttribute(e,t+1),i[t]=0===t?0:i[t-1],i[t+1]=i[t]+ls.distanceTo(cs);t.setAttribute("lineDistance",new ft(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(t.isGeometry){const e=t.vertices,i=t.lineDistances;for(let t=0,n=e.length;t<n;t+=2)ls.copy(e[t]),cs.copy(e[t+1]),i[t]=0===t?0:i[t-1],i[t+1]=i[t]+ls.distanceTo(cs)}return this}}),ps.prototype=Object.create(Jt.prototype),ps.prototype.constructor=ps,ps.prototype.isMeshStandardMaterial=!0,ps.prototype.copy=function(t){return Jt.prototype.copy.call(this,t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.vertexTangents=t.vertexTangents,this},ds.prototype=Object.create(ps.prototype),ds.prototype.constructor=ds,ds.prototype.isMeshPhysicalMaterial=!0,ds.prototype.copy=function(t){return ps.prototype.copy.call(this,t),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.reflectivity=t.reflectivity,t.sheen?this.sheen=(this.sheen||new et).copy(t.sheen):this.sheen=null,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this},ms.prototype=Object.create(Jt.prototype),ms.prototype.constructor=ms,ms.prototype.isShadowMaterial=!0,ms.prototype.copy=function(t){return Jt.prototype.copy.call(this,t),this.color.copy(t.color),this},fs.prototype=Object.create(is.prototype),fs.prototype.constructor=fs,fs.prototype.isLineDashedMaterial=!0,fs.prototype.copy=function(t){return is.prototype.copy.call(this,t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this};const gs=new d;let ys,xs;const vs=new d,bs=new d;function Ms(t,e=1){Bt.call(this),this.type="Light",this.color=new et(t),this.intensity=e}function ws(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.mapSize=new s(512,512),this.map=null,this.mapPass=null,this.matrix=new k,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new I,this._frameExtents=new s(1,1),this._viewportCount=1,this._viewports=[new J(0,0,1,1)]}function _s(t=-1,e=1,i=1,n=-1,r=.1,s=2e3){Ii.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=i,this.bottom=n,this.near=r,this.far=s,this.updateProjectionMatrix()}function Ss(){ws.call(this,new _s(-5,5,5,-5,.5,500))}function Ts(t,e){Ms.call(this,t,e),this.type="DirectionalLight",this.position.copy(Bt.DefaultUp),this.updateMatrix(),this.target=new Bt,this.shadow=new Ss}function Es(t,e){Ms.call(this,t,e),this.type="AmbientLight"}function As(t,e,i){Ms.call(this,t,i),this.type="HemisphereLight",this.position.copy(Bt.DefaultUp),this.updateMatrix(),this.groundColor=new et(e)}Ms.prototype=Object.assign(Object.create(Bt.prototype),{constructor:Ms,isLight:!0,copy:function(t){return Bt.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},toJSON:function(t){const e=Bt.prototype.toJSON.call(this,t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}),Object.assign(ws.prototype,{_projScreenMatrix:new k,_lightPositionWorld:new d,_lookTarget:new d,getViewportCount:function(){return this._viewportCount},getFrustum:function(){return this._frustum},updateMatrices:function(t){const e=this.camera,i=this.matrix,n=this._projScreenMatrix,r=this._lookTarget,s=this._lightPositionWorld;s.setFromMatrixPosition(t.matrixWorld),e.position.copy(s),r.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(r),e.updateMatrixWorld(),n.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(n),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(e.projectionMatrix),i.multiply(e.matrixWorldInverse)},getViewport:function(t){return this._viewports[t]},getFrameExtents:function(){return this._frameExtents},copy:function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){const t={};return 0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}),_s.prototype=Object.assign(Object.create(Ii.prototype),{constructor:_s,isOrthographicCamera:!0,copy:function(t,e){return Ii.prototype.copy.call(this,t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this},setViewOffset:function(t,e,i,n,r,s){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=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,n=(this.top+this.bottom)/2;let r=i-t,s=i+t,o=n+e,a=n-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,s=r+t*this.view.width,o-=e*this.view.offsetY,a=o-e*this.view.height}this.projectionMatrix.makeOrthographic(r,s,o,a,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()},toJSON:function(t){const e=Bt.prototype.toJSON.call(this,t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}),Ss.prototype=Object.assign(Object.create(ws.prototype),{constructor:Ss,isDirectionalLightShadow:!0,updateMatrices:function(t){ws.prototype.updateMatrices.call(this,t)}}),Ts.prototype=Object.assign(Object.create(Ms.prototype),{constructor:Ts,isDirectionalLight:!0,copy:function(t){return Ms.prototype.copy.call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),Es.prototype=Object.assign(Object.create(Ms.prototype),{constructor:Es,isAmbientLight:!0}),As.prototype=Object.assign(Object.create(Ms.prototype),{constructor:As,isHemisphereLight:!0,copy:function(t){return Ms.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}});const Ls={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};function Rs(t,e,i){const n=this;let r=!1,s=0,o=0,a=void 0;const h=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=i,this.itemStart=function(t){o++,!1===r&&void 0!==n.onStart&&n.onStart(t,s,o),r=!0},this.itemEnd=function(t){s++,void 0!==n.onProgress&&n.onProgress(t,s,o),s===o&&(r=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(t){void 0!==n.onError&&n.onError(t)},this.resolveURL=function(t){return a?a(t):t},this.setURLModifier=function(t){return a=t,this},this.addHandler=function(t,e){return h.push(t,e),this},this.removeHandler=function(t){const e=h.indexOf(t);return-1!==e&&h.splice(e,2),this},this.getHandler=function(t){for(let e=0,i=h.length;e<i;e+=2){const i=h[e],n=h[e+1];if(i.global&&(i.lastIndex=0),i.test(t))return n}return null}}const Ps=new Rs;function Cs(t){this.manager=void 0!==t?t:Ps,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}function Os(t){Cs.call(this,t)}function zs(t){Cs.call(this,t)}function Ns(t){Cs.call(this,t)}function Bs(){this.type="Curve",this.arcLengthDivisions=200}function Fs(t,e,i,n,r,s,o,a){Bs.call(this),this.type="EllipseCurve",this.aX=t||0,this.aY=e||0,this.xRadius=i||1,this.yRadius=n||1,this.aStartAngle=r||0,this.aEndAngle=s||2*Math.PI,this.aClockwise=o||!1,this.aRotation=a||0}function Ds(t,e,i,n,r,s){Fs.call(this,t,e,i,i,n,r,s),this.type="ArcCurve"}function Gs(){let t=0,e=0,i=0,n=0;function r(r,s,o,a){t=r,e=o,i=-3*r+3*s-2*o-a,n=2*r-2*s+o+a}return{initCatmullRom:function(t,e,i,n,s){r(e,i,s*(i-t),s*(n-e))},initNonuniformCatmullRom:function(t,e,i,n,s,o,a){let h=(e-t)/s-(i-t)/(s+o)+(i-e)/o,l=(i-e)/o-(n-e)/(o+a)+(n-i)/a;h*=o,l*=o,r(e,i,h,l)},calc:function(r){const s=r*r;return t+e*r+i*s+n*(s*r)}}}Object.assign(Cs.prototype,{load:function(){},loadAsync:function(t,e){const i=this;return new Promise((function(n,r){i.load(t,n,e,r)}))},parse:function(){},setCrossOrigin:function(t){return this.crossOrigin=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setPath:function(t){return this.path=t,this},setResourcePath:function(t){return this.resourcePath=t,this},setRequestHeader:function(t){return this.requestHeader=t,this}}),Os.prototype=Object.assign(Object.create(Cs.prototype),{constructor:Os,load:function(t,e,i,n){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,s=Ls.get(t);if(void 0!==s)return r.manager.itemStart(t),setTimeout((function(){e&&e(s),r.manager.itemEnd(t)}),0),s;const o=document.createElementNS("http://www.w3.org/1999/xhtml","img");function a(){o.removeEventListener("load",a,!1),o.removeEventListener("error",h,!1),Ls.add(t,this),e&&e(this),r.manager.itemEnd(t)}function h(e){o.removeEventListener("load",a,!1),o.removeEventListener("error",h,!1),n&&n(e),r.manager.itemError(t),r.manager.itemEnd(t)}return o.addEventListener("load",a,!1),o.addEventListener("error",h,!1),"data:"!==t.substr(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),r.manager.itemStart(t),o.src=t,o}}),zs.prototype=Object.assign(Object.create(Cs.prototype),{constructor:zs,load:function(t,e,i,n){const r=new l,s=new Os(this.manager);return s.setCrossOrigin(this.crossOrigin),s.setPath(this.path),s.load(t,(function(i){r.image=i;const n=t.search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/);r.format=n?1022:1023,r.needsUpdate=!0,void 0!==e&&e(r)}),i,n),r}}),Ns.prototype=Object.assign(Object.create(Cs.prototype),{constructor:Ns,load:function(t,e,i,n){const r=new Vi,s=new Os(this.manager);s.setCrossOrigin(this.crossOrigin),s.setPath(this.path);let o=0;function a(i){s.load(t[i],(function(t){r.images[i]=t,o++,6===o&&(r.needsUpdate=!0,e&&e(r))}),void 0,n)}for(let e=0;e<t.length;++e)a(e);return r}}),Object.assign(Bs.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(t,e){const i=this.getUtoTmapping(t);return this.getPoint(i,e)},getPoints:function(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return e},getSpacedPoints:function(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e},getLength:function(){const t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let i,n=this.getPoint(0),r=0;e.push(0);for(let s=1;s<=t;s++)i=this.getPoint(s/t),r+=i.distanceTo(n),e.push(r),n=i;return this.cacheArcLengths=e,e},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){const i=this.getLengths();let n=0;const r=i.length;let s;s=e||t*i[r-1];let o,a=0,h=r-1;for(;a<=h;)if(n=Math.floor(a+(h-a)/2),o=i[n]-s,o<0)a=n+1;else{if(!(o>0)){h=n;break}h=n-1}if(n=h,i[n]===s)return n/(r-1);const l=i[n];return(n+(s-l)/(i[n+1]-l))/(r-1)},getTangent:function(t,e){let i=t-1e-4,n=t+1e-4;i<0&&(i=0),n>1&&(n=1);const r=this.getPoint(i),o=this.getPoint(n),a=e||(r.isVector2?new s:new d);return a.copy(o).sub(r).normalize(),a},getTangentAt:function(t,e){const i=this.getUtoTmapping(t);return this.getTangent(i,e)},computeFrenetFrames:function(t,e){const i=new d,r=[],s=[],o=[],a=new d,h=new k;for(let e=0;e<=t;e++){const i=e/t;r[e]=this.getTangentAt(i,new d),r[e].normalize()}s[0]=new d,o[0]=new d;let l=Number.MAX_VALUE;const c=Math.abs(r[0].x),u=Math.abs(r[0].y),p=Math.abs(r[0].z);c<=l&&(l=c,i.set(1,0,0)),u<=l&&(l=u,i.set(0,1,0)),p<=l&&i.set(0,0,1),a.crossVectors(r[0],i).normalize(),s[0].crossVectors(r[0],a),o[0].crossVectors(r[0],s[0]);for(let e=1;e<=t;e++){if(s[e]=s[e-1].clone(),o[e]=o[e-1].clone(),a.crossVectors(r[e-1],r[e]),a.length()>Number.EPSILON){a.normalize();const t=Math.acos(n.clamp(r[e-1].dot(r[e]),-1,1));s[e].applyMatrix4(h.makeRotationAxis(a,t))}o[e].crossVectors(r[e],s[e])}if(!0===e){let e=Math.acos(n.clamp(s[0].dot(s[t]),-1,1));e/=t,r[0].dot(a.crossVectors(s[0],s[t]))>0&&(e=-e);for(let i=1;i<=t;i++)s[i].applyMatrix4(h.makeRotationAxis(r[i],e*i)),o[i].crossVectors(r[i],s[i])}return{tangents:r,normals:s,binormals:o}},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this},toJSON:function(){const t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t},fromJSON:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}),Fs.prototype=Object.create(Bs.prototype),Fs.prototype.constructor=Fs,Fs.prototype.isEllipseCurve=!0,Fs.prototype.getPoint=function(t,e){const i=e||new s,n=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const o=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=n;for(;r>n;)r-=n;r<Number.EPSILON&&(r=o?0:n),!0!==this.aClockwise||o||(r===n?r=-n:r-=n);const a=this.aStartAngle+t*r;let h=this.aX+this.xRadius*Math.cos(a),l=this.aY+this.yRadius*Math.sin(a);if(0!==this.aRotation){const t=Math.cos(this.aRotation),e=Math.sin(this.aRotation),i=h-this.aX,n=l-this.aY;h=i*t-n*e+this.aX,l=i*e+n*t+this.aY}return i.set(h,l)},Fs.prototype.copy=function(t){return Bs.prototype.copy.call(this,t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this},Fs.prototype.toJSON=function(){const t=Bs.prototype.toJSON.call(this);return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t},Fs.prototype.fromJSON=function(t){return Bs.prototype.fromJSON.call(this,t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this},Ds.prototype=Object.create(Fs.prototype),Ds.prototype.constructor=Ds,Ds.prototype.isArcCurve=!0;const Is=new d,ks=new Gs,Us=new Gs,Vs=new Gs;function Ws(t=[],e=!1,i="centripetal",n=.5){Bs.call(this),this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=i,this.tension=n}function js(t,e,i,n,r){const s=.5*(n-e),o=.5*(r-i),a=t*t;return(2*i-2*n+s+o)*(t*a)+(-3*i+3*n-2*s-o)*a+s*t+i}function Hs(t,e,i,n){return function(t,e){const i=1-t;return i*i*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,i)+function(t,e){return t*t*e}(t,n)}function qs(t,e,i,n,r){return function(t,e){const i=1-t;return i*i*i*e}(t,e)+function(t,e){const i=1-t;return 3*i*i*t*e}(t,i)+function(t,e){return 3*(1-t)*t*t*e}(t,n)+function(t,e){return t*t*t*e}(t,r)}function Xs(t=new s,e=new s,i=new s,n=new s){Bs.call(this),this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=i,this.v3=n}function Js(t=new d,e=new d,i=new d,n=new d){Bs.call(this),this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=i,this.v3=n}function Ys(t=new s,e=new s){Bs.call(this),this.type="LineCurve",this.v1=t,this.v2=e}function Zs(t=new d,e=new d){Bs.call(this),this.type="LineCurve3",this.v1=t,this.v2=e}function Qs(t=new s,e=new s,i=new s){Bs.call(this),this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=i}function Ks(t=new d,e=new d,i=new d){Bs.call(this),this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=i}function $s(t=[]){Bs.call(this),this.type="SplineCurve",this.points=t}Ws.prototype=Object.create(Bs.prototype),Ws.prototype.constructor=Ws,Ws.prototype.isCatmullRomCurve3=!0,Ws.prototype.getPoint=function(t,e=new d){const i=e,n=this.points,r=n.length,s=(r-(this.closed?0:1))*t;let o,a,h=Math.floor(s),l=s-h;this.closed?h+=h>0?0:(Math.floor(Math.abs(h)/r)+1)*r:0===l&&h===r-1&&(h=r-2,l=1),this.closed||h>0?o=n[(h-1)%r]:(Is.subVectors(n[0],n[1]).add(n[0]),o=Is);const c=n[h%r],u=n[(h+1)%r];if(this.closed||h+2<r?a=n[(h+2)%r]:(Is.subVectors(n[r-1],n[r-2]).add(n[r-1]),a=Is),"centripetal"===this.curveType||"chordal"===this.curveType){const t="chordal"===this.curveType?.5:.25;let e=Math.pow(o.distanceToSquared(c),t),i=Math.pow(c.distanceToSquared(u),t),n=Math.pow(u.distanceToSquared(a),t);i<1e-4&&(i=1),e<1e-4&&(e=i),n<1e-4&&(n=i),ks.initNonuniformCatmullRom(o.x,c.x,u.x,a.x,e,i,n),Us.initNonuniformCatmullRom(o.y,c.y,u.y,a.y,e,i,n),Vs.initNonuniformCatmullRom(o.z,c.z,u.z,a.z,e,i,n)}else"catmullrom"===this.curveType&&(ks.initCatmullRom(o.x,c.x,u.x,a.x,this.tension),Us.initCatmullRom(o.y,c.y,u.y,a.y,this.tension),Vs.initCatmullRom(o.z,c.z,u.z,a.z,this.tension));return i.set(ks.calc(l),Us.calc(l),Vs.calc(l)),i},Ws.prototype.copy=function(t){Bs.prototype.copy.call(this,t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push(i.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this},Ws.prototype.toJSON=function(){const t=Bs.prototype.toJSON.call(this);t.points=[];for(let e=0,i=this.points.length;e<i;e++){const i=this.points[e];t.points.push(i.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t},Ws.prototype.fromJSON=function(t){Bs.prototype.fromJSON.call(this,t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push((new d).fromArray(i))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this},Xs.prototype=Object.create(Bs.prototype),Xs.prototype.constructor=Xs,Xs.prototype.isCubicBezierCurve=!0,Xs.prototype.getPoint=function(t,e=new s){const i=e,n=this.v0,r=this.v1,o=this.v2,a=this.v3;return i.set(qs(t,n.x,r.x,o.x,a.x),qs(t,n.y,r.y,o.y,a.y)),i},Xs.prototype.copy=function(t){return Bs.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this},Xs.prototype.toJSON=function(){const t=Bs.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t},Xs.prototype.fromJSON=function(t){return Bs.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this},Js.prototype=Object.create(Bs.prototype),Js.prototype.constructor=Js,Js.prototype.isCubicBezierCurve3=!0,Js.prototype.getPoint=function(t,e=new d){const i=e,n=this.v0,r=this.v1,s=this.v2,o=this.v3;return i.set(qs(t,n.x,r.x,s.x,o.x),qs(t,n.y,r.y,s.y,o.y),qs(t,n.z,r.z,s.z,o.z)),i},Js.prototype.copy=function(t){return Bs.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this},Js.prototype.toJSON=function(){const t=Bs.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t},Js.prototype.fromJSON=function(t){return Bs.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this},Ys.prototype=Object.create(Bs.prototype),Ys.prototype.constructor=Ys,Ys.prototype.isLineCurve=!0,Ys.prototype.getPoint=function(t,e=new s){const i=e;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i},Ys.prototype.getPointAt=function(t,e){return this.getPoint(t,e)},Ys.prototype.getTangent=function(t,e){const i=e||new s;return i.copy(this.v2).sub(this.v1).normalize(),i},Ys.prototype.copy=function(t){return Bs.prototype.copy.call(this,t),this.v1.copy(t.v1),this.v2.copy(t.v2),this},Ys.prototype.toJSON=function(){const t=Bs.prototype.toJSON.call(this);return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},Ys.prototype.fromJSON=function(t){return Bs.prototype.fromJSON.call(this,t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},Zs.prototype=Object.create(Bs.prototype),Zs.prototype.constructor=Zs,Zs.prototype.isLineCurve3=!0,Zs.prototype.getPoint=function(t,e=new d){const i=e;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i},Zs.prototype.getPointAt=function(t,e){return this.getPoint(t,e)},Zs.prototype.copy=function(t){return Bs.prototype.copy.call(this,t),this.v1.copy(t.v1),this.v2.copy(t.v2),this},Zs.prototype.toJSON=function(){const t=Bs.prototype.toJSON.call(this);return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},Zs.prototype.fromJSON=function(t){return Bs.prototype.fromJSON.call(this,t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},Qs.prototype=Object.create(Bs.prototype),Qs.prototype.constructor=Qs,Qs.prototype.isQuadraticBezierCurve=!0,Qs.prototype.getPoint=function(t,e=new s){const i=e,n=this.v0,r=this.v1,o=this.v2;return i.set(Hs(t,n.x,r.x,o.x),Hs(t,n.y,r.y,o.y)),i},Qs.prototype.copy=function(t){return Bs.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this},Qs.prototype.toJSON=function(){const t=Bs.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},Qs.prototype.fromJSON=function(t){return Bs.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},Ks.prototype=Object.create(Bs.prototype),Ks.prototype.constructor=Ks,Ks.prototype.isQuadraticBezierCurve3=!0,Ks.prototype.getPoint=function(t,e=new d){const i=e,n=this.v0,r=this.v1,s=this.v2;return i.set(Hs(t,n.x,r.x,s.x),Hs(t,n.y,r.y,s.y),Hs(t,n.z,r.z,s.z)),i},Ks.prototype.copy=function(t){return Bs.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this},Ks.prototype.toJSON=function(){const t=Bs.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},Ks.prototype.fromJSON=function(t){return Bs.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},$s.prototype=Object.create(Bs.prototype),$s.prototype.constructor=$s,$s.prototype.isSplineCurve=!0,$s.prototype.getPoint=function(t,e=new s){const i=e,n=this.points,r=(n.length-1)*t,o=Math.floor(r),a=r-o,h=n[0===o?o:o-1],l=n[o],c=n[o>n.length-2?n.length-1:o+1],u=n[o>n.length-3?n.length-1:o+2];return i.set(js(a,h.x,l.x,c.x,u.x),js(a,h.y,l.y,c.y,u.y)),i},$s.prototype.copy=function(t){Bs.prototype.copy.call(this,t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push(i.clone())}return this},$s.prototype.toJSON=function(){const t=Bs.prototype.toJSON.call(this);t.points=[];for(let e=0,i=this.points.length;e<i;e++){const i=this.points[e];t.points.push(i.toArray())}return t},$s.prototype.fromJSON=function(t){Bs.prototype.fromJSON.call(this,t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push((new s).fromArray(i))}return this};var to=Object.freeze({__proto__:null,ArcCurve:Ds,CatmullRomCurve3:Ws,CubicBezierCurve:Xs,CubicBezierCurve3:Js,EllipseCurve:Fs,LineCurve:Ys,LineCurve3:Zs,QuadraticBezierCurve:Qs,QuadraticBezierCurve3:Ks,SplineCurve:$s});function eo(){Bs.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}function io(t){eo.call(this),this.type="Path",this.currentPoint=new s,t&&this.setFromPoints(t)}function no(t){io.call(this,t),this.uuid=n.generateUUID(),this.type="Shape",this.holes=[]}function ro(t,e,i,n,r){let s,o;if(r===function(t,e,i,n){let r=0;for(let s=e,o=i-n;s<i;s+=n)r+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return r}(t,e,i,n)>0)for(s=e;s<i;s+=n)o=Eo(s,t[s],t[s+1],o);else for(s=i-n;s>=e;s-=n)o=Eo(s,t[s],t[s+1],o);return o&&bo(o,o.next)&&(Ao(o),o=o.next),o}function so(t,e){if(!t)return t;e||(e=t);let i,n=t;do{if(i=!1,n.steiner||!bo(n,n.next)&&0!==vo(n.prev,n,n.next))n=n.next;else{if(Ao(n),n=e=n.prev,n===n.next)break;i=!0}}while(i||n!==e);return e}function oo(t,e,i,n,r,s,o){if(!t)return;!o&&s&&function(t,e,i,n){let r=t;do{null===r.z&&(r.z=fo(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,i,n,r,s,o,a,h,l=1;do{for(i=t,t=null,s=null,o=0;i;){for(o++,n=i,a=0,e=0;e<l&&(a++,n=n.nextZ,n);e++);for(h=l;a>0||h>0&&n;)0!==a&&(0===h||!n||i.z<=n.z)?(r=i,i=i.nextZ,a--):(r=n,n=n.nextZ,h--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;i=n}s.nextZ=null,l*=2}while(o>1)}(r)}(t,n,r,s);let a,h,l=t;for(;t.prev!==t.next;)if(a=t.prev,h=t.next,s?ho(t,n,r,s):ao(t))e.push(a.i/i),e.push(t.i/i),e.push(h.i/i),Ao(t),t=h.next,l=h.next;else if((t=h)===l){o?1===o?oo(t=lo(so(t),e,i),e,i,n,r,s,2):2===o&&co(t,e,i,n,r,s):oo(so(t),e,i,n,r,s,1);break}}function ao(t){const e=t.prev,i=t,n=t.next;if(vo(e,i,n)>=0)return!1;let r=t.next.next;for(;r!==t.prev;){if(yo(e.x,e.y,i.x,i.y,n.x,n.y,r.x,r.y)&&vo(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function ho(t,e,i,n){const r=t.prev,s=t,o=t.next;if(vo(r,s,o)>=0)return!1;const a=r.x<s.x?r.x<o.x?r.x:o.x:s.x<o.x?s.x:o.x,h=r.y<s.y?r.y<o.y?r.y:o.y:s.y<o.y?s.y:o.y,l=r.x>s.x?r.x>o.x?r.x:o.x:s.x>o.x?s.x:o.x,c=r.y>s.y?r.y>o.y?r.y:o.y:s.y>o.y?s.y:o.y,u=fo(a,h,e,i,n),p=fo(l,c,e,i,n);let d=t.prevZ,m=t.nextZ;for(;d&&d.z>=u&&m&&m.z<=p;){if(d!==t.prev&&d!==t.next&&yo(r.x,r.y,s.x,s.y,o.x,o.y,d.x,d.y)&&vo(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,m!==t.prev&&m!==t.next&&yo(r.x,r.y,s.x,s.y,o.x,o.y,m.x,m.y)&&vo(m.prev,m,m.next)>=0)return!1;m=m.nextZ}for(;d&&d.z>=u;){if(d!==t.prev&&d!==t.next&&yo(r.x,r.y,s.x,s.y,o.x,o.y,d.x,d.y)&&vo(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;m&&m.z<=p;){if(m!==t.prev&&m!==t.next&&yo(r.x,r.y,s.x,s.y,o.x,o.y,m.x,m.y)&&vo(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function lo(t,e,i){let n=t;do{const r=n.prev,s=n.next.next;!bo(r,s)&&Mo(r,n,n.next,s)&&So(r,s)&&So(s,r)&&(e.push(r.i/i),e.push(n.i/i),e.push(s.i/i),Ao(n),Ao(n.next),n=t=s),n=n.next}while(n!==t);return so(n)}function co(t,e,i,n,r,s){let o=t;do{let t=o.next.next;for(;t!==o.prev;){if(o.i!==t.i&&xo(o,t)){let a=To(o,t);return o=so(o,o.next),a=so(a,a.next),oo(o,e,i,n,r,s),void oo(a,e,i,n,r,s)}t=t.next}o=o.next}while(o!==t)}function uo(t,e){return t.x-e.x}function po(t,e){if(e=function(t,e){let i=e;const n=t.x,r=t.y;let s,o=-1/0;do{if(r<=i.y&&r>=i.next.y&&i.next.y!==i.y){const t=i.x+(r-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(t<=n&&t>o){if(o=t,t===n){if(r===i.y)return i;if(r===i.next.y)return i.next}s=i.x<i.next.x?i:i.next}}i=i.next}while(i!==e);if(!s)return null;if(n===o)return s;const a=s,h=s.x,l=s.y;let c,u=1/0;i=s;do{n>=i.x&&i.x>=h&&n!==i.x&&yo(r<l?n:o,r,h,l,r<l?o:n,r,i.x,i.y)&&(c=Math.abs(r-i.y)/(n-i.x),So(i,t)&&(c<u||c===u&&(i.x>s.x||i.x===s.x&&mo(s,i)))&&(s=i,u=c)),i=i.next}while(i!==a);return s}(t,e)){const i=To(e,t);so(e,e.next),so(i,i.next)}}function mo(t,e){return vo(t.prev,t,e.prev)<0&&vo(e.next,t,t.next)<0}function fo(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function go(t){let e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function yo(t,e,i,n,r,s,o,a){return(r-o)*(e-a)-(t-o)*(s-a)>=0&&(t-o)*(n-a)-(i-o)*(e-a)>=0&&(i-o)*(s-a)-(r-o)*(n-a)>=0}function xo(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&Mo(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(So(t,e)&&So(e,t)&&function(t,e){let i=t,n=!1;const r=(t.x+e.x)/2,s=(t.y+e.y)/2;do{i.y>s!=i.next.y>s&&i.next.y!==i.y&&r<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)&&(vo(t.prev,t,e.prev)||vo(t,e.prev,e))||bo(t,e)&&vo(t.prev,t,t.next)>0&&vo(e.prev,e,e.next)>0)}function vo(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function bo(t,e){return t.x===e.x&&t.y===e.y}function Mo(t,e,i,n){const r=_o(vo(t,e,i)),s=_o(vo(t,e,n)),o=_o(vo(i,n,t)),a=_o(vo(i,n,e));return r!==s&&o!==a||!(0!==r||!wo(t,i,e))||!(0!==s||!wo(t,n,e))||!(0!==o||!wo(i,t,n))||!(0!==a||!wo(i,e,n))}function wo(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function _o(t){return t>0?1:t<0?-1:0}function So(t,e){return vo(t.prev,t,t.next)<0?vo(t,e,t.next)>=0&&vo(t,t.prev,e)>=0:vo(t,e,t.prev)<0||vo(t,t.next,e)<0}function To(t,e){const i=new Lo(t.i,t.x,t.y),n=new Lo(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,s.next=n,n.prev=s,n}function Eo(t,e,i,n){const r=new Lo(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function Ao(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Lo(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}eo.prototype=Object.assign(Object.create(Bs.prototype),{constructor:eo,add:function(t){this.curves.push(t)},closePath:function(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new Ys(e,t))},getPoint:function(t){const e=t*this.getLength(),i=this.getCurveLengths();let n=0;for(;n<i.length;){if(i[n]>=e){const t=i[n]-e,r=this.curves[n],s=r.getLength(),o=0===s?0:1-t/s;return r.getPointAt(o)}n++}return null},getLength:function(){const t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let i=0,n=this.curves.length;i<n;i++)e+=this.curves[i].getLength(),t.push(e);return this.cacheLengths=t,t},getSpacedPoints:function(t=40){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return this.autoClose&&e.push(e[0]),e},getPoints:function(t=12){const e=[];let i;for(let n=0,r=this.curves;n<r.length;n++){const s=r[n],o=s&&s.isEllipseCurve?2*t:s&&(s.isLineCurve||s.isLineCurve3)?1:s&&s.isSplineCurve?t*s.points.length:t,a=s.getPoints(o);for(let t=0;t<a.length;t++){const n=a[t];i&&i.equals(n)||(e.push(n),i=n)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e},copy:function(t){Bs.prototype.copy.call(this,t),this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){const i=t.curves[e];this.curves.push(i.clone())}return this.autoClose=t.autoClose,this},toJSON:function(){const t=Bs.prototype.toJSON.call(this);t.autoClose=this.autoClose,t.curves=[];for(let e=0,i=this.curves.length;e<i;e++){const i=this.curves[e];t.curves.push(i.toJSON())}return t},fromJSON:function(t){Bs.prototype.fromJSON.call(this,t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){const i=t.curves[e];this.curves.push((new to[i.type]).fromJSON(i))}return this}}),io.prototype=Object.assign(Object.create(eo.prototype),{constructor:io,setFromPoints:function(t){this.moveTo(t[0].x,t[0].y);for(let e=1,i=t.length;e<i;e++)this.lineTo(t[e].x,t[e].y);return this},moveTo:function(t,e){return this.currentPoint.set(t,e),this},lineTo:function(t,e){const i=new Ys(this.currentPoint.clone(),new s(t,e));return this.curves.push(i),this.currentPoint.set(t,e),this},quadraticCurveTo:function(t,e,i,n){const r=new Qs(this.currentPoint.clone(),new s(t,e),new s(i,n));return this.curves.push(r),this.currentPoint.set(i,n),this},bezierCurveTo:function(t,e,i,n,r,o){const a=new Xs(this.currentPoint.clone(),new s(t,e),new s(i,n),new s(r,o));return this.curves.push(a),this.currentPoint.set(r,o),this},splineThru:function(t){const e=new $s([this.currentPoint.clone()].concat(t));return this.curves.push(e),this.currentPoint.copy(t[t.length-1]),this},arc:function(t,e,i,n,r,s){const o=this.currentPoint.x,a=this.currentPoint.y;return this.absarc(t+o,e+a,i,n,r,s),this},absarc:function(t,e,i,n,r,s){return this.absellipse(t,e,i,i,n,r,s),this},ellipse:function(t,e,i,n,r,s,o,a){const h=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(t+h,e+l,i,n,r,s,o,a),this},absellipse:function(t,e,i,n,r,s,o,a){const h=new Fs(t,e,i,n,r,s,o,a);if(this.curves.length>0){const t=h.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(h);const l=h.getPoint(1);return this.currentPoint.copy(l),this},copy:function(t){return eo.prototype.copy.call(this,t),this.currentPoint.copy(t.currentPoint),this},toJSON:function(){const t=eo.prototype.toJSON.call(this);return t.currentPoint=this.currentPoint.toArray(),t},fromJSON:function(t){return eo.prototype.fromJSON.call(this,t),this.currentPoint.fromArray(t.currentPoint),this}}),no.prototype=Object.assign(Object.create(io.prototype),{constructor:no,getPointsHoles:function(t){const e=[];for(let i=0,n=this.holes.length;i<n;i++)e[i]=this.holes[i].getPoints(t);return e},extractPoints:function(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}},copy:function(t){io.prototype.copy.call(this,t),this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){const i=t.holes[e];this.holes.push(i.clone())}return this},toJSON:function(){const t=io.prototype.toJSON.call(this);t.uuid=this.uuid,t.holes=[];for(let e=0,i=this.holes.length;e<i;e++){const i=this.holes[e];t.holes.push(i.toJSON())}return t},fromJSON:function(t){io.prototype.fromJSON.call(this,t),this.uuid=t.uuid,this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){const i=t.holes[e];this.holes.push((new io).fromJSON(i))}return this}});const Ro={area:function(t){const e=t.length;let i=0;for(let n=e-1,r=0;r<e;n=r++)i+=t[n].x*t[r].y-t[r].x*t[n].y;return.5*i},isClockWise:function(t){return Ro.area(t)<0},triangulateShape:function(t,e){const i=[],n=[],r=[];Po(t),Co(i,t);let s=t.length;e.forEach(Po);for(let t=0;t<e.length;t++)n.push(s),s+=e[t].length,Co(i,e[t]);const o=function(t,e,i){i=i||2;const n=e&&e.length,r=n?e[0]*i:t.length;let s=ro(t,0,r,i,!0);const o=[];if(!s||s.next===s.prev)return o;let a,h,l,c,u,p,d;if(n&&(s=function(t,e,i,n){const r=[];let s,o,a,h,l;for(s=0,o=e.length;s<o;s++)a=e[s]*n,h=s<o-1?e[s+1]*n:t.length,l=ro(t,a,h,n,!1),l===l.next&&(l.steiner=!0),r.push(go(l));for(r.sort(uo),s=0;s<r.length;s++)po(r[s],i),i=so(i,i.next);return i}(t,e,s,i)),t.length>80*i){a=l=t[0],h=c=t[1];for(let e=i;e<r;e+=i)u=t[e],p=t[e+1],u<a&&(a=u),p<h&&(h=p),u>l&&(l=u),p>c&&(c=p);d=Math.max(l-a,c-h),d=0!==d?1/d:0}return oo(s,o,i,a,h,d),o}(i,n);for(let t=0;t<o.length;t+=3)r.push(o.slice(t,t+3));return r}};function Po(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function Co(t,e){for(let i=0;i<e.length;i++)t.push(e[i].x),t.push(e[i].y)}function Oo(){this.type="ShapePath",this.color=new et,this.subPaths=[],this.currentPath=null}function zo(t){this.type="Font",this.data=t}function No(t,e,i,n,r){const s=r.glyphs[t]||r.glyphs["?"];if(!s)return void console.error('THREE.Font: character "'+t+'" does not exists in font family '+r.familyName+".");const o=new Oo;let a,h,l,c,u,p,d,m;if(s.o){const t=s._cachedOutline||(s._cachedOutline=s.o.split(" "));for(let r=0,s=t.length;r<s;)switch(t[r++]){case"m":a=t[r++]*e+i,h=t[r++]*e+n,o.moveTo(a,h);break;case"l":a=t[r++]*e+i,h=t[r++]*e+n,o.lineTo(a,h);break;case"q":l=t[r++]*e+i,c=t[r++]*e+n,u=t[r++]*e+i,p=t[r++]*e+n,o.quadraticCurveTo(u,p,l,c);break;case"b":l=t[r++]*e+i,c=t[r++]*e+n,u=t[r++]*e+i,p=t[r++]*e+n,d=t[r++]*e+i,m=t[r++]*e+n,o.bezierCurveTo(u,p,d,m,l,c)}}return{offsetX:s.ha*e,path:o}}Object.assign(Oo.prototype,{moveTo:function(t,e){return this.currentPath=new io,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this},lineTo:function(t,e){return this.currentPath.lineTo(t,e),this},quadraticCurveTo:function(t,e,i,n){return this.currentPath.quadraticCurveTo(t,e,i,n),this},bezierCurveTo:function(t,e,i,n,r,s){return this.currentPath.bezierCurveTo(t,e,i,n,r,s),this},splineThru:function(t){return this.currentPath.splineThru(t),this},toShapes:function(t,e){function i(t){const e=[];for(let i=0,n=t.length;i<n;i++){const n=t[i],r=new no;r.curves=n.curves,e.push(r)}return e}function n(t,e){const i=e.length;let n=!1;for(let r=i-1,s=0;s<i;r=s++){let i=e[r],o=e[s],a=o.x-i.x,h=o.y-i.y;if(Math.abs(h)>Number.EPSILON){if(h<0&&(i=e[s],a=-a,o=e[r],h=-h),t.y<i.y||t.y>o.y)continue;if(t.y===i.y){if(t.x===i.x)return!0}else{const e=h*(t.x-i.x)-a*(t.y-i.y);if(0===e)return!0;if(e<0)continue;n=!n}}else{if(t.y!==i.y)continue;if(o.x<=t.x&&t.x<=i.x||i.x<=t.x&&t.x<=o.x)return!0}}return n}const r=Ro.isClockWise,s=this.subPaths;if(0===s.length)return[];if(!0===e)return i(s);let o,a,h;const l=[];if(1===s.length)return a=s[0],h=new no,h.curves=a.curves,l.push(h),l;let c=!r(s[0].getPoints());c=t?!c:c;const u=[],p=[];let d,m,f=[],g=0;p[g]=void 0,f[g]=[];for(let e=0,i=s.length;e<i;e++)a=s[e],d=a.getPoints(),o=r(d),o=t?!o:o,o?(!c&&p[g]&&g++,p[g]={s:new no,p:d},p[g].s.curves=a.curves,c&&g++,f[g]=[]):f[g].push({h:a,p:d[0]});if(!p[0])return i(s);if(p.length>1){let t=!1;const e=[];for(let t=0,e=p.length;t<e;t++)u[t]=[];for(let i=0,r=p.length;i<r;i++){const r=f[i];for(let s=0;s<r.length;s++){const o=r[s];let a=!0;for(let r=0;r<p.length;r++)n(o.p,p[r].p)&&(i!==r&&e.push({froms:i,tos:r,hole:s}),a?(a=!1,u[r].push(o)):t=!0);a&&u[i].push(o)}}e.length>0&&(t||(f=u))}for(let t=0,e=p.length;t<e;t++){h=p[t].s,l.push(h),m=f[t];for(let t=0,e=m.length;t<e;t++)h.holes.push(m[t].h)}return l}}),Object.assign(zo.prototype,{isFont:!0,generateShapes:function(t,e=100){const i=[],n=function(t,e,i){const n=Array.from?Array.from(t):String(t).split(""),r=e/i.resolution,s=(i.boundingBox.yMax-i.boundingBox.yMin+i.underlineThickness)*r,o=[];let a=0,h=0;for(let t=0;t<n.length;t++){const e=n[t];if("\n"===e)a=0,h-=s;else{const t=No(e,r,a,h,i);a+=t.offsetX,o.push(t.path)}}return o}(t,e,this.data);for(let t=0,e=n.length;t<e;t++)Array.prototype.push.apply(i,n[t].toShapes());return i}});const Bo={};function Fo(t){Cs.call(this,t)}function Do(t){Cs.call(this,t)}Fo.prototype=Object.assign(Object.create(Cs.prototype),{constructor:Fo,load:function(t,e,i,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,s=Ls.get(t);if(void 0!==s)return r.manager.itemStart(t),setTimeout((function(){e&&e(s),r.manager.itemEnd(t)}),0),s;if(void 0!==Bo[t])return void Bo[t].push({onLoad:e,onProgress:i,onError:n});const o=t.match(/^data:(.*?)(;base64)?,(.*)$/);let a;if(o){const i=o[1],s=!!o[2];let a=o[3];a=decodeURIComponent(a),s&&(a=atob(a));try{let n;const s=(this.responseType||"").toLowerCase();switch(s){case"arraybuffer":case"blob":const t=new Uint8Array(a.length);for(let e=0;e<a.length;e++)t[e]=a.charCodeAt(e);n="blob"===s?new Blob([t.buffer],{type:i}):t.buffer;break;case"document":const e=new DOMParser;n=e.parseFromString(a,i);break;case"json":n=JSON.parse(a);break;default:n=a}setTimeout((function(){e&&e(n),r.manager.itemEnd(t)}),0)}catch(e){setTimeout((function(){n&&n(e),r.manager.itemError(t),r.manager.itemEnd(t)}),0)}}else{Bo[t]=[],Bo[t].push({onLoad:e,onProgress:i,onError:n}),a=new XMLHttpRequest,a.open("GET",t,!0),a.addEventListener("load",(function(e){const i=this.response,n=Bo[t];if(delete Bo[t],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),Ls.add(t,i);for(let t=0,e=n.length;t<e;t++){const e=n[t];e.onLoad&&e.onLoad(i)}r.manager.itemEnd(t)}else{for(let t=0,i=n.length;t<i;t++){const i=n[t];i.onError&&i.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)}}),!1),a.addEventListener("progress",(function(e){const i=Bo[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onProgress&&n.onProgress(e)}}),!1),a.addEventListener("error",(function(e){const i=Bo[t];delete Bo[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onError&&n.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)}),!1),a.addEventListener("abort",(function(e){const i=Bo[t];delete Bo[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onError&&n.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)}),!1),void 0!==this.responseType&&(a.responseType=this.responseType),void 0!==this.withCredentials&&(a.withCredentials=this.withCredentials),a.overrideMimeType&&a.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain");for(const t in this.requestHeader)a.setRequestHeader(t,this.requestHeader[t]);a.send(null)}return r.manager.itemStart(t),a},setResponseType:function(t){return this.responseType=t,this},setMimeType:function(t){return this.mimeType=t,this}}),Do.prototype=Object.assign(Object.create(Cs.prototype),{constructor:Do,load:function(t,e,i,n){const r=this,s=new Fo(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(r.withCredentials),s.load(t,(function(t){let i;try{i=JSON.parse(t)}catch(e){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),i=JSON.parse(t.substring(65,t.length-2))}const n=r.parse(i);e&&e(n)}),i,n)},parse:function(t){return new zo(t)}});class Go extends jt{constructor(t,e){super(),this.type="ExtrudeBufferGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];const i=this,n=[],r=[];for(let e=0,i=t.length;e<i;e++)o(t[e]);function o(t){const o=[],a=void 0!==e.curveSegments?e.curveSegments:12,h=void 0!==e.steps?e.steps:1;let l=void 0!==e.depth?e.depth:100,c=void 0===e.bevelEnabled||e.bevelEnabled,u=void 0!==e.bevelThickness?e.bevelThickness:6,p=void 0!==e.bevelSize?e.bevelSize:u-2,m=void 0!==e.bevelOffset?e.bevelOffset:0,f=void 0!==e.bevelSegments?e.bevelSegments:3;const g=e.extrudePath,y=void 0!==e.UVGenerator?e.UVGenerator:Io;void 0!==e.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),l=e.amount);let x,v,b,M,w,_=!1;g&&(x=g.getSpacedPoints(h),_=!0,c=!1,v=g.computeFrenetFrames(h,!1),b=new d,M=new d,w=new d),c||(f=0,u=0,p=0,m=0);const S=t.extractPoints(a);let T=S.shape;const E=S.holes;if(!Ro.isClockWise(T)){T=T.reverse();for(let t=0,e=E.length;t<e;t++){const e=E[t];Ro.isClockWise(e)&&(E[t]=e.reverse())}}const A=Ro.triangulateShape(T,E),L=T;for(let t=0,e=E.length;t<e;t++){const e=E[t];T=T.concat(e)}function R(t,e,i){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(i).add(t)}const P=T.length,C=A.length;function O(t,e,i){let n,r,o;const a=t.x-e.x,h=t.y-e.y,l=i.x-t.x,c=i.y-t.y,u=a*a+h*h,p=a*c-h*l;if(Math.abs(p)>Number.EPSILON){const p=Math.sqrt(u),d=Math.sqrt(l*l+c*c),m=e.x-h/p,f=e.y+a/p,g=((i.x-c/d-m)*c-(i.y+l/d-f)*l)/(a*c-h*l);n=m+a*g-t.x,r=f+h*g-t.y;const y=n*n+r*r;if(y<=2)return new s(n,r);o=Math.sqrt(y/2)}else{let t=!1;a>Number.EPSILON?l>Number.EPSILON&&(t=!0):a<-Number.EPSILON?l<-Number.EPSILON&&(t=!0):Math.sign(h)===Math.sign(c)&&(t=!0),t?(n=-h,r=a,o=Math.sqrt(u)):(n=a,r=h,o=Math.sqrt(u/2))}return new s(n/o,r/o)}const z=[];for(let t=0,e=L.length,i=e-1,n=t+1;t<e;t++,i++,n++)i===e&&(i=0),n===e&&(n=0),z[t]=O(L[t],L[i],L[n]);const N=[];let B,F=z.concat();for(let t=0,e=E.length;t<e;t++){const e=E[t];B=[];for(let t=0,i=e.length,n=i-1,r=t+1;t<i;t++,n++,r++)n===i&&(n=0),r===i&&(r=0),B[t]=O(e[t],e[n],e[r]);N.push(B),F=F.concat(B)}for(let t=0;t<f;t++){const e=t/f,i=u*Math.cos(e*Math.PI/2),n=p*Math.sin(e*Math.PI/2)+m;for(let t=0,e=L.length;t<e;t++){const e=R(L[t],z[t],n);I(e.x,e.y,-i)}for(let t=0,e=E.length;t<e;t++){const e=E[t];B=N[t];for(let t=0,r=e.length;t<r;t++){const r=R(e[t],B[t],n);I(r.x,r.y,-i)}}}const D=p+m;for(let t=0;t<P;t++){const e=c?R(T[t],F[t],D):T[t];_?(M.copy(v.normals[0]).multiplyScalar(e.x),b.copy(v.binormals[0]).multiplyScalar(e.y),w.copy(x[0]).add(M).add(b),I(w.x,w.y,w.z)):I(e.x,e.y,0)}for(let t=1;t<=h;t++)for(let e=0;e<P;e++){const i=c?R(T[e],F[e],D):T[e];_?(M.copy(v.normals[t]).multiplyScalar(i.x),b.copy(v.binormals[t]).multiplyScalar(i.y),w.copy(x[t]).add(M).add(b),I(w.x,w.y,w.z)):I(i.x,i.y,l/h*t)}for(let t=f-1;t>=0;t--){const e=t/f,i=u*Math.cos(e*Math.PI/2),n=p*Math.sin(e*Math.PI/2)+m;for(let t=0,e=L.length;t<e;t++){const e=R(L[t],z[t],n);I(e.x,e.y,l+i)}for(let t=0,e=E.length;t<e;t++){const e=E[t];B=N[t];for(let t=0,r=e.length;t<r;t++){const r=R(e[t],B[t],n);_?I(r.x,r.y+x[h-1].y,x[h-1].x+i):I(r.x,r.y,l+i)}}}function G(t,e){let i=t.length;for(;--i>=0;){const n=i;let r=i-1;r<0&&(r=t.length-1);for(let t=0,i=h+2*f;t<i;t++){const i=P*t,s=P*(t+1);U(e+n+i,e+r+i,e+r+s,e+n+s)}}}function I(t,e,i){o.push(t),o.push(e),o.push(i)}function k(t,e,r){V(t),V(e),V(r);const s=n.length/3,o=y.generateTopUV(i,n,s-3,s-2,s-1);W(o[0]),W(o[1]),W(o[2])}function U(t,e,r,s){V(t),V(e),V(s),V(e),V(r),V(s);const o=n.length/3,a=y.generateSideWallUV(i,n,o-6,o-3,o-2,o-1);W(a[0]),W(a[1]),W(a[3]),W(a[1]),W(a[2]),W(a[3])}function V(t){n.push(o[3*t+0]),n.push(o[3*t+1]),n.push(o[3*t+2])}function W(t){r.push(t.x),r.push(t.y)}!function(){const t=n.length/3;if(c){let t=0,e=P*t;for(let t=0;t<C;t++){const i=A[t];k(i[2]+e,i[1]+e,i[0]+e)}t=h+2*f,e=P*t;for(let t=0;t<C;t++){const i=A[t];k(i[0]+e,i[1]+e,i[2]+e)}}else{for(let t=0;t<C;t++){const e=A[t];k(e[2],e[1],e[0])}for(let t=0;t<C;t++){const e=A[t];k(e[0]+P*h,e[1]+P*h,e[2]+P*h)}}i.addGroup(t,n.length/3-t,0)}(),function(){const t=n.length/3;let e=0;G(L,e),e+=L.length;for(let t=0,i=E.length;t<i;t++){const i=E[t];G(i,e),e+=i.length}i.addGroup(t,n.length/3-t,1)}()}this.setAttribute("position",new ft(n,3)),this.setAttribute("uv",new ft(r,2)),this.computeVertexNormals()}toJSON(){const t=jt.prototype.toJSON.call(this);return function(t,e,i){if(i.shapes=[],Array.isArray(t))for(let e=0,n=t.length;e<n;e++){const n=t[e];i.shapes.push(n.uuid)}else i.shapes.push(t.uuid);return void 0!==e.extrudePath&&(i.options.extrudePath=e.extrudePath.toJSON()),i}(this.parameters.shapes,this.parameters.options,t)}}const Io={generateTopUV:function(t,e,i,n,r){const o=e[3*i],a=e[3*i+1],h=e[3*n],l=e[3*n+1],c=e[3*r],u=e[3*r+1];return[new s(o,a),new s(h,l),new s(c,u)]},generateSideWallUV:function(t,e,i,n,r,o){const a=e[3*i],h=e[3*i+1],l=e[3*i+2],c=e[3*n],u=e[3*n+1],p=e[3*n+2],d=e[3*r],m=e[3*r+1],f=e[3*r+2],g=e[3*o],y=e[3*o+1],x=e[3*o+2];return Math.abs(h-u)<.01?[new s(a,1-l),new s(c,1-p),new s(d,1-f),new s(g,1-x)]:[new s(h,1-l),new s(u,1-p),new s(m,1-f),new s(y,1-x)]}};class ko extends Go{constructor(t,e={}){const i=e.font;if(!i||!i.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new jt;const n=i.generateShapes(t,e.size);e.depth=void 0!==e.height?e.height:50,void 0===e.bevelThickness&&(e.bevelThickness=10),void 0===e.bevelSize&&(e.bevelSize=8),void 0===e.bevelEnabled&&(e.bevelEnabled=!1),super(n,e),this.type="TextBufferGeometry"}}function Uo(t){Jt.call(this),this.type="MeshPhongMaterial",this.color=new et(16777215),this.specular=new et(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new et(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new s(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}Uo.prototype=Object.create(Jt.prototype),Uo.prototype.constructor=Uo,Uo.prototype.isMeshPhongMaterial=!0,Uo.prototype.copy=function(t){return Jt.prototype.copy.call(this,t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this};class Vo{constructor(t){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}clone(){return new Vo(void 0===this.value.clone?this.value:this.value.clone())}}class Wo extends jt{constructor(t=1,e=8,i=6,n=0,r=2*Math.PI,s=0,o=Math.PI){super(),this.type="SphereBufferGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:n,phiLength:r,thetaStart:s,thetaLength:o},e=Math.max(3,Math.floor(e)),i=Math.max(2,Math.floor(i));const a=Math.min(s+o,Math.PI);let h=0;const l=[],c=new d,u=new d,p=[],m=[],f=[],g=[];for(let p=0;p<=i;p++){const d=[],y=p/i;let x=0;0==p&&0==s?x=.5/e:p==i&&a==Math.PI&&(x=-.5/e);for(let i=0;i<=e;i++){const a=i/e;c.x=-t*Math.cos(n+a*r)*Math.sin(s+y*o),c.y=t*Math.cos(s+y*o),c.z=t*Math.sin(n+a*r)*Math.sin(s+y*o),m.push(c.x,c.y,c.z),u.copy(c).normalize(),f.push(u.x,u.y,u.z),g.push(a+x,1-y),d.push(h++)}l.push(d)}for(let t=0;t<i;t++)for(let n=0;n<e;n++){const e=l[t][n+1],r=l[t][n],o=l[t+1][n],h=l[t+1][n+1];(0!==t||s>0)&&p.push(e,r,h),(t!==i-1||a<Math.PI)&&p.push(r,o,h)}this.setIndex(p),this.setAttribute("position",new ft(m,3)),this.setAttribute("normal",new ft(f,3)),this.setAttribute("uv",new ft(g,2))}}function jo(){ws.call(this,new ki(50,1,.5,500)),this.focus=1}function Ho(t,e,i,n,r,s){Ms.call(this,t,e),this.type="SpotLight",this.position.copy(Bt.DefaultUp),this.updateMatrix(),this.target=new Bt,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(t){this.intensity=t/Math.PI}}),this.distance=void 0!==i?i:0,this.angle=void 0!==n?n:Math.PI/3,this.penumbra=void 0!==r?r:0,this.decay=void 0!==s?s:1,this.shadow=new jo}jo.prototype=Object.assign(Object.create(ws.prototype),{constructor:jo,isSpotLightShadow:!0,updateMatrices:function(t){const e=this.camera,i=2*n.RAD2DEG*t.angle*this.focus,r=this.mapSize.width/this.mapSize.height,s=t.distance||e.far;i===e.fov&&r===e.aspect&&s===e.far||(e.fov=i,e.aspect=r,e.far=s,e.updateProjectionMatrix()),ws.prototype.updateMatrices.call(this,t)}}),Ho.prototype=Object.assign(Object.create(Ms.prototype),{constructor:Ho,isSpotLight:!0,copy:function(t){return Ms.prototype.copy.call(this,t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}});const qo={decodeText:function(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let i=0,n=t.length;i<n;i++)e+=String.fromCharCode(t[i]);try{return decodeURIComponent(escape(e))}catch(t){return e}},extractUrlBase:function(t){const e=t.lastIndexOf("/");return-1===e?"./":t.substr(0,e+1)}};function Xo(t){Cs.call(this,t)}Xo.prototype=Object.assign(Object.create(Cs.prototype),{constructor:Xo,load:function(t,e,i,n){const r=this,s=new u,o=new Fo(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(r.withCredentials),o.load(t,(function(t){const i=r.parse(t);i&&(void 0!==i.image?s.image=i.image:void 0!==i.data&&(s.image.width=i.width,s.image.height=i.height,s.image.data=i.data),s.wrapS=void 0!==i.wrapS?i.wrapS:1001,s.wrapT=void 0!==i.wrapT?i.wrapT:1001,s.magFilter=void 0!==i.magFilter?i.magFilter:1006,s.minFilter=void 0!==i.minFilter?i.minFilter:1006,s.anisotropy=void 0!==i.anisotropy?i.anisotropy:1,void 0!==i.format&&(s.format=i.format),void 0!==i.type&&(s.type=i.type),void 0!==i.mipmaps&&(s.mipmaps=i.mipmaps,s.minFilter=1008),1===i.mipmapCount&&(s.minFilter=1006),s.needsUpdate=!0,e&&e(s,i))}),i,n),s}});const Jo={arraySlice:function(t,e,i){return Jo.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==i?i:t.length)):t.slice(e,i)},convertArray:function(t,e,i){return!t||!i&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){const e=t.length,i=new Array(e);for(let t=0;t!==e;++t)i[t]=t;return i.sort((function(e,i){return t[e]-t[i]})),i},sortedArray:function(t,e,i){const n=t.length,r=new t.constructor(n);for(let s=0,o=0;o!==n;++s){const n=i[s]*e;for(let i=0;i!==e;++i)r[o++]=t[n+i]}return r},flattenJSON:function(t,e,i,n){let r=1,s=t[0];for(;void 0!==s&&void 0===s[n];)s=t[r++];if(void 0===s)return;let o=s[n];if(void 0!==o)if(Array.isArray(o))do{o=s[n],void 0!==o&&(e.push(s.time),i.push.apply(i,o)),s=t[r++]}while(void 0!==s);else if(void 0!==o.toArray)do{o=s[n],void 0!==o&&(e.push(s.time),o.toArray(i,i.length)),s=t[r++]}while(void 0!==s);else do{o=s[n],void 0!==o&&(e.push(s.time),i.push(o)),s=t[r++]}while(void 0!==s)},subclip:function(t,e,i,n,r=30){const s=t.clone();s.name=e;const o=[];for(let t=0;t<s.tracks.length;++t){const e=s.tracks[t],a=e.getValueSize(),h=[],l=[];for(let t=0;t<e.times.length;++t){const s=e.times[t]*r;if(!(s<i||s>=n)){h.push(e.times[t]);for(let i=0;i<a;++i)l.push(e.values[t*a+i])}}0!==h.length&&(e.times=Jo.convertArray(h,e.times.constructor),e.values=Jo.convertArray(l,e.values.constructor),o.push(e))}s.tracks=o;let a=1/0;for(let t=0;t<s.tracks.length;++t)a>s.tracks[t].times[0]&&(a=s.tracks[t].times[0]);for(let t=0;t<s.tracks.length;++t)s.tracks[t].shift(-1*a);return s.resetDuration(),s},makeClipAdditive:function(t,e=0,i=t,n=30){n<=0&&(n=30);const r=i.tracks.length,s=e/n;for(let e=0;e<r;++e){const n=i.tracks[e],r=n.ValueTypeName;if("bool"===r||"string"===r)continue;const o=t.tracks.find((function(t){return t.name===n.name&&t.ValueTypeName===r}));if(void 0===o)continue;let a=0;const h=n.getValueSize();n.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(a=h/3);let l=0;const c=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(l=c/3);const u=n.times.length-1;let d;if(s<=n.times[0]){const t=a,e=h-a;d=Jo.arraySlice(n.values,t,e)}else if(s>=n.times[u]){const t=u*h+a,e=t+h-a;d=Jo.arraySlice(n.values,t,e)}else{const t=n.createInterpolant(),e=a,i=h-a;t.evaluate(s),d=Jo.arraySlice(t.resultBuffer,e,i)}"quaternion"===r&&(new p).fromArray(d).normalize().conjugate().toArray(d);const m=o.times.length;for(let t=0;t<m;++t){const e=t*c+l;if("quaternion"===r)p.multiplyQuaternionsFlat(o.values,e,d,0,o.values,e);else{const t=c-2*l;for(let i=0;i<t;++i)o.values[e+i]-=d[i]}}}return t.blendMode=2501,t}};function Yo(t,e,i,n){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==n?n:new e.constructor(i),this.sampleValues=e,this.valueSize=i}function Zo(t,e,i,n){Yo.call(this,t,e,i,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Qo(t,e,i,n){Yo.call(this,t,e,i,n)}function Ko(t,e,i,n){Yo.call(this,t,e,i,n)}function $o(t,e,i,n){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Jo.convertArray(e,this.TimeBufferType),this.values=Jo.convertArray(i,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}function ta(t,e,i){$o.call(this,t,e,i)}function ea(t,e,i,n){$o.call(this,t,e,i,n)}function ia(t,e,i,n){$o.call(this,t,e,i,n)}function na(t,e,i,n){Yo.call(this,t,e,i,n)}function ra(t,e,i,n){$o.call(this,t,e,i,n)}function sa(t,e,i,n){$o.call(this,t,e,i,n)}function oa(t,e,i,n){$o.call(this,t,e,i,n)}function aa(t,e=-1,i,r=2500){this.name=t,this.tracks=i,this.duration=e,this.blendMode=r,this.uuid=n.generateUUID(),this.duration<0&&this.resetDuration()}function ha(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return ia;case"vector":case"vector2":case"vector3":case"vector4":return oa;case"color":return ea;case"quaternion":return ra;case"bool":case"boolean":return ta;case"string":return sa}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){const e=[],i=[];Jo.flattenJSON(t.keys,e,i,"value"),t.times=e,t.values=i}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}Object.assign(Yo.prototype,{evaluate:function(t){const e=this.parameterPositions;let i=this._cachedIndex,n=e[i],r=e[i-1];t:{e:{let s;i:{n:if(!(t<n)){for(let s=i+2;;){if(void 0===n){if(t<r)break n;return i=e.length,this._cachedIndex=i,this.afterEnd_(i-1,t,r)}if(i===s)break;if(r=n,n=e[++i],t<n)break e}s=e.length;break i}if(t>=r)break t;{const o=e[1];t<o&&(i=2,r=o);for(let s=i-2;;){if(void 0===r)return this._cachedIndex=0,this.beforeStart_(0,t,n);if(i===s)break;if(n=r,r=e[--i-1],t>=r)break e}s=i,i=0}}for(;i<s;){const n=i+s>>>1;t<e[n]?s=n:i=n+1}if(n=e[i],r=e[i-1],void 0===r)return this._cachedIndex=0,this.beforeStart_(0,t,n);if(void 0===n)return i=e.length,this._cachedIndex=i,this.afterEnd_(i-1,r,t)}this._cachedIndex=i,this.intervalChanged_(i,r,n)}return this.interpolate_(i,r,t,n)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(t){const e=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=t*n;for(let t=0;t!==n;++t)e[t]=i[r+t];return e},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}}),Object.assign(Yo.prototype,{beforeStart_:Yo.prototype.copySampleValue_,afterEnd_:Yo.prototype.copySampleValue_}),Zo.prototype=Object.assign(Object.create(Yo.prototype),{constructor:Zo,DefaultSettings_:{endingStart:2400,endingEnd:2400},intervalChanged_:function(t,e,i){const n=this.parameterPositions;let r=t-2,s=t+1,o=n[r],a=n[s];if(void 0===o)switch(this.getSettings_().endingStart){case 2401:r=t,o=2*e-i;break;case 2402:r=n.length-2,o=e+n[r]-n[r+1];break;default:r=t,o=i}if(void 0===a)switch(this.getSettings_().endingEnd){case 2401:s=t,a=2*i-e;break;case 2402:s=1,a=i+n[1]-n[0];break;default:s=t-1,a=e}const h=.5*(i-e),l=this.valueSize;this._weightPrev=h/(e-o),this._weightNext=h/(a-i),this._offsetPrev=r*l,this._offsetNext=s*l},interpolate_:function(t,e,i,n){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=t*o,h=a-o,l=this._offsetPrev,c=this._offsetNext,u=this._weightPrev,p=this._weightNext,d=(i-e)/(n-e),m=d*d,f=m*d,g=-u*f+2*u*m-u*d,y=(1+u)*f+(-1.5-2*u)*m+(-.5+u)*d+1,x=(-1-p)*f+(1.5+p)*m+.5*d,v=p*f-p*m;for(let t=0;t!==o;++t)r[t]=g*s[l+t]+y*s[h+t]+x*s[a+t]+v*s[c+t];return r}}),Qo.prototype=Object.assign(Object.create(Yo.prototype),{constructor:Qo,interpolate_:function(t,e,i,n){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=t*o,h=a-o,l=(i-e)/(n-e),c=1-l;for(let t=0;t!==o;++t)r[t]=s[h+t]*c+s[a+t]*l;return r}}),Ko.prototype=Object.assign(Object.create(Yo.prototype),{constructor:Ko,interpolate_:function(t){return this.copySampleValue_(t-1)}}),Object.assign($o,{toJSON:function(t){const e=t.constructor;let i;if(void 0!==e.toJSON)i=e.toJSON(t);else{i={name:t.name,times:Jo.convertArray(t.times,Array),values:Jo.convertArray(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(i.interpolation=e)}return i.type=t.ValueTypeName,i}}),Object.assign($o.prototype,{constructor:$o,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:2301,InterpolantFactoryMethodDiscrete:function(t){return new Ko(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodLinear:function(t){return new Qo(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:function(t){return new Zo(this.times,this.values,this.getValueSize(),t)},setInterpolation:function(t){let e;switch(t){case 2300:e=this.InterpolantFactoryMethodDiscrete;break;case 2301:e=this.InterpolantFactoryMethodLinear;break;case 2302:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){const e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",e),this}return this.createInterpolant=e,this},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}},getValueSize:function(){return this.values.length/this.times.length},shift:function(t){if(0!==t){const e=this.times;for(let i=0,n=e.length;i!==n;++i)e[i]+=t}return this},scale:function(t){if(1!==t){const e=this.times;for(let i=0,n=e.length;i!==n;++i)e[i]*=t}return this},trim:function(t,e){const i=this.times,n=i.length;let r=0,s=n-1;for(;r!==n&&i[r]<t;)++r;for(;-1!==s&&i[s]>e;)--s;if(++s,0!==r||s!==n){r>=s&&(s=Math.max(s,1),r=s-1);const t=this.getValueSize();this.times=Jo.arraySlice(i,r,s),this.values=Jo.arraySlice(this.values,r*t,s*t)}return this},validate:function(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const i=this.times,n=this.values,r=i.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let s=null;for(let e=0;e!==r;e++){const n=i[e];if("number"==typeof n&&isNaN(n)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,e,n),t=!1;break}if(null!==s&&s>n){console.error("THREE.KeyframeTrack: Out of order keys.",this,e,n,s),t=!1;break}s=n}if(void 0!==n&&Jo.isTypedArray(n))for(let e=0,i=n.length;e!==i;++e){const i=n[e];if(isNaN(i)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,e,i),t=!1;break}}return t},optimize:function(){const t=Jo.arraySlice(this.times),e=Jo.arraySlice(this.values),i=this.getValueSize(),n=2302===this.getInterpolation(),r=t.length-1;let s=1;for(let o=1;o<r;++o){let r=!1;const a=t[o];if(a!==t[o+1]&&(1!==o||a!==a[0]))if(n)r=!0;else{const t=o*i,n=t-i,s=t+i;for(let o=0;o!==i;++o){const i=e[t+o];if(i!==e[n+o]||i!==e[s+o]){r=!0;break}}}if(r){if(o!==s){t[s]=t[o];const n=o*i,r=s*i;for(let t=0;t!==i;++t)e[r+t]=e[n+t]}++s}}if(r>0){t[s]=t[r];for(let t=r*i,n=s*i,o=0;o!==i;++o)e[n+o]=e[t+o];++s}return s!==t.length?(this.times=Jo.arraySlice(t,0,s),this.values=Jo.arraySlice(e,0,s*i)):(this.times=t,this.values=e),this},clone:function(){const t=Jo.arraySlice(this.times,0),e=Jo.arraySlice(this.values,0),i=new(0,this.constructor)(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}),ta.prototype=Object.assign(Object.create($o.prototype),{constructor:ta,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),ea.prototype=Object.assign(Object.create($o.prototype),{constructor:ea,ValueTypeName:"color"}),ia.prototype=Object.assign(Object.create($o.prototype),{constructor:ia,ValueTypeName:"number"}),na.prototype=Object.assign(Object.create(Yo.prototype),{constructor:na,interpolate_:function(t,e,i,n){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=(i-e)/(n-e);let h=t*o;for(let t=h+o;h!==t;h+=4)p.slerpFlat(r,0,s,h-o,s,h,a);return r}}),ra.prototype=Object.assign(Object.create($o.prototype),{constructor:ra,ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(t){return new na(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),sa.prototype=Object.assign(Object.create($o.prototype),{constructor:sa,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),oa.prototype=Object.assign(Object.create($o.prototype),{constructor:oa,ValueTypeName:"vector"}),Object.assign(aa,{parse:function(t){const e=[],i=t.tracks,n=1/(t.fps||1);for(let t=0,r=i.length;t!==r;++t)e.push(ha(i[t]).scale(n));const r=new aa(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r},toJSON:function(t){const e=[],i=t.tracks,n={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let t=0,n=i.length;t!==n;++t)e.push($o.toJSON(i[t]));return n},CreateFromMorphTargetSequence:function(t,e,i,n){const r=e.length,s=[];for(let t=0;t<r;t++){let o=[],a=[];o.push((t+r-1)%r,t,(t+1)%r),a.push(0,1,0);const h=Jo.getKeyframeOrder(o);o=Jo.sortedArray(o,1,h),a=Jo.sortedArray(a,1,h),n||0!==o[0]||(o.push(r),a.push(a[0])),s.push(new ia(".morphTargetInfluences["+e[t].name+"]",o,a).scale(1/i))}return new aa(t,-1,s)},findByName:function(t,e){let i=t;if(!Array.isArray(t)){const e=t;i=e.geometry&&e.geometry.animations||e.animations}for(let t=0;t<i.length;t++)if(i[t].name===e)return i[t];return null},CreateClipsFromMorphTargetSequences:function(t,e,i){const n={},r=/^([\w-]*?)([\d]+)$/;for(let e=0,i=t.length;e<i;e++){const i=t[e],s=i.name.match(r);if(s&&s.length>1){const t=s[1];let e=n[t];e||(n[t]=e=[]),e.push(i)}}const s=[];for(const t in n)s.push(aa.CreateFromMorphTargetSequence(t,n[t],e,i));return s},parseAnimation:function(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(t,e,i,n,r){if(0!==i.length){const s=[],o=[];Jo.flattenJSON(i,s,o,n),0!==s.length&&r.push(new t(e,s,o))}},n=[],r=t.name||"default",s=t.fps||30,o=t.blendMode;let a=t.length||-1;const h=t.hierarchy||[];for(let t=0;t<h.length;t++){const r=h[t].keys;if(r&&0!==r.length)if(r[0].morphTargets){const t={};let e;for(e=0;e<r.length;e++)if(r[e].morphTargets)for(let i=0;i<r[e].morphTargets.length;i++)t[r[e].morphTargets[i]]=-1;for(const i in t){const t=[],s=[];for(let n=0;n!==r[e].morphTargets.length;++n){const n=r[e];t.push(n.time),s.push(n.morphTarget===i?1:0)}n.push(new ia(".morphTargetInfluence["+i+"]",t,s))}a=t.length*(s||1)}else{const s=".bones["+e[t].name+"]";i(oa,s+".position",r,"pos",n),i(ra,s+".quaternion",r,"rot",n),i(oa,s+".scale",r,"scl",n)}}return 0===n.length?null:new aa(r,a,n,o)}}),Object.assign(aa.prototype,{resetDuration:function(){let t=0;for(let e=0,i=this.tracks.length;e!==i;++e){const i=this.tracks[e];t=Math.max(t,i.times[i.times.length-1])}return this.duration=t,this},trim:function(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this},validate:function(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t},optimize:function(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this},clone:function(){const t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new aa(this.name,this.duration,t,this.blendMode)},toJSON:function(){return aa.toJSON(this)}});const la=new RegExp("[\\[\\]\\.:\\/]","g"),ca="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",ua=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),pa=/(WCOD+)?/.source.replace("WCOD",ca),da=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),ma=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),fa=new RegExp("^"+ua+pa+da+ma+"$"),ga=["material","materials","bones"];function ya(t,e,i){const n=i||xa.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,n)}function xa(t,e,i){this.path=e,this.parsedPath=i||xa.parseTrackName(e),this.node=xa.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}function va(t){Jt.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new s(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function ba(t){te.call(this,t),this.type="RawShaderMaterial"}Object.assign(ya.prototype,{getValue:function(t,e){this.bind();const i=this._targetGroup.nCachedObjects_,n=this._bindings[i];void 0!==n&&n.getValue(t,e)},setValue:function(t,e){const i=this._bindings;for(let n=this._targetGroup.nCachedObjects_,r=i.length;n!==r;++n)i[n].setValue(t,e)},bind:function(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].bind()},unbind:function(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].unbind()}}),Object.assign(xa,{Composite:ya,create:function(t,e,i){return t&&t.isAnimationObjectGroup?new xa.Composite(t,e,i):new xa(t,e,i)},sanitizeNodeName:function(t){return t.replace(/\s/g,"_").replace(la,"")},parseTrackName:function(t){const e=fa.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const i={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},n=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==n&&-1!==n){const t=i.nodeName.substring(n+1);-1!==ga.indexOf(t)&&(i.nodeName=i.nodeName.substring(0,n),i.objectName=t)}if(null===i.propertyName||0===i.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return i},findNode:function(t,e){if(!e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const i=t.skeleton.getBoneByName(e);if(void 0!==i)return i}if(t.children){const i=function(t){for(let n=0;n<t.length;n++){const r=t[n];if(r.name===e||r.uuid===e)return r;const s=i(r.children);if(s)return s}return null},n=i(t.children);if(n)return n}return null}}),Object.assign(xa.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(t,e){t[e]=this.node[this.propertyName]},function(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)t[e++]=i[n]},function(t,e){t[e]=this.resolvedProperty[this.propertyIndex]},function(t,e){this.resolvedProperty.toArray(t,e)}],SetterByBindingTypeAndVersioning:[[function(t,e){this.targetObject[this.propertyName]=t[e]},function(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=t[e++]},function(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=t[e++];this.targetObject.needsUpdate=!0},function(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty[this.propertyIndex]=t[e]},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty.fromArray(t,e)},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(t,e){this.bind(),this.getValue(t,e)},setValue:function(t,e){this.bind(),this.setValue(t,e)},bind:function(){let t=this.node;const e=this.parsedPath,i=e.objectName,n=e.propertyName;let r=e.propertyIndex;if(t||(t=xa.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");if(i){let n=e.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(let e=0;e<t.length;e++)if(t[e].name===n){n=e;break}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!==n){if(void 0===t[n])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[n]}}const s=t[n];if(void 0===s){const i=e.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+i+"."+n+" but it wasn't found.",t)}let o=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?o=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(o=this.Versioning.MatrixWorldNeedsUpdate);let a=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===n){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.isBufferGeometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",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[r]&&(r=t.morphTargetDictionary[r])}a=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else void 0!==s.fromArray&&void 0!==s.toArray?(a=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(a=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=n;this.getValue=this.GetterByBindingType[a],this.setValue=this.SetterByBindingTypeAndVersioning[a][o]},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),Object.assign(xa.prototype,{_getValue_unbound:xa.prototype.getValue,_setValue_unbound:xa.prototype.setValue}),va.prototype=Object.create(Jt.prototype),va.prototype.constructor=va,va.prototype.isMeshNormalMaterial=!0,va.prototype.copy=function(t){return Jt.prototype.copy.call(this,t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},ba.prototype=Object.create(te.prototype),ba.prototype.constructor=ba,ba.prototype.isRawShaderMaterial=!0;const Ma=Math.pow(2,8),wa=[.125,.215,.35,.446,.526,.582],_a=5+wa.length,Sa={3e3:0,3001:1,3002:2,3004:3,3005:4,3006:5,3007:6,3003:7},Ta=new _s,{_lodPlanes:Ea,_sizeLods:Aa,_sigmas:La}=function(){const t=[],e=[],i=[];let n=8;for(let r=0;r<_a;r++){const s=Math.pow(2,n);e.push(s);let o=1/s;r>4?o=wa[r-8+4-1]:0==r&&(o=0),i.push(o);const a=1/(s-1),h=-a/2,l=1+a/2,c=[h,h,l,h,l,l,h,h,l,l,h,l],u=6,p=6,d=3,m=2,f=1,g=new Float32Array(d*p*u),y=new Float32Array(m*p*u),x=new Float32Array(f*p*u);for(let t=0;t<u;t++){const e=t%3*2/3-1,i=t>2?0:-1,n=[e,i,0,e+2/3,i,0,e+2/3,i+1,0,e,i,0,e+2/3,i+1,0,e,i+1,0];g.set(n,d*p*t),y.set(c,m*p*t);const r=[t,t,t,t,t,t];x.set(r,f*p*t)}const v=new jt;v.setAttribute("position",new ot(g,d)),v.setAttribute("uv",new ot(y,m)),v.setAttribute("faceIndex",new ot(x,f)),t.push(v),n>4&&n--}return{_lodPlanes:t,_sizeLods:e,_sigmas:i}}(),Ra=new et;let Pa=null;const Ca=(1+Math.sqrt(5))/2,Oa=1/Ca,za=[new d(1,1,1),new d(-1,1,1),new d(1,1,-1),new d(-1,1,-1),new d(0,Ca,Oa),new d(0,Ca,-Oa),new d(Oa,0,Ca),new d(-Oa,0,Ca),new d(Ca,Oa,0),new d(-Ca,Oa,0)];function Na(t){return void 0!==t&&1009===t.type&&(3e3===t.encoding||3001===t.encoding||3007===t.encoding)}function Ba(t){const e=new Gi(3*Ma,3*Ma,t);return e.texture.mapping=306,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function Fa(t,e,i,n,r){t.viewport.set(e,i,n,r),t.scissor.set(e,i,n,r)}function Da(){return new ba({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:new s(1,1)},inputEncoding:{value:Sa[3e3]},outputEncoding:{value:Sa[3e3]}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\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 vec2 texelSize;\n\n\t\t\t\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include <encodings_pars_fragment>\n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else if ( inputEncoding == 6 ) {\n\n\t\t return LinearToLogLuv(value);\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else if ( outputEncoding == 6 ) {\n\n\t\t return LogLuvToLinear(value);\n\n\t\t\t}\n\n\t\t\telse {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tvec2 f = fract( uv / texelSize - 0.5 );\n\t\t\t\tuv -= f * texelSize;\n\t\t\t\tvec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x += texelSize.x;\n\t\t\t\tvec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.y += texelSize.y;\n\t\t\t\tvec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x -= texelSize.x;\n\t\t\t\tvec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\n\t\t\t\tvec3 tm = mix( tl, tr, f.x );\n\t\t\t\tvec3 bm = mix( bl, br, f.x );\n\t\t\t\tgl_FragColor.rgb = mix( tm, bm, f.y );\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function Ga(){return new ba({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:Sa[3e3]},outputEncoding:{value:Sa[3e3]}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\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 samplerCube envMap;\n\n\t\t\t\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include <encodings_pars_fragment>\n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else if ( inputEncoding == 6 ) {\n\n\t\t return LinearToLogLuv(value);\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else if ( outputEncoding == 6 ) {\n\n\t\t return LogLuvToLinear(value);\n\n\t\t\t}\n\n\t\t\telse {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}class Ia{constructor(t,e,i){Object.defineProperty(this,"isFog",{value:!0}),this.name="",this.color=new et(t),this.near=void 0!==e?e:1,this.far=void 0!==i?i:1e3}clone(){return new Ia(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}function ka(t,e,i,n){Ms.call(this,t,e),this.type="RectAreaLight",this.target=new Bt,this.width=void 0!==i?i:10,this.height=void 0!==n?n:10,this.areaTexture=null}return ka.prototype=Object.assign(Object.create(Ms.prototype),{constructor:ka,isRectAreaLight:!0,copy:function(t){return Ms.prototype.copy.call(this,t),this.width=t.width,this.height=t.height,this},toJSON:function(t){const e=Ms.prototype.toJSON.call(this,t);return e.object.width=this.width,e.object.height=this.height,e}}),t.ACESFilmicToneMapping=4,t.AddEquation=100,t.AddOperation=2,t.AdditiveAnimationBlendMode=2501,t.AdditiveBlending=2,t.AlphaFormat=1021,t.AlwaysDepth=1,t.AlwaysStencilFunc=519,t.AmbientLight=Es,t.AnimationClip=aa,t.AnimationUtils=Jo,t.ArrowHelper=class extends Bt{constructor(t,e,i,n,r,s){super(),this.type="ArrowHelper",void 0===t&&(t=new d(0,0,1)),void 0===e&&(e=new d(0,0,0)),void 0===i&&(i=1),void 0===n&&(n=16776960),void 0===r&&(r=.2*i),void 0===s&&(s=.2*r),void 0===ys&&(ys=new jt,ys.setAttribute("position",new ft([0,0,0,0,1,0],3)),xs=new Qr(0,.5,1,5,1),xs.translate(0,-.5,0)),this.position.copy(e),this.line=new hs(ys,new is({color:n,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Ie(xs,new Me({color:n,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(i,r,s)}setDirection(t){if(t.y>.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{gs.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(gs,e)}}setLength(t,e,i){void 0===e&&(e=.2*t),void 0===i&&(i=.2*e),this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(i,e,i),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}},t.BackSide=1,t.BasicDepthPacking=3200,t.BasicShadowMap=0,t.Box3=g,t.BoxBufferGeometry=Ht,t.BoxGeometry=class extends qr{constructor(t,e,i,n,r,s){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:n,heightSegments:r,depthSegments:s},this.fromBufferGeometry(new Ht(t,e,i,n,r,s)),this.mergeVertices()}},t.BufferAttribute=ot,t.BufferGeometry=jt,t.ByteType=1010,t.CineonToneMapping=3,t.ClampToEdgeWrapping=1001,t.Clock=class{constructor(t){this.autoStart=void 0===t||t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Kr(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const e=Kr();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}},t.Color=et,t.CubeReflectionMapping=301,t.CubeRefractionMapping=302,t.CubeTexture=Vi,t.CubeTextureLoader=Ns,t.CubeUVReflectionMapping=306,t.CubeUVRefractionMapping=307,t.CullFaceBack=1,t.CullFaceFront=2,t.CullFaceFrontBack=3,t.CullFaceNone=0,t.CustomBlending=5,t.CustomToneMapping=5,t.CylinderGeometry=class extends qr{constructor(t,e,i,n,r,s,o,a){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:i,radialSegments:n,heightSegments:r,openEnded:s,thetaStart:o,thetaLength:a},this.fromBufferGeometry(new Qr(t,e,i,n,r,s,o,a)),this.mergeVertices()}},t.DataTexture=u,t.DataTextureLoader=Xo,t.DecrementStencilOp=7683,t.DecrementWrapStencilOp=34056,t.DefaultLoadingManager=Ps,t.DepthFormat=1026,t.DepthStencilFormat=1027,t.DirectionalLight=Ts,t.DoubleSide=2,t.DstAlphaFactor=206,t.DstColorFactor=208,t.DynamicCopyUsage=35050,t.DynamicDrawUsage=35048,t.DynamicReadUsage=35049,t.EdgesGeometry=class extends jt{constructor(t,e){super(),this.type="EdgesGeometry",this.parameters={thresholdAngle:e},e=void 0!==e?e:1,t.isGeometry&&(t=(new jt).fromGeometry(t));const i=Math.pow(10,4),r=Math.cos(n.DEG2RAD*e),s=t.getIndex(),o=t.getAttribute("position"),a=s?s.count:o.count,h=[0,0,0],l=["a","b","c"],c=new Array(3),u={},p=[];for(let t=0;t<a;t+=3){s?(h[0]=s.getX(t),h[1]=s.getX(t+1),h[2]=s.getX(t+2)):(h[0]=t,h[1]=t+1,h[2]=t+2);const{a:e,b:n,c:a}=Zr;if(e.fromBufferAttribute(o,h[0]),n.fromBufferAttribute(o,h[1]),a.fromBufferAttribute(o,h[2]),Zr.getNormal(Yr),c[0]=`${Math.round(e.x*i)},${Math.round(e.y*i)},${Math.round(e.z*i)}`,c[1]=`${Math.round(n.x*i)},${Math.round(n.y*i)},${Math.round(n.z*i)}`,c[2]=`${Math.round(a.x*i)},${Math.round(a.y*i)},${Math.round(a.z*i)}`,c[0]!==c[1]&&c[1]!==c[2]&&c[2]!==c[0])for(let t=0;t<3;t++){const e=(t+1)%3,i=c[t],n=c[e],s=Zr[l[t]],o=Zr[l[e]],a=`${i}_${n}`,d=`${n}_${i}`;d in u&&u[d]?(Yr.dot(u[d].normal)<=r&&(p.push(s.x,s.y,s.z),p.push(o.x,o.y,o.z)),u[d]=null):a in u||(u[a]={index0:h[t],index1:h[e],normal:Yr.clone()})}}for(const t in u)if(u[t]){const{index0:e,index1:i}=u[t];Xr.fromBufferAttribute(o,e),Jr.fromBufferAttribute(o,i),p.push(Xr.x,Xr.y,Xr.z),p.push(Jr.x,Jr.y,Jr.z)}this.setAttribute("position",new ft(p,3))}},t.EqualDepth=4,t.EqualStencilFunc=514,t.EquirectangularReflectionMapping=303,t.EquirectangularRefractionMapping=304,t.Euler=xt,t.EventDispatcher=r,t.Face3=be,t.FileLoader=Fo,t.FlatShading=1,t.Float32BufferAttribute=ft,t.Float64BufferAttribute=gt,t.FloatType=1015,t.Fog=Ia,t.FontLoader=Do,t.FrontSide=0,t.GLSL1="100",t.GLSL3="300 es",t.GammaEncoding=3007,t.Geometry=qr,t.GreaterDepth=6,t.GreaterEqualDepth=5,t.GreaterEqualStencilFunc=518,t.GreaterStencilFunc=516,t.Group=Gr,t.HalfFloatType=1016,t.HemisphereLight=As,t.IncrementStencilOp=7682,t.IncrementWrapStencilOp=34055,t.Int16BufferAttribute=ct,t.Int32BufferAttribute=pt,t.Int8BufferAttribute=at,t.IntType=1013,t.Interpolant=Yo,t.InterpolateDiscrete=2300,t.InterpolateLinear=2301,t.InterpolateSmooth=2302,t.InvertStencilOp=5386,t.KeepStencilOp=7680,t.Layers=Mt,t.LessDepth=2,t.LessEqualDepth=3,t.LessEqualStencilFunc=515,t.LessStencilFunc=513,t.Line=hs,t.Line3=class{constructor(t,e){this.start=void 0!==t?t:new d,this.end=void 0!==e?e:new d}set(t,e){return this.start.copy(t),this.end.copy(e),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return void 0===t&&(console.warn("THREE.Line3: .getCenter() target is now required"),t=new d),t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return void 0===t&&(console.warn("THREE.Line3: .delta() target is now required"),t=new d),t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return void 0===e&&(console.warn("THREE.Line3: .at() target is now required"),e=new d),this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){vs.subVectors(t,this.start),bs.subVectors(this.end,this.start);const i=bs.dot(bs);let r=bs.dot(vs)/i;return e&&(r=n.clamp(r,0,1)),r}closestPointToPoint(t,e,i){const n=this.closestPointToPointParameter(t,e);return void 0===i&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),i=new d),this.delta(i).multiplyScalar(n).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}},t.LineBasicMaterial=is,t.LineDashedMaterial=fs,t.LineSegments=us,t.LinearEncoding=3e3,t.LinearFilter=1006,t.LinearMipMapLinearFilter=1008,t.LinearMipMapNearestFilter=1007,t.LinearMipmapLinearFilter=1008,t.LinearMipmapNearestFilter=1007,t.LinearToneMapping=1,t.Loader=Cs,t.LoaderUtils=qo,t.LoadingManager=Rs,t.LogLuvEncoding=3003,t.LoopOnce=2200,t.LoopPingPong=2202,t.LoopRepeat=2201,t.LuminanceAlphaFormat=1025,t.LuminanceFormat=1024,t.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},t.Material=Jt,t.MathUtils=n,t.Matrix4=k,t.MaxEquation=104,t.Mesh=Ie,t.MeshBasicMaterial=Me,t.MeshDepthMaterial=Rr,t.MeshNormalMaterial=va,t.MeshPhongMaterial=Uo,t.MeshPhysicalMaterial=ds,t.MeshStandardMaterial=ps,t.MinEquation=103,t.MirroredRepeatWrapping=1002,t.MixOperation=1,t.MultiplyBlending=4,t.MultiplyOperation=0,t.NearestFilter=1003,t.NearestMipMapLinearFilter=1005,t.NearestMipMapNearestFilter=1004,t.NearestMipmapLinearFilter=1005,t.NearestMipmapNearestFilter=1004,t.NeverDepth=0,t.NeverStencilFunc=512,t.NoBlending=0,t.NoToneMapping=0,t.NormalAnimationBlendMode=2500,t.NormalBlending=1,t.NotEqualDepth=7,t.NotEqualStencilFunc=517,t.NumberKeyframeTrack=ia,t.Object3D=Bt,t.ObjectSpaceNormalMap=1,t.OneFactor=201,t.OneMinusDstAlphaFactor=207,t.OneMinusDstColorFactor=209,t.OneMinusSrcAlphaFactor=205,t.OneMinusSrcColorFactor=203,t.OrthographicCamera=_s,t.PCFShadowMap=1,t.PCFSoftShadowMap=2,t.PMREMGenerator=class{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._blurMaterial=new ba({name:"SphericalGaussianBlur",defines:{n:20},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:new Float32Array(20)},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:new d(0,1,0)},inputEncoding:{value:Sa[3e3]},outputEncoding:{value:Sa[3e3]}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\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\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include <encodings_pars_fragment>\n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else if ( inputEncoding == 6 ) {\n\n\t\t return LinearToLogLuv(value);\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else if ( outputEncoding == 6 ) {\n\n\t\t return LogLuvToLinear(value);\n\n\t\t\t}\n\n\t\t\telse {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t\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\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1}),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,i=.1,n=100){Pa=this._renderer.getRenderTarget();const r=this._allocateTargets();return this._sceneToCubeUV(t,i,n,r),e>0&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(t){return this._fromTexture(t)}fromCubemap(t){return this._fromTexture(t)}compileCubemapShader(){null===this._cubemapShader&&(this._cubemapShader=Ga(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){null===this._equirectShader&&(this._equirectShader=Da(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(let t=0;t<Ea.length;t++)Ea[t].dispose()}_cleanup(t){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(Pa),t.scissorTest=!1,Fa(t,0,0,t.width,t.height)}_fromTexture(t){Pa=this._renderer.getRenderTarget();const e=this._allocateTargets(t);return this._textureToCubeUV(t,e),this._applyPMREM(e),this._cleanup(e),e}_allocateTargets(t){const e={magFilter:1003,minFilter:1003,generateMipmaps:!1,type:1009,format:1023,encoding:Na(t)?t.encoding:3002,depthBuffer:!1},i=Ba(e);return i.depthBuffer=!t,this._pingPongRenderTarget=Ba(e),i}_compileMaterial(t){const e=new Ie(Ea[0],t);this._renderer.compile(e,Ta)}_sceneToCubeUV(t,e,i,n){const r=new ki(90,1,e,i),s=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],a=this._renderer,h=a.outputEncoding,l=a.toneMapping;a.getClearColor(Ra);const c=a.getClearAlpha();a.toneMapping=0,a.outputEncoding=3e3;let u=t.background;if(u&&u.isColor){u.convertSRGBToLinear();const e=Math.max(u.r,u.g,u.b),i=Math.min(Math.max(Math.ceil(Math.log2(e)),-128),127);u=u.multiplyScalar(Math.pow(2,-i));const n=(i+128)/255;a.setClearColor(u,n),t.background=null}for(let e=0;e<6;e++){const i=e%3;0==i?(r.up.set(0,s[e],0),r.lookAt(o[e],0,0)):1==i?(r.up.set(0,0,s[e]),r.lookAt(0,o[e],0)):(r.up.set(0,s[e],0),r.lookAt(0,0,o[e])),Fa(n,i*Ma,e>2?Ma:0,Ma,Ma),a.setRenderTarget(n),a.render(t,r)}a.toneMapping=l,a.outputEncoding=h,a.setClearColor(Ra,c)}_textureToCubeUV(t,e){const i=this._renderer;t.isCubeTexture?null==this._cubemapShader&&(this._cubemapShader=Ga()):null==this._equirectShader&&(this._equirectShader=Da());const n=t.isCubeTexture?this._cubemapShader:this._equirectShader,r=new Ie(Ea[0],n),s=n.uniforms;s.envMap.value=t,t.isCubeTexture||s.texelSize.value.set(1/t.image.width,1/t.image.height),s.inputEncoding.value=Sa[t.encoding],s.outputEncoding.value=Sa[e.texture.encoding],Fa(e,0,0,3*Ma,2*Ma),i.setRenderTarget(e),i.render(r,Ta)}_applyPMREM(t){const e=this._renderer,i=e.autoClear;e.autoClear=!1;for(let e=1;e<_a;e++){const i=Math.sqrt(La[e]*La[e]-La[e-1]*La[e-1]),n=za[(e-1)%za.length];this._blur(t,e-1,e,i,n)}e.autoClear=i}_blur(t,e,i,n,r){const s=this._pingPongRenderTarget;this._halfBlur(t,s,e,i,n,"latitudinal",r),this._halfBlur(s,t,i,i,n,"longitudinal",r)}_halfBlur(t,e,i,n,r,s,o){const a=this._renderer,h=this._blurMaterial;"latitudinal"!==s&&"longitudinal"!==s&&console.error("blur direction must be either latitudinal or longitudinal!");const l=new Ie(Ea[n],h),c=h.uniforms,u=Aa[i]-1,p=isFinite(r)?Math.PI/(2*u):2*Math.PI/39,d=r/p,m=isFinite(r)?1+Math.floor(3*d):20;m>20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${m} samples when the maximum is set to 20`);const f=[];let g=0;for(let t=0;t<20;++t){const e=t/d,i=Math.exp(-e*e/2);f.push(i),0==t?g+=i:t<m&&(g+=2*i)}for(let t=0;t<f.length;t++)f[t]=f[t]/g;c.envMap.value=t.texture,c.samples.value=m,c.weights.value=f,c.latitudinal.value="latitudinal"===s,o&&(c.poleAxis.value=o),c.dTheta.value=p,c.mipInt.value=8-i,c.inputEncoding.value=Sa[t.texture.encoding],c.outputEncoding.value=Sa[t.texture.encoding];const y=Aa[n];Fa(e,3*Math.max(0,Ma-2*y),(0===n?0:2*Ma)+2*y*(n>4?n-8+4:0),3*y,2*y),a.setRenderTarget(e),a.render(l,Ta)}},t.Path=io,t.PerspectiveCamera=ki,t.Plane=F,t.PlaneBufferGeometry=qt,t.PlaneGeometry=class extends qr{constructor(t,e,i,n){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:n},this.fromBufferGeometry(new qt(t,e,i,n)),this.mergeVertices()}},t.PropertyBinding=xa,t.Quaternion=p,t.QuaternionKeyframeTrack=ra,t.REVISION="124",t.RGBADepthPacking=3201,t.RGBAFormat=1023,t.RGBAIntegerFormat=1033,t.RGBA_ASTC_10x10_Format=37819,t.RGBA_ASTC_10x5_Format=37816,t.RGBA_ASTC_10x6_Format=37817,t.RGBA_ASTC_10x8_Format=37818,t.RGBA_ASTC_12x10_Format=37820,t.RGBA_ASTC_12x12_Format=37821,t.RGBA_ASTC_4x4_Format=37808,t.RGBA_ASTC_5x4_Format=37809,t.RGBA_ASTC_5x5_Format=37810,t.RGBA_ASTC_6x5_Format=37811,t.RGBA_ASTC_6x6_Format=37812,t.RGBA_ASTC_8x5_Format=37813,t.RGBA_ASTC_8x6_Format=37814,t.RGBA_ASTC_8x8_Format=37815,t.RGBA_BPTC_Format=36492,t.RGBA_ETC2_EAC_Format=37496,t.RGBA_PVRTC_2BPPV1_Format=35843,t.RGBA_PVRTC_4BPPV1_Format=35842,t.RGBA_S3TC_DXT1_Format=33777,t.RGBA_S3TC_DXT3_Format=33778,t.RGBA_S3TC_DXT5_Format=33779,t.RGBDEncoding=3006,t.RGBEEncoding=3002,t.RGBEFormat=1023,t.RGBFormat=1022,t.RGBIntegerFormat=1032,t.RGBM16Encoding=3005,t.RGBM7Encoding=3004,t.RGB_ETC1_Format=36196,t.RGB_ETC2_Format=37492,t.RGB_PVRTC_2BPPV1_Format=35841,t.RGB_PVRTC_4BPPV1_Format=35840,t.RGB_S3TC_DXT1_Format=33776,t.RGFormat=1030,t.RGIntegerFormat=1031,t.Ray=he,t.Raycaster=$r,t.RectAreaLight=ka,t.RedFormat=1028,t.RedIntegerFormat=1029,t.ReinhardToneMapping=2,t.RepeatWrapping=1e3,t.ReplaceStencilOp=7681,t.ReverseSubtractEquation=102,t.SRGB8_ALPHA8_ASTC_10x10_Format=37851,t.SRGB8_ALPHA8_ASTC_10x5_Format=37848,t.SRGB8_ALPHA8_ASTC_10x6_Format=37849,t.SRGB8_ALPHA8_ASTC_10x8_Format=37850,t.SRGB8_ALPHA8_ASTC_12x10_Format=37852,t.SRGB8_ALPHA8_ASTC_12x12_Format=37853,t.SRGB8_ALPHA8_ASTC_4x4_Format=37840,t.SRGB8_ALPHA8_ASTC_5x4_Format=37841,t.SRGB8_ALPHA8_ASTC_5x5_Format=37842,t.SRGB8_ALPHA8_ASTC_6x5_Format=37843,t.SRGB8_ALPHA8_ASTC_6x6_Format=37844,t.SRGB8_ALPHA8_ASTC_8x5_Format=37845,t.SRGB8_ALPHA8_ASTC_8x6_Format=37846,t.SRGB8_ALPHA8_ASTC_8x8_Format=37847,t.Scene=class extends Bt{constructor(){super(),Object.defineProperty(this,"isScene",{value:!0}),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.background&&(e.object.background=this.background.toJSON(t)),null!==this.environment&&(e.object.environment=this.environment.toJSON(t)),null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}},t.ShaderChunk=Pi,t.ShaderLib=Oi,t.ShaderMaterial=te,t.ShadowMaterial=ms,t.Shape=no,t.ShapeBufferGeometry=class extends jt{constructor(t,e=12){super(),this.type="ShapeBufferGeometry",this.parameters={shapes:t,curveSegments:e};const i=[],n=[],r=[],s=[];let o=0,a=0;if(!1===Array.isArray(t))h(t);else for(let e=0;e<t.length;e++)h(t[e]),this.addGroup(o,a,e),o+=a,a=0;function h(t){const o=n.length/3,h=t.extractPoints(e);let l=h.shape;const c=h.holes;!1===Ro.isClockWise(l)&&(l=l.reverse());for(let t=0,e=c.length;t<e;t++){const e=c[t];!0===Ro.isClockWise(e)&&(c[t]=e.reverse())}const u=Ro.triangulateShape(l,c);for(let t=0,e=c.length;t<e;t++){const e=c[t];l=l.concat(e)}for(let t=0,e=l.length;t<e;t++){const e=l[t];n.push(e.x,e.y,0),r.push(0,0,1),s.push(e.x,e.y)}for(let t=0,e=u.length;t<e;t++){const e=u[t],n=e[0]+o,r=e[1]+o,s=e[2]+o;i.push(n,r,s),a+=3}}this.setIndex(i),this.setAttribute("position",new ft(n,3)),this.setAttribute("normal",new ft(r,3)),this.setAttribute("uv",new ft(s,2))}toJSON(){const t=jt.prototype.toJSON.call(this);return function(t,e){if(e.shapes=[],Array.isArray(t))for(let i=0,n=t.length;i<n;i++){const n=t[i];e.shapes.push(n.uuid)}else e.shapes.push(t.uuid);return e}(this.parameters.shapes,t)}},t.ShortType=1011,t.SmoothShading=2,t.Sphere=O,t.SphereBufferGeometry=Wo,t.SphereGeometry=class extends qr{constructor(t,e,i,n,r,s,o){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:n,phiLength:r,thetaStart:s,thetaLength:o},this.fromBufferGeometry(new Wo(t,e,i,n,r,s,o)),this.mergeVertices()}},t.SpotLight=Ho,t.SrcAlphaFactor=204,t.SrcAlphaSaturateFactor=210,t.SrcColorFactor=202,t.StaticCopyUsage=35046,t.StaticDrawUsage=35044,t.StaticReadUsage=35045,t.StreamCopyUsage=35042,t.StreamDrawUsage=35040,t.StreamReadUsage=35041,t.SubtractEquation=101,t.SubtractiveBlending=3,t.TOUCH={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},t.TangentSpaceNormalMap=0,t.TextGeometry=class extends qr{constructor(t,e){super(),this.type="TextGeometry",this.parameters={text:t,parameters:e},this.fromBufferGeometry(new ko(t,e)),this.mergeVertices()}},t.Texture=l,t.TextureLoader=zs,t.TriangleFanDrawMode=2,t.TriangleStripDrawMode=1,t.TrianglesDrawMode=0,t.UVMapping=300,t.Uint16BufferAttribute=ut,t.Uint32BufferAttribute=dt,t.Uint8BufferAttribute=ht,t.Uint8ClampedBufferAttribute=lt,t.Uniform=Vo,t.UniformsLib=Ci,t.UniformsUtils=Qt,t.UnsignedByteType=1009,t.UnsignedInt248Type=1020,t.UnsignedIntType=1014,t.UnsignedShort4444Type=1017,t.UnsignedShort5551Type=1018,t.UnsignedShort565Type=1019,t.UnsignedShortType=1012,t.VSMShadowMap=3,t.Vector2=s,t.Vector3=d,t.Vector4=J,t.VectorKeyframeTrack=oa,t.WebGLCubeRenderTarget=Wi,t.WebGLRenderTarget=Gi,t.WebGLRenderer=function(t){const e=void 0!==(t=t||{}).canvas?t.canvas:function(){const t=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return t.style.display="block",t}(),i=void 0!==t.context?t.context:null,r=void 0!==t.alpha&&t.alpha,o=void 0===t.depth||t.depth,a=void 0===t.stencil||t.stencil,h=void 0!==t.antialias&&t.antialias,l=void 0===t.premultipliedAlpha||t.premultipliedAlpha,c=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,p=void 0!==t.powerPreference?t.powerPreference:"default",m=void 0!==t.failIfMajorPerformanceCaveat&&t.failIfMajorPerformanceCaveat;let f=null,g=null;const y=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.outputEncoding=3e3,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1,this.saoBuffer=null,this.indirectDiffuseBuffer=null,this.screenBufferSize=new THREE.Vector2(0,0),this.maxMorphTargets=8,this.maxMorphNormals=4;const x=this;let v=!1,b=null,M=0,w=0,_=null,S=null,T=-1,E=null;const A=new J,L=new J;let R=null,P=e.width,C=e.height,O=1,z=null,N=null;const B=new J(0,0,P,C),F=new J(0,0,P,C);let D=!1;const G=new I;let U=!1,V=!1;const W=new k,j=new d,H={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function q(){return null===_?O:1}let X,Y,Z,Q,K,$,tt,rt,st,ot,at,ht,lt,ct,ut,pt,dt,mt,ft,gt,yt,xt=i;function vt(t,i){for(let n=0;n<t.length;n++){const r=t[n],s=e.getContext(r,i);if(null!==s)return s}return null}try{const t={alpha:r,depth:o,stencil:a,antialias:h,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:p,failIfMajorPerformanceCaveat:m};if(e.addEventListener("webglcontextlost",_t,!1),e.addEventListener("webglcontextrestored",St,!1),null===xt){const e=["webgl2","webgl","experimental-webgl"];if(!0===x.isWebGL1Renderer&&e.shift(),xt=vt(e,t),null===xt)throw vt(e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}void 0===xt.getShaderPrecisionFormat&&(xt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(t){throw console.error("THREE.WebGLRenderer: "+t.message),t}function bt(){X=new Hi(xt),Y=new Fi(xt,X,t),!1===Y.isWebGL2&&(X.get("WEBGL_depth_texture"),X.get("OES_texture_float"),X.get("OES_texture_half_float"),X.get("OES_texture_half_float_linear"),X.get("OES_standard_derivatives"),X.get("OES_element_index_uint"),X.get("OES_vertex_array_object"),X.get("ANGLE_instanced_arrays")),X.get("OES_texture_float_linear"),gt=new Fr(xt,X,Y),Z=new Nr(xt,X,Y),Z.scissor(L.copy(F).multiplyScalar(O).floor()),Z.viewport(A.copy(B).multiplyScalar(O).floor()),Q=new Ji(xt),K=new xr,$=new Br(xt,X,Z,K,Y,gt,Q),tt=new ji(x),rt=new nt(xt,Y),yt=new Ni(xt,X,rt,Y),st=new qi(xt,rt,Q,yt),ot=new Ki(xt,st,rt,Q),dt=new Qi(xt),ut=new Di(K),at=new yr(x,tt,X,Y,yt,ut),ht=new Ur(K),lt=new wr(K),ct=new Lr(X,Y),pt=new zi(x,tt,Z,ot,l),mt=new Bi(xt,X,Q,Y),ft=new Xi(xt,X,Q,Y),Q.programs=at.programs,x.capabilities=Y,x.extensions=X,x.properties=K,x.renderLists=lt,x.state=Z,x.info=Q}bt();const Mt=new kr(x,xt);this.xr=Mt;const wt=new zr(x,ot,Y.maxTextureSize);function _t(t){t.preventDefault(),v=!0}function St(){v=!1,bt()}function Tt(t){const e=t.target;e.removeEventListener("dispose",Tt),function(t){Et(t),K.remove(t)}(e)}function Et(t){const e=K.get(t).program;void 0!==e&&at.releaseProgram(e)}this.shadowMap=wt,this.getContext=function(){return xt},this.getContextAttributes=function(){return xt.getContextAttributes()},this.forceContextLoss=function(){const t=X.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){const t=X.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return O},this.setPixelRatio=function(t){void 0!==t&&(O=t,this.setSize(P,C,!1))},this.getSize=function(t){return void 0===t&&(console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),t=new s),t.set(P,C)},this.setSize=function(t,i,n){Mt.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(P=t,C=i,e.width=Math.floor(t*O),e.height=Math.floor(i*O),!1!==n&&(e.style.width=t+"px",e.style.height=i+"px"),this.setViewport(0,0,t,i))},this.getDrawingBufferSize=function(t){return void 0===t&&(console.warn("WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument"),t=new s),t.set(P*O,C*O).floor()},this.setDrawingBufferSize=function(t,i,n){P=t,C=i,O=n,e.width=Math.floor(t*n),e.height=Math.floor(i*n),this.setViewport(0,0,t,i)},this.getCurrentViewport=function(t){return void 0===t&&(console.warn("WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument"),t=new J),t.copy(A)},this.getViewport=function(t){return t.copy(B)},this.setViewport=function(t,e,i,n){t.isVector4?B.set(t.x,t.y,t.z,t.w):B.set(t,e,i,n),Z.viewport(A.copy(B).multiplyScalar(O).floor())},this.getScissor=function(t){return t.copy(F)},this.setScissor=function(t,e,i,n){t.isVector4?F.set(t.x,t.y,t.z,t.w):F.set(t,e,i,n),Z.scissor(L.copy(F).multiplyScalar(O).floor())},this.getScissorTest=function(){return D},this.setScissorTest=function(t){Z.setScissorTest(D=t)},this.setOpaqueSort=function(t){z=t},this.setTransparentSort=function(t){N=t},this.getClearColor=function(t){return void 0===t&&(console.warn("WebGLRenderer: .getClearColor() now requires a Color as an argument"),t=new et),t.copy(pt.getClearColor())},this.setClearColor=function(){pt.setClearColor.apply(pt,arguments)},this.getClearAlpha=function(){return pt.getClearAlpha()},this.setClearAlpha=function(){pt.setClearAlpha.apply(pt,arguments)},this.clear=function(t,e,i){let n=0;(void 0===t||t)&&(n|=16384),(void 0===e||e)&&(n|=256),(void 0===i||i)&&(n|=1024),xt.clear(n)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",_t,!1),e.removeEventListener("webglcontextrestored",St,!1),lt.dispose(),ct.dispose(),K.dispose(),tt.dispose(),ot.dispose(),yt.dispose(),Mt.dispose(),Lt.stop()},this.renderBufferImmediate=function(t,e){yt.initAttributes();const i=K.get(t);t.hasPositions&&!i.position&&(i.position=xt.createBuffer()),t.hasNormals&&!i.normal&&(i.normal=xt.createBuffer()),t.hasUvs&&!i.uv&&(i.uv=xt.createBuffer()),t.hasColors&&!i.color&&(i.color=xt.createBuffer());const n=e.getAttributes();t.hasPositions&&(xt.bindBuffer(34962,i.position),xt.bufferData(34962,t.positionArray,35048),yt.enableAttribute(n.position),xt.vertexAttribPointer(n.position,3,5126,!1,0,0)),t.hasNormals&&(xt.bindBuffer(34962,i.normal),xt.bufferData(34962,t.normalArray,35048),yt.enableAttribute(n.normal),xt.vertexAttribPointer(n.normal,3,5126,!1,0,0)),t.hasUvs&&(xt.bindBuffer(34962,i.uv),xt.bufferData(34962,t.uvArray,35048),yt.enableAttribute(n.uv),xt.vertexAttribPointer(n.uv,2,5126,!1,0,0)),t.hasColors&&(xt.bindBuffer(34962,i.color),xt.bufferData(34962,t.colorArray,35048),yt.enableAttribute(n.color),xt.vertexAttribPointer(n.color,3,5126,!1,0,0)),yt.disableUnusedAttributes(),xt.drawArrays(4,0,t.count),t.count=0},this.renderBufferDirect=function(t,e,i,n,r,s){null===e&&(e=H);const o=r.isMesh&&r.matrixWorld.determinant()<0,a=zt(t,e,n,r);Z.setMaterial(n,o);let h=i.index;const l=i.attributes.position;if(null===h){if(void 0===l||0===l.count)return}else if(0===h.count)return;let c,u=1;!0===n.wireframe&&(h=st.getWireframeAttribute(i),u=2),(n.morphTargets||n.morphNormals)&&dt.update(r,i,n,a),yt.setup(r,n,a,i,h);let p=mt;null!==h&&(c=rt.get(h),p=ft,p.setIndex(c));const d=null!==h?h.count:l.count,m=i.drawRange.start*u,f=i.drawRange.count*u,g=null!==s?s.start*u:0,y=null!==s?s.count*u:1/0,x=Math.max(m,g),v=Math.min(d,m+f,g+y)-1,b=Math.max(0,v-x+1);if(0!==b){if(r.isMesh)!0===n.wireframe?(Z.setLineWidth(n.wireframeLinewidth*q()),p.setMode(1)):p.setMode(4);else if(r.isLine){let t=n.linewidth;void 0===t&&(t=1),Z.setLineWidth(t*q()),r.isLineSegments?p.setMode(1):r.isLineLoop?p.setMode(2):p.setMode(3)}else r.isPoints?p.setMode(0):r.isSprite&&p.setMode(4);if(r.isInstancedMesh)p.renderInstances(x,b,r.count);else if(i.isInstancedBufferGeometry){const t=Math.min(i.instanceCount,i._maxInstanceCount);p.renderInstances(x,b,t)}else p.render(x,b)}},this.compile=function(t,e){g=ct.get(t),g.init(),t.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(g.pushLight(t),t.castShadow&&g.pushShadow(t))})),g.setupLights();const i=new WeakMap;t.traverse((function(e){const n=e.material;if(n)if(Array.isArray(n))for(let r=0;r<n.length;r++){const s=n[r];!1===i.has(s)&&(Ot(s,t,e),i.set(s))}else!1===i.has(n)&&(Ot(n,t,e),i.set(n))}))};let At=null;const Lt=new it;function Rt(t,e,i,n){if(!1===t.visible)return;if(t.layers.test(e.layers))if(t.isGroup)i=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(e);else if(t.isLight)g.pushLight(t),t.castShadow&&g.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||G.intersectsSprite(t)){n&&j.setFromMatrixPosition(t.matrixWorld).applyMatrix4(W);const e=ot.update(t),r=t.material;r.visible&&f.push(t,e,r,i,j.z,null)}}else if(t.isImmediateRenderObject)n&&j.setFromMatrixPosition(t.matrixWorld).applyMatrix4(W),f.push(t,null,t.material,i,j.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.frame!==Q.render.frame&&(t.skeleton.update(),t.skeleton.frame=Q.render.frame),!t.frustumCulled||G.intersectsObject(t))){n&&j.setFromMatrixPosition(t.matrixWorld).applyMatrix4(W);const e=ot.update(t),r=t.material;if(Array.isArray(r)){const n=e.groups;for(let s=0,o=n.length;s<o;s++){const o=n[s],a=r[o.materialIndex];a&&a.visible&&f.push(t,e,a,i,j.z,o)}}else r.visible&&f.push(t,e,r,i,j.z,null)}const r=t.children;for(let t=0,s=r.length;t<s;t++)Rt(r[t],e,i,n)}function Pt(t,e,i){const n=!0===e.isScene?e.overrideMaterial:null;for(let r=0,s=t.length;r<s;r++){const s=t[r],o=s.object,a=s.geometry,h=null===n?s.material:n,l=s.group;if(i.isArrayCamera){const t=i.cameras;for(let i=0,n=t.length;i<n;i++){const n=t[i];o.layers.test(n.layers)&&(Z.viewport(A.copy(n.viewport)),g.setupLightsView(n),Ct(o,e,n,a,h,l))}}else Ct(o,e,i,a,h,l)}}function Ct(t,e,i,n,r,s){if(t.onBeforeRender(x,e,i,n,r,s),t.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),t.isImmediateRenderObject){const n=zt(i,e,r,t);Z.setMaterial(r),yt.reset(),function(t,e){t.render((function(t){x.renderBufferImmediate(t,e)}))}(t,n)}else x.renderBufferDirect(i,e,n,r,t,s);t.onAfterRender(x,e,i,n,r,s)}function Ot(t,e,i){!0!==e.isScene&&(e=H);const n=K.get(t),r=g.state.lights,s=g.state.shadowsArray,o=r.state.version,a=at.getParameters(t,r.state,s,e,i),h=at.getProgramCacheKey(a);let l=n.program,c=!0;if(void 0===l)t.addEventListener("dispose",Tt);else if(l.cacheKey!==h)Et(t);else if(n.lightsStateVersion!==o)c=!1;else{if(void 0!==a.shaderID){const i=t.isMeshStandardMaterial?e.environment:null;return void(n.envMap=tt.get(t.envMap||i))}c=!1}c&&(a.uniforms=at.getUniforms(t),t.onBeforeCompile(a,x),l=at.acquireProgram(a,h),n.program=l,n.uniforms=a.uniforms,n.outputEncoding=a.outputEncoding);const u=n.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(n.numClippingPlanes=ut.numPlanes,n.numIntersection=ut.numIntersection,u.clippingPlanes=ut.uniform),n.environment=t.isMeshStandardMaterial?e.environment:null,n.fog=e.fog,n.envMap=tt.get(t.envMap||n.environment),n.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),n.lightsStateVersion=o,n.needsLights&&(u.ambientLightColor.value=r.state.ambient,u.lightProbe.value=r.state.probe,u.directionalLights.value=r.state.directional,u.directionalLightShadows.value=r.state.directionalShadow,u.spotLights.value=r.state.spot,u.spotLightShadows.value=r.state.spotShadow,u.rectAreaLights.value=r.state.rectArea,u.rectAreaTexture.value=r.state.rectAreaTexture,u.ltc_1.value=r.state.rectAreaLTC1,u.ltc_2.value=r.state.rectAreaLTC2,u.pointLights.value=r.state.point,u.pointLightShadows.value=r.state.pointShadow,u.hemisphereLights.value=r.state.hemi,u.directionalShadowMap.value=r.state.directionalShadowMap,u.directionalShadowMatrix.value=r.state.directionalShadowMatrix,u.spotShadowMap.value=r.state.spotShadowMap,u.spotShadowMatrix.value=r.state.spotShadowMatrix,u.spotPosition.value=r.state.spotPosition,u.pointShadowMap.value=r.state.pointShadowMap,u.pointShadowMatrix.value=r.state.pointShadowMatrix,u.rectShadowMap.value=r.state.rectShadowMap);const p=n.program.getUniforms(),d=Zn.seqWithValue(p.seq,u);n.uniformsList=d}function zt(t,e,i,r){!0!==e.isScene&&(e=H),$.resetTextureUnits();const s=e.fog,o=i.isMeshStandardMaterial?e.environment:null,a=null===_?x.outputEncoding:_.texture.encoding,h=tt.get(i.envMap||o),l=K.get(i),c=g.state.lights,p=i.transparent||i.alphaTest>0,d=void 0!==i.transmission&&i.transmission>0;var m=!p&&!d;if(U&&(!0===V||t!==E)){const e=t===E&&i.id===T;ut.setState(i,t,e)}i.version===l.__version?i.fog&&l.fog!==s||l.environment!==o||l.needsLights&&l.lightsStateVersion!==c.state.version?Ot(i,e,r):void 0===l.numClippingPlanes||l.numClippingPlanes===ut.numPlanes&&l.numIntersection===ut.numIntersection?(l.outputEncoding!==a||l.envMap!==h)&&Ot(i,e,r):Ot(i,e,r):(Ot(i,e,r),l.__version=i.version);let f=!1,y=!1,v=!1;const b=l.program,M=b.getUniforms(),w=l.uniforms;if(Z.useProgram(b.program)&&(f=!0,y=!0,v=!0),i.id!==T&&(T=i.id,y=!0),f||E!==t){if(M.setValue(xt,"projectionMatrix",t.projectionMatrix),Y.logarithmicDepthBuffer&&M.setValue(xt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),E!==t&&(E=t,y=!0,v=!0),i.isShaderMaterial||i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshStandardMaterial||i.envMap){const e=M.map.cameraPosition;void 0!==e&&e.setValue(xt,j.setFromMatrixPosition(t.matrixWorld))}(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&M.setValue(xt,"isOrthographic",!0===t.isOrthographicCamera),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial||i.isShadowMaterial||i.skinning)&&M.setValue(xt,"viewMatrix",t.matrixWorldInverse)}if(i.skinning){M.setOptional(xt,r,"bindMatrix"),M.setOptional(xt,r,"bindMatrixInverse");const t=r.skeleton;if(t){const e=t.bones;if(Y.floatVertexTextures){if(null===t.boneTexture){let i=Math.sqrt(4*e.length);i=n.ceilPowerOfTwo(i),i=Math.max(i,4);const r=new Float32Array(i*i*4);r.set(t.boneMatrices);const s=new u(r,i,i,1023,1015);t.boneMatrices=r,t.boneTexture=s,t.boneTextureSize=i}M.setValue(xt,"boneTexture",t.boneTexture,$),M.setValue(xt,"boneTextureSize",t.boneTextureSize)}else M.setOptional(xt,t,"boneMatrices")}}var S,A;return(y||l.receiveShadow!==r.receiveShadow)&&(l.receiveShadow=r.receiveShadow,M.setValue(xt,"receiveShadow",r.receiveShadow)),y&&(M.setValue(xt,"toneMappingExposure",x.toneMappingExposure),M.setValue(xt,"screenBufferSize",x.screenBufferSize),M.setValue(xt,"useAO",m),M.setValue(xt,"saoBuffer",x.saoBuffer,$),M.setValue(xt,"indirectDiffuseBuffer",x.indirectDiffuseBuffer,$),l.needsLights&&(A=v,(S=w).ambientLightColor.needsUpdate=A,S.lightProbe.needsUpdate=A,S.directionalLights.needsUpdate=A,S.directionalLightShadows.needsUpdate=A,S.pointLights.needsUpdate=A,S.pointLightShadows.needsUpdate=A,S.spotLights.needsUpdate=A,S.spotLightShadows.needsUpdate=A,S.rectAreaLights.needsUpdate=A,S.hemisphereLights.needsUpdate=A),s&&i.fog&&ht.refreshFogUniforms(w,s),ht.refreshMaterialUniforms(w,i,O,C),Zn.upload(xt,l.uniformsList,w,$)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(Zn.upload(xt,l.uniformsList,w,$),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&M.setValue(xt,"center",r.center),M.setValue(xt,"modelViewMatrix",r.modelViewMatrix),M.setValue(xt,"normalMatrix",r.normalMatrix),M.setValue(xt,"modelMatrix",r.matrixWorld),b}Lt.setAnimationLoop((function(t){Mt.isPresenting||At&&At(t)})),"undefined"!=typeof window&&Lt.setContext(window),this.setAnimationLoop=function(t){At=t,Mt.setAnimationLoop(t),null===t?Lt.stop():Lt.start()},this.render=function(t,e){let i,n;if(void 0!==arguments[2]&&(console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead."),i=arguments[2]),void 0!==arguments[3]&&(console.warn("THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead."),n=arguments[3]),void 0!==e&&!0!==e.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===v)return;yt.resetDefaultState(),T=-1,E=null,!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),!0===Mt.enabled&&!0===Mt.isPresenting&&(e=Mt.getCamera(e)),!0===t.isScene&&t.onBeforeRender(x,t,e,i||_),g=ct.get(t,y.length),g.init(),y.push(g),W.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),G.setFromProjectionMatrix(W),V=this.localClippingEnabled,U=ut.init(this.clippingPlanes,V,e),f=lt.get(t,e),f.init(),Rt(t,e,0,x.sortObjects),f.finish(),!0===x.sortObjects&&f.sort(z,N),!0===U&&ut.beginShadows();const r=g.state.shadowsArray;wt.render(r,t,e),g.setupLights(),g.setupLightsView(e),!0===U&&ut.endShadows(),!0===this.info.autoReset&&this.info.reset(),void 0!==i&&this.setRenderTarget(i),pt.render(f,t,e,n);const s=f.opaque,o=f.transparent;s.length>0&&Pt(s,t,e),o.length>0&&Pt(o,t,e),!0===t.isScene&&t.onAfterRender(x,t,e),null!==_&&($.updateRenderTargetMipmap(_),$.updateMultisampleRenderTarget(_)),Z.buffers.depth.setTest(!0),Z.buffers.depth.setMask(!0),Z.buffers.color.setMask(!0),Z.setPolygonOffset(!1),y.pop(),g=y.length>0?y[y.length-1]:null,f=null},this.setFramebuffer=function(t){b!==t&&null===_&&xt.bindFramebuffer(36160,t),b=t},this.getActiveCubeFace=function(){return M},this.getActiveMipmapLevel=function(){return w},this.getRenderList=function(){return f},this.setRenderList=function(t){f=t},this.getRenderTarget=function(){return _},this.setRenderTarget=function(t,e=0,i=0){_=t,M=e,w=i,t&&void 0===K.get(t).__webglFramebuffer&&$.setupRenderTarget(t);let n=b,r=!1;if(t){const i=K.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(n=i[e],r=!0):n=t.isWebGLMultisampleRenderTarget?K.get(t).__webglMultisampledFramebuffer:i,A.copy(t.viewport),L.copy(t.scissor),R=t.scissorTest}else A.copy(B).multiplyScalar(O).floor(),L.copy(F).multiplyScalar(O).floor(),R=D;if(S!==n&&(xt.bindFramebuffer(36160,n),S=n),Z.viewport(A),Z.scissor(L),Z.setScissorTest(R),r){const n=K.get(t.texture);xt.framebufferTexture2D(36160,36064,34069+e,n.__webglTexture,i)}},this.readRenderTargetPixels=function(t,e,i,n,r,s,o){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=K.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==o&&(a=a[o]),a){let o=!1;a!==S&&(xt.bindFramebuffer(36160,a),o=!0);try{const a=t.texture,h=a.format,l=a.type;if(1023!==h&&gt.convert(h)!==xt.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(1009===l||gt.convert(l)===xt.getParameter(35738)||1015===l&&(Y.isWebGL2||X.get("OES_texture_float")||X.get("WEBGL_color_buffer_float"))||1016===l&&(Y.isWebGL2?X.get("EXT_color_buffer_float"):X.get("EXT_color_buffer_half_float"))))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===xt.checkFramebufferStatus(36160)?e>=0&&e<=t.width-n&&i>=0&&i<=t.height-r&&xt.readPixels(e,i,n,r,gt.convert(h),gt.convert(l),s):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{o&&xt.bindFramebuffer(36160,S)}}},this.copyFramebufferToTexture=function(t,e,i=0){const n=Math.pow(2,-i),r=Math.floor(e.image.width*n),s=Math.floor(e.image.height*n),o=gt.convert(e.format);$.setTexture2D(e,0),xt.copyTexImage2D(3553,i,o,t.x,t.y,r,s,0),Z.unbindTexture()},this.copyTextureToTexture=function(t,e,i,n=0){const r=e.image.width,s=e.image.height,o=gt.convert(i.format),a=gt.convert(i.type);$.setTexture2D(i,0),xt.pixelStorei(37440,i.flipY),xt.pixelStorei(37441,i.premultiplyAlpha),xt.pixelStorei(3317,i.unpackAlignment),e.isDataTexture?xt.texSubImage2D(3553,n,t.x,t.y,r,s,o,a,e.image.data):e.isCompressedTexture?xt.compressedTexSubImage2D(3553,n,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,o,e.mipmaps[0].data):xt.texSubImage2D(3553,n,t.x,t.y,o,a,e.image),0===n&&i.generateMipmaps&&xt.generateMipmap(3553),Z.unbindTexture()},this.initTexture=function(t){$.setTexture2D(t,0),Z.unbindTexture()},this.resetState=function(){Z.reset(),yt.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))},t.WrapAroundEnding=2402,t.ZeroCurvatureEnding=2400,t.ZeroFactor=200,t.ZeroSlopeEnding=2401,t.ZeroStencilOp=0,t.sRGBEncoding=3001,t}({});
1
+ var THREE=function(t){const e=[];for(let t=0;t<256;t++)e[t]=(t<16?"0":"")+t.toString(16);let i=1234567;const n={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){const t=4294967295*Math.random()|0,i=4294967295*Math.random()|0,n=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return(e[255&t]+e[t>>8&255]+e[t>>16&255]+e[t>>24&255]+"-"+e[255&i]+e[i>>8&255]+"-"+e[i>>16&15|64]+e[i>>24&255]+"-"+e[63&n|128]+e[n>>8&255]+"-"+e[n>>16&255]+e[n>>24&255]+e[255&r]+e[r>>8&255]+e[r>>16&255]+e[r>>24&255]).toUpperCase()},clamp:function(t,e,i){return Math.max(e,Math.min(i,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,i,n,r){return n+(t-e)*(r-n)/(i-e)},lerp:function(t,e,i){return(1-i)*t+i*e},smoothstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*(3-2*t)},smootherstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){return void 0!==t&&(i=t%2147483647),i=16807*i%2147483647,(i-1)/2147483646},degToRad:function(t){return t*n.DEG2RAD},radToDeg:function(t){return t*n.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},setQuaternionFromProperEuler:function(t,e,i,n,r){const s=Math.cos,o=Math.sin,a=s(i/2),h=o(i/2),l=s((e+n)/2),c=o((e+n)/2),u=s((e-n)/2),p=o((e-n)/2),d=s((n-e)/2),m=o((n-e)/2);switch(r){case"XYX":t.set(a*c,h*u,h*p,a*l);break;case"YZY":t.set(h*p,a*c,h*u,a*l);break;case"ZXZ":t.set(h*u,h*p,a*c,a*l);break;case"XZX":t.set(a*c,h*m,h*d,a*l);break;case"YXY":t.set(h*d,a*c,h*m,a*l);break;case"ZYZ":t.set(h*m,h*d,a*c,a*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}};function r(){}Object.assign(r.prototype,{addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});const i=this._listeners;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;const i=this._listeners;return void 0!==i[t]&&-1!==i[t].indexOf(e)},removeEventListener:function(t,e){if(void 0===this._listeners)return;const i=this._listeners[t];if(void 0!==i){const t=i.indexOf(e);-1!==t&&i.splice(t,1)}},dispatchEvent:function(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const i=e.slice(0);for(let e=0,n=i.length;e<n;e++)i[e].call(this,t)}}});class s{constructor(t=0,e=0){Object.defineProperty(this,"isVector2",{value:!0}),this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,i=this.y,n=t.elements;return this.x=n[0]*e+n[3]*i+n[6],this.y=n[1]*e+n[4]*i+n[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=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}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e,i){return void 0!==i&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const i=Math.cos(e),n=Math.sin(e),r=this.x-t.x,s=this.y-t.y;return this.x=r*i-s*n+t.x,this.y=r*n+s*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}}class o{constructor(){Object.defineProperty(this,"isMatrix3",{value:!0}),this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(t,e,i,n,r,s,o,a,h){const l=this.elements;return l[0]=t,l[1]=n,l[2]=o,l[3]=e,l[4]=r,l[5]=a,l[6]=i,l[7]=s,l[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}clone(){return(new this.constructor).fromArray(this.elements)}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,r=this.elements,s=i[0],o=i[3],a=i[6],h=i[1],l=i[4],c=i[7],u=i[2],p=i[5],d=i[8],m=n[0],f=n[3],g=n[6],y=n[1],x=n[4],v=n[7],b=n[2],M=n[5],w=n[8];return r[0]=s*m+o*y+a*b,r[3]=s*f+o*x+a*M,r[6]=s*g+o*v+a*w,r[1]=h*m+l*y+c*b,r[4]=h*f+l*x+c*M,r[7]=h*g+l*v+c*w,r[2]=u*m+p*y+d*b,r[5]=u*f+p*x+d*M,r[8]=u*g+p*v+d*w,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],s=t[4],o=t[5],a=t[6],h=t[7],l=t[8];return e*s*l-e*o*h-i*r*l+i*o*a+n*r*h-n*s*a}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],s=t[4],o=t[5],a=t[6],h=t[7],l=t[8],c=l*s-o*h,u=o*a-l*r,p=h*r-s*a,d=e*c+i*u+n*p;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);const m=1/d;return t[0]=c*m,t[1]=(n*h-l*i)*m,t[2]=(o*i-n*s)*m,t[3]=u*m,t[4]=(l*e-n*a)*m,t[5]=(n*r-o*e)*m,t[6]=p*m,t[7]=(i*a-h*e)*m,t[8]=(s*e-i*r)*m,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).copy(this).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,i,n,r,s,o){const a=Math.cos(r),h=Math.sin(r);return this.set(i*a,i*h,-i*(a*s+h*o)+s+t,-n*h,n*a,-n*(-h*s+a*o)+o+e,0,0,1),this}scale(t,e){const i=this.elements;return i[0]*=t,i[3]*=t,i[6]*=t,i[1]*=e,i[4]*=e,i[7]*=e,this}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.elements,r=n[0],s=n[3],o=n[6],a=n[1],h=n[4],l=n[7];return n[0]=e*r+i*a,n[3]=e*s+i*h,n[6]=e*o+i*l,n[1]=-i*r+e*a,n[4]=-i*s+e*h,n[7]=-i*o+e*l,this}translate(t,e){const i=this.elements;return i[0]+=t*i[2],i[3]+=t*i[5],i[6]+=t*i[8],i[1]+=e*i[2],i[4]+=e*i[5],i[7]+=e*i[8],this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<9;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}}let a,h=0;function l(t=l.DEFAULT_IMAGE,e=l.DEFAULT_MAPPING,i=1001,r=1001,a=1006,c=1008,u=1023,p=1009,d=1,m=3e3){Object.defineProperty(this,"id",{value:h++}),this.uuid=n.generateUUID(),this.name="",this.image=t,this.mipmaps=[],this.mapping=e,this.wrapS=i,this.wrapT=r,this.magFilter=a,this.minFilter=c,this.anisotropy=d,this.format=u,this.internalFormat=null,this.type=p,this.offset=new s(0,0),this.repeat=new s(1,1),this.center=new s(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new o,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=m,this.version=0,this.onUpdate=null}function c(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?function(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===a&&(a=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),a.width=t.width,a.height=t.height;const i=a.getContext("2d");t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0,t.width,t.height),e=a}return e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}(t):t.data?{data:Array.prototype.slice.call(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}function u(t,e,i,n,r,s,o,a,h,c,u,p){l.call(this,null,s,o,a,h,c,n,r,u,p),this.image={data:t||null,width:e||1,height:i||1},this.magFilter=void 0!==h?h:1003,this.minFilter=void 0!==c?c:1003,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}l.DEFAULT_IMAGE=void 0,l.DEFAULT_MAPPING=300,l.prototype=Object.assign(Object.create(r.prototype),{constructor:l,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const i={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,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,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){const r=this.image;if(void 0===r.uuid&&(r.uuid=n.generateUUID()),!e&&void 0===t.images[r.uuid]){let e;if(Array.isArray(r)){e=[];for(let t=0,i=r.length;t<i;t++)r[t].isDataTexture?e.push(c(r[t].image)):e.push(c(r[t]))}else e=c(r);t.images[r.uuid]={uuid:r.uuid,url:e}}i.image=r.uuid}return e||(t.textures[this.uuid]=i),i},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case 1e3:t.x=t.x-Math.floor(t.x);break;case 1001:t.x=t.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case 1e3:t.y=t.y-Math.floor(t.y);break;case 1001:t.y=t.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}}),Object.defineProperty(l.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),u.prototype=Object.create(l.prototype),u.prototype.constructor=u,u.prototype.isDataTexture=!0;class p{constructor(t=0,e=0,i=0,n=1){Object.defineProperty(this,"isQuaternion",{value:!0}),this._x=t,this._y=e,this._z=i,this._w=n}static slerp(t,e,i,n){return i.copy(t).slerp(e,n)}static slerpFlat(t,e,i,n,r,s,o){let a=i[n+0],h=i[n+1],l=i[n+2],c=i[n+3];const u=r[s+0],p=r[s+1],d=r[s+2],m=r[s+3];if(c!==m||a!==u||h!==p||l!==d){let t=1-o;const e=a*u+h*p+l*d+c*m,i=e>=0?1:-1,n=1-e*e;if(n>Number.EPSILON){const r=Math.sqrt(n),s=Math.atan2(r,e*i);t=Math.sin(t*s)/r,o=Math.sin(o*s)/r}const r=o*i;if(a=a*t+u*r,h=h*t+p*r,l=l*t+d*r,c=c*t+m*r,t===1-o){const t=1/Math.sqrt(a*a+h*h+l*l+c*c);a*=t,h*=t,l*=t,c*=t}}t[e]=a,t[e+1]=h,t[e+2]=l,t[e+3]=c}static multiplyQuaternionsFlat(t,e,i,n,r,s){const o=i[n],a=i[n+1],h=i[n+2],l=i[n+3],c=r[s],u=r[s+1],p=r[s+2],d=r[s+3];return t[e]=o*d+l*c+a*p-h*u,t[e+1]=a*d+l*u+h*c-o*p,t[e+2]=h*d+l*p+o*u-a*c,t[e+3]=l*d-o*c-a*u-h*p,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._w=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const i=t._x,n=t._y,r=t._z,s=t._order,o=Math.cos,a=Math.sin,h=o(i/2),l=o(n/2),c=o(r/2),u=a(i/2),p=a(n/2),d=a(r/2);switch(s){case"XYZ":this._x=u*l*c+h*p*d,this._y=h*p*c-u*l*d,this._z=h*l*d+u*p*c,this._w=h*l*c-u*p*d;break;case"YXZ":this._x=u*l*c+h*p*d,this._y=h*p*c-u*l*d,this._z=h*l*d-u*p*c,this._w=h*l*c+u*p*d;break;case"ZXY":this._x=u*l*c-h*p*d,this._y=h*p*c+u*l*d,this._z=h*l*d+u*p*c,this._w=h*l*c-u*p*d;break;case"ZYX":this._x=u*l*c-h*p*d,this._y=h*p*c+u*l*d,this._z=h*l*d-u*p*c,this._w=h*l*c+u*p*d;break;case"YZX":this._x=u*l*c+h*p*d,this._y=h*p*c+u*l*d,this._z=h*l*d-u*p*c,this._w=h*l*c-u*p*d;break;case"XZY":this._x=u*l*c-h*p*d,this._y=h*p*c-u*l*d,this._z=h*l*d+u*p*c,this._w=h*l*c+u*p*d;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!1!==e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const i=e/2,n=Math.sin(i);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,i=e[0],n=e[4],r=e[8],s=e[1],o=e[5],a=e[9],h=e[2],l=e[6],c=e[10],u=i+o+c;if(u>0){const t=.5/Math.sqrt(u+1);this._w=.25/t,this._x=(l-a)*t,this._y=(r-h)*t,this._z=(s-n)*t}else if(i>o&&i>c){const t=2*Math.sqrt(1+i-o-c);this._w=(l-a)/t,this._x=.25*t,this._y=(n+s)/t,this._z=(r+h)/t}else if(o>c){const t=2*Math.sqrt(1+o-i-c);this._w=(r-h)/t,this._x=(n+s)/t,this._y=.25*t,this._z=(a+l)/t}else{const t=2*Math.sqrt(1+c-i-o);this._w=(s-n)/t,this._x=(r+h)/t,this._y=(a+l)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<1e-6?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(n.clamp(this.dot(t),-1,1)))}rotateTowards(t,e){const i=this.angleTo(t);if(0===i)return this;const n=Math.min(1,e/i);return this.slerp(t,n),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const i=t._x,n=t._y,r=t._z,s=t._w,o=e._x,a=e._y,h=e._z,l=e._w;return this._x=i*l+s*o+n*h-r*a,this._y=n*l+s*a+r*o-i*h,this._z=r*l+s*h+i*a-n*o,this._w=s*l-i*o-n*a-r*h,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const i=this._x,n=this._y,r=this._z,s=this._w;let o=s*t._w+i*t._x+n*t._y+r*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=s,this._x=i,this._y=n,this._z=r,this;const a=1-o*o;if(a<=Number.EPSILON){const t=1-e;return this._w=t*s+e*this._w,this._x=t*i+e*this._x,this._y=t*n+e*this._y,this._z=t*r+e*this._z,this.normalize(),this._onChangeCallback(),this}const h=Math.sqrt(a),l=Math.atan2(h,o),c=Math.sin((1-e)*l)/h,u=Math.sin(e*l)/h;return this._w=s*c+this._w*u,this._x=i*c+this._x*u,this._y=n*c+this._y*u,this._z=r*c+this._z*u,this._onChangeCallback(),this}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}class d{constructor(t=0,e=0,i=0){Object.defineProperty(this,"isVector3",{value:!0}),this.x=t,this.y=e,this.z=i}set(t,e,i){return void 0===i&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(f.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(f.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*n,this.y=r[1]*e+r[4]*i+r[7]*n,this.z=r[2]*e+r[5]*i+r[8]*n,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,i=this.y,n=this.z,r=t.elements,s=1/(r[3]*e+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*n+r[12])*s,this.y=(r[1]*e+r[5]*i+r[9]*n+r[13])*s,this.z=(r[2]*e+r[6]*i+r[10]*n+r[14])*s,this}applyQuaternion(t){const e=this.x,i=this.y,n=this.z,r=t.x,s=t.y,o=t.z,a=t.w,h=a*e+s*n-o*i,l=a*i+o*e-r*n,c=a*n+r*i-s*e,u=-r*e-s*i-o*n;return this.x=h*a+u*-r+l*-o-c*-s,this.y=l*a+u*-s+c*-r-h*-o,this.z=c*a+u*-o+h*-s-l*-r,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*n,this.y=r[1]*e+r[5]*i+r[9]*n,this.z=r[2]*e+r[6]*i+r[10]*n,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=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}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)}crossVectors(t,e){const i=t.x,n=t.y,r=t.z,s=e.x,o=e.y,a=e.z;return this.x=n*a-r*o,this.y=r*s-i*a,this.z=i*o-n*s,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return m.copy(this).projectOnVector(t),this.sub(m)}reflect(t){return this.sub(m.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(n.clamp(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return e*e+i*i+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,i){const n=Math.sin(e)*t;return this.x=n*Math.sin(i),this.y=Math.cos(e)*t,this.z=n*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=n,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e,i){return void 0!==i&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}}const m=new d,f=new p;class g{constructor(t,e){Object.defineProperty(this,"isBox3",{value:!0}),this.min=void 0!==t?t:new d(1/0,1/0,1/0),this.max=void 0!==e?e:new d(-1/0,-1/0,-1/0)}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){let e=1/0,i=1/0,n=1/0,r=-1/0,s=-1/0,o=-1/0;for(let a=0,h=t.length;a<h;a+=3){const h=t[a],l=t[a+1],c=t[a+2];h<e&&(e=h),l<i&&(i=l),c<n&&(n=c),h>r&&(r=h),l>s&&(s=l),c>o&&(o=c)}return this.min.set(e,i,n),this.max.set(r,s,o),this}setFromBufferAttribute(t){let e=1/0,i=1/0,n=1/0,r=-1/0,s=-1/0,o=-1/0;for(let a=0,h=t.count;a<h;a++){const h=t.getX(a),l=t.getY(a),c=t.getZ(a);h<e&&(e=h),l<i&&(i=l),c<n&&(n=c),h>r&&(r=h),l>s&&(s=l),c>o&&(o=c)}return this.min.set(e,i,n),this.max.set(r,s,o),this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=v.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}setFromObject(t){return this.makeEmpty(),this.expandByObject(t)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return void 0===t&&(console.warn("THREE.Box3: .getCenter() target is now required"),t=new d),this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return void 0===t&&(console.warn("THREE.Box3: .getSize() target is now required"),t=new d),this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t){t.updateWorldMatrix(!1,!1);const e=t.geometry;void 0!==e&&(null===e.boundingBox&&e.computeBoundingBox(),b.copy(e.boundingBox),b.applyMatrix4(t.matrixWorld),this.union(b));const i=t.children;for(let t=0,e=i.length;t<e;t++)this.expandByObject(i[t]);return this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return void 0===e&&(console.warn("THREE.Box3: .getParameter() target is now required"),e=new d),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsSphere(t){return this.clampPoint(t.center,v),v.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(A),L.subVectors(this.max,A),M.subVectors(t.a,A),w.subVectors(t.b,A),_.subVectors(t.c,A),S.subVectors(w,M),T.subVectors(_,w),E.subVectors(M,_);let e=[0,-S.z,S.y,0,-T.z,T.y,0,-E.z,E.y,S.z,0,-S.x,T.z,0,-T.x,E.z,0,-E.x,-S.y,S.x,0,-T.y,T.x,0,-E.y,E.x,0];return!!y(e,M,w,_,L)&&(e=[1,0,0,0,1,0,0,0,1],!!y(e,M,w,_,L)&&(R.crossVectors(S,T),e=[R.x,R.y,R.z],y(e,M,w,_,L)))}clampPoint(t,e){return void 0===e&&(console.warn("THREE.Box3: .clampPoint() target is now required"),e=new d),e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return v.copy(t).clamp(this.min,this.max).sub(t).length()}getBoundingSphere(t){return void 0===t&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(t.center),t.radius=.5*this.getSize(v).length(),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(x[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),x[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),x[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),x[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),x[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),x[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),x[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),x[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(x)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}function y(t,e,i,n,r){for(let s=0,o=t.length-3;s<=o;s+=3){P.fromArray(t,s);const o=r.x*Math.abs(P.x)+r.y*Math.abs(P.y)+r.z*Math.abs(P.z),a=e.dot(P),h=i.dot(P),l=n.dot(P);if(Math.max(-Math.max(a,h,l),Math.min(a,h,l))>o)return!1}return!0}const x=[new d,new d,new d,new d,new d,new d,new d,new d],v=new d,b=new g,M=new d,w=new d,_=new d,S=new d,T=new d,E=new d,A=new d,L=new d,R=new d,P=new d,C=new g;class O{constructor(t,e){this.center=void 0!==t?t:new d,this.radius=void 0!==e?e:-1}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const i=this.center;void 0!==e?i.copy(e):C.setFromPoints(t).getCenter(i);let n=0;for(let e=0,r=t.length;e<r;e++)n=Math.max(n,i.distanceToSquared(t[e]));return this.radius=Math.sqrt(n),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const i=this.center.distanceToSquared(t);return void 0===e&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),e=new d),e.copy(t),i>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return void 0===t&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),t=new g),this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}}const z=new d,N=new d,B=new o;class F{constructor(t,e){Object.defineProperty(this,"isPlane",{value:!0}),this.normal=void 0!==t?t:new d(1,0,0),this.constant=void 0!==e?e:0}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,i,n){return this.normal.set(t,e,i),this.constant=n,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,i){const n=z.subVectors(i,e).cross(N.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(n,t),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return void 0===e&&(console.warn("THREE.Plane: .projectPoint() target is now required"),e=new d),e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)}intersectLine(t,e){void 0===e&&(console.warn("THREE.Plane: .intersectLine() target is now required"),e=new d);const i=t.delta(z),n=this.normal.dot(i);if(0===n)return 0===this.distanceToPoint(t.start)?e.copy(t.start):void 0;const r=-(t.start.dot(this.normal)+this.constant)/n;return r<0||r>1?void 0:e.copy(i).multiplyScalar(r).add(t.start)}intersectsLine(t){const e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return void 0===t&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),t=new d),t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const i=e||B.getNormalMatrix(t),n=this.coplanarPoint(z).applyMatrix4(t),r=this.normal.applyMatrix3(i).normalize();return this.constant=-n.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}}const D=new O,G=new d;class I{constructor(t,e,i,n,r,s){this.planes=[void 0!==t?t:new F,void 0!==e?e:new F,void 0!==i?i:new F,void 0!==n?n:new F,void 0!==r?r:new F,void 0!==s?s:new F]}set(t,e,i,n,r,s){const o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(i),o[3].copy(n),o[4].copy(r),o[5].copy(s),this}clone(){return(new this.constructor).copy(this)}copy(t){const e=this.planes;for(let i=0;i<6;i++)e[i].copy(t.planes[i]);return this}setFromProjectionMatrix(t){const e=this.planes,i=t.elements,n=i[0],r=i[1],s=i[2],o=i[3],a=i[4],h=i[5],l=i[6],c=i[7],u=i[8],p=i[9],d=i[10],m=i[11],f=i[12],g=i[13],y=i[14],x=i[15];return e[0].setComponents(o-n,c-a,m-u,x-f).normalize(),e[1].setComponents(o+n,c+a,m+u,x+f).normalize(),e[2].setComponents(o+r,c+h,m+p,x+g).normalize(),e[3].setComponents(o-r,c-h,m-p,x-g).normalize(),e[4].setComponents(o-s,c-l,m-d,x-y).normalize(),e[5].setComponents(o+s,c+l,m+d,x+y).normalize(),this}intersectsObject(t){const e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),D.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(D)}intersectsSprite(t){return D.center.set(0,0,0),D.radius=.7071067811865476,D.applyMatrix4(t.matrixWorld),this.intersectsSphere(D)}intersectsSphere(t){const e=this.planes,i=t.center,n=-t.radius;for(let t=0;t<6;t++)if(e[t].distanceToPoint(i)<n)return!1;return!0}intersectsBox(t){const e=this.planes;for(let i=0;i<6;i++){const n=e[i];if(G.x=n.normal.x>0?t.max.x:t.min.x,G.y=n.normal.y>0?t.max.y:t.min.y,G.z=n.normal.z>0?t.max.z:t.min.z,n.distanceToPoint(G)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}}class k{constructor(){Object.defineProperty(this,"isMatrix4",{value:!0}),this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(t,e,i,n,r,s,o,a,h,l,c,u,p,d,m,f){const g=this.elements;return g[0]=t,g[4]=e,g[8]=i,g[12]=n,g[1]=r,g[5]=s,g[9]=o,g[13]=a,g[2]=h,g[6]=l,g[10]=c,g[14]=u,g[3]=p,g[7]=d,g[11]=m,g[15]=f,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new k).fromArray(this.elements)}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){const e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}extractBasis(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,i=t.elements,n=1/U.setFromMatrixColumn(t,0).length(),r=1/U.setFromMatrixColumn(t,1).length(),s=1/U.setFromMatrixColumn(t,2).length();return e[0]=i[0]*n,e[1]=i[1]*n,e[2]=i[2]*n,e[3]=0,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=0,e[8]=i[8]*s,e[9]=i[9]*s,e[10]=i[10]*s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const e=this.elements,i=t.x,n=t.y,r=t.z,s=Math.cos(i),o=Math.sin(i),a=Math.cos(n),h=Math.sin(n),l=Math.cos(r),c=Math.sin(r);if("XYZ"===t.order){const t=s*l,i=s*c,n=o*l,r=o*c;e[0]=a*l,e[4]=-a*c,e[8]=h,e[1]=i+n*h,e[5]=t-r*h,e[9]=-o*a,e[2]=r-t*h,e[6]=n+i*h,e[10]=s*a}else if("YXZ"===t.order){const t=a*l,i=a*c,n=h*l,r=h*c;e[0]=t+r*o,e[4]=n*o-i,e[8]=s*h,e[1]=s*c,e[5]=s*l,e[9]=-o,e[2]=i*o-n,e[6]=r+t*o,e[10]=s*a}else if("ZXY"===t.order){const t=a*l,i=a*c,n=h*l,r=h*c;e[0]=t-r*o,e[4]=-s*c,e[8]=n+i*o,e[1]=i+n*o,e[5]=s*l,e[9]=r-t*o,e[2]=-s*h,e[6]=o,e[10]=s*a}else if("ZYX"===t.order){const t=s*l,i=s*c,n=o*l,r=o*c;e[0]=a*l,e[4]=n*h-i,e[8]=t*h+r,e[1]=a*c,e[5]=r*h+t,e[9]=i*h-n,e[2]=-h,e[6]=o*a,e[10]=s*a}else if("YZX"===t.order){const t=s*a,i=s*h,n=o*a,r=o*h;e[0]=a*l,e[4]=r-t*c,e[8]=n*c+i,e[1]=c,e[5]=s*l,e[9]=-o*l,e[2]=-h*l,e[6]=i*c+n,e[10]=t-r*c}else if("XZY"===t.order){const t=s*a,i=s*h,n=o*a,r=o*h;e[0]=a*l,e[4]=-c,e[8]=h*l,e[1]=t*c+r,e[5]=s*l,e[9]=i*c-n,e[2]=n*c-i,e[6]=o*l,e[10]=r*c+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(W,t,j)}lookAt(t,e,i){const n=this.elements;return X.subVectors(t,e),0===X.lengthSq()&&(X.z=1),X.normalize(),H.crossVectors(i,X),0===H.lengthSq()&&(1===Math.abs(i.z)?X.x+=1e-4:X.z+=1e-4,X.normalize(),H.crossVectors(i,X)),H.normalize(),q.crossVectors(X,H),n[0]=H.x,n[4]=q.x,n[8]=X.x,n[1]=H.y,n[5]=q.y,n[9]=X.y,n[2]=H.z,n[6]=q.z,n[10]=X.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,r=this.elements,s=i[0],o=i[4],a=i[8],h=i[12],l=i[1],c=i[5],u=i[9],p=i[13],d=i[2],m=i[6],f=i[10],g=i[14],y=i[3],x=i[7],v=i[11],b=i[15],M=n[0],w=n[4],_=n[8],S=n[12],T=n[1],E=n[5],A=n[9],L=n[13],R=n[2],P=n[6],C=n[10],O=n[14],z=n[3],N=n[7],B=n[11],F=n[15];return r[0]=s*M+o*T+a*R+h*z,r[4]=s*w+o*E+a*P+h*N,r[8]=s*_+o*A+a*C+h*B,r[12]=s*S+o*L+a*O+h*F,r[1]=l*M+c*T+u*R+p*z,r[5]=l*w+c*E+u*P+p*N,r[9]=l*_+c*A+u*C+p*B,r[13]=l*S+c*L+u*O+p*F,r[2]=d*M+m*T+f*R+g*z,r[6]=d*w+m*E+f*P+g*N,r[10]=d*_+m*A+f*C+g*B,r[14]=d*S+m*L+f*O+g*F,r[3]=y*M+x*T+v*R+b*z,r[7]=y*w+x*E+v*P+b*N,r[11]=y*_+x*A+v*C+b*B,r[15]=y*S+x*L+v*O+b*F,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[4],n=t[8],r=t[12],s=t[1],o=t[5],a=t[9],h=t[13],l=t[2],c=t[6],u=t[10],p=t[14];return t[3]*(+r*a*c-n*h*c-r*o*u+i*h*u+n*o*p-i*a*p)+t[7]*(+e*a*p-e*h*u+r*s*u-n*s*p+n*h*l-r*a*l)+t[11]*(+e*h*c-e*o*p-r*s*c+i*s*p+r*o*l-i*h*l)+t[15]*(-n*o*l-e*a*c+e*o*u+n*s*c-i*s*u+i*a*l)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,i){const n=this.elements;return t.isVector3?(n[12]=t.x,n[13]=t.y,n[14]=t.z):(n[12]=t,n[13]=e,n[14]=i),this}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],s=t[4],o=t[5],a=t[6],h=t[7],l=t[8],c=t[9],u=t[10],p=t[11],d=t[12],m=t[13],f=t[14],g=t[15],y=c*f*h-m*u*h+m*a*p-o*f*p-c*a*g+o*u*g,x=d*u*h-l*f*h-d*a*p+s*f*p+l*a*g-s*u*g,v=l*m*h-d*c*h+d*o*p-s*m*p-l*o*g+s*c*g,b=d*c*a-l*m*a-d*o*u+s*m*u+l*o*f-s*c*f,M=e*y+i*x+n*v+r*b;if(0===M)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/M;return t[0]=y*w,t[1]=(m*u*r-c*f*r-m*n*p+i*f*p+c*n*g-i*u*g)*w,t[2]=(o*f*r-m*a*r+m*n*h-i*f*h-o*n*g+i*a*g)*w,t[3]=(c*a*r-o*u*r-c*n*h+i*u*h+o*n*p-i*a*p)*w,t[4]=x*w,t[5]=(l*f*r-d*u*r+d*n*p-e*f*p-l*n*g+e*u*g)*w,t[6]=(d*a*r-s*f*r-d*n*h+e*f*h+s*n*g-e*a*g)*w,t[7]=(s*u*r-l*a*r+l*n*h-e*u*h-s*n*p+e*a*p)*w,t[8]=v*w,t[9]=(d*c*r-l*m*r-d*i*p+e*m*p+l*i*g-e*c*g)*w,t[10]=(s*m*r-d*o*r+d*i*h-e*m*h-s*i*g+e*o*g)*w,t[11]=(l*o*r-s*c*r-l*i*h+e*c*h+s*i*p-e*o*p)*w,t[12]=b*w,t[13]=(l*m*n-d*c*n+d*i*u-e*m*u-l*i*f+e*c*f)*w,t[14]=(d*o*n-s*m*n-d*i*a+e*m*a+s*i*f-e*o*f)*w,t[15]=(s*c*n-l*o*n+l*i*a-e*c*a-s*i*u+e*o*u)*w,this}scale(t){const e=this.elements,i=t.x,n=t.y,r=t.z;return e[0]*=i,e[4]*=n,e[8]*=r,e[1]*=i,e[5]*=n,e[9]*=r,e[2]*=i,e[6]*=n,e[10]*=r,e[3]*=i,e[7]*=n,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,n))}makeTranslation(t,e,i){return this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const i=Math.cos(e),n=Math.sin(e),r=1-i,s=t.x,o=t.y,a=t.z,h=r*s,l=r*o;return this.set(h*s+i,h*o-n*a,h*a+n*o,0,h*o+n*a,l*o+i,l*a-n*s,0,h*a-n*o,l*a+n*s,r*a*a+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i){return this.set(1,e,i,0,t,1,i,0,t,e,1,0,0,0,0,1),this}compose(t,e,i){const n=this.elements,r=e._x,s=e._y,o=e._z,a=e._w,h=r+r,l=s+s,c=o+o,u=r*h,p=r*l,d=r*c,m=s*l,f=s*c,g=o*c,y=a*h,x=a*l,v=a*c,b=i.x,M=i.y,w=i.z;return n[0]=(1-(m+g))*b,n[1]=(p+v)*b,n[2]=(d-x)*b,n[3]=0,n[4]=(p-v)*M,n[5]=(1-(u+g))*M,n[6]=(f+y)*M,n[7]=0,n[8]=(d+x)*w,n[9]=(f-y)*w,n[10]=(1-(u+m))*w,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this}decompose(t,e,i){const n=this.elements;let r=U.set(n[0],n[1],n[2]).length();const s=U.set(n[4],n[5],n[6]).length(),o=U.set(n[8],n[9],n[10]).length();this.determinant()<0&&(r=-r),t.x=n[12],t.y=n[13],t.z=n[14],V.copy(this);const a=1/r,h=1/s,l=1/o;return V.elements[0]*=a,V.elements[1]*=a,V.elements[2]*=a,V.elements[4]*=h,V.elements[5]*=h,V.elements[6]*=h,V.elements[8]*=l,V.elements[9]*=l,V.elements[10]*=l,e.setFromRotationMatrix(V),i.x=r,i.y=s,i.z=o,this}makePerspective(t,e,i,n,r,s){void 0===s&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const o=this.elements,a=2*r/(e-t),h=2*r/(i-n),l=(e+t)/(e-t),c=(i+n)/(i-n),u=-(s+r)/(s-r),p=-2*s*r/(s-r);return o[0]=a,o[4]=0,o[8]=l,o[12]=0,o[1]=0,o[5]=h,o[9]=c,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(t,e,i,n,r,s){const o=this.elements,a=1/(e-t),h=1/(i-n),l=1/(s-r),c=(e+t)*a,u=(i+n)*h,p=(s+r)*l;return o[0]=2*a,o[4]=0,o[8]=0,o[12]=-c,o[1]=0,o[5]=2*h,o[9]=0,o[13]=-u,o[2]=0,o[6]=0,o[10]=-2*l,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<16;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}}const U=new d,V=new k,W=new d(0,0,0),j=new d(1,1,1),H=new d,q=new d,X=new d;class J{constructor(t=0,e=0,i=0,n=1){Object.defineProperty(this,"isVector4",{value:!0}),this.x=t,this.y=e,this.z=i,this.w=n}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,i,n){return this.x=t,this.y=e,this.z=i,this.w=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){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: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,i=this.y,n=this.z,r=this.w,s=t.elements;return this.x=s[0]*e+s[4]*i+s[8]*n+s[12]*r,this.y=s[1]*e+s[5]*i+s[9]*n+s[13]*r,this.z=s[2]*e+s[6]*i+s[10]*n+s[14]*r,this.w=s[3]*e+s[7]*i+s[11]*n+s[15]*r,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,i,n,r;const s=t.elements,o=s[0],a=s[4],h=s[8],l=s[1],c=s[5],u=s[9],p=s[2],d=s[6],m=s[10];if(Math.abs(a-l)<.01&&Math.abs(h-p)<.01&&Math.abs(u-d)<.01){if(Math.abs(a+l)<.1&&Math.abs(h+p)<.1&&Math.abs(u+d)<.1&&Math.abs(o+c+m-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;const t=(o+1)/2,s=(c+1)/2,f=(m+1)/2,g=(a+l)/4,y=(h+p)/4,x=(u+d)/4;return t>s&&t>f?t<.01?(i=0,n=.707106781,r=.707106781):(i=Math.sqrt(t),n=g/i,r=y/i):s>f?s<.01?(i=.707106781,n=0,r=.707106781):(n=Math.sqrt(s),i=g/n,r=x/n):f<.01?(i=.707106781,n=.707106781,r=0):(r=Math.sqrt(f),i=y/r,n=x/r),this.set(i,n,r,e),this}let f=Math.sqrt((d-u)*(d-u)+(h-p)*(h-p)+(l-a)*(l-a));return Math.abs(f)<.001&&(f=1),this.x=(d-u)/f,this.y=(h-p)/f,this.z=(l-a)/f,this.w=Math.acos((o+c+m-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=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}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e,i){return void 0!==i&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}}const Y={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},Z={h:0,s:0,l:0},Q={h:0,s:0,l:0};function K(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}function $(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function tt(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class et{constructor(t,e,i){return Object.defineProperty(this,"isColor",{value:!0}),void 0===e&&void 0===i?this.set(t):this.setRGB(t,e,i)}set(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this}setRGB(t,e,i){return this.r=t,this.g=e,this.b=i,this}setHSL(t,e,i){if(t=n.euclideanModulo(t,1),e=n.clamp(e,0,1),i=n.clamp(i,0,1),0===e)this.r=this.g=this.b=i;else{const n=i<=.5?i*(1+e):i+e-i*e,r=2*i-n;this.r=K(r,n,t+1/3),this.g=K(r,n,t),this.b=K(r,n,t-1/3)}return this}setStyle(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let i;if(i=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){let t;const n=i[1],r=i[2];switch(n){case"rgb":case"rgba":if(t=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,e(t[4]),this;if(t=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,e(t[4]),this;break;case"hsl":case"hsla":if(t=/^(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r)){const i=parseFloat(t[1])/360,n=parseInt(t[2],10)/100,r=parseInt(t[3],10)/100;return e(t[4]),this.setHSL(i,n,r)}}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=i[1],e=t.length;if(3===e)return this.r=parseInt(t.charAt(0)+t.charAt(0),16)/255,this.g=parseInt(t.charAt(1)+t.charAt(1),16)/255,this.b=parseInt(t.charAt(2)+t.charAt(2),16)/255,this;if(6===e)return this.r=parseInt(t.charAt(0)+t.charAt(1),16)/255,this.g=parseInt(t.charAt(2)+t.charAt(3),16)/255,this.b=parseInt(t.charAt(4)+t.charAt(5),16)/255,this}return t&&t.length>0?this.setColorName(t):this}setColorName(t){const e=Y[t];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copyGammaToLinear(t,e=2){return this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this}copyLinearToGamma(t,e=2){const i=e>0?1/e:1;return this.r=Math.pow(t.r,i),this.g=Math.pow(t.g,i),this.b=Math.pow(t.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.r=$(t.r),this.g=$(t.g),this.b=$(t.b),this}copyLinearToSRGB(t){return this.r=tt(t.r),this.g=tt(t.g),this.b=tt(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(t){void 0===t&&(console.warn("THREE.Color: .getHSL() target is now required"),t={h:0,s:0,l:0});const e=this.r,i=this.g,n=this.b,r=Math.max(e,i,n),s=Math.min(e,i,n);let o,a;const h=(s+r)/2;if(s===r)o=0,a=0;else{const t=r-s;switch(a=h<=.5?t/(r+s):t/(2-r-s),r){case e:o=(i-n)/t+(i<n?6:0);break;case i:o=(n-e)/t+2;break;case n:o=(e-i)/t+4}o/=6}return t.h=o,t.s=a,t.l=h,t}getStyle(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"}offsetHSL(t,e,i){return this.getHSL(Z),Z.h+=t,Z.s+=e,Z.l+=i,this.setHSL(Z.h,Z.s,Z.l),this}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpHSL(t,e){this.getHSL(Z),t.getHSL(Q);const i=n.lerp(Z.h,Q.h,e),r=n.lerp(Z.s,Q.s,e),s=n.lerp(Z.l,Q.l,e);return this.setHSL(i,r,s),this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),!0===t.normalized&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}}function it(){let t=null,e=!1,i=null,n=null;function r(e,s){i(e,s),n=t.requestAnimationFrame(r)}return{start:function(){!0!==e&&null!==i&&(n=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(t){i=t},setContext:function(e){t=e}}}function nt(t,e){const i=e.isWebGL2,n=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),n.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const i=n.get(e);i&&(t.deleteBuffer(i.buffer),n.delete(e))},update:function(e,r){if(e.isGLBufferAttribute){const t=n.get(e);return void((!t||t.version<e.version)&&n.set(e,{buffer:e.buffer,type:e.type,bytesPerElement:e.elementSize,version:e.version}))}e.isInterleavedBufferAttribute&&(e=e.data);const s=n.get(e);void 0===s?n.set(e,function(e,n){const r=e.array,s=e.usage,o=t.createBuffer();t.bindBuffer(n,o),t.bufferData(n,r,s),e.onUploadCallback();let a=5126;return r instanceof Float32Array?a=5126:r instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):r instanceof Uint16Array?e.isFloat16BufferAttribute?i?a=5131:console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2."):a=5123:r instanceof Int16Array?a=5122:r instanceof Uint32Array?a=5125:r instanceof Int32Array?a=5124:r instanceof Int8Array?a=5120:r instanceof Uint8Array&&(a=5121),{buffer:o,type:a,bytesPerElement:r.BYTES_PER_ELEMENT,version:e.version}}(e,r)):s.version<e.version&&(function(e,n,r){const s=n.array,o=n.updateRange;t.bindBuffer(r,e),-1===o.count?t.bufferSubData(r,0,s):(i?t.bufferSubData(r,o.offset*s.BYTES_PER_ELEMENT,s,o.offset,o.count):t.bufferSubData(r,o.offset*s.BYTES_PER_ELEMENT,s.subarray(o.offset,o.offset+o.count)),o.count=-1)}(s.buffer,e,r),s.version=e.version)}}}et.NAMES=Y,et.prototype.r=1,et.prototype.g=1,et.prototype.b=1;const rt=new d,st=new s;function ot(t,e,i){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===i,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0}function at(t,e,i){ot.call(this,new Int8Array(t),e,i)}function ht(t,e,i){ot.call(this,new Uint8Array(t),e,i)}function lt(t,e,i){ot.call(this,new Uint8ClampedArray(t),e,i)}function ct(t,e,i){ot.call(this,new Int16Array(t),e,i)}function ut(t,e,i){ot.call(this,new Uint16Array(t),e,i)}function pt(t,e,i){ot.call(this,new Int32Array(t),e,i)}function dt(t,e,i){ot.call(this,new Uint32Array(t),e,i)}function mt(t,e,i){ot.call(this,new Uint16Array(t),e,i)}function ft(t,e,i){ot.call(this,new Float32Array(t),e,i)}function gt(t,e,i){ot.call(this,new Float64Array(t),e,i)}Object.defineProperty(ot.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(ot.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this},copyAt:function(t,e,i){t*=this.itemSize,i*=e.itemSize;for(let n=0,r=this.itemSize;n<r;n++)this.array[t+n]=e.array[i+n];return this},copyArray:function(t){return this.array.set(t),this},copyColorsArray:function(t){const e=this.array;let i=0;for(let n=0,r=t.length;n<r;n++){let r=t[n];void 0===r&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",n),r=new et),e[i++]=r.r,e[i++]=r.g,e[i++]=r.b}return this},copyVector2sArray:function(t){const e=this.array;let i=0;for(let n=0,r=t.length;n<r;n++){let r=t[n];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",n),r=new s),e[i++]=r.x,e[i++]=r.y}return this},copyVector3sArray:function(t){const e=this.array;let i=0;for(let n=0,r=t.length;n<r;n++){let r=t[n];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",n),r=new d),e[i++]=r.x,e[i++]=r.y,e[i++]=r.z}return this},copyVector4sArray:function(t){const e=this.array;let i=0;for(let n=0,r=t.length;n<r;n++){let r=t[n];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",n),r=new J),e[i++]=r.x,e[i++]=r.y,e[i++]=r.z,e[i++]=r.w}return this},applyMatrix3:function(t){if(2===this.itemSize)for(let e=0,i=this.count;e<i;e++)st.fromBufferAttribute(this,e),st.applyMatrix3(t),this.setXY(e,st.x,st.y);else if(3===this.itemSize)for(let e=0,i=this.count;e<i;e++)rt.fromBufferAttribute(this,e),rt.applyMatrix3(t),this.setXYZ(e,rt.x,rt.y,rt.z);return this},applyMatrix4:function(t){for(let e=0,i=this.count;e<i;e++)rt.x=this.getX(e),rt.y=this.getY(e),rt.z=this.getZ(e),rt.applyMatrix4(t),this.setXYZ(e,rt.x,rt.y,rt.z);return this},applyNormalMatrix:function(t){for(let e=0,i=this.count;e<i;e++)rt.x=this.getX(e),rt.y=this.getY(e),rt.z=this.getZ(e),rt.applyNormalMatrix(t),this.setXYZ(e,rt.x,rt.y,rt.z);return this},transformDirection:function(t){for(let e=0,i=this.count;e<i;e++)rt.x=this.getX(e),rt.y=this.getY(e),rt.z=this.getZ(e),rt.transformDirection(t),this.setXYZ(e,rt.x,rt.y,rt.z);return this},set:function(t,e=0){return this.array.set(t,e),this},getX:function(t){return this.array[t*this.itemSize]},setX:function(t,e){return this.array[t*this.itemSize]=e,this},getY:function(t){return this.array[t*this.itemSize+1]},setY:function(t,e){return this.array[t*this.itemSize+1]=e,this},getZ:function(t){return this.array[t*this.itemSize+2]},setZ:function(t,e){return this.array[t*this.itemSize+2]=e,this},getW:function(t){return this.array[t*this.itemSize+3]},setW:function(t,e){return this.array[t*this.itemSize+3]=e,this},setXY:function(t,e,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this},setXYZ:function(t,e,i,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this},setXYZW:function(t,e,i,n,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this.array[t+3]=r,this},onUpload:function(t){return this.onUploadCallback=t,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)},toJSON:function(){return{itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized}}}),at.prototype=Object.create(ot.prototype),at.prototype.constructor=at,ht.prototype=Object.create(ot.prototype),ht.prototype.constructor=ht,lt.prototype=Object.create(ot.prototype),lt.prototype.constructor=lt,ct.prototype=Object.create(ot.prototype),ct.prototype.constructor=ct,ut.prototype=Object.create(ot.prototype),ut.prototype.constructor=ut,pt.prototype=Object.create(ot.prototype),pt.prototype.constructor=pt,dt.prototype=Object.create(ot.prototype),dt.prototype.constructor=dt,mt.prototype=Object.create(ot.prototype),mt.prototype.constructor=mt,mt.prototype.isFloat16BufferAttribute=!0,ft.prototype=Object.create(ot.prototype),ft.prototype.constructor=ft,gt.prototype=Object.create(ot.prototype),gt.prototype.constructor=gt;class yt{constructor(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}computeGroups(t){const e=[];let i,n,r=void 0;const s=t.faces;for(n=0;n<s.length;n++){const t=s[n];t.materialIndex!==r&&(r=t.materialIndex,void 0!==i&&(i.count=3*n-i.start,e.push(i)),i={start:3*n,materialIndex:r})}void 0!==i&&(i.count=3*n-i.start,e.push(i)),this.groups=e}fromGeometry(t){const e=t.faces,i=t.vertices,n=t.faceVertexUvs,r=n[0]&&n[0].length>0,o=n[1]&&n[1].length>0,a=t.morphTargets,h=a.length;let l;if(h>0){l=[];for(let t=0;t<h;t++)l[t]={name:a[t].name,data:[]};this.morphTargets.position=l}const c=t.morphNormals,u=c.length;let p;if(u>0){p=[];for(let t=0;t<u;t++)p[t]={name:c[t].name,data:[]};this.morphTargets.normal=p}const d=t.skinIndices,m=t.skinWeights,f=d.length===i.length,g=m.length===i.length;i.length>0&&0===e.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(let t=0;t<e.length;t++){const y=e[t];this.vertices.push(i[y.a],i[y.b],i[y.c]);const x=y.vertexNormals;if(3===x.length)this.normals.push(x[0],x[1],x[2]);else{const t=y.normal;this.normals.push(t,t,t)}const v=y.vertexColors;if(3===v.length)this.colors.push(v[0],v[1],v[2]);else{const t=y.color;this.colors.push(t,t,t)}if(!0===r){const e=n[0][t];void 0!==e?this.uvs.push(e[0],e[1],e[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",t),this.uvs.push(new s,new s,new s))}if(!0===o){const e=n[1][t];void 0!==e?this.uvs2.push(e[0],e[1],e[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",t),this.uvs2.push(new s,new s,new s))}for(let t=0;t<h;t++){const e=a[t].vertices;l[t].data.push(e[y.a],e[y.b],e[y.c])}for(let e=0;e<u;e++){const i=c[e].vertexNormals[t];p[e].data.push(i.a,i.b,i.c)}f&&this.skinIndices.push(d[y.a],d[y.b],d[y.c]),g&&this.skinWeights.push(m[y.a],m[y.b],m[y.c])}return this.computeGroups(t),this.verticesNeedUpdate=t.verticesNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this}}class xt{constructor(t=0,e=0,i=0,n=xt.DefaultOrder){Object.defineProperty(this,"isEuler",{value:!0}),this._x=t,this._y=e,this._z=i,this._order=n}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._order=n||this._order,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e,i){const r=n.clamp,s=t.elements,o=s[0],a=s[4],h=s[8],l=s[1],c=s[5],u=s[9],p=s[2],d=s[6],m=s[10];switch(e=e||this._order){case"XYZ":this._y=Math.asin(r(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(-u,m),this._z=Math.atan2(-a,o)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-r(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(h,m),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-p,o),this._z=0);break;case"ZXY":this._x=Math.asin(r(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-p,m),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,o));break;case"ZYX":this._y=Math.asin(-r(p,-1,1)),Math.abs(p)<.9999999?(this._x=Math.atan2(d,m),this._z=Math.atan2(l,o)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(r(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-p,o)):(this._x=0,this._y=Math.atan2(h,m));break;case"XZY":this._z=Math.asin(-r(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(h,o)):(this._x=Math.atan2(-u,m),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!1!==i&&this._onChangeCallback(),this}setFromQuaternion(t,e,i){return vt.makeRotationFromQuaternion(t),this.setFromRotationMatrix(vt,e,i)}setFromVector3(t,e){return this.set(t.x,t.y,t.z,e||this._order)}reorder(t){return bt.setFromEuler(this),this.setFromQuaternion(bt,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}toVector3(t){return t?t.set(this._x,this._y,this._z):new d(this._x,this._y,this._z)}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}xt.DefaultOrder="XYZ",xt.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];const vt=new k,bt=new p;class Mt{constructor(){this.mask=1}set(t){this.mask=1<<t|0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return 0!=(this.mask&t.mask)}}let wt=0;const _t=new d,St=new p,Tt=new k,Et=new d,At=new d,Lt=new d,Rt=new p,Pt=new d(1,0,0),Ct=new d(0,1,0),Ot=new d(0,0,1),zt={type:"added"},Nt={type:"removed"};function Bt(){Object.defineProperty(this,"id",{value:wt++}),this.uuid=n.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Bt.DefaultUp.clone();const t=new d,e=new xt,i=new p,r=new d(1,1,1);e._onChange((function(){i.setFromEuler(e,!1)})),i._onChange((function(){e.setFromQuaternion(i,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new k},normalMatrix:{value:new o}}),this.matrix=new k,this.matrixWorld=new k,this.matrixAutoUpdate=Bt.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new Mt,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}function Ft(t){if(0===t.length)return-1/0;let e=t[0];for(let i=1,n=t.length;i<n;++i)t[i]>e&&(e=t[i]);return e}Bt.DefaultUp=new d(0,1,0),Bt.DefaultMatrixAutoUpdate=!0,Bt.prototype=Object.assign(Object.create(r.prototype),{constructor:Bt,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix4:function(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(t){return this.quaternion.premultiply(t),this},setRotationFromAxisAngle:function(t,e){this.quaternion.setFromAxisAngle(t,e)},setRotationFromEuler:function(t){this.quaternion.setFromEuler(t,!0)},setRotationFromMatrix:function(t){this.quaternion.setFromRotationMatrix(t)},setRotationFromQuaternion:function(t){this.quaternion.copy(t)},rotateOnAxis:function(t,e){return St.setFromAxisAngle(t,e),this.quaternion.multiply(St),this},rotateOnWorldAxis:function(t,e){return St.setFromAxisAngle(t,e),this.quaternion.premultiply(St),this},rotateX:function(t){return this.rotateOnAxis(Pt,t)},rotateY:function(t){return this.rotateOnAxis(Ct,t)},rotateZ:function(t){return this.rotateOnAxis(Ot,t)},translateOnAxis:function(t,e){return _t.copy(t).applyQuaternion(this.quaternion),this.position.add(_t.multiplyScalar(e)),this},translateX:function(t){return this.translateOnAxis(Pt,t)},translateY:function(t){return this.translateOnAxis(Ct,t)},translateZ:function(t){return this.translateOnAxis(Ot,t)},localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:function(t){return t.applyMatrix4(Tt.copy(this.matrixWorld).invert())},lookAt:function(t,e,i){t.isVector3?Et.copy(t):Et.set(t,e,i);const n=this.parent;this.updateWorldMatrix(!0,!1),At.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Tt.lookAt(At,Et,this.up):Tt.lookAt(Et,At,this.up),this.quaternion.setFromRotationMatrix(Tt),n&&(Tt.extractRotation(n.matrixWorld),St.setFromRotationMatrix(Tt),this.quaternion.premultiply(St.invert()))},add:function(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(zt)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)},remove:function(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(Nt)),this},clear:function(){for(let t=0;t<this.children.length;t++){const e=this.children[t];e.parent=null,e.dispatchEvent(Nt)}return this.children.length=0,this},attach:function(t){return this.updateWorldMatrix(!0,!1),Tt.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),Tt.multiply(t.parent.matrixWorld)),t.applyMatrix4(Tt),t.updateWorldMatrix(!1,!1),this.add(t),this},getObjectById:function(t){return this.getObjectByProperty("id",t)},getObjectByName:function(t){return this.getObjectByProperty("name",t)},getObjectByProperty:function(t,e){if(this[t]===e)return this;for(let i=0,n=this.children.length;i<n;i++){const n=this.children[i].getObjectByProperty(t,e);if(void 0!==n)return n}},getWorldPosition:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),t=new d),this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),t=new p),this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(At,t,Lt),t},getWorldScale:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),t=new d),this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(At,Rt,t),t},getWorldDirection:function(t){void 0===t&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),t=new d),this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()},raycast:function(){},traverse:function(t){t(this);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverse(t)},traverseVisible:function(t){if(!1===this.visible)return;t(this);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverseVisible(t)},traverseAncestors:function(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].updateMatrixWorld(t)},updateWorldMatrix:function(t,e){const i=this.parent;if(!0===t&&null!==i&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===e){const t=this.children;for(let e=0,i=t.length;e<i;e++)t[e].updateWorldMatrix(!1,!0)}},toJSON:function(t){const e=void 0===t||"string"==typeof t,i={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{}},i.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const n={};function r(e,i){return void 0===e[i.uuid]&&(e[i.uuid]=i.toJSON(t)),i.uuid}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),!0===this.castShadow&&(n.castShadow=!0),!0===this.receiveShadow&&(n.receiveShadow=!0),!1===this.visible&&(n.visible=!1),!1===this.frustumCulled&&(n.frustumCulled=!1),0!==this.renderOrder&&(n.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(n.matrixAutoUpdate=!1),this.isInstancedMesh&&(n.type="InstancedMesh",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON()),this.isMesh||this.isLine||this.isPoints){n.geometry=r(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const i=e.shapes;if(Array.isArray(i))for(let e=0,n=i.length;e<n;e++){const n=i[e];r(t.shapes,n)}else r(t.shapes,i)}}if(this.isSkinnedMesh&&(n.bindMode=this.bindMode,n.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(t.skeletons,this.skeleton),n.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let i=0,n=this.material.length;i<n;i++)e.push(r(t.materials,this.material[i]));n.material=e}else n.material=r(t.materials,this.material);if(this.children.length>0){n.children=[];for(let e=0;e<this.children.length;e++)n.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){n.animations=[];for(let e=0;e<this.animations.length;e++){const i=this.animations[e];n.animations.push(r(t.animations,i))}}if(e){const e=s(t.geometries),n=s(t.materials),r=s(t.textures),o=s(t.images),a=s(t.shapes),h=s(t.skeletons),l=s(t.animations);e.length>0&&(i.geometries=e),n.length>0&&(i.materials=n),r.length>0&&(i.textures=r),o.length>0&&(i.images=o),a.length>0&&(i.shapes=a),h.length>0&&(i.skeletons=h),l.length>0&&(i.animations=l)}return i.object=n,i;function s(t){const e=[];for(const i in t){const n=t[i];delete n.metadata,e.push(n)}return e}},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e<t.children.length;e++){const i=t.children[e];this.add(i.clone())}return this}});let Dt=1;const Gt=new k,It=new Bt,kt=new d,Ut=new g,Vt=new g,Wt=new d;function jt(){Object.defineProperty(this,"id",{value:Dt+=2}),this.uuid=n.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}jt.prototype=Object.assign(Object.create(r.prototype),{constructor:jt,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(t){return Array.isArray(t)?this.index=new(Ft(t)>65535?dt:ut)(t,1):this.index=t,this},getAttribute:function(t){return this.attributes[t]},setAttribute:function(t,e){return this.attributes[t]=e,this},deleteAttribute:function(t){return delete this.attributes[t],this},hasAttribute:function(t){return void 0!==this.attributes[t]},addGroup:function(t,e,i=0){this.groups.push({start:t,count:e,materialIndex:i})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix4:function(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const i=this.attributes.normal;if(void 0!==i){const e=(new o).getNormalMatrix(t);i.applyNormalMatrix(e),i.needsUpdate=!0}const n=this.attributes.tangent;return void 0!==n&&(n.transformDirection(t),n.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(t){return Gt.makeRotationX(t),this.applyMatrix4(Gt),this},rotateY:function(t){return Gt.makeRotationY(t),this.applyMatrix4(Gt),this},rotateZ:function(t){return Gt.makeRotationZ(t),this.applyMatrix4(Gt),this},translate:function(t,e,i){return Gt.makeTranslation(t,e,i),this.applyMatrix4(Gt),this},scale:function(t,e,i){return Gt.makeScale(t,e,i),this.applyMatrix4(Gt),this},lookAt:function(t){return It.lookAt(t),It.updateMatrix(),this.applyMatrix4(It.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(kt).negate(),this.translate(kt.x,kt.y,kt.z),this},setFromObject:function(t){const e=t.geometry;if(t.isPoints||t.isLine){const t=new ft(3*e.vertices.length,3),i=new ft(3*e.colors.length,3);if(this.setAttribute("position",t.copyVector3sArray(e.vertices)),this.setAttribute("color",i.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length){const t=new ft(e.lineDistances.length,1);this.setAttribute("lineDistance",t.copyArray(e.lineDistances))}null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone())}else t.isMesh&&e&&e.isGeometry&&this.fromGeometry(e);return this},setFromPoints:function(t){const e=[];for(let i=0,n=t.length;i<n;i++){const n=t[i];e.push(n.x,n.y,n.z||0)}return this.setAttribute("position",new ft(e,3)),this},updateFromObject:function(t){let e=t.geometry;if(t.isMesh){let t=e.__directGeometry;if(!0===e.elementsNeedUpdate&&(t=void 0,e.elementsNeedUpdate=!1),void 0===t)return this.fromGeometry(e);t.verticesNeedUpdate=e.verticesNeedUpdate,t.normalsNeedUpdate=e.normalsNeedUpdate,t.colorsNeedUpdate=e.colorsNeedUpdate,t.uvsNeedUpdate=e.uvsNeedUpdate,t.groupsNeedUpdate=e.groupsNeedUpdate,e.verticesNeedUpdate=!1,e.normalsNeedUpdate=!1,e.colorsNeedUpdate=!1,e.uvsNeedUpdate=!1,e.groupsNeedUpdate=!1,e=t}if(!0===e.verticesNeedUpdate){const t=this.attributes.position;void 0!==t&&(t.copyVector3sArray(e.vertices),t.needsUpdate=!0),e.verticesNeedUpdate=!1}if(!0===e.normalsNeedUpdate){const t=this.attributes.normal;void 0!==t&&(t.copyVector3sArray(e.normals),t.needsUpdate=!0),e.normalsNeedUpdate=!1}if(!0===e.colorsNeedUpdate){const t=this.attributes.color;void 0!==t&&(t.copyColorsArray(e.colors),t.needsUpdate=!0),e.colorsNeedUpdate=!1}if(e.uvsNeedUpdate){const t=this.attributes.uv;void 0!==t&&(t.copyVector2sArray(e.uvs),t.needsUpdate=!0),e.uvsNeedUpdate=!1}if(e.lineDistancesNeedUpdate){const t=this.attributes.lineDistance;void 0!==t&&(t.copyArray(e.lineDistances),t.needsUpdate=!0),e.lineDistancesNeedUpdate=!1}return e.groupsNeedUpdate&&(e.computeGroups(t.geometry),this.groups=e.groups,e.groupsNeedUpdate=!1),this},fromGeometry:function(t){return t.__directGeometry=(new yt).fromGeometry(t),this.fromDirectGeometry(t.__directGeometry)},fromDirectGeometry:function(t){const e=new Float32Array(3*t.vertices.length);if(this.setAttribute("position",new ot(e,3).copyVector3sArray(t.vertices)),t.normals.length>0){const e=new Float32Array(3*t.normals.length);this.setAttribute("normal",new ot(e,3).copyVector3sArray(t.normals))}if(t.colors.length>0){const e=new Float32Array(3*t.colors.length);this.setAttribute("color",new ot(e,3).copyColorsArray(t.colors))}if(t.uvs.length>0){const e=new Float32Array(2*t.uvs.length);this.setAttribute("uv",new ot(e,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){const e=new Float32Array(2*t.uvs2.length);this.setAttribute("uv2",new ot(e,2).copyVector2sArray(t.uvs2))}this.groups=t.groups;for(const e in t.morphTargets){const i=[],n=t.morphTargets[e];for(let t=0,e=n.length;t<e;t++){const e=n[t],r=new ft(3*e.data.length,3);r.name=e.name,i.push(r.copyVector3sArray(e.data))}this.morphAttributes[e]=i}if(t.skinIndices.length>0){const e=new ft(4*t.skinIndices.length,4);this.setAttribute("skinIndex",e.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){const e=new ft(4*t.skinWeights.length,4);this.setAttribute("skinWeight",e.copyVector4sArray(t.skinWeights))}return null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new g);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.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 d(-1/0,-1/0,-1/0),new d(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const i=e[t];Ut.setFromBufferAttribute(i),this.morphTargetsRelative?(Wt.addVectors(this.boundingBox.min,Ut.min),this.boundingBox.expandByPoint(Wt),Wt.addVectors(this.boundingBox.max,Ut.max),this.boundingBox.expandByPoint(Wt)):(this.boundingBox.expandByPoint(Ut.min),this.boundingBox.expandByPoint(Ut.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)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new O);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.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 d,1/0);if(t){const i=this.boundingSphere.center;if(Ut.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const i=e[t];Vt.setFromBufferAttribute(i),this.morphTargetsRelative?(Wt.addVectors(Ut.min,Vt.min),Ut.expandByPoint(Wt),Wt.addVectors(Ut.max,Vt.max),Ut.expandByPoint(Wt)):(Ut.expandByPoint(Vt.min),Ut.expandByPoint(Vt.max))}Ut.getCenter(i);let n=0;for(let e=0,r=t.count;e<r;e++)Wt.fromBufferAttribute(t,e),n=Math.max(n,i.distanceToSquared(Wt));if(e)for(let r=0,s=e.length;r<s;r++){const s=e[r],o=this.morphTargetsRelative;for(let e=0,r=s.count;e<r;e++)Wt.fromBufferAttribute(s,e),o&&(kt.fromBufferAttribute(t,e),Wt.add(kt)),n=Math.max(n,i.distanceToSquared(Wt))}this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}},computeFaceNormals:function(){},computeVertexNormals:function(){const t=this.index,e=this.getAttribute("position");if(void 0!==e){let i=this.getAttribute("normal");if(void 0===i)i=new ot(new Float32Array(3*e.count),3),this.setAttribute("normal",i);else for(let t=0,e=i.count;t<e;t++)i.setXYZ(t,0,0,0);const n=new d,r=new d,s=new d,o=new d,a=new d,h=new d,l=new d,c=new d;if(t)for(let u=0,p=t.count;u<p;u+=3){const p=t.getX(u+0),d=t.getX(u+1),m=t.getX(u+2);n.fromBufferAttribute(e,p),r.fromBufferAttribute(e,d),s.fromBufferAttribute(e,m),l.subVectors(s,r),c.subVectors(n,r),l.cross(c),o.fromBufferAttribute(i,p),a.fromBufferAttribute(i,d),h.fromBufferAttribute(i,m),o.add(l),a.add(l),h.add(l),i.setXYZ(p,o.x,o.y,o.z),i.setXYZ(d,a.x,a.y,a.z),i.setXYZ(m,h.x,h.y,h.z)}else for(let t=0,o=e.count;t<o;t+=3)n.fromBufferAttribute(e,t+0),r.fromBufferAttribute(e,t+1),s.fromBufferAttribute(e,t+2),l.subVectors(s,r),c.subVectors(n,r),l.cross(c),i.setXYZ(t+0,l.x,l.y,l.z),i.setXYZ(t+1,l.x,l.y,l.z),i.setXYZ(t+2,l.x,l.y,l.z);this.normalizeNormals(),i.needsUpdate=!0}},merge:function(t,e){if(!t||!t.isBufferGeometry)return void console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t);void 0===e&&(e=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));const i=this.attributes;for(const n in i){if(void 0===t.attributes[n])continue;const r=i[n].array,s=t.attributes[n],o=s.array,a=s.itemSize*e,h=Math.min(o.length,r.length-a);for(let t=0,e=a;t<h;t++,e++)r[e]=o[t]}return this},normalizeNormals:function(){const t=this.attributes.normal;for(let e=0,i=t.count;e<i;e++)Wt.fromBufferAttribute(t,e),Wt.normalize(),t.setXYZ(e,Wt.x,Wt.y,Wt.z)},toNonIndexed:function(){function t(t,e){const i=t.array,n=t.itemSize,r=t.normalized,s=new i.constructor(e.length*n);let o=0,a=0;for(let t=0,r=e.length;t<r;t++){o=e[t]*n;for(let t=0;t<n;t++)s[a++]=i[o++]}return new ot(s,n,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;const e=new jt,i=this.index.array,n=this.attributes;for(const r in n){const s=t(n[r],i);e.setAttribute(r,s)}const r=this.morphAttributes;for(const n in r){const s=[],o=r[n];for(let e=0,n=o.length;e<n;e++){const n=t(o[e],i);s.push(n)}e.morphAttributes[n]=s}e.morphTargetsRelative=this.morphTargetsRelative;const s=this.groups;for(let t=0,i=s.length;t<i;t++){const i=s[t];e.addGroup(i.start,i.count,i.materialIndex)}return e},toJSON:function(){const t={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const i in e)void 0!==e[i]&&(t[i]=e[i]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const i=this.attributes;for(const e in i){const n=i[e],r=n.toJSON(t.data);""!==n.name&&(r.name=n.name),t.data.attributes[e]=r}const n={};let r=!1;for(const e in this.morphAttributes){const i=this.morphAttributes[e],s=[];for(let e=0,n=i.length;e<n;e++){const n=i[e],r=n.toJSON(t.data);""!==n.name&&(r.name=n.name),s.push(r)}s.length>0&&(n[e]=s,r=!0)}r&&(t.data.morphAttributes=n,t.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));const o=this.boundingSphere;return null!==o&&(t.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),t},clone:function(){return(new jt).copy(this)},copy:function(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const i=t.index;null!==i&&this.setIndex(i.clone(e));const n=t.attributes;for(const t in n){const i=n[t];this.setAttribute(t,i.clone(e))}const r=t.morphAttributes;for(const t in r){const i=[],n=r[t];for(let t=0,r=n.length;t<r;t++)i.push(n[t].clone(e));this.morphAttributes[t]=i}this.morphTargetsRelative=t.morphTargetsRelative;const s=t.groups;for(let t=0,e=s.length;t<e;t++){const e=s[t];this.addGroup(e.start,e.count,e.materialIndex)}const o=t.boundingBox;null!==o&&(this.boundingBox=o.clone());const a=t.boundingSphere;return null!==a&&(this.boundingSphere=a.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});class Ht extends jt{constructor(t=1,e=1,i=1,n=1,r=1,s=1){super(),this.type="BoxBufferGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:n,heightSegments:r,depthSegments:s};const o=this;n=Math.floor(n),r=Math.floor(r),s=Math.floor(s);const a=[],h=[],l=[],c=[];let u=0,p=0;function m(t,e,i,n,r,s,m,f,g,y,x){const v=s/g,b=m/y,M=s/2,w=m/2,_=f/2,S=g+1,T=y+1;let E=0,A=0;const L=new d;for(let s=0;s<T;s++){const o=s*b-w;for(let a=0;a<S;a++){const u=a*v-M;L[t]=u*n,L[e]=o*r,L[i]=_,h.push(L.x,L.y,L.z),L[t]=0,L[e]=0,L[i]=f>0?1:-1,l.push(L.x,L.y,L.z),c.push(a/g),c.push(1-s/y),E+=1}}for(let t=0;t<y;t++)for(let e=0;e<g;e++){const i=u+e+S*t,n=u+e+S*(t+1),r=u+(e+1)+S*(t+1),s=u+(e+1)+S*t;a.push(i,n,s),a.push(n,r,s),A+=6}o.addGroup(p,A,x),p+=A,u+=E}m("z","y","x",-1,-1,i,e,t,s,r,0),m("z","y","x",1,-1,i,e,-t,s,r,1),m("x","z","y",1,1,t,i,e,n,s,2),m("x","z","y",1,-1,t,i,-e,n,s,3),m("x","y","z",1,-1,t,e,i,n,r,4),m("x","y","z",-1,-1,t,e,-i,n,r,5),this.setIndex(a),this.setAttribute("position",new ft(h,3)),this.setAttribute("normal",new ft(l,3)),this.setAttribute("uv",new ft(c,2))}}class qt extends jt{constructor(t=1,e=1,i=1,n=1){super(),this.type="PlaneBufferGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:n};const r=t/2,s=e/2,o=Math.floor(i),a=Math.floor(n),h=o+1,l=a+1,c=t/o,u=e/a,p=[],d=[],m=[],f=[];for(let t=0;t<l;t++){const e=t*u-s;for(let i=0;i<h;i++){const n=i*c-r;d.push(n,-e,0),m.push(0,0,1),f.push(i/o),f.push(1-t/a)}}for(let t=0;t<a;t++)for(let e=0;e<o;e++){const i=e+h*t,n=e+h*(t+1),r=e+1+h*(t+1),s=e+1+h*t;p.push(i,n,s),p.push(n,r,s)}this.setIndex(p),this.setAttribute("position",new ft(d,3)),this.setAttribute("normal",new ft(m,3)),this.setAttribute("uv",new ft(f,2))}}let Xt=0;function Jt(){Object.defineProperty(this,"id",{value:Xt++}),this.uuid=n.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.blending=1,this.side=0,this.flatShading=!1,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}function Yt(t){const e={};for(const i in t){e[i]={};for(const n in t[i]){const r=t[i][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture)?e[i][n]=r.clone():Array.isArray(r)?e[i][n]=r.slice():e[i][n]=r}}return e}function Zt(t){const e={};for(let i=0;i<t.length;i++){const n=Yt(t[i]);for(const t in n)e[t]=n[t]}return e}Jt.prototype=Object.assign(Object.create(r.prototype),{constructor:Jt,isMaterial:!0,onBeforeCompile:function(){},customProgramCacheKey:function(){return this.onBeforeCompile.toString()},setValues:function(t){if(void 0!==t)for(const e in t){const i=t[e];if(void 0===i){console.warn("THREE.Material: '"+e+"' parameter is undefined.");continue}if("shading"===e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===i;continue}const n=this[e];void 0!==n?n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[e]=i:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}},toJSON:function(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function n(t){const e=[];for(const i in t){const n=t[i];delete n.metadata,e.push(n)}return e}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(i.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(t).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,i.reflectivity=this.reflectivity,i.refractionRatio=this.refractionRatio,void 0!==this.combine&&(i.combine=this.combine),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.size&&(i.size=this.size),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(i.blending=this.blending),!0===this.flatShading&&(i.flatShading=this.flatShading),0!==this.side&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(i.morphTargets=!0),!0===this.morphNormals&&(i.morphNormals=!0),!0===this.skinning&&(i.skinning=!0),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),e){const e=n(t.textures),r=n(t.images);e.length>0&&(i.textures=e),r.length>0&&(i.images=r)}return i},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.blending=t.blending,this.side=t.side,this.flatShading=t.flatShading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let i=null;if(null!==e){const t=e.length;i=new Array(t);for(let n=0;n!==t;++n)i[n]=e[n].clone()}return this.clippingPlanes=i,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(Jt.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}});const Qt={clone:Yt,merge:Zt};var Kt=_rsl.default_vertex,$t=_rsl.default_fragment;function te(t){Jt.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader=Kt,this.fragmentShader=$t,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}te.prototype=Object.create(Jt.prototype),te.prototype.constructor=te,te.prototype.isShaderMaterial=!0,te.prototype.copy=function(t){return Jt.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Yt(t.uniforms),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this},te.prototype.toJSON=function(t){const e=Jt.prototype.toJSON.call(this,t);e.glslVersion=this.glslVersion,e.uniforms={};for(const i in this.uniforms){const n=this.uniforms[i].value;n&&n.isTexture?e.uniforms[i]={type:"t",value:n.toJSON(t).uuid}:n&&n.isColor?e.uniforms[i]={type:"c",value:n.getHex()}:n&&n.isVector2?e.uniforms[i]={type:"v2",value:n.toArray()}:n&&n.isVector3?e.uniforms[i]={type:"v3",value:n.toArray()}:n&&n.isVector4?e.uniforms[i]={type:"v4",value:n.toArray()}:n&&n.isMatrix3?e.uniforms[i]={type:"m3",value:n.toArray()}:n&&n.isMatrix4?e.uniforms[i]={type:"m4",value:n.toArray()}:e.uniforms[i]={value:n}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;const i={};for(const t in this.extensions)!0===this.extensions[t]&&(i[t]=!0);return Object.keys(i).length>0&&(e.extensions=i),e};const ee=new d,ie=new d,ne=new d,re=new d,se=new d,oe=new d,ae=new d;class he{constructor(t,e){this.origin=void 0!==t?t:new d,this.direction=void 0!==e?e:new d(0,0,-1)}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return void 0===e&&(console.warn("THREE.Ray: .at() target is now required"),e=new d),e.copy(this.direction).multiplyScalar(t).add(this.origin)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,ee)),this}closestPointToPoint(t,e){void 0===e&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),e=new d),e.subVectors(t,this.origin);const i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(i).add(this.origin)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=ee.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(ee.copy(this.direction).multiplyScalar(e).add(this.origin),ee.distanceToSquared(t))}distanceSqToSegment(t,e,i,n){ie.copy(t).add(e).multiplyScalar(.5),ne.copy(e).sub(t).normalize(),re.copy(this.origin).sub(ie);const r=.5*t.distanceTo(e),s=-this.direction.dot(ne),o=re.dot(this.direction),a=-re.dot(ne),h=re.lengthSq(),l=Math.abs(1-s*s);let c,u,p,d;if(l>0)if(c=s*a-o,u=s*o-a,d=r*l,c>=0)if(u>=-d)if(u<=d){const t=1/l;c*=t,u*=t,p=c*(c+s*u+2*o)+u*(s*c+u+2*a)+h}else u=r,c=Math.max(0,-(s*u+o)),p=-c*c+u*(u+2*a)+h;else u=-r,c=Math.max(0,-(s*u+o)),p=-c*c+u*(u+2*a)+h;else u<=-d?(c=Math.max(0,-(-s*r+o)),u=c>0?-r:Math.min(Math.max(-r,-a),r),p=-c*c+u*(u+2*a)+h):u<=d?(c=0,u=Math.min(Math.max(-r,-a),r),p=u*(u+2*a)+h):(c=Math.max(0,-(s*r+o)),u=c>0?r:Math.min(Math.max(-r,-a),r),p=-c*c+u*(u+2*a)+h);else u=s>0?-r:r,c=Math.max(0,-(s*u+o)),p=-c*c+u*(u+2*a)+h;return i&&i.copy(this.direction).multiplyScalar(c).add(this.origin),n&&n.copy(ne).multiplyScalar(u).add(ie),p}intersectSphere(t,e){ee.subVectors(t.center,this.origin);const i=ee.dot(this.direction),n=ee.dot(ee)-i*i,r=t.radius*t.radius;if(n>r)return null;const s=Math.sqrt(r-n),o=i-s,a=i+s;return o<0&&a<0?null:o<0?this.at(a,e):this.at(o,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null}intersectPlane(t,e){const i=this.distanceToPlane(t);return null===i?null:this.at(i,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let i,n,r,s,o,a;const h=1/this.direction.x,l=1/this.direction.y,c=1/this.direction.z,u=this.origin;return h>=0?(i=(t.min.x-u.x)*h,n=(t.max.x-u.x)*h):(i=(t.max.x-u.x)*h,n=(t.min.x-u.x)*h),l>=0?(r=(t.min.y-u.y)*l,s=(t.max.y-u.y)*l):(r=(t.max.y-u.y)*l,s=(t.min.y-u.y)*l),i>s||r>n?null:((r>i||i!=i)&&(i=r),(s<n||n!=n)&&(n=s),c>=0?(o=(t.min.z-u.z)*c,a=(t.max.z-u.z)*c):(o=(t.max.z-u.z)*c,a=(t.min.z-u.z)*c),i>a||o>n?null:((o>i||i!=i)&&(i=o),(a<n||n!=n)&&(n=a),n<0?null:this.at(i>=0?i:n,e)))}intersectsBox(t){return null!==this.intersectBox(t,ee)}intersectTriangle(t,e,i,n,r){se.subVectors(e,t),oe.subVectors(i,t),ae.crossVectors(se,oe);let s,o=this.direction.dot(ae);if(o>0){if(n)return null;s=1}else{if(!(o<0))return null;s=-1,o=-o}re.subVectors(this.origin,t);const a=s*this.direction.dot(oe.crossVectors(re,oe));if(a<0)return null;const h=s*this.direction.dot(se.cross(re));if(h<0)return null;if(a+h>o)return null;const l=-s*re.dot(ae);return l<0?null:this.at(l/o,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}}const le=new d,ce=new d,ue=new d,pe=new d,de=new d,me=new d,fe=new d,ge=new d,ye=new d,xe=new d;class ve{constructor(t,e,i){this.a=void 0!==t?t:new d,this.b=void 0!==e?e:new d,this.c=void 0!==i?i:new d}static getNormal(t,e,i,n){void 0===n&&(console.warn("THREE.Triangle: .getNormal() target is now required"),n=new d),n.subVectors(i,e),le.subVectors(t,e),n.cross(le);const r=n.lengthSq();return r>0?n.multiplyScalar(1/Math.sqrt(r)):n.set(0,0,0)}static getBarycoord(t,e,i,n,r){le.subVectors(n,e),ce.subVectors(i,e),ue.subVectors(t,e);const s=le.dot(le),o=le.dot(ce),a=le.dot(ue),h=ce.dot(ce),l=ce.dot(ue),c=s*h-o*o;if(void 0===r&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),r=new d),0===c)return r.set(-2,-1,-1);const u=1/c,p=(h*a-o*l)*u,m=(s*l-o*a)*u;return r.set(1-p-m,m,p)}static containsPoint(t,e,i,n){return this.getBarycoord(t,e,i,n,pe),pe.x>=0&&pe.y>=0&&pe.x+pe.y<=1}static getUV(t,e,i,n,r,s,o,a){return this.getBarycoord(t,e,i,n,pe),a.set(0,0),a.addScaledVector(r,pe.x),a.addScaledVector(s,pe.y),a.addScaledVector(o,pe.z),a}static isFrontFacing(t,e,i,n){return le.subVectors(i,e),ce.subVectors(t,e),le.cross(ce).dot(n)<0}set(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this}setFromPointsAndIndices(t,e,i,n){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[n]),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return le.subVectors(this.c,this.b),ce.subVectors(this.a,this.b),.5*le.cross(ce).length()}getMidpoint(t){return void 0===t&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),t=new d),t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return ve.getNormal(this.a,this.b,this.c,t)}getPlane(t){return void 0===t&&(console.warn("THREE.Triangle: .getPlane() target is now required"),t=new F),t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return ve.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,i,n,r){return ve.getUV(t,this.a,this.b,this.c,e,i,n,r)}containsPoint(t){return ve.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return ve.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){void 0===e&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),e=new d);const i=this.a,n=this.b,r=this.c;let s,o;de.subVectors(n,i),me.subVectors(r,i),ge.subVectors(t,i);const a=de.dot(ge),h=me.dot(ge);if(a<=0&&h<=0)return e.copy(i);ye.subVectors(t,n);const l=de.dot(ye),c=me.dot(ye);if(l>=0&&c<=l)return e.copy(n);const u=a*c-l*h;if(u<=0&&a>=0&&l<=0)return s=a/(a-l),e.copy(i).addScaledVector(de,s);xe.subVectors(t,r);const p=de.dot(xe),m=me.dot(xe);if(m>=0&&p<=m)return e.copy(r);const f=p*h-a*m;if(f<=0&&h>=0&&m<=0)return o=h/(h-m),e.copy(i).addScaledVector(me,o);const g=l*m-p*c;if(g<=0&&c-l>=0&&p-m>=0)return fe.subVectors(r,n),o=(c-l)/(c-l+(p-m)),e.copy(n).addScaledVector(fe,o);const y=1/(g+f+u);return s=f*y,o=u*y,e.copy(i).addScaledVector(de,s).addScaledVector(me,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}class be{constructor(t,e,i,n,r,s=0){this.a=t,this.b=e,this.c=i,this.normal=n&&n.isVector3?n:new d,this.vertexNormals=Array.isArray(n)?n:[],this.color=r&&r.isColor?r:new et,this.vertexColors=Array.isArray(r)?r:[],this.materialIndex=s}clone(){return(new this.constructor).copy(this)}copy(t){this.a=t.a,this.b=t.b,this.c=t.c,this.normal.copy(t.normal),this.color.copy(t.color),this.materialIndex=t.materialIndex;for(let e=0,i=t.vertexNormals.length;e<i;e++)this.vertexNormals[e]=t.vertexNormals[e].clone();for(let e=0,i=t.vertexColors.length;e<i;e++)this.vertexColors[e]=t.vertexColors[e].clone();return this}}function Me(t){Jt.call(this),this.type="MeshBasicMaterial",this.color=new et(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.setValues(t)}Me.prototype=Object.create(Jt.prototype),Me.prototype.constructor=Me,Me.prototype.isMeshBasicMaterial=!0,Me.prototype.copy=function(t){return Jt.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this};const we=new k,_e=new he,Se=new O,Te=new d,Ee=new d,Ae=new d,Le=new d,Re=new d,Pe=new d,Ce=new d,Oe=new d,ze=new d,Ne=new s,Be=new s,Fe=new s,De=new d,Ge=new d;function Ie(t=new jt,e=new Me){Bt.call(this),this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}function ke(t,e,i,n,r,s,o,a){let h;if(h=1===e.side?n.intersectTriangle(o,s,r,!0,a):n.intersectTriangle(r,s,o,2!==e.side,a),null===h)return null;Ge.copy(a),Ge.applyMatrix4(t.matrixWorld);const l=i.ray.origin.distanceTo(Ge);return l<i.near||l>i.far?null:{distance:l,point:Ge.clone(),object:t}}function Ue(t,e,i,n,r,o,a,h,l,c,u,p){Te.fromBufferAttribute(r,c),Ee.fromBufferAttribute(r,u),Ae.fromBufferAttribute(r,p);const d=t.morphTargetInfluences;if(e.morphTargets&&o&&d){Ce.set(0,0,0),Oe.set(0,0,0),ze.set(0,0,0);for(let t=0,e=o.length;t<e;t++){const e=d[t],i=o[t];0!==e&&(Le.fromBufferAttribute(i,c),Re.fromBufferAttribute(i,u),Pe.fromBufferAttribute(i,p),a?(Ce.addScaledVector(Le,e),Oe.addScaledVector(Re,e),ze.addScaledVector(Pe,e)):(Ce.addScaledVector(Le.sub(Te),e),Oe.addScaledVector(Re.sub(Ee),e),ze.addScaledVector(Pe.sub(Ae),e)))}Te.add(Ce),Ee.add(Oe),Ae.add(ze)}t.isSkinnedMesh&&(t.boneTransform(c,Te),t.boneTransform(u,Ee),t.boneTransform(p,Ae));const m=ke(t,e,i,n,Te,Ee,Ae,De);if(m){h&&(Ne.fromBufferAttribute(h,c),Be.fromBufferAttribute(h,u),Fe.fromBufferAttribute(h,p),m.uv=ve.getUV(De,Te,Ee,Ae,Ne,Be,Fe,new s)),l&&(Ne.fromBufferAttribute(l,c),Be.fromBufferAttribute(l,u),Fe.fromBufferAttribute(l,p),m.uv2=ve.getUV(De,Te,Ee,Ae,Ne,Be,Fe,new s));const t=new be(c,u,p);ve.getNormal(Te,Ee,Ae,t.normal),m.face=t}return m}Ie.prototype=Object.assign(Object.create(Bt.prototype),{constructor:Ie,isMesh:!0,copy:function(t){return Bt.prototype.copy.call(this,t),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=t.material,this.geometry=t.geometry,this},updateMorphTargets:function(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,i=Object.keys(e);if(i.length>0){const t=e[i[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,i=t.length;e<i;e++){const i=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(t,e){const i=this.geometry,n=this.material,r=this.matrixWorld;if(void 0===n)return;if(null===i.boundingSphere&&i.computeBoundingSphere(),Se.copy(i.boundingSphere),Se.applyMatrix4(r),!1===t.ray.intersectsSphere(Se))return;if(we.copy(r).invert(),_e.copy(t.ray).applyMatrix4(we),null!==i.boundingBox&&!1===_e.intersectsBox(i.boundingBox))return;let o;if(i.isBufferGeometry){const r=i.index,s=i.attributes.position,a=i.morphAttributes.position,h=i.morphTargetsRelative,l=i.attributes.uv,c=i.attributes.uv2,u=i.groups,p=i.drawRange;if(null!==r)if(Array.isArray(n))for(let i=0,d=u.length;i<d;i++){const d=u[i],m=n[d.materialIndex];for(let i=Math.max(d.start,p.start),n=Math.min(d.start+d.count,p.start+p.count);i<n;i+=3){const n=r.getX(i),u=r.getX(i+1),p=r.getX(i+2);o=Ue(this,m,t,_e,s,a,h,l,c,n,u,p),o&&(o.faceIndex=Math.floor(i/3),o.face.materialIndex=d.materialIndex,e.push(o))}}else for(let i=Math.max(0,p.start),u=Math.min(r.count,p.start+p.count);i<u;i+=3){const u=r.getX(i),p=r.getX(i+1),d=r.getX(i+2);o=Ue(this,n,t,_e,s,a,h,l,c,u,p,d),o&&(o.faceIndex=Math.floor(i/3),e.push(o))}else if(void 0!==s)if(Array.isArray(n))for(let i=0,r=u.length;i<r;i++){const r=u[i],d=n[r.materialIndex];for(let i=Math.max(r.start,p.start),n=Math.min(r.start+r.count,p.start+p.count);i<n;i+=3)o=Ue(this,d,t,_e,s,a,h,l,c,i,i+1,i+2),o&&(o.faceIndex=Math.floor(i/3),o.face.materialIndex=r.materialIndex,e.push(o))}else for(let i=Math.max(0,p.start),r=Math.min(s.count,p.start+p.count);i<r;i+=3)o=Ue(this,n,t,_e,s,a,h,l,c,i,i+1,i+2),o&&(o.faceIndex=Math.floor(i/3),e.push(o))}else if(i.isGeometry){const r=Array.isArray(n),a=i.vertices,h=i.faces;let l;const c=i.faceVertexUvs[0];c.length>0&&(l=c);for(let i=0,c=h.length;i<c;i++){const c=h[i],u=r?n[c.materialIndex]:n;if(void 0===u)continue;const p=a[c.a],d=a[c.b],m=a[c.c];if(o=ke(this,u,t,_e,p,d,m,De),o){if(l&&l[i]){const t=l[i];Ne.copy(t[0]),Be.copy(t[1]),Fe.copy(t[2]),o.uv=ve.getUV(De,p,d,m,Ne,Be,Fe,new s)}o.face=c,o.faceIndex=i,e.push(o)}}}}});var Ve=_rsl.alphamap_fragment,We=_rsl.alphamap_pars_fragment,je=_rsl.alphatest_fragment,He=_rsl.aomap_fragment,qe=_rsl.aomap_pars_fragment,Xe=_rsl.apply_accumulative_buffers_fragment,Je=_rsl.apply_accumulative_buffers_pars_fragment,Ye=_rsl.begin_vertex,Ze=_rsl.beginnormal_vertex,Qe=_rsl.bsdfs,Ke=_rsl.bumpmap_pars_fragment,$e=_rsl.clipping_planes_fragment,ti=_rsl.clipping_planes_pars_fragment,ei=_rsl.clipping_planes_pars_vertex,ii=_rsl.clipping_planes_vertex,ni=_rsl.color_fragment,ri=_rsl.color_pars_fragment,si=_rsl.color_pars_vertex,oi=_rsl.color_vertex,ai=_rsl.common,hi=_rsl.cube_uv_reflection_fragment,li=_rsl.defaultnormal_vertex,ci=_rsl.displacementmap_pars_vertex,ui=_rsl.displacementmap_vertex,pi=_rsl.emissivemap_fragment,di=_rsl.emissivemap_pars_fragment,mi=_rsl.encodings_fragment,fi=_rsl.encodings_pars_fragment,gi=_rsl.envmap_fragment,yi=_rsl.envmap_common_pars_fragment,xi=_rsl.envmap_pars_fragment,vi=_rsl.envmap_pars_vertex,bi=_rsl.envmap_vertex,Mi=_rsl.fog_vertex,wi=_rsl.fog_pars_vertex,_i=_rsl.fog_fragment,Si=_rsl.fog_pars_fragment,Ti=_rsl.gradientmap_pars_fragment,Ei=_rsl.lightmap_fragment,Ai=_rsl.lightmap_pars_fragment,Li=_rsl.lights_lambert_vertex,Ri=_rsl.lights_pars_begin;const Pi={alphamap_fragment:Ve,alphamap_pars_fragment:We,alphatest_fragment:je,aomap_fragment:He,aomap_pars_fragment:qe,apply_accumulative_buffers_fragment:Xe,apply_accumulative_buffers_pars_fragment:Je,begin_vertex:Ye,beginnormal_vertex:Ze,bsdfs:Qe,bumpmap_pars_fragment:Ke,clipping_planes_fragment:$e,clipping_planes_pars_fragment:ti,clipping_planes_pars_vertex:ei,clipping_planes_vertex:ii,color_fragment:ni,color_pars_fragment:ri,color_pars_vertex:si,color_vertex:oi,common:ai,cube_uv_reflection_fragment:hi,defaultnormal_vertex:li,displacementmap_pars_vertex:ci,displacementmap_vertex:ui,emissivemap_fragment:pi,emissivemap_pars_fragment:di,encodings_fragment:mi,encodings_pars_fragment:fi,envmap_fragment:gi,envmap_common_pars_fragment:yi,envmap_pars_fragment:xi,envmap_pars_vertex:vi,envmap_physical_pars_fragment:_rsl.envmap_physical_pars_fragment,envmap_vertex:bi,fog_vertex:Mi,fog_pars_vertex:wi,fog_fragment:_i,fog_pars_fragment:Si,gradientmap_pars_fragment:Ti,lightmap_fragment:Ei,lightmap_pars_fragment:Ai,lights_lambert_vertex:Li,lights_pars_begin:Ri,lights_toon_fragment:_rsl.lights_toon_fragment,lights_toon_pars_fragment:_rsl.lights_toon_pars_fragment,lights_phong_fragment:_rsl.lights_phong_fragment,lights_phong_pars_fragment:_rsl.lights_phong_pars_fragment,lights_physical_fragment:_rsl.lights_physical_fragment,lights_physical_pars_fragment:_rsl.lights_physical_pars_fragment,lights_fragment_begin:_rsl.lights_fragment_begin,lights_fragment_maps:_rsl.lights_fragment_maps,lights_fragment_end:_rsl.lights_fragment_end,logdepthbuf_fragment:_rsl.logdepthbuf_fragment,logdepthbuf_pars_fragment:_rsl.logdepthbuf_pars_fragment,logdepthbuf_pars_vertex:_rsl.logdepthbuf_pars_vertex,logdepthbuf_vertex:_rsl.logdepthbuf_vertex,map_fragment:_rsl.map_fragment,map_pars_fragment:_rsl.map_pars_fragment,map_particle_fragment:_rsl.map_particle_fragment,map_particle_pars_fragment:_rsl.map_particle_pars_fragment,metalnessmap_fragment:_rsl.metalnessmap_fragment,metalnessmap_pars_fragment:_rsl.metalnessmap_pars_fragment,morphnormal_vertex:_rsl.morphnormal_vertex,morphtarget_pars_vertex:_rsl.morphtarget_pars_vertex,morphtarget_vertex:_rsl.morphtarget_vertex,normal_fragment_begin:_rsl.normal_fragment_begin,normal_fragment_maps:_rsl.normal_fragment_maps,normalmap_pars_fragment:_rsl.normalmap_pars_fragment,clearcoat_normal_fragment_begin:_rsl.clearcoat_normal_fragment_begin,clearcoat_normal_fragment_maps:_rsl.clearcoat_normal_fragment_maps,clearcoat_pars_fragment:_rsl.clearcoat_pars_fragment,packing:_rsl.packing,premultiplied_alpha_fragment:_rsl.premultiplied_alpha_fragment,project_vertex:_rsl.project_vertex,dithering_fragment:_rsl.dithering_fragment,dithering_pars_fragment:_rsl.dithering_pars_fragment,roughnessmap_fragment:_rsl.roughnessmap_fragment,roughnessmap_pars_fragment:_rsl.roughnessmap_pars_fragment,shadowmap_pars_fragment:_rsl.shadowmap_pars_fragment,shadowmap_pars_vertex:_rsl.shadowmap_pars_vertex,shadowmap_vertex:_rsl.shadowmap_vertex,shadowmask_pars_fragment:_rsl.shadowmask_pars_fragment,skinbase_vertex:_rsl.skinbase_vertex,skinning_pars_vertex:_rsl.skinning_pars_vertex,skinning_vertex:_rsl.skinning_vertex,skinnormal_vertex:_rsl.skinnormal_vertex,specularmap_fragment:_rsl.specularmap_fragment,specularmap_pars_fragment:_rsl.specularmap_pars_fragment,tonemapping_fragment:_rsl.tonemapping_fragment,tonemapping_pars_fragment:_rsl.tonemapping_pars_fragment,transmissionmap_fragment:_rsl.transmissionmap_fragment,transmissionmap_pars_fragment:_rsl.transmissionmap_pars_fragment,uv_pars_fragment:_rsl.uv_pars_fragment,uv_pars_vertex:_rsl.uv_pars_vertex,uv_vertex:_rsl.uv_vertex,uv2_pars_fragment:_rsl.uv2_pars_fragment,uv2_pars_vertex:_rsl.uv2_pars_vertex,uv2_vertex:_rsl.uv2_vertex,worldpos_vertex:_rsl.worldpos_vertex,background_frag:_rsl.background_frag,background_vert:_rsl.background_vert,cube_frag:_rsl.cube_frag,cube_vert:_rsl.cube_vert,depth_frag:_rsl.depth_frag,depth_vert:_rsl.depth_vert,distanceRGBA_frag:_rsl.distanceRGBA_frag,distanceRGBA_vert:_rsl.distanceRGBA_vert,equirect_frag:_rsl.equirect_frag,equirect_vert:_rsl.equirect_vert,linedashed_frag:_rsl.linedashed_frag,linedashed_vert:_rsl.linedashed_vert,meshbasic_frag:_rsl.meshbasic_frag,meshbasic_vert:_rsl.meshbasic_vert,meshlambert_frag:_rsl.meshlambert_frag,meshlambert_vert:_rsl.meshlambert_vert,meshmatcap_frag:_rsl.meshmatcap_frag,meshmatcap_vert:_rsl.meshmatcap_vert,meshtoon_frag:_rsl.meshtoon_frag,meshtoon_vert:_rsl.meshtoon_vert,meshphong_frag:_rsl.meshphong_frag,meshphong_vert:_rsl.meshphong_vert,meshphysical_frag:_rsl.meshphysical_frag,meshphysical_vert:_rsl.meshphysical_vert,normal_frag:_rsl.normal_frag,normal_vert:_rsl.normal_vert,points_frag:_rsl.points_frag,points_vert:_rsl.points_vert,shadow_frag:_rsl.shadow_frag,shadow_vert:_rsl.shadow_vert,sprite_frag:_rsl.sprite_frag,sprite_vert:_rsl.sprite_vert},Ci={common:{diffuse:{value:new et(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new o},uv2Transform:{value:new o},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0},maxCubeSize:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new s(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new et(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:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},spotPosition:{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:{},shadow:{},useAreaTexture:{}}},ltc_1:{value:null},ltc_2:{value:null},rectAreaTexture:{value:[]},rectShadowMap:{value:[]}},points:{diffuse:{value:new et(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new o}},sprite:{diffuse:{value:new et(15658734)},opacity:{value:1},center:{value:new s(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new o}}},Oi={basic:{uniforms:Zt([Ci.common,Ci.specularmap,Ci.envmap,Ci.aomap,Ci.lightmap,Ci.fog]),vertexShader:Pi.meshbasic_vert,fragmentShader:Pi.meshbasic_frag},lambert:{uniforms:Zt([Ci.common,Ci.specularmap,Ci.envmap,Ci.aomap,Ci.lightmap,Ci.emissivemap,Ci.fog,Ci.lights,{emissive:{value:new et(0)}}]),vertexShader:Pi.meshlambert_vert,fragmentShader:Pi.meshlambert_frag},phong:{uniforms:Zt([Ci.common,Ci.specularmap,Ci.envmap,Ci.aomap,Ci.lightmap,Ci.emissivemap,Ci.bumpmap,Ci.normalmap,Ci.displacementmap,Ci.fog,Ci.lights,{emissive:{value:new et(0)},specular:{value:new et(1118481)},shininess:{value:30}}]),vertexShader:Pi.meshphong_vert,fragmentShader:Pi.meshphong_frag},standard:{uniforms:Zt([Ci.common,Ci.envmap,Ci.aomap,Ci.lightmap,Ci.emissivemap,Ci.bumpmap,Ci.normalmap,Ci.displacementmap,Ci.roughnessmap,Ci.metalnessmap,Ci.fog,Ci.lights,{emissive:{value:new et(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Pi.meshphysical_vert,fragmentShader:Pi.meshphysical_frag},toon:{uniforms:Zt([Ci.common,Ci.aomap,Ci.lightmap,Ci.emissivemap,Ci.bumpmap,Ci.normalmap,Ci.displacementmap,Ci.gradientmap,Ci.fog,Ci.lights,{emissive:{value:new et(0)}}]),vertexShader:Pi.meshtoon_vert,fragmentShader:Pi.meshtoon_frag},matcap:{uniforms:Zt([Ci.common,Ci.bumpmap,Ci.normalmap,Ci.displacementmap,Ci.fog,{matcap:{value:null}}]),vertexShader:Pi.meshmatcap_vert,fragmentShader:Pi.meshmatcap_frag},points:{uniforms:Zt([Ci.points,Ci.fog]),vertexShader:Pi.points_vert,fragmentShader:Pi.points_frag},dashed:{uniforms:Zt([Ci.common,Ci.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Pi.linedashed_vert,fragmentShader:Pi.linedashed_frag},depth:{uniforms:Zt([Ci.common,Ci.displacementmap]),vertexShader:Pi.depth_vert,fragmentShader:Pi.depth_frag},normal:{uniforms:Zt([Ci.common,Ci.bumpmap,Ci.normalmap,Ci.displacementmap,{opacity:{value:1}}]),vertexShader:Pi.normal_vert,fragmentShader:Pi.normal_frag},sprite:{uniforms:Zt([Ci.sprite,Ci.fog]),vertexShader:Pi.sprite_vert,fragmentShader:Pi.sprite_frag},background:{uniforms:{uvTransform:{value:new o},t2D:{value:null}},vertexShader:Pi.background_vert,fragmentShader:Pi.background_frag},cube:{uniforms:Zt([Ci.envmap,{opacity:{value:1}}]),vertexShader:Pi.cube_vert,fragmentShader:Pi.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Pi.equirect_vert,fragmentShader:Pi.equirect_frag},distanceRGBA:{uniforms:Zt([Ci.common,Ci.displacementmap,{referencePosition:{value:new d},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Pi.distanceRGBA_vert,fragmentShader:Pi.distanceRGBA_frag},shadow:{uniforms:Zt([Ci.lights,Ci.fog,{color:{value:new et(0)},opacity:{value:1}}]),vertexShader:Pi.shadow_vert,fragmentShader:Pi.shadow_frag}};function zi(t,e,i,n,r){const s=new et(0);let o,a,h=0,l=null,c=0,u=null;function p(t,e){i.buffers.color.setClear(t.r,t.g,t.b,e,r)}return{getClearColor:function(){return s},setClearColor:function(t,e=1){s.set(t),h=e,p(s,h)},getClearAlpha:function(){return h},setClearAlpha:function(t){h=t,p(s,h)},render:function(i,r,d,m){let f=!0===r.isScene?r.background:null;f&&f.isTexture&&(f=e.get(f));const g=t.xr,y=g.getSession&&g.getSession();y&&"additive"===y.environmentBlendMode&&(f=null),null===f?p(s,h):f&&f.isColor&&(p(f,1),m=!0),(t.autoClear||m)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),f&&(f.isCubeTexture||f.isWebGLCubeRenderTarget||306===f.mapping)?(void 0===a&&(a=new Ie(new Ht(1,1,1),new te({name:"BackgroundCubeMaterial",uniforms:Yt(Oi.cube.uniforms),vertexShader:Oi.cube.vertexShader,fragmentShader:Oi.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),a.geometry.deleteAttribute("normal"),a.geometry.deleteAttribute("uv"),a.onBeforeRender=function(t,e,i){this.matrixWorld.copyPosition(i.matrixWorld)},Object.defineProperty(a.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(a)),f.isWebGLCubeRenderTarget&&(f=f.texture),a.material.uniforms.envMap.value=f,a.material.uniforms.flipEnvMap.value=f.isCubeTexture&&f._needsFlipEnvMap?-1:1,l===f&&c===f.version&&u===t.toneMapping||(a.material.needsUpdate=!0,l=f,c=f.version,u=t.toneMapping),i.unshift(a,a.geometry,a.material,0,0,null)):f&&f.isTexture&&(void 0===o&&(o=new Ie(new qt(2,2),new te({name:"BackgroundMaterial",uniforms:Yt(Oi.background.uniforms),vertexShader:Oi.background.vertexShader,fragmentShader:Oi.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),o.geometry.deleteAttribute("normal"),Object.defineProperty(o.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(o)),o.material.uniforms.t2D.value=f,!0===f.matrixAutoUpdate&&f.updateMatrix(),o.material.uniforms.uvTransform.value.copy(f.matrix),l===f&&c===f.version&&u===t.toneMapping||(o.material.needsUpdate=!0,l=f,c=f.version,u=t.toneMapping),i.unshift(o,o.geometry,o.material,0,0,null))}}}function Ni(t,e,i,n){const r=t.getParameter(34921),s=n.isWebGL2?null:e.get("OES_vertex_array_object"),o=n.isWebGL2||null!==s,a={},h=p(null);let l=h;function c(e){return n.isWebGL2?t.bindVertexArray(e):s.bindVertexArrayOES(e)}function u(e){return n.isWebGL2?t.deleteVertexArray(e):s.deleteVertexArrayOES(e)}function p(t){const e=[],i=[],n=[];for(let t=0;t<r;t++)e[t]=0,i[t]=0,n[t]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:i,attributeDivisors:n,object:t,attributes:{},index:null}}function d(){const t=l.newAttributes;for(let e=0,i=t.length;e<i;e++)t[e]=0}function m(t){f(t,0)}function f(i,r){const s=l.newAttributes,o=l.enabledAttributes,a=l.attributeDivisors;s[i]=1,0===o[i]&&(t.enableVertexAttribArray(i),o[i]=1),a[i]!==r&&((n.isWebGL2?t:e.get("ANGLE_instanced_arrays"))[n.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](i,r),a[i]=r)}function g(){const e=l.newAttributes,i=l.enabledAttributes;for(let n=0,r=i.length;n<r;n++)i[n]!==e[n]&&(t.disableVertexAttribArray(n),i[n]=0)}function y(e,i,r,s,o,a){!0!==n.isWebGL2||5124!==r&&5125!==r?t.vertexAttribPointer(e,i,r,s,o,a):t.vertexAttribIPointer(e,i,r,o,a)}function x(){v(),l!==h&&(l=h,c(l.object))}function v(){h.geometry=null,h.program=null,h.wireframe=!1}return{setup:function(r,h,u,x,v){let b=!1;if(o){const e=function(e,i,r){const o=!0===r.wireframe;let h=a[e.id];void 0===h&&(h={},a[e.id]=h);let l=h[i.id];void 0===l&&(l={},h[i.id]=l);let c=l[o];return void 0===c&&(c=p(n.isWebGL2?t.createVertexArray():s.createVertexArrayOES()),l[o]=c),c}(x,u,h);l!==e&&(l=e,c(l.object)),b=function(t,e){const i=l.attributes,n=t.attributes;let r=0;for(const t in n){const e=i[t],s=n[t];if(void 0===e)return!0;if(e.attribute!==s)return!0;if(e.data!==s.data)return!0;r++}return l.attributesNum!==r||l.index!==e}(x,v),b&&function(t,e){const i={},n=t.attributes;let r=0;for(const t in n){const e=n[t],s={};s.attribute=e,e.data&&(s.data=e.data),i[t]=s,r++}l.attributes=i,l.attributesNum=r,l.index=e}(x,v)}else{const t=!0===h.wireframe;l.geometry===x.id&&l.program===u.id&&l.wireframe===t||(l.geometry=x.id,l.program=u.id,l.wireframe=t,b=!0)}!0===r.isInstancedMesh&&(b=!0),null!==v&&i.update(v,34963),b&&(function(r,s,o,a){if(!1===n.isWebGL2&&(r.isInstancedMesh||a.isInstancedBufferGeometry)&&null===e.get("ANGLE_instanced_arrays"))return;d();const h=a.attributes,l=o.getAttributes(),c=s.defaultAttributeValues;for(const e in l){const n=l[e];if(n>=0){const s=h[e];if(void 0!==s){const e=s.normalized,r=s.itemSize,o=i.get(s);if(void 0===o)continue;const h=o.buffer,l=o.type,c=o.bytesPerElement;if(s.isInterleavedBufferAttribute){const i=s.data,o=i.stride,u=s.offset;i&&i.isInstancedInterleavedBuffer?(f(n,i.meshPerAttribute),void 0===a._maxInstanceCount&&(a._maxInstanceCount=i.meshPerAttribute*i.count)):m(n),t.bindBuffer(34962,h),y(n,r,l,e,o*c,u*c)}else s.isInstancedBufferAttribute?(f(n,s.meshPerAttribute),void 0===a._maxInstanceCount&&(a._maxInstanceCount=s.meshPerAttribute*s.count)):m(n),t.bindBuffer(34962,h),y(n,r,l,e,0,0)}else if("instanceMatrix"===e){const e=i.get(r.instanceMatrix);if(void 0===e)continue;const s=e.buffer,o=e.type;f(n+0,1),f(n+1,1),f(n+2,1),f(n+3,1),t.bindBuffer(34962,s),t.vertexAttribPointer(n+0,4,o,!1,64,0),t.vertexAttribPointer(n+1,4,o,!1,64,16),t.vertexAttribPointer(n+2,4,o,!1,64,32),t.vertexAttribPointer(n+3,4,o,!1,64,48)}else if("instanceColor"===e){const e=i.get(r.instanceColor);if(void 0===e)continue;const s=e.buffer,o=e.type;f(n,1),t.bindBuffer(34962,s),t.vertexAttribPointer(n,3,o,!1,12,0)}else if(void 0!==c){const i=c[e];if(void 0!==i)switch(i.length){case 2:t.vertexAttrib2fv(n,i);break;case 3:t.vertexAttrib3fv(n,i);break;case 4:t.vertexAttrib4fv(n,i);break;default:t.vertexAttrib1fv(n,i)}}}}g()}(r,h,u,x),null!==v&&t.bindBuffer(34963,i.get(v).buffer))},reset:x,resetDefaultState:v,dispose:function(){x();for(const t in a){const e=a[t];for(const t in e){const i=e[t];for(const t in i)u(i[t].object),delete i[t];delete e[t]}delete a[t]}},releaseStatesOfGeometry:function(t){if(void 0===a[t.id])return;const e=a[t.id];for(const t in e){const i=e[t];for(const t in i)u(i[t].object),delete i[t];delete e[t]}delete a[t.id]},releaseStatesOfProgram:function(t){for(const e in a){const i=a[e];if(void 0===i[t.id])continue;const n=i[t.id];for(const t in n)u(n[t].object),delete n[t];delete i[t.id]}},initAttributes:d,enableAttribute:m,disableUnusedAttributes:g}}function Bi(t,e,i,n){const r=n.isWebGL2;let s;this.setMode=function(t){s=t},this.render=function(e,n){t.drawArrays(s,e,n),i.update(n,s,1)},this.renderInstances=function(n,o,a){if(0===a)return;let h,l;if(r)h=t,l="drawArraysInstanced";else if(h=e.get("ANGLE_instanced_arrays"),l="drawArraysInstancedANGLE",null===h)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");h[l](s,n,o,a),i.update(o,s,a)}}function Fi(t,e,i){let n;function r(e){if("highp"===e){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const s="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext;let o=void 0!==i.precision?i.precision:"highp";const a=r(o);a!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",a,"instead."),o=a);const h=!0===i.logarithmicDepthBuffer,l=t.getParameter(34930),c=t.getParameter(35660),u=t.getParameter(3379),p=t.getParameter(34076),d=t.getParameter(34921),m=t.getParameter(36347),f=t.getParameter(36348),g=t.getParameter(36349),y=c>0,x=s||!!e.get("OES_texture_float");return{isWebGL2:s,getMaxAnisotropy:function(){if(void 0!==n)return n;const i=e.get("EXT_texture_filter_anisotropic");return n=null!==i?t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,n},getMaxPrecision:r,precision:o,logarithmicDepthBuffer:h,maxTextures:l,maxVertexTextures:c,maxTextureSize:u,maxCubemapSize:p,maxAttributes:d,maxVertexUniforms:m,maxVaryings:f,maxFragmentUniforms:g,vertexTextures:y,floatFragmentTextures:x,floatVertexTextures:y&&x,maxSamples:s?t.getParameter(36183):0}}function Di(t){const e=this;let i=null,n=0,r=!1,s=!1;const a=new F,h=new o,l={value:null,needsUpdate:!1};function c(){l.value!==i&&(l.value=i,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(t,i,n,r){const s=null!==t?t.length:0;let o=null;if(0!==s){if(o=l.value,!0!==r||null===o){const e=n+4*s,r=i.matrixWorldInverse;h.getNormalMatrix(r),(null===o||o.length<e)&&(o=new Float32Array(e));for(let e=0,i=n;e!==s;++e,i+=4)a.copy(t[e]).applyMatrix4(r,h),a.normal.toArray(o,i),o[i+3]=a.constant}l.value=o,l.needsUpdate=!0}return e.numPlanes=s,e.numIntersection=0,o}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e,s){const o=0!==t.length||e||0!==n||r;return r=e,i=u(t,s,0),n=t.length,o},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1,c()},this.setState=function(e,o,a){const h=e.clippingPlanes,p=e.clipIntersection,d=e.clipShadows,m=t.get(e);if(!r||null===h||0===h.length||s&&!d)s?u(null):c();else{const t=s?0:n,e=4*t;let r=m.clippingState||null;l.value=r,r=u(h,o,e,a);for(let t=0;t!==e;++t)r[t]=i[t];m.clippingState=r,this.numIntersection=p?this.numPlanes:0,this.numPlanes+=t}}}function Gi(t,e,i){this.width=t,this.height=e,this.scissor=new J(0,0,t,e),this.scissorTest=!1,this.viewport=new J(0,0,t,e),i=i||{},this.texture=new l(void 0,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),this.texture.image={},this.texture.image.width=t,this.texture.image.height=e,this.texture.generateMipmaps=void 0!==i.generateMipmaps&&i.generateMipmaps,this.texture.minFilter=void 0!==i.minFilter?i.minFilter:1006,this.depthBuffer=void 0===i.depthBuffer||i.depthBuffer,this.stencilBuffer=void 0!==i.stencilBuffer&&i.stencilBuffer,this.depthTexture=void 0!==i.depthTexture?i.depthTexture:null}function Ii(){Bt.call(this),this.type="Camera",this.matrixWorldInverse=new k,this.projectionMatrix=new k,this.projectionMatrixInverse=new k}function ki(t=50,e=1,i=.1,n=2e3){Ii.call(this),this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=i,this.far=n,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function Ui(t,e,i){if(Bt.call(this),this.type="CubeCamera",!0!==i.isWebGLCubeRenderTarget)return void console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");this.renderTarget=i;const n=new ki(90,1,t,e);n.layers=this.layers,n.up.set(0,-1,0),n.lookAt(new d(1,0,0)),this.add(n);const r=new ki(90,1,t,e);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new d(-1,0,0)),this.add(r);const s=new ki(90,1,t,e);s.layers=this.layers,s.up.set(0,0,1),s.lookAt(new d(0,1,0)),this.add(s);const o=new ki(90,1,t,e);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(new d(0,-1,0)),this.add(o);const a=new ki(90,1,t,e);a.layers=this.layers,a.up.set(0,-1,0),a.lookAt(new d(0,0,1)),this.add(a);const h=new ki(90,1,t,e);h.layers=this.layers,h.up.set(0,-1,0),h.lookAt(new d(0,0,-1)),this.add(h),this.update=function(t,e){null===this.parent&&this.updateMatrixWorld();const l=t.xr.enabled,c=t.getRenderTarget();t.xr.enabled=!1;const u=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,t.setRenderTarget(i,0),t.render(e,n),t.setRenderTarget(i,1),t.render(e,r),t.setRenderTarget(i,2),t.render(e,s),t.setRenderTarget(i,3),t.render(e,o),t.setRenderTarget(i,4),t.render(e,a),i.texture.generateMipmaps=u,t.setRenderTarget(i,5),t.render(e,h),t.setRenderTarget(c),t.xr.enabled=l}}function Vi(t,e,i,n,r,s,o,a,h,c){t=void 0!==t?t:[],e=void 0!==e?e:301,o=void 0!==o?o:1022,l.call(this,t,e,i,n,r,s,o,a,h,c),this.flipY=!1,this.maxLod=-1,this._needsFlipEnvMap=!0}function Wi(t,e,i){Number.isInteger(e)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),e=i),Gi.call(this,t,t,e),e=e||{},this.texture=new Vi(void 0,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.encoding),this.texture._needsFlipEnvMap=!1}function ji(t){let e=new WeakMap;function i(t,e){return 303===e?t.mapping=301:304===e&&(t.mapping=302),t}function n(t){const i=t.target;i.removeEventListener("dispose",n);const r=e.get(i);void 0!==r&&(e.delete(i),r.dispose())}return{get:function(r){if(r&&r.isTexture){const s=r.mapping;if(303===s||304===s){if(e.has(r))return i(e.get(r).texture,r.mapping);{const s=r.image;if(s&&s.height>0){const o=t.getRenderList(),a=t.getRenderTarget(),h=new Wi(s.height/2);return h.fromEquirectangularTexture(t,r),e.set(r,h),t.setRenderTarget(a),t.setRenderList(o),r.addEventListener("dispose",n),i(h.texture,r.mapping)}return null}}}return r},dispose:function(){e=new WeakMap}}}function Hi(t){const e={};return{has:function(i){if(void 0!==e[i])return null!==e[i];let n;switch(i){case"WEBGL_depth_texture":n=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:n=t.getExtension(i)}return e[i]=n,null!==n},get:function(t){return this.has(t)||console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),e[t]}}}function qi(t,e,i,n){const r=new WeakMap,s=new WeakMap;function o(t){const a=t.target,h=r.get(a);null!==h.index&&e.remove(h.index);for(const t in h.attributes)e.remove(h.attributes[t]);a.removeEventListener("dispose",o),r.delete(a);const l=s.get(h);l&&(e.remove(l),s.delete(h)),n.releaseStatesOfGeometry(h),!0===a.isInstancedBufferGeometry&&delete a._maxInstanceCount,i.memory.geometries--}function a(t){const i=[],n=t.index,r=t.attributes.position;let o=0;if(null!==n){const t=n.array;o=n.version;for(let e=0,n=t.length;e<n;e+=3){const n=t[e+0],r=t[e+1],s=t[e+2];i.push(n,r,r,s,s,n)}}else{const t=r.array;o=r.version;for(let e=0,n=t.length/3-1;e<n;e+=3){const t=e+0,n=e+1,r=e+2;i.push(t,n,n,r,r,t)}}const a=new(Ft(i)>65535?dt:ut)(i,1);a.version=o;const h=s.get(t);h&&e.remove(h),s.set(t,a)}return{get:function(t,e){let n=r.get(e);return n||(e.addEventListener("dispose",o),e.isBufferGeometry?n=e:e.isGeometry&&(void 0===e._bufferGeometry&&(e._bufferGeometry=(new jt).setFromObject(t)),n=e._bufferGeometry),r.set(e,n),i.memory.geometries++,n)},update:function(t){const i=t.attributes;for(const t in i)e.update(i[t],34962);const n=t.morphAttributes;for(const t in n){const i=n[t];for(let t=0,n=i.length;t<n;t++)e.update(i[t],34962)}},getWireframeAttribute:function(t){const e=s.get(t);if(e){const i=t.index;null!==i&&e.version<i.version&&a(t)}else a(t);return s.get(t)}}}function Xi(t,e,i,n){const r=n.isWebGL2;let s,o,a;this.setMode=function(t){s=t},this.setIndex=function(t){o=t.type,a=t.bytesPerElement},this.render=function(e,n){t.drawElements(s,n,o,e*a),i.update(n,s,1)},this.renderInstances=function(n,h,l){if(0===l)return;let c,u;if(r)c=t,u="drawElementsInstanced";else if(c=e.get("ANGLE_instanced_arrays"),u="drawElementsInstancedANGLE",null===c)return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");c[u](s,h,o,n*a,l),i.update(h,s,l)}}function Ji(t){const e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.frame++,e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(t,i,n){switch(e.calls++,i){case 4:e.triangles+=n*(t/3);break;case 1:e.lines+=n*(t/2);break;case 3:e.lines+=n*(t-1);break;case 2:e.lines+=n*t;break;case 0:e.points+=n*t;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",i)}}}}function Yi(t,e){return t[0]-e[0]}function Zi(t,e){return Math.abs(e[1])-Math.abs(t[1])}function Qi(t){const e={},i=new Float32Array(8),n=[];for(let t=0;t<8;t++)n[t]=[t,0];return{update:function(r,s,o,a){const h=r.morphTargetInfluences,l=void 0===h?0:h.length;let c=e[s.id];if(void 0===c){c=[];for(let t=0;t<l;t++)c[t]=[t,0];e[s.id]=c}for(let t=0;t<l;t++){const e=c[t];e[0]=t,e[1]=h[t]}c.sort(Zi);for(let t=0;t<8;t++)t<l&&c[t][1]?(n[t][0]=c[t][0],n[t][1]=c[t][1]):(n[t][0]=Number.MAX_SAFE_INTEGER,n[t][1]=0);n.sort(Yi);const u=o.morphTargets&&s.morphAttributes.position,p=o.morphNormals&&s.morphAttributes.normal;let d=0;for(let t=0;t<8;t++){const e=n[t],r=e[0],o=e[1];r!==Number.MAX_SAFE_INTEGER&&o?(u&&s.getAttribute("morphTarget"+t)!==u[r]&&s.setAttribute("morphTarget"+t,u[r]),p&&s.getAttribute("morphNormal"+t)!==p[r]&&s.setAttribute("morphNormal"+t,p[r]),i[t]=o,d+=o):(u&&!0===s.hasAttribute("morphTarget"+t)&&s.deleteAttribute("morphTarget"+t),p&&!0===s.hasAttribute("morphNormal"+t)&&s.deleteAttribute("morphNormal"+t),i[t]=0)}const m=s.morphTargetsRelative?1:1-d;a.getUniforms().setValue(t,"morphTargetBaseInfluence",m),a.getUniforms().setValue(t,"morphTargetInfluences",i)}}}function Ki(t,e,i,n){let r=new WeakMap;function s(t){const e=t.target;e.removeEventListener("dispose",s),i.remove(e.instanceMatrix),null!==e.instanceColor&&i.remove(e.instanceColor)}return{update:function(t){const o=n.render.frame,a=t.geometry,h=e.get(t,a);return r.get(h)!==o&&(a.isGeometry&&h.updateFromObject(t),e.update(h),r.set(h,o)),t.isInstancedMesh&&(!1===t.hasEventListener("dispose",s)&&t.addEventListener("dispose",s),i.update(t.instanceMatrix,34962),null!==t.instanceColor&&i.update(t.instanceColor,34962)),h},dispose:function(){r=new WeakMap}}}function $i(t=null,e=1,i=1,n=1){l.call(this,null),this.image={data:t,width:e,height:i,depth:n},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}function tn(t=null,e=1,i=1,n=1){l.call(this,null),this.image={data:t,width:e,height:i,depth:n},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}Oi.physical={uniforms:Zt([Oi.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new s(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new et(0)},transmission:{value:0},transmissionMap:{value:null}}]),vertexShader:Pi.meshphysical_vert,fragmentShader:Pi.meshphysical_frag},Gi.prototype=Object.assign(Object.create(r.prototype),{constructor:Gi,isWebGLRenderTarget:!0,setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.texture.image.width=t,this.texture.image.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Ii.prototype=Object.assign(Object.create(Bt.prototype),{constructor:Ii,isCamera:!0,copy:function(t,e){return Bt.prototype.copy.call(this,t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this},getWorldDirection:function(t){void 0===t&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),t=new d),this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()},updateMatrixWorld:function(t){Bt.prototype.updateMatrixWorld.call(this,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()},updateWorldMatrix:function(t,e){Bt.prototype.updateWorldMatrix.call(this,t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()},clone:function(){return(new this.constructor).copy(this)}}),ki.prototype=Object.assign(Object.create(Ii.prototype),{constructor:ki,isPerspectiveCamera:!0,copy:function(t,e){return Ii.prototype.copy.call(this,t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this},setFocalLength:function(t){const e=.5*this.getFilmHeight()/t;this.fov=2*n.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){const t=Math.tan(.5*n.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*n.RAD2DEG*Math.atan(Math.tan(.5*n.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(t,e,i,n,r,s){this.aspect=t/e,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=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){const t=this.near;let e=t*Math.tan(.5*n.DEG2RAD*this.fov)/this.zoom,i=2*e,r=this.aspect*i,s=-.5*r;const o=this.view;if(null!==this.view&&this.view.enabled){const t=o.fullWidth,n=o.fullHeight;s+=o.offsetX*r/t,e-=o.offsetY*i/n,r*=o.width/t,i*=o.height/n}const a=this.filmOffset;0!==a&&(s+=t*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,e,e-i,t,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()},toJSON:function(t){const e=Bt.prototype.toJSON.call(this,t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}),Ui.prototype=Object.create(Bt.prototype),Ui.prototype.constructor=Ui,Vi.prototype=Object.create(l.prototype),Vi.prototype.constructor=Vi,Vi.prototype.isCubeTexture=!0,Object.defineProperty(Vi.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}}),Wi.prototype=Object.create(Gi.prototype),Wi.prototype.constructor=Wi,Wi.prototype.isWebGLCubeRenderTarget=!0,Wi.prototype.fromEquirectangularTexture=function(t,e){this.texture.type=e.type,this.texture.format=1023,this.texture.encoding=e.encoding,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const i=new Ht(5,5,5),n=new te({name:"CubemapFromEquirect",uniforms:Yt({tEquirect:{value:null}}),vertexShader:"\n\n\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t#include <begin_vertex>\n\t\t\t\t#include <project_vertex>\n\n\t\t\t}\n\t\t",fragmentShader:"\n\n\t\t\tuniform sampler2D tEquirect;\n\n\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t}\n\t\t",side:1,blending:0});n.uniforms.tEquirect.value=e;const r=new Ie(i,n),s=e.minFilter;return 1008===e.minFilter&&(e.minFilter=1006),new Ui(1,10,this).update(t,r),e.minFilter=s,r.geometry.dispose(),r.material.dispose(),this},Wi.prototype.clear=function(t,e,i,n){const r=t.getRenderTarget();for(let r=0;r<6;r++)t.setRenderTarget(this,r),t.clear(e,i,n);t.setRenderTarget(r)},$i.prototype=Object.create(l.prototype),$i.prototype.constructor=$i,$i.prototype.isDataTexture2DArray=!0,tn.prototype=Object.create(l.prototype),tn.prototype.constructor=tn,tn.prototype.isDataTexture3D=!0;const en=new l,nn=new $i,rn=new tn,sn=new Vi,on=[],an=[],hn=new Float32Array(16),ln=new Float32Array(9),cn=new Float32Array(4);function un(t,e,i){const n=t[0];if(n<=0||n>0)return t;const r=e*i;let s=on[r];if(void 0===s&&(s=new Float32Array(r),on[r]=s),0!==e){n.toArray(s,0);for(let n=1,r=0;n!==e;++n)r+=i,t[n].toArray(s,r)}return s}function pn(t,e){if(t.length!==e.length)return!1;for(let i=0,n=t.length;i<n;i++)if(t[i]!==e[i])return!1;return!0}function dn(t,e){for(let i=0,n=e.length;i<n;i++)t[i]=e[i]}function mn(t,e){let i=an[e];void 0===i&&(i=new Int32Array(e),an[e]=i);for(let n=0;n!==e;++n)i[n]=t.allocateTextureUnit();return i}function fn(t,e){const i=this.cache;i[0]!==e&&(t.uniform1f(this.addr,e),i[0]=e)}function gn(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),i[0]=e.x,i[1]=e.y);else{if(pn(i,e))return;t.uniform2fv(this.addr,e),dn(i,e)}}function yn(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),i[0]=e.x,i[1]=e.y,i[2]=e.z);else if(void 0!==e.r)i[0]===e.r&&i[1]===e.g&&i[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),i[0]=e.r,i[1]=e.g,i[2]=e.b);else{if(pn(i,e))return;t.uniform3fv(this.addr,e),dn(i,e)}}function xn(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z&&i[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),i[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=e.w);else{if(pn(i,e))return;t.uniform4fv(this.addr,e),dn(i,e)}}function vn(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(pn(i,e))return;t.uniformMatrix2fv(this.addr,!1,e),dn(i,e)}else{if(pn(i,n))return;cn.set(n),t.uniformMatrix2fv(this.addr,!1,cn),dn(i,n)}}function bn(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(pn(i,e))return;t.uniformMatrix3fv(this.addr,!1,e),dn(i,e)}else{if(pn(i,n))return;ln.set(n),t.uniformMatrix3fv(this.addr,!1,ln),dn(i,n)}}function Mn(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(pn(i,e))return;t.uniformMatrix4fv(this.addr,!1,e),dn(i,e)}else{if(pn(i,n))return;hn.set(n),t.uniformMatrix4fv(this.addr,!1,hn),dn(i,n)}}function wn(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.safeSetTexture2D(e||en,r)}function _n(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTexture2DArray(e||nn,r)}function Sn(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTexture3D(e||rn,r)}function Tn(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.safeSetTextureCube(e||sn,r)}function En(t,e){const i=this.cache;i[0]!==e&&(t.uniform1i(this.addr,e),i[0]=e)}function An(t,e){const i=this.cache;pn(i,e)||(t.uniform2iv(this.addr,e),dn(i,e))}function Ln(t,e){const i=this.cache;pn(i,e)||(t.uniform3iv(this.addr,e),dn(i,e))}function Rn(t,e){const i=this.cache;pn(i,e)||(t.uniform4iv(this.addr,e),dn(i,e))}function Pn(t,e){const i=this.cache;i[0]!==e&&(t.uniform1ui(this.addr,e),i[0]=e)}function Cn(t,e){t.uniform1fv(this.addr,e)}function On(t,e){t.uniform1iv(this.addr,e)}function zn(t,e){t.uniform2iv(this.addr,e)}function Nn(t,e){t.uniform3iv(this.addr,e)}function Bn(t,e){t.uniform4iv(this.addr,e)}function Fn(t,e){const i=un(e,this.size,2);t.uniform2fv(this.addr,i)}function Dn(t,e){const i=un(e,this.size,3);t.uniform3fv(this.addr,i)}function Gn(t,e){const i=un(e,this.size,4);t.uniform4fv(this.addr,i)}function In(t,e){const i=un(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,i)}function kn(t,e){const i=un(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,i)}function Un(t,e){const i=un(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,i)}function Vn(t,e,i){const n=e.length,r=mn(i,n);t.uniform1iv(this.addr,r);for(let t=0;t!==n;++t)i.safeSetTexture2D(e[t]||en,r[t])}function Wn(t,e,i){const n=e.length,r=mn(i,n);t.uniform1iv(this.addr,r);for(let t=0;t!==n;++t)i.safeSetTextureCube(e[t]||sn,r[t])}function jn(t,e,i){this.id=t,this.addr=i,this.cache=[],this.setValue=function(t){switch(t){case 5126:return fn;case 35664:return gn;case 35665:return yn;case 35666:return xn;case 35674:return vn;case 35675:return bn;case 35676:return Mn;case 5124:case 35670:return En;case 35667:case 35671:return An;case 35668:case 35672:return Ln;case 35669:case 35673:return Rn;case 5125:return Pn;case 35678:case 36198:case 36298:case 36306:case 35682:return wn;case 35679:case 36299:case 36307:return Sn;case 35680:case 36300:case 36308:case 36293:return Tn;case 36289:case 36303:case 36311:case 36292:return _n}}(e.type)}function Hn(t,e,i){this.id=t,this.addr=i,this.cache=[],this.size=e.size,this.setValue=function(t){switch(t){case 5126:return Cn;case 35664:return Fn;case 35665:return Dn;case 35666:return Gn;case 35674:return In;case 35675:return kn;case 35676:return Un;case 5124:case 35670:return On;case 35667:case 35671:return zn;case 35668:case 35672:return Nn;case 35669:case 35673:return Bn;case 35678:case 36198:case 36298:case 36306:case 35682:return Vn;case 35680:case 36300:case 36308:case 36293:return Wn}}(e.type)}function qn(t){this.id=t,this.seq=[],this.map={}}Hn.prototype.updateCache=function(t){const e=this.cache;t instanceof Float32Array&&e.length!==t.length&&(this.cache=new Float32Array(t.length)),dn(e,t)},qn.prototype.setValue=function(t,e,i){const n=this.seq;for(let r=0,s=n.length;r!==s;++r){const s=n[r];s.setValue(t,e[s.id],i)}};const Xn=/(\w+)(\])?(\[|\.)?/g;function Jn(t,e){t.seq.push(e),t.map[e.id]=e}function Yn(t,e,i){const n=t.name,r=n.length;for(Xn.lastIndex=0;;){const s=Xn.exec(n),o=Xn.lastIndex;let a=s[1];const h="]"===s[2],l=s[3];if(h&&(a|=0),void 0===l||"["===l&&o+2===r){Jn(i,void 0===l?new jn(a,t,e):new Hn(a,t,e));break}{let t=i.map[a];void 0===t&&(t=new qn(a),Jn(i,t)),i=t}}}function Zn(t,e){this.seq=[],this.map={};const i=t.getProgramParameter(e,35718);for(let n=0;n<i;++n){const i=t.getActiveUniform(e,n);Yn(i,t.getUniformLocation(e,i.name),this)}}function Qn(t,e,i){const n=t.createShader(e);return t.shaderSource(n,i),t.compileShader(n),n}Zn.prototype.setValue=function(t,e,i,n){const r=this.map[e];void 0!==r&&r.setValue(t,i,n)},Zn.prototype.setOptional=function(t,e,i){const n=e[i];void 0!==n&&this.setValue(t,i,n)},Zn.upload=function(t,e,i,n){for(let r=0,s=e.length;r!==s;++r){const s=e[r],o=i[s.id];!1!==o.needsUpdate&&s.setValue(t,o.value,n)}},Zn.seqWithValue=function(t,e){const i=[];for(let n=0,r=t.length;n!==r;++n){const r=t[n];r.id in e&&i.push(r)}return i};let Kn=0;function $n(t){switch(t){case 3e3:return["Linear","( value )"];case 3001:return["sRGB","( value )"];case 3002:return["RGBE","( value )"];case 3004:return["RGBM","( value, 7.0 )"];case 3005:return["RGBM","( value, 16.0 )"];case 3006:return["RGBD","( value, 256.0 )"];case 3007:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case 3003:return["LogLuv","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",t),["Linear","( value )"]}}function tr(t,e,i){const n=t.getShaderParameter(e,35713),r=t.getShaderInfoLog(e).trim();return n&&""===r?"":"THREE.WebGLShader: gl.getShaderInfoLog() "+i+"\n"+r+function(t){const e=t.split("\n");for(let t=0;t<e.length;t++)e[t]=t+1+": "+e[t];return e.join("\n")}(t.getShaderSource(e))}function er(t,e){const i=$n(e);return"vec4 "+t+"( vec4 value ) { return "+i[0]+"ToLinear"+i[1]+"; }"}function ir(t,e){const i=$n(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+i[0]+i[1]+"; }"}function nr(t,e){let i;switch(e){case 1:i="Linear";break;case 2:i="Reinhard";break;case 3:i="OptimizedCineon";break;case 4:i="ACESFilmic";break;case 5:i="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),i="Linear"}return"vec3 "+t+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}function rr(t){return""!==t}function sr(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function or(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const ar=/^[ \t]*#include +<([\w\d./]+)>/gm;function hr(t){return t.replace(ar,lr)}function lr(t,e){const i=Pi[e];if(void 0===i)throw new Error("Can not resolve #include <"+e+">");return hr(i)}const cr=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,ur=/#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 pr(t){return t.replace(ur,mr).replace(cr,dr)}function dr(t,e,i,n){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),mr(0,e,i,n)}function mr(t,e,i,n){let r="";for(let t=parseInt(e);t<parseInt(i);t++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+t+" ]").replace(/UNROLLED_LOOP_INDEX/g,t);return r}function fr(t){let e="precision "+t.precision+" float;\nprecision "+t.precision+" int;";return"highp"===t.precision?e+="\n#define HIGH_PRECISION":"mediump"===t.precision?e+="\n#define MEDIUM_PRECISION":"lowp"===t.precision&&(e+="\n#define LOW_PRECISION"),e}function gr(t,e,i,n){const r=t.getContext(),s=i.defines;let o=i.vertexShader,a=i.fragmentShader;const h=function(t){let e="SHADOWMAP_TYPE_BASIC";return 1===t.shadowMapType?e="SHADOWMAP_TYPE_PCF":2===t.shadowMapType?e="SHADOWMAP_TYPE_PCF_SOFT":3===t.shadowMapType&&(e="SHADOWMAP_TYPE_VSM"),e}(i),l=function(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case 301:case 302:e="ENVMAP_TYPE_CUBE";break;case 306:case 307:e="ENVMAP_TYPE_CUBE_UV"}return e}(i),c=function(t){let e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case 302:case 307:e="ENVMAP_MODE_REFRACTION"}return e}(i),u=function(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case 0:e="ENVMAP_BLENDING_MULTIPLY";break;case 1:e="ENVMAP_BLENDING_MIX";break;case 2:e="ENVMAP_BLENDING_ADD"}return e}(i),p=t.gammaFactor>0?t.gammaFactor:1,d=i.isWebGL2?"":function(t){return[t.extensionDerivatives||t.envMapCubeUV||t.bumpMap||t.tangentSpaceNormalMap||t.clearcoatNormalMap||t.flatShading||"physical"===t.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(rr).join("\n")}(i),m=function(t){const e=[];for(const i in t){const n=t[i];!1!==n&&e.push("#define "+i+" "+n)}return e.join("\n")}(s),f=r.createProgram();let g,y,x=i.glslVersion?"#version "+i.glslVersion+"\n":"";i.isRawShaderMaterial?(g=[m].filter(rr).join("\n"),g.length>0&&(g+="\n"),y=[d,m].filter(rr).join("\n"),y.length>0&&(y+="\n")):(g=[fr(i),"#define SHADER_NAME "+i.shaderName,m,i.instancing?"#define USE_INSTANCING":"",i.instancingColor?"#define USE_INSTANCING_COLOR":"",i.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+p,"#define MAX_BONES "+i.maxBones,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+c:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMap&&i.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",i.normalMap&&i.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.displacementMap&&i.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.vertexTangents?"#define USE_TANGENT":"",i.vertexColors?"#define USE_COLOR":"",i.vertexUvs?"#define USE_UV":"",i.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.useVertexTexture?"#define BONE_TEXTURE":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&!1===i.flatShading?"#define USE_MORPHNORMALS":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+h:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.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_TANGENT","\tattribute vec4 tangent;","#endif","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\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(rr).join("\n"),y=[d,fr(i),"#define SHADER_NAME "+i.shaderName,m,i.alphaTest?"#define ALPHATEST "+i.alphaTest+(i.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+p,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.matcap?"#define USE_MATCAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+l:"",i.envMap?"#define "+c:"",i.envMap?"#define "+u:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMap&&i.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",i.normalMap&&i.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.sheen?"#define USE_SHEEN":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.vertexTangents?"#define USE_TANGENT":"",i.vertexColors||i.instancingColor?"#define USE_COLOR":"",i.vertexUvs?"#define USE_UV":"",i.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+h:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",i.envMap&&i.extensionShaderTextureLOD||i.envMap&&i.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==i.toneMapping?"#define TONE_MAPPING":"",0!==i.toneMapping?Pi.tonemapping_pars_fragment:"",0!==i.toneMapping?nr("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",Pi.encodings_pars_fragment,i.map?er("mapTexelToLinear",i.mapEncoding):"",i.matcap?er("matcapTexelToLinear",i.matcapEncoding):"",i.envMap?er("envMapTexelToLinear",i.envMapEncoding):"",i.emissiveMap?er("emissiveMapTexelToLinear",i.emissiveMapEncoding):"",i.lightMap?er("lightMapTexelToLinear",i.lightMapEncoding):"",ir("linearToOutputTexel",i.outputEncoding),i.depthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(rr).join("\n")),o=hr(o),o=sr(o,i),o=or(o,i),a=hr(a),a=sr(a,i),a=or(a,i),o=pr(o),a=pr(a),i.isWebGL2&&!0!==i.isRawShaderMaterial&&(x="#version 300 es\n",g=["#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,y=["#define varying in","300 es"===i.glslVersion?"":"out highp vec4 pc_fragColor;","300 es"===i.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"+y);const v=x+y+a,b=Qn(r,35633,x+g+o),M=Qn(r,35632,v);if(r.attachShader(f,b),r.attachShader(f,M),void 0!==i.index0AttributeName?r.bindAttribLocation(f,0,i.index0AttributeName):!0===i.morphTargets&&r.bindAttribLocation(f,0,"position"),r.linkProgram(f),t.debug.checkShaderErrors){const t=r.getProgramInfoLog(f).trim(),e=r.getShaderInfoLog(b).trim(),i=r.getShaderInfoLog(M).trim();let n=!0,s=!0;if(!1===r.getProgramParameter(f,35714)){n=!1;const e=tr(r,b,"vertex"),i=tr(r,M,"fragment");console.error("THREE.WebGLProgram: shader error: ",r.getError(),"35715",r.getProgramParameter(f,35715),"gl.getProgramInfoLog",t,e,i)}else""!==t?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",t):""!==e&&""!==i||(s=!1);s&&(this.diagnostics={runnable:n,programLog:t,vertexShader:{log:e,prefix:g},fragmentShader:{log:i,prefix:y}})}let w,_;return r.deleteShader(b),r.deleteShader(M),this.getUniforms=function(){return void 0===w&&(w=new Zn(r,f)),w},this.getAttributes=function(){return void 0===_&&(_=function(t,e){const i={},n=t.getProgramParameter(e,35721);for(let r=0;r<n;r++){const n=t.getActiveAttrib(e,r).name;i[n]=t.getAttribLocation(e,n)}return i}(r,f)),_},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(f),this.program=void 0},this.name=i.shaderName,this.id=Kn++,this.cacheKey=e,this.usedTimes=1,this.program=f,this.vertexShader=b,this.fragmentShader=M,this}function yr(t,e,i,n,r,s){const o=[],a=n.isWebGL2,h=n.logarithmicDepthBuffer,l=n.floatVertexTextures,c=n.maxVertexUniforms,u=n.vertexTextures;let p=n.precision;const d={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"},m=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","instancingColor","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","sheen","transmissionMap"];function f(t){let e;return t&&t.isTexture?e=t.encoding:t&&t.isWebGLRenderTarget?(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),e=t.texture.encoding):e=3e3,e}return{getParameters:function(r,o,m,g,y){const x=g.fog,v=r.isMeshStandardMaterial?g.environment:null,b=e.get(r.envMap||v),M=d[r.type],w=y.isSkinnedMesh?function(t){const e=t.skeleton.bones;if(l)return 1024;{const t=c,i=Math.floor((t-20)/4),n=Math.min(i,e.length);return n<e.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+e.length+" bones. This GPU supports "+n+"."),0):n}}(y):0;let _,S;if(null!==r.precision&&(p=n.getMaxPrecision(r.precision),p!==r.precision&&console.warn("THREE.WebGLProgram.getParameters:",r.precision,"not supported, using",p,"instead.")),M){const t=Oi[M];_=t.vertexShader,S=t.fragmentShader}else _=r.vertexShader,S=r.fragmentShader;const T=t.getRenderTarget();return{isWebGL2:a,shaderID:M,shaderName:r.type,vertexShader:_,fragmentShader:S,defines:r.defines,isRawShaderMaterial:!0===r.isRawShaderMaterial,glslVersion:r.glslVersion,precision:p,instancing:!0===y.isInstancedMesh,instancingColor:!0===y.isInstancedMesh&&null!==y.instanceColor,supportsVertexTextures:u,outputEncoding:null!==T?f(T.texture):t.outputEncoding,map:!!r.map,mapEncoding:f(r.map),matcap:!!r.matcap,matcapEncoding:f(r.matcap),envMap:!!b,envMapMode:b&&b.mapping,envMapEncoding:f(b),envMapCubeUV:!!b&&(306===b.mapping||307===b.mapping),lightMap:!!r.lightMap,lightMapEncoding:f(r.lightMap),aoMap:!!r.aoMap,emissiveMap:!!r.emissiveMap,emissiveMapEncoding:f(r.emissiveMap),bumpMap:!!r.bumpMap,normalMap:!!r.normalMap,objectSpaceNormalMap:1===r.normalMapType,tangentSpaceNormalMap:0===r.normalMapType,clearcoatMap:!!r.clearcoatMap,clearcoatRoughnessMap:!!r.clearcoatRoughnessMap,clearcoatNormalMap:!!r.clearcoatNormalMap,displacementMap:!!r.displacementMap,roughnessMap:!!r.roughnessMap,metalnessMap:!!r.metalnessMap,specularMap:!!r.specularMap,alphaMap:!!r.alphaMap,gradientMap:!!r.gradientMap,sheen:!!r.sheen,transmissionMap:!!r.transmissionMap,combine:r.combine,vertexTangents:r.normalMap&&r.vertexTangents,vertexColors:r.vertexColors,vertexUvs:!!(r.map||r.bumpMap||r.normalMap||r.specularMap||r.alphaMap||r.emissiveMap||r.roughnessMap||r.metalnessMap||r.clearcoatMap||r.clearcoatRoughnessMap||r.clearcoatNormalMap||r.displacementMap||r.transmissionMap),uvsVertexOnly:!(r.map||r.bumpMap||r.normalMap||r.specularMap||r.alphaMap||r.emissiveMap||r.roughnessMap||r.metalnessMap||r.clearcoatNormalMap||r.transmissionMap||!r.displacementMap),fog:!!x,useFog:r.fog,fogExp2:x&&x.isFogExp2,flatShading:r.flatShading,sizeAttenuation:r.sizeAttenuation,logarithmicDepthBuffer:h,skinning:r.skinning&&w>0,maxBones:w,useVertexTexture:l,morphTargets:r.morphTargets,morphNormals:r.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:r.dithering,shadowMapEnabled:t.shadowMap.enabled&&m.length>0,shadowMapType:t.shadowMap.type,toneMapping:r.toneMapped?t.toneMapping:0,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:r.premultipliedAlpha,alphaTest:r.alphaTest,doubleSided:2===r.side,flipSided:1===r.side,depthPacking:void 0!==r.depthPacking&&r.depthPacking,index0AttributeName:r.index0AttributeName,extensionDerivatives:r.extensions&&r.extensions.derivatives,extensionFragDepth:r.extensions&&r.extensions.fragDepth,extensionDrawBuffers:r.extensions&&r.extensions.drawBuffers,extensionShaderTextureLOD:r.extensions&&r.extensions.shaderTextureLOD,rendererExtensionFragDepth:a||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:a||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:a||i.has("EXT_shader_texture_lod"),customProgramCacheKey:r.customProgramCacheKey()}},getProgramCacheKey:function(e){const i=[];if(e.shaderID?i.push(e.shaderID):(i.push(e.fragmentShader),i.push(e.vertexShader)),void 0!==e.defines)for(const t in e.defines)i.push(t),i.push(e.defines[t]);if(!1===e.isRawShaderMaterial){for(let t=0;t<m.length;t++)i.push(e[m[t]]);i.push(t.outputEncoding),i.push(t.gammaFactor)}return i.push(e.customProgramCacheKey),i.join()},getUniforms:function(t){const e=d[t.type];let i;if(e){const t=Oi[e];i=Qt.clone(t.uniforms)}else i=t.uniforms;return i},acquireProgram:function(e,i){let n;for(let t=0,e=o.length;t<e;t++){const e=o[t];if(e.cacheKey===i){n=e,++n.usedTimes;break}}return void 0===n&&(n=new gr(t,i,e,r),o.push(n)),n},releaseProgram:function(t){if(0==--t.usedTimes){const e=o.indexOf(t);o[e]=o[o.length-1],o.pop(),t.destroy()}},programs:o}}function xr(){let t=new WeakMap;return{get:function(e){let i=t.get(e);return void 0===i&&(i={},t.set(e,i)),i},remove:function(e){t.delete(e)},update:function(e,i,n){t.get(e)[i]=n},dispose:function(){t=new WeakMap}}}function vr(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.program!==e.program?t.program.id-e.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function br(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function Mr(t){const e=[];let i=0;const n=[],r=[],s={id:-1};function o(n,r,o,a,h,l){let c=e[i];const u=t.get(o);return void 0===c?(c={id:n.id,object:n,geometry:r,material:o,program:u.program||s,groupOrder:a,renderOrder:n.renderOrder,z:h,group:l},e[i]=c):(c.id=n.id,c.object=n,c.geometry=r,c.material=o,c.program=u.program||s,c.groupOrder=a,c.renderOrder=n.renderOrder,c.z=h,c.group=l),i++,c}return{opaque:n,transparent:r,init:function(){i=0,n.length=0,r.length=0},push:function(t,e,i,s,a,h){const l=o(t,e,i,s,a,h);(!0===i.transparent?r:n).push(l)},unshift:function(t,e,i,s,a,h){const l=o(t,e,i,s,a,h);(!0===i.transparent?r:n).unshift(l)},finish:function(){for(let t=i,n=e.length;t<n;t++){const i=e[t];if(null===i.id)break;i.id=null,i.object=null,i.geometry=null,i.material=null,i.program=null,i.group=null}},sort:function(t,e){n.length>1&&n.sort(t||vr),r.length>1&&r.sort(e||br)}}}function wr(t){let e=new WeakMap;return{get:function(i,n){const r=e.get(i);let s;return void 0===r?(s=new Mr(t),e.set(i,new WeakMap),e.get(i).set(n,s)):(s=r.get(n),void 0===s&&(s=new Mr(t),r.set(n,s))),s},dispose:function(){e=new WeakMap}}}function _r(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let i;switch(e.type){case"DirectionalLight":i={direction:new d,color:new et};break;case"SpotLight":i={position:new d,direction:new d,color:new et,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new d,color:new et,distance:0,decay:0};break;case"HemisphereLight":i={direction:new d,skyColor:new et,groundColor:new et};break;case"RectAreaLight":i={color:new et,position:new d,halfWidth:new d,halfHeight:new d}}return t[e.id]=i,i}}}let Sr=0;function Tr(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function Er(t,e){const i=new _r,n=function(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let i;switch(e.type){case"DirectionalLight":case"SpotLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new s};break;case"PointLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new s,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=i,i}}}(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],spotPosition:[],rectArea:[],rectAreaTexture:[],rectShadowMap:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let t=0;t<9;t++)r.probe.push(new d);const o=new d,a=new k,h=new k;return{setup:function(s){let o=0,a=0,l=0;for(let t=0;t<9;t++)r.probe[t].set(0,0,0);let c=0,u=0,p=0,d=0,m=0,f=0,g=0,y=0;s.sort(Tr);for(let t=0,e=s.length;t<e;t++){const e=s[t],x=e.color,v=e.intensity,b=e.distance,M=e.shadow&&e.shadow.map?e.shadow.map.texture:null;if(e.isAmbientLight)o+=x.r*v,a+=x.g*v,l+=x.b*v;else if(e.isLightProbe)for(let t=0;t<9;t++)r.probe[t].addScaledVector(e.sh.coefficients[t],v);else if(e.isDirectionalLight){const t=i.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity),e.castShadow){const t=e.shadow,i=n.get(e);i.shadowBias=t.bias,i.shadowNormalBias=t.normalBias,i.shadowRadius=t.radius,i.shadowMapSize=t.mapSize,r.directionalShadow[c]=i,r.directionalShadowMap[c]=M,r.directionalShadowMatrix[c]=e.shadow.matrix,f++}r.directional[c]=t,c++}else if(e.isSpotLight){const t=i.get(e);if(t.position.setFromMatrixPosition(e.matrixWorld),t.color.copy(x).multiplyScalar(v),t.distance=b,t.coneCos=Math.cos(e.angle),t.penumbraCos=Math.cos(e.angle*(1-e.penumbra)),t.decay=e.decay,e.castShadow){const t=e.shadow,i=n.get(e);i.shadowBias=t.bias,i.shadowNormalBias=t.normalBias,i.shadowRadius=t.radius,i.shadowMapSize=t.mapSize,r.spotShadow[p]=i,r.spotShadowMap[p]=M,r.spotShadowMatrix[p]=e.shadow.matrix,y++}r.spotPosition[p]=t.position,r.spot[p]=t,p++}else if(e.isRectAreaLight){const t=i.get(e);t.color.copy(x).multiplyScalar(v),t.halfWidth.set(.5*e.width,0,0),t.halfHeight.set(0,.5*e.height,0),t.halfWidth.applyMatrix4(h),t.halfHeight.applyMatrix4(h),t.shadow=e.castShadow,e.castShadow&&(r.rectShadowMap[d]=M),t.useAreaTexture=!1,e.areaTexture&&(t.useAreaTexture=!0),r.rectArea[d]=t,r.rectAreaTexture[d]=e.areaTexture,d++}else if(e.isPointLight){const t=i.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity),t.distance=e.distance,t.decay=e.decay,e.castShadow){const t=e.shadow,i=n.get(e);i.shadowBias=t.bias,i.shadowNormalBias=t.normalBias,i.shadowRadius=t.radius,i.shadowMapSize=t.mapSize,i.shadowCameraNear=t.camera.near,i.shadowCameraFar=t.camera.far,r.pointShadow[u]=i,r.pointShadowMap[u]=M,r.pointShadowMatrix[u]=e.shadow.matrix,g++}r.point[u]=t,u++}else if(e.isHemisphereLight){const t=i.get(e);t.skyColor.copy(e.color).multiplyScalar(v),t.groundColor.copy(e.groundColor).multiplyScalar(v),r.hemi[m]=t,m++}}d>0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(r.rectAreaLTC1=Ci.LTC_FLOAT_1,r.rectAreaLTC2=Ci.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=Ci.LTC_HALF_1,r.rectAreaLTC2=Ci.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=o,r.ambient[1]=a,r.ambient[2]=l;const x=r.hash;x.directionalLength===c&&x.pointLength===u&&x.spotLength===p&&x.rectAreaLength===d&&x.hemiLength===m&&x.numDirectionalShadows===f&&x.numPointShadows===g&&x.numSpotShadows===y||(r.directional.length=c,r.spot.length=p,r.rectArea.length=d,r.point.length=u,r.hemi.length=m,r.directionalShadow.length=f,r.directionalShadowMap.length=f,r.pointShadow.length=g,r.pointShadowMap.length=g,r.spotShadow.length=y,r.spotShadowMap.length=y,r.directionalShadowMatrix.length=f,r.pointShadowMatrix.length=g,r.spotShadowMatrix.length=y,x.directionalLength=c,x.pointLength=u,x.spotLength=p,x.rectAreaLength=d,x.hemiLength=m,x.numDirectionalShadows=f,x.numPointShadows=g,x.numSpotShadows=y,r.version=Sr++)},setupView:function(t,e){let i=0,n=0,s=0,l=0,c=0;const u=e.matrixWorldInverse;for(let e=0,p=t.length;e<p;e++){const p=t[e];if(p.isDirectionalLight){const t=r.directional[i];t.direction.setFromMatrixPosition(p.matrixWorld),o.setFromMatrixPosition(p.target.matrixWorld),t.direction.sub(o),t.direction.transformDirection(u),i++}else if(p.isSpotLight){const t=r.spot[s];t.position.setFromMatrixPosition(p.matrixWorld),t.position.applyMatrix4(u),t.direction.setFromMatrixPosition(p.matrixWorld),o.setFromMatrixPosition(p.target.matrixWorld),t.direction.sub(o),t.direction.transformDirection(u),s++}else if(p.isRectAreaLight){const t=r.rectArea[l];t.position.setFromMatrixPosition(p.matrixWorld),t.position.applyMatrix4(u),h.identity(),a.copy(p.matrixWorld),a.premultiply(u),h.extractRotation(a),t.halfWidth.set(.5*p.width,0,0),t.halfHeight.set(0,.5*p.height,0),t.halfWidth.applyMatrix4(h),t.halfHeight.applyMatrix4(h),l++}else if(p.isPointLight){const t=r.point[n];t.position.setFromMatrixPosition(p.matrixWorld),t.position.applyMatrix4(u),n++}else if(p.isHemisphereLight){const t=r.hemi[c];t.direction.setFromMatrixPosition(p.matrixWorld),t.direction.transformDirection(u),t.direction.normalize(),c++}}},state:r}}function Ar(t,e){const i=new Er(t,e),n=[],r=[];return{init:function(){n.length=0,r.length=0},state:{lightsArray:n,shadowsArray:r,lights:i},setupLights:function(){i.setup(n)},setupLightsView:function(t){i.setupView(n,t)},pushLight:function(t){n.push(t)},pushShadow:function(t){r.push(t)}}}function Lr(t,e){let i=new WeakMap;return{get:function(n,r=0){let s;return!1===i.has(n)?(s=new Ar(t,e),i.set(n,[]),i.get(n).push(s)):r>=i.get(n).length?(s=new Ar(t,e),i.get(n).push(s)):s=i.get(n)[r],s},dispose:function(){i=new WeakMap}}}function Rr(t){Jt.call(this),this.type="MeshDepthMaterial",this.depthPacking=3200,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(t)}function Pr(t){Jt.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new d,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(t)}Rr.prototype=Object.create(Jt.prototype),Rr.prototype.constructor=Rr,Rr.prototype.isMeshDepthMaterial=!0,Rr.prototype.copy=function(t){return Jt.prototype.copy.call(this,t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},Pr.prototype=Object.create(Jt.prototype),Pr.prototype.constructor=Pr,Pr.prototype.isMeshDistanceMaterial=!0,Pr.prototype.copy=function(t){return Jt.prototype.copy.call(this,t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this};var Cr=_rsl.vsm_frag,Or=_rsl.vsm_vert;function zr(t,e,i){let n=new I;const r=new s,o=new s,a=new J,h=[],l=[],c={},u={0:1,1:0,2:2},p=new te({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new s},radius:{value:4}},vertexShader:Or,fragmentShader:Cr}),d=p.clone();d.defines.HORIZONTAL_PASS=1;const m=new jt;m.setAttribute("position",new ot(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const f=new Ie(m,p),g=this;function y(i,n){const r=e.update(f);p.uniforms.shadow_pass.value=i.map.texture,p.uniforms.resolution.value=i.mapSize,p.uniforms.radius.value=i.radius,t.setRenderTarget(i.mapPass),t.clear(),t.renderBufferDirect(n,null,r,p,f,null),d.uniforms.shadow_pass.value=i.mapPass.texture,d.uniforms.resolution.value=i.mapSize,d.uniforms.radius.value=i.radius,t.setRenderTarget(i.map),t.clear(),t.renderBufferDirect(n,null,r,d,f,null)}function x(t,e,i){const n=t<<0|e<<1|i<<2;let r=h[n];return void 0===r&&(r=new Rr({depthPacking:3201,morphTargets:t,skinning:e}),h[n]=r),r}function v(t,e,i){const n=t<<0|e<<1|i<<2;let r=l[n];return void 0===r&&(r=new Pr({morphTargets:t,skinning:e}),l[n]=r),r}function b(e,i,n,r,s,o,a){let h=null,l=x,p=e.customDepthMaterial;if(!0===r.isPointLight&&(l=v,p=e.customDistanceMaterial),void 0===p){let t=!1;!0===n.morphTargets&&(t=i.morphAttributes&&i.morphAttributes.position&&i.morphAttributes.position.length>0);let r=!1;!0===e.isSkinnedMesh&&(!0===n.skinning?r=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e)),h=l(t,r,!0===e.isInstancedMesh)}else h=p;if(t.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length){const t=h.uuid,e=n.uuid;let i=c[t];void 0===i&&(i={},c[t]=i);let r=i[e];void 0===r&&(r=h.clone(),i[e]=r),h=r}return h.visible=n.visible,h.wireframe=n.wireframe,h.side=3===a?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:u[n.side],h.clipShadows=n.clipShadows,h.clippingPlanes=n.clippingPlanes,h.clipIntersection=n.clipIntersection,h.wireframeLinewidth=n.wireframeLinewidth,h.linewidth=n.linewidth,!0===r.isPointLight&&!0===h.isMeshDistanceMaterial&&(h.referencePosition.setFromMatrixPosition(r.matrixWorld),h.nearDistance=s,h.farDistance=o),h}function M(i,r,s,o,a){if(!1===i.visible)return;if(i.layers.test(r.layers)&&(i.isMesh||i.isLine||i.isPoints)&&(i.castShadow||i.receiveShadow&&3===a)&&(!i.frustumCulled||n.intersectsObject(i))){i.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,i.matrixWorld);const n=e.update(i),r=i.material;if(Array.isArray(r)){const e=n.groups;for(let h=0,l=e.length;h<l;h++){const l=e[h],c=r[l.materialIndex];if(c&&c.visible){const e=b(i,n,c,o,s.near,s.far,a);t.renderBufferDirect(s,null,n,e,i,l)}}}else if(r.visible){const e=b(i,n,r,o,s.near,s.far,a);t.renderBufferDirect(s,null,n,e,i,null)}}const h=i.children;for(let t=0,e=h.length;t<e;t++)M(h[t],r,s,o,a)}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.render=function(e,s,h){if(!1===g.enabled)return;if(!1===g.autoUpdate&&!1===g.needsUpdate)return;if(0===e.length)return;const l=t.getRenderTarget(),c=t.getActiveCubeFace(),u=t.getActiveMipmapLevel(),p=t.state;p.setBlending(0),p.buffers.color.setClear(1,1,1,1),p.buffers.depth.setTest(!0),p.setScissorTest(!1);for(let l=0,c=e.length;l<c;l++){var d=e[l];if(d.isRectAreaLight)continue;var m=d.shadow;if(void 0===m){console.warn("THREE.WebGLShadowMap:",d,"has no shadow.");continue}if(!1===m.autoUpdate&&!1===m.needsUpdate)continue;r.copy(m.mapSize);const c=m.getFrameExtents();if(r.multiply(c),o.copy(m.mapSize),(r.x>i||r.y>i)&&(r.x>i&&(o.x=Math.floor(i/c.x),r.x=o.x*c.x,m.mapSize.x=o.x),r.y>i&&(o.y=Math.floor(i/c.y),r.y=o.y*c.y,m.mapSize.y=o.y)),null===m.map&&!m.isPointLightShadow&&3===this.type){const t={minFilter:1006,magFilter:1006,format:1023};m.map=new Gi(r.x,r.y,t),m.map.texture.name=d.name+".shadowMap",m.mapPass=new Gi(r.x,r.y,t),m.camera.updateProjectionMatrix()}if(null===m.map){const t={minFilter:1003,magFilter:1003,format:1023};m.map=new Gi(r.x,r.y,t),m.map.texture.name=d.name+".shadowMap",m.camera.updateProjectionMatrix()}t.setRenderTarget(m.map),t.clear();const u=m.getViewportCount();for(let t=0;t<u;t++){const e=m.getViewport(t);a.set(o.x*e.x,o.y*e.y,o.x*e.z,o.y*e.w),p.viewport(a),m.updateMatrices(d,t),n=m.getFrustum(),M(s,h,m.camera,d,this.type)}m.isPointLightShadow||3!==this.type||y(m,h),m.needsUpdate=!1}g.needsUpdate=!1,t.setRenderTarget(l,c,u)}}function Nr(t,e,i){const n=i.isWebGL2,r=new function(){let e=!1;const i=new J;let n=null;const r=new J(0,0,0,0);return{setMask:function(i){n===i||e||(t.colorMask(i,i,i,i),n=i)},setLocked:function(t){e=t},setClear:function(e,n,s,o,a){!0===a&&(e*=o,n*=o,s*=o),i.set(e,n,s,o),!1===r.equals(i)&&(t.clearColor(e,n,s,o),r.copy(i))},reset:function(){e=!1,n=null,r.set(-1,0,0,0)}}},s=new function(){let e=!1,i=null,n=null,r=null;return{setTest:function(t){t?z(2929):N(2929)},setMask:function(n){i===n||e||(t.depthMask(n),i=n)},setFunc:function(e){if(n!==e){if(e)switch(e){case 0:t.depthFunc(512);break;case 1:t.depthFunc(519);break;case 2:t.depthFunc(513);break;case 3:t.depthFunc(515);break;case 4:t.depthFunc(514);break;case 5:t.depthFunc(518);break;case 6:t.depthFunc(516);break;case 7:t.depthFunc(517);break;default:t.depthFunc(515)}else t.depthFunc(515);n=e}},setLocked:function(t){e=t},setClear:function(e){r!==e&&(t.clearDepth(e),r=e)},reset:function(){e=!1,i=null,n=null,r=null}}},o=new function(){let e=!1,i=null,n=null,r=null,s=null,o=null,a=null,h=null,l=null;return{setTest:function(t){e||(t?z(2960):N(2960))},setMask:function(n){i===n||e||(t.stencilMask(n),i=n)},setFunc:function(e,i,o){n===e&&r===i&&s===o||(t.stencilFunc(e,i,o),n=e,r=i,s=o)},setOp:function(e,i,n){o===e&&a===i&&h===n||(t.stencilOp(e,i,n),o=e,a=i,h=n)},setLocked:function(t){e=t},setClear:function(e){l!==e&&(t.clearStencil(e),l=e)},reset:function(){e=!1,i=null,n=null,r=null,s=null,o=null,a=null,h=null,l=null}}};let a={},h=null,l=null,c=null,u=null,p=null,d=null,m=null,f=null,g=null,y=!1,x=null,v=null,b=null,M=null,w=null;const _=t.getParameter(35661);let S=!1,T=0;const E=t.getParameter(7938);-1!==E.indexOf("WebGL")?(T=parseFloat(/^WebGL (\d)/.exec(E)[1]),S=T>=1):-1!==E.indexOf("OpenGL ES")&&(T=parseFloat(/^OpenGL ES (\d)/.exec(E)[1]),S=T>=2);let A=null,L={};const R=new J,P=new J;function C(e,i,n){const r=new Uint8Array(4),s=t.createTexture();t.bindTexture(e,s),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(let e=0;e<n;e++)t.texImage2D(i+e,0,6408,1,1,0,6408,5121,r);return s}const O={};function z(e){!0!==a[e]&&(t.enable(e),a[e]=!0)}function N(e){!1!==a[e]&&(t.disable(e),a[e]=!1)}O[3553]=C(3553,3553,1),O[34067]=C(34067,34069,6),r.setClear(0,0,0,1),s.setClear(1),o.setClear(0),z(2929),s.setFunc(3),G(!1),I(1),z(2884),D(0);const B={100:32774,101:32778,102:32779};if(n)B[103]=32775,B[104]=32776;else{const t=e.get("EXT_blend_minmax");null!==t&&(B[103]=t.MIN_EXT,B[104]=t.MAX_EXT)}const F={200:0,201:1,202:768,204:770,210:776,208:774,206:772,203:769,205:771,209:775,207:773};function D(e,i,n,r,s,o,a,h){if(0!==e){if(l||(z(3042),l=!0),5===e)s=s||i,o=o||n,a=a||r,i===u&&s===m||(t.blendEquationSeparate(B[i],B[s]),u=i,m=s),n===p&&r===d&&o===f&&a===g||(t.blendFuncSeparate(F[n],F[r],F[o],F[a]),p=n,d=r,f=o,g=a),c=e,y=null;else if(e!==c||h!==y){if(100===u&&100===m||(t.blendEquation(32774),u=100,m=100),h)switch(e){case 1:t.blendFuncSeparate(1,771,1,771);break;case 2:t.blendFunc(1,1);break;case 3:t.blendFuncSeparate(0,0,769,771);break;case 4:t.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case 1:t.blendFuncSeparate(770,771,1,771);break;case 2:t.blendFunc(770,1);break;case 3:t.blendFunc(0,769);break;case 4:t.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}p=null,d=null,f=null,g=null,c=e,y=h}}else l&&(N(3042),l=!1)}function G(e){x!==e&&(e?t.frontFace(2304):t.frontFace(2305),x=e)}function I(e){0!==e?(z(2884),e!==v&&(1===e?t.cullFace(1029):2===e?t.cullFace(1028):t.cullFace(1032))):N(2884),v=e}function k(e,i,n){e?(z(32823),M===i&&w===n||(t.polygonOffset(i,n),M=i,w=n)):N(32823)}function U(e){void 0===e&&(e=33984+_-1),A!==e&&(t.activeTexture(e),A=e)}return{buffers:{color:r,depth:s,stencil:o},enable:z,disable:N,useProgram:function(e){return h!==e&&(t.useProgram(e),h=e,!0)},setBlending:D,setMaterial:function(t,e){2===t.side?N(2884):z(2884);let i=1===t.side;e&&(i=!i),G(i),1===t.blending&&!1===t.transparent?D(0):D(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),r.setMask(t.colorWrite);const n=t.stencilWrite;o.setTest(n),n&&(o.setMask(t.stencilWriteMask),o.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),o.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),k(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)},setFlipSided:G,setCullFace:I,setLineWidth:function(e){e!==b&&(S&&t.lineWidth(e),b=e)},setPolygonOffset:k,setScissorTest:function(t){t?z(3089):N(3089)},activeTexture:U,bindTexture:function(e,i){null===A&&U();let n=L[A];void 0===n&&(n={type:void 0,texture:void 0},L[A]=n),n.type===e&&n.texture===i||(t.bindTexture(e,i||O[e]),n.type=e,n.texture=i)},unbindTexture:function(){const e=L[A];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage3D:function(){try{t.texImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(e){!1===R.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),R.copy(e))},viewport:function(e){!1===P.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),P.copy(e))},reset:function(){a={},A=null,L={},h=null,l=null,c=null,u=null,p=null,d=null,m=null,f=null,g=null,y=!1,x=null,v=null,b=null,M=null,w=null,r.reset(),s.reset(),o.reset()}}}function Br(t,e,i,r,s,o,a){const h=s.isWebGL2,l=s.maxTextures,c=s.maxCubemapSize,u=s.maxTextureSize,p=s.maxSamples,d=new WeakMap;let m,f=!1;try{f="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(t){}function g(t,e){return f?new OffscreenCanvas(t,e):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function y(t,e,i,r){let s=1;if((t.width>r||t.height>r)&&(s=r/Math.max(t.width,t.height)),s<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const r=e?n.floorPowerOfTwo:Math.floor,o=r(s*t.width),a=r(s*t.height);void 0===m&&(m=g(o,a));const h=i?g(o,a):m;return h.width=o,h.height=a,h.getContext("2d").drawImage(t,0,0,o,a),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+o+"x"+a+")."),h}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function x(t){return n.isPowerOfTwo(t.width)&&n.isPowerOfTwo(t.height)}function v(t,e){return t.generateMipmaps&&e&&1003!==t.minFilter&&1006!==t.minFilter}function b(e,i,n,s){t.generateMipmap(e),r.get(i).__maxMipLevel=Math.log(Math.max(n,s))*Math.LOG2E}function M(i,n,r){if(!1===h)return n;if(null!==i){if(void 0!==t[i])return t[i];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+i+"'")}let s=n;return 6403===n&&(5126===r&&(s=33326),5131===r&&(s=33325),5121===r&&(s=33321)),6407===n&&(5126===r&&(s=34837),5131===r&&(s=34843),5121===r&&(s=32849)),6408===n&&(5126===r&&(s=34836),5131===r&&(s=34842),5121===r&&(s=32856)),33325!==s&&33326!==s&&34842!==s&&34836!==s||e.get("EXT_color_buffer_float"),s}function w(t){return 1003===t||1004===t||1005===t?9728:9729}function _(e){const i=e.target;i.removeEventListener("dispose",_),function(e){const i=r.get(e);void 0!==i.__webglInit&&(t.deleteTexture(i.__webglTexture),r.remove(e))}(i),i.isVideoTexture&&d.delete(i),a.memory.textures--}function S(e){const i=e.target;i.removeEventListener("dispose",S),function(e){const i=r.get(e),n=r.get(e.texture);if(e){if(void 0!==n.__webglTexture&&t.deleteTexture(n.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++)t.deleteFramebuffer(i.__webglFramebuffer[e]),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer[e]);else t.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&t.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer&&t.deleteRenderbuffer(i.__webglColorRenderbuffer),i.__webglDepthRenderbuffer&&t.deleteRenderbuffer(i.__webglDepthRenderbuffer);r.remove(e.texture),r.remove(e)}}(i),a.memory.textures--}let T=0;function E(t,e){const n=r.get(t);if(t.isVideoTexture&&function(t){const e=a.render.frame;d.get(t)!==e&&(d.set(t,e),t.update())}(t),t.version>0&&n.__version!==t.version){const i=t.image;if(void 0===i)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==i.complete)return void O(n,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.__maxMipLevel=t.maxLod?t.maxLod:t.mipmaps.length-1,n.__maxCubeSize=t.image?t.image.width:1,i.activeTexture(33984+e),i.bindTexture(3553,n.__webglTexture)}function A(e,n){const s=r.get(e);e.version>0&&s.__version!==e.version?function(e,n,r){if(6!==n.image.length)return;C(e,n),i.activeTexture(33984+r),i.bindTexture(34067,e.__webglTexture),t.pixelStorei(37440,n.flipY);const s=n&&(n.isCompressedTexture||n.image[0].isCompressedTexture),a=n.image[0]&&n.image[0].isDataTexture,l=[];for(let t=0;t<6;t++)l[t]=s||a?a?n.image[t].image:n.image[t]:y(n.image[t],!1,!0,c);const u=l[0],p=x(u)||h,d=o.convert(n.format),m=o.convert(n.type),f=M(n.internalFormat,d,m);let g;if(P(34067,n,p),s){for(let t=0;t<6;t++){g=l[t].mipmaps;for(let e=0;e<g.length;e++){const r=g[e];1023!==n.format&&1022!==n.format?null!==d?i.compressedTexImage2D(34069+t,e,f,r.width,r.height,0,r.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):i.texImage2D(34069+t,e,f,r.width,r.height,0,d,m,r.data)}}e.__maxMipLevel=g.length-1}else{g=n.mipmaps;for(let t=0;t<6;t++)if(a){i.texImage2D(34069+t,0,f,l[t].width,l[t].height,0,d,m,l[t].data);for(let e=0;e<g.length;e++){const n=g[e].image[t].image;i.texImage2D(34069+t,e+1,f,n.width,n.height,0,d,m,n.data)}}else{i.texImage2D(34069+t,0,f,d,m,l[t]);for(let e=0;e<g.length;e++){const n=g[e];i.texImage2D(34069+t,e+1,f,d,m,n.image[t])}}e.__maxMipLevel=n.maxLod>0?n.maxLod:g.length,e.__maxCubeSize=u.width}v(n,p)&&b(34067,n,u.width,u.height),e.__version=n.version,n.onUpdate&&n.onUpdate(n)}(s,e,n):(i.activeTexture(33984+n),i.bindTexture(34067,s.__webglTexture))}const L={1e3:10497,1001:33071,1002:33648},R={1003:9728,1004:9984,1005:9986,1006:9729,1007:9985,1008:9987};function P(i,n,o){o?(t.texParameteri(i,10242,L[n.wrapS]),t.texParameteri(i,10243,L[n.wrapT]),32879!==i&&35866!==i||t.texParameteri(i,32882,L[n.wrapR]),t.texParameteri(i,10240,R[n.magFilter]),t.texParameteri(i,10241,R[n.minFilter])):(t.texParameteri(i,10242,33071),t.texParameteri(i,10243,33071),32879!==i&&35866!==i||t.texParameteri(i,32882,33071),1001===n.wrapS&&1001===n.wrapT||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(i,10240,w(n.magFilter)),t.texParameteri(i,10241,w(n.minFilter)),1003!==n.minFilter&&1006!==n.minFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter."));const a=e.get("EXT_texture_filter_anisotropic");if(a){if(1015===n.type&&null===e.get("OES_texture_float_linear"))return;if(1016===n.type&&null===(h||e.get("OES_texture_half_float_linear")))return;(n.anisotropy>1||r.get(n).__currentAnisotropy)&&(t.texParameterf(i,a.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(n.anisotropy,s.getMaxAnisotropy())),r.get(n).__currentAnisotropy=n.anisotropy)}}function C(e,i){void 0===e.__webglInit&&(e.__webglInit=!0,i.addEventListener("dispose",_),e.__webglTexture=t.createTexture(),a.memory.textures++)}function O(e,n,r){let s=3553;n.isDataTexture2DArray&&(s=35866),n.isDataTexture3D&&(s=32879),C(e,n),i.activeTexture(33984+r),i.bindTexture(s,e.__webglTexture),t.pixelStorei(37440,n.flipY),t.pixelStorei(37441,n.premultiplyAlpha),t.pixelStorei(3317,n.unpackAlignment);const a=function(t){return!h&&(1001!==t.wrapS||1001!==t.wrapT||1003!==t.minFilter&&1006!==t.minFilter)}(n)&&!1===x(n.image),l=y(n.image,a,!1,u),c=x(l)||h,p=o.convert(n.format);let d,m=o.convert(n.type),f=M(n.internalFormat,p,m);P(s,n,c);const g=n.mipmaps;if(n.isDepthTexture)f=6402,h?f=1015===n.type?36012:1014===n.type?33190:1020===n.type?35056:33189:1015===n.type&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),1026===n.format&&6402===f&&1012!==n.type&&1014!==n.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),n.type=1012,m=o.convert(n.type)),1027===n.format&&6402===f&&(f=34041,1020!==n.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),n.type=1020,m=o.convert(n.type))),i.texImage2D(3553,0,f,l.width,l.height,0,p,m,null);else if(n.isDataTexture)if(g.length>0&&c){for(let t=0,e=g.length;t<e;t++)d=g[t],i.texImage2D(3553,t,f,d.width,d.height,0,p,m,d.data);n.generateMipmaps=!1,e.__maxMipLevel=g.length-1}else i.texImage2D(3553,0,f,l.width,l.height,0,p,m,l.data),e.__maxMipLevel=0;else if(n.isCompressedTexture){for(let t=0,e=g.length;t<e;t++)d=g[t],1023!==n.format&&1022!==n.format?null!==p?i.compressedTexImage2D(3553,t,f,d.width,d.height,0,d.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):i.texImage2D(3553,t,f,d.width,d.height,0,p,m,d.data);e.__maxMipLevel=g.length-1}else if(n.isDataTexture2DArray)i.texImage3D(35866,0,f,l.width,l.height,l.depth,0,p,m,l.data),e.__maxMipLevel=0;else if(n.isDataTexture3D)i.texImage3D(32879,0,f,l.width,l.height,l.depth,0,p,m,l.data),e.__maxMipLevel=0;else if(g.length>0&&c){for(let t=0,e=g.length;t<e;t++)d=g[t],i.texImage2D(3553,t,f,p,m,d);n.generateMipmaps=!1,e.__maxMipLevel=g.length-1}else i.texImage2D(3553,0,f,p,m,l),e.__maxMipLevel=0;v(n,c)&&b(s,n,l.width,l.height),e.__version=n.version,n.onUpdate&&n.onUpdate(n)}function z(e,n,s,a){const h=o.convert(n.texture.format),l=o.convert(n.texture.type),c=M(n.texture.internalFormat,h,l);i.texImage2D(a,0,c,n.width,n.height,0,h,l,null),t.bindFramebuffer(36160,e),t.framebufferTexture2D(36160,s,a,r.get(n.texture).__webglTexture,0),t.bindFramebuffer(36160,null)}function N(e,i,n){if(t.bindRenderbuffer(36161,e),i.depthBuffer&&!i.stencilBuffer){let r=33189;if(n){const e=i.depthTexture;e&&e.isDepthTexture&&(1015===e.type?r=36012:1014===e.type&&(r=33190));const n=B(i);t.renderbufferStorageMultisample(36161,n,r,i.width,i.height)}else t.renderbufferStorage(36161,r,i.width,i.height);t.framebufferRenderbuffer(36160,36096,36161,e)}else if(i.depthBuffer&&i.stencilBuffer){if(n){const e=B(i);t.renderbufferStorageMultisample(36161,e,35056,i.width,i.height)}else t.renderbufferStorage(36161,34041,i.width,i.height);t.framebufferRenderbuffer(36160,33306,36161,e)}else{const e=o.convert(i.texture.format),r=o.convert(i.texture.type),s=M(i.texture.internalFormat,e,r);if(n){const e=B(i);t.renderbufferStorageMultisample(36161,e,s,i.width,i.height)}else t.renderbufferStorage(36161,s,i.width,i.height)}t.bindRenderbuffer(36161,null)}function B(t){return h&&t.isWebGLMultisampleRenderTarget?Math.min(p,t.samples):0}let F=!1,D=!1;this.allocateTextureUnit=function(){const t=T;return t>=l&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+l),T+=1,t},this.resetTextureUnits=function(){T=0},this.setTexture2D=E,this.setTexture2DArray=function(t,e){const n=r.get(t);t.version>0&&n.__version!==t.version?O(n,t,e):(i.activeTexture(33984+e),i.bindTexture(35866,n.__webglTexture))},this.setTexture3D=function(t,e){const n=r.get(t);t.version>0&&n.__version!==t.version?O(n,t,e):(i.activeTexture(33984+e),i.bindTexture(32879,n.__webglTexture))},this.setTextureCube=A,this.setupRenderTarget=function(e){const n=r.get(e),s=r.get(e.texture);e.addEventListener("dispose",S),s.__webglTexture=t.createTexture(),a.memory.textures++;const l=!0===e.isWebGLCubeRenderTarget,c=!0===e.isWebGLMultisampleRenderTarget,u=x(e)||h;if(!h||1022!==e.texture.format||1015!==e.texture.type&&1016!==e.texture.type||(e.texture.format=1023,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),l){n.__webglFramebuffer=[];for(let e=0;e<6;e++)n.__webglFramebuffer[e]=t.createFramebuffer()}else if(n.__webglFramebuffer=t.createFramebuffer(),c)if(h){n.__webglMultisampledFramebuffer=t.createFramebuffer(),n.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,n.__webglColorRenderbuffer);const i=o.convert(e.texture.format),r=o.convert(e.texture.type),s=M(e.texture.internalFormat,i,r),a=B(e);t.renderbufferStorageMultisample(36161,a,s,e.width,e.height),t.bindFramebuffer(36160,n.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,n.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),e.depthBuffer&&(n.__webglDepthRenderbuffer=t.createRenderbuffer(),N(n.__webglDepthRenderbuffer,e,!0)),t.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(l){i.bindTexture(34067,s.__webglTexture),P(34067,e.texture,u);for(let t=0;t<6;t++)z(n.__webglFramebuffer[t],e,36064,34069+t);v(e.texture,u)&&b(34067,e.texture,e.width,e.height),i.bindTexture(34067,null)}else i.bindTexture(3553,s.__webglTexture),P(3553,e.texture,u),z(n.__webglFramebuffer,e,36064,3553),v(e.texture,u)&&b(3553,e.texture,e.width,e.height),i.bindTexture(3553,null);e.depthBuffer&&function(e){const i=r.get(e),n=!0===e.isWebGLCubeRenderTarget;if(e.depthTexture){if(n)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,i){if(i&&i.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,e),!i.depthTexture||!i.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");r.get(i.depthTexture).__webglTexture&&i.depthTexture.image.width===i.width&&i.depthTexture.image.height===i.height||(i.depthTexture.image.width=i.width,i.depthTexture.image.height=i.height,i.depthTexture.needsUpdate=!0),E(i.depthTexture,0);const n=r.get(i.depthTexture).__webglTexture;if(1026===i.depthTexture.format)t.framebufferTexture2D(36160,36096,3553,n,0);else{if(1027!==i.depthTexture.format)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(36160,33306,3553,n,0)}}(i.__webglFramebuffer,e)}else if(n){i.__webglDepthbuffer=[];for(let n=0;n<6;n++)t.bindFramebuffer(36160,i.__webglFramebuffer[n]),i.__webglDepthbuffer[n]=t.createRenderbuffer(),N(i.__webglDepthbuffer[n],e,!1)}else t.bindFramebuffer(36160,i.__webglFramebuffer),i.__webglDepthbuffer=t.createRenderbuffer(),N(i.__webglDepthbuffer,e,!1);t.bindFramebuffer(36160,null)}(e)},this.updateRenderTargetMipmap=function(t){const e=t.texture;if(v(e,x(t)||h)){const n=t.isWebGLCubeRenderTarget?34067:3553,s=r.get(e).__webglTexture;i.bindTexture(n,s),b(n,e,t.width,t.height),i.bindTexture(n,null)}},this.updateMultisampleRenderTarget=function(e){if(e.isWebGLMultisampleRenderTarget)if(h){const i=r.get(e);t.bindFramebuffer(36008,i.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,i.__webglFramebuffer);const n=e.width,s=e.height;let o=16384;e.depthBuffer&&(o|=256),e.stencilBuffer&&(o|=1024),t.blitFramebuffer(0,0,n,s,0,0,n,s,o,9728),t.bindFramebuffer(36160,i.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(t,e){t&&t.isWebGLRenderTarget&&(!1===F&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),F=!0),t=t.texture),E(t,e)},this.safeSetTextureCube=function(t,e){t&&t.isWebGLCubeRenderTarget&&(!1===D&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),D=!0),t=t.texture),A(t,e)}}function Fr(t,e,i){const n=i.isWebGL2;return{convert:function(t){let i;if(1009===t)return 5121;if(1017===t)return 32819;if(1018===t)return 32820;if(1019===t)return 33635;if(1010===t)return 5120;if(1011===t)return 5122;if(1012===t)return 5123;if(1013===t)return 5124;if(1014===t)return 5125;if(1015===t)return 5126;if(1016===t)return n?5131:(i=e.get("OES_texture_half_float"),null!==i?i.HALF_FLOAT_OES:null);if(1021===t)return 6406;if(1022===t)return 6407;if(1023===t)return 6408;if(1024===t)return 6409;if(1025===t)return 6410;if(1026===t)return 6402;if(1027===t)return 34041;if(1028===t)return 6403;if(1029===t)return 36244;if(1030===t)return 33319;if(1031===t)return 33320;if(1032===t)return 36248;if(1033===t)return 36249;if(33776===t||33777===t||33778===t||33779===t){if(i=e.get("WEBGL_compressed_texture_s3tc"),null===i)return null;if(33776===t)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===t)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===t)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===t)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===t||35841===t||35842===t||35843===t){if(i=e.get("WEBGL_compressed_texture_pvrtc"),null===i)return null;if(35840===t)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===t)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===t)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===t)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===t)return i=e.get("WEBGL_compressed_texture_etc1"),null!==i?i.COMPRESSED_RGB_ETC1_WEBGL:null;if((37492===t||37496===t)&&(i=e.get("WEBGL_compressed_texture_etc"),null!==i)){if(37492===t)return i.COMPRESSED_RGB8_ETC2;if(37496===t)return i.COMPRESSED_RGBA8_ETC2_EAC}return 37808===t||37809===t||37810===t||37811===t||37812===t||37813===t||37814===t||37815===t||37816===t||37817===t||37818===t||37819===t||37820===t||37821===t||37840===t||37841===t||37842===t||37843===t||37844===t||37845===t||37846===t||37847===t||37848===t||37849===t||37850===t||37851===t||37852===t||37853===t?(i=e.get("WEBGL_compressed_texture_astc"),null!==i?t:null):36492===t?(i=e.get("EXT_texture_compression_bptc"),null!==i?t:null):1020===t?n?34042:(i=e.get("WEBGL_depth_texture"),null!==i?i.UNSIGNED_INT_24_8_WEBGL:null):void 0}}}function Dr(t=[]){ki.call(this),this.cameras=t}function Gr(){Bt.call(this),this.type="Group"}function Ir(){this._targetRay=null,this._grip=null,this._hand=null}function kr(t,e){const i=this;let n=null,r=1,s=null,o="local-floor",a=null;const h=[],l=new Map,c=new ki;c.layers.enable(1),c.viewport=new J;const u=new ki;u.layers.enable(2),u.viewport=new J;const p=[c,u],m=new Dr;m.layers.enable(1),m.layers.enable(2);let f=null,g=null;function y(t){const e=l.get(t.inputSource);e&&e.dispatchEvent({type:t.type,data:t.inputSource})}function x(){l.forEach((function(t,e){t.disconnect(e)})),l.clear(),t.setFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),T.stop(),i.isPresenting=!1,i.dispatchEvent({type:"sessionend"})}function v(t){s=t,T.setContext(n),T.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}function b(t){const e=n.inputSources;for(let t=0;t<h.length;t++)l.set(e[t],h[t]);for(let e=0;e<t.removed.length;e++){const i=t.removed[e],n=l.get(i);n&&(n.dispatchEvent({type:"disconnected",data:i}),l.delete(i))}for(let e=0;e<t.added.length;e++){const i=t.added[e],n=l.get(i);n&&n.dispatchEvent({type:"connected",data:i})}}this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=h[t];return void 0===e&&(e=new Ir,h[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=h[t];return void 0===e&&(e=new Ir,h[t]=e),e.getGripSpace()},this.getHand=function(t){let e=h[t];return void 0===e&&(e=new Ir,h[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){r=t,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){o=t,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return s},this.getSession=function(){return n},this.setSession=function(t){if(n=t,null!==n){n.addEventListener("select",y),n.addEventListener("selectstart",y),n.addEventListener("selectend",y),n.addEventListener("squeeze",y),n.addEventListener("squeezestart",y),n.addEventListener("squeezeend",y),n.addEventListener("end",x);const t=e.getContextAttributes();!0!==t.xrCompatible&&e.makeXRCompatible();const i={antialias:t.antialias,alpha:t.alpha,depth:t.depth,stencil:t.stencil,framebufferScaleFactor:r},s=new XRWebGLLayer(n,e,i);n.updateRenderState({baseLayer:s}),n.requestReferenceSpace(o).then(v),n.addEventListener("inputsourceschange",b)}};const M=new d,w=new d;function _(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.getCamera=function(t){m.near=u.near=c.near=t.near,m.far=u.far=c.far=t.far,f===m.near&&g===m.far||(n.updateRenderState({depthNear:m.near,depthFar:m.far}),f=m.near,g=m.far);const e=t.parent,i=m.cameras;_(m,e);for(let t=0;t<i.length;t++)_(i[t],e);t.matrixWorld.copy(m.matrixWorld);const r=t.children;for(let t=0,e=r.length;t<e;t++)r[t].updateMatrixWorld(!0);return 2===i.length?function(t,e,i){M.setFromMatrixPosition(e.matrixWorld),w.setFromMatrixPosition(i.matrixWorld);const n=M.distanceTo(w),r=e.projectionMatrix.elements,s=i.projectionMatrix.elements,o=r[14]/(r[10]-1),a=r[14]/(r[10]+1),h=(r[9]+1)/r[5],l=(r[9]-1)/r[5],c=(r[8]-1)/r[0],u=(s[8]+1)/s[0],p=o*c,d=o*u,m=n/(-c+u),f=m*-c;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(f),t.translateZ(m),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert();const g=o+m,y=a+m,x=p-f,v=d+(n-f),b=h*a/y*g,_=l*a/y*g;t.projectionMatrix.makePerspective(x,v,b,_,g,y)}(m,c,u):m.projectionMatrix.copy(c.projectionMatrix),m};let S=null;const T=new it;T.setAnimationLoop((function(e,i){if(a=i.getViewerPose(s),null!==a){const e=a.views,i=n.renderState.baseLayer;t.setFramebuffer(i.framebuffer);let r=!1;e.length!==m.cameras.length&&(m.cameras.length=0,r=!0);for(let t=0;t<e.length;t++){const n=e[t],s=i.getViewport(n),o=p[t];o.matrix.fromArray(n.transform.matrix),o.projectionMatrix.fromArray(n.projectionMatrix),o.viewport.set(s.x,s.y,s.width,s.height),0===t&&m.matrix.copy(o.matrix),!0===r&&m.cameras.push(o)}}const r=n.inputSources;for(let t=0;t<h.length;t++){const e=h[t],n=r[t];e.update(n,i,s)}S&&S(e,i)})),this.setAnimationLoop=function(t){S=t},this.dispose=function(){}}function Ur(t){function e(e,i){e.opacity.value=i.opacity,i.color&&e.diffuse.value.copy(i.color),i.emissive&&e.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),i.map&&(e.map.value=i.map),i.alphaMap&&(e.alphaMap.value=i.alphaMap),i.specularMap&&(e.specularMap.value=i.specularMap);const n=t.get(i).envMap;if(n){e.envMap.value=n,e.flipEnvMap.value=n.isCubeTexture&&n._needsFlipEnvMap?-1:1,e.reflectivity.value=i.reflectivity,e.refractionRatio.value=i.refractionRatio;const r=t.get(n).__maxMipLevel,s=t.get(n).__maxCubeSize;void 0!==r&&(e.maxMipLevel.value=r),void 0!==s&&(e.maxCubeSize.value=s)}let r,s;i.lightMap&&(e.lightMap.value=i.lightMap,e.lightMapIntensity.value=i.lightMapIntensity),i.aoMap&&(e.aoMap.value=i.aoMap,e.aoMapIntensity.value=i.aoMapIntensity),i.map?r=i.map:i.specularMap?r=i.specularMap:i.displacementMap?r=i.displacementMap:i.normalMap?r=i.normalMap:i.bumpMap?r=i.bumpMap:i.roughnessMap?r=i.roughnessMap:i.metalnessMap?r=i.metalnessMap:i.alphaMap?r=i.alphaMap:i.emissiveMap?r=i.emissiveMap:i.clearcoatMap?r=i.clearcoatMap:i.clearcoatNormalMap?r=i.clearcoatNormalMap:i.clearcoatRoughnessMap&&(r=i.clearcoatRoughnessMap),void 0!==r&&(r.isWebGLRenderTarget&&(r=r.texture),!0===r.matrixAutoUpdate&&r.updateMatrix(),e.uvTransform.value.copy(r.matrix)),i.aoMap?s=i.aoMap:i.lightMap&&(s=i.lightMap),void 0!==s&&(s.isWebGLRenderTarget&&(s=s.texture),!0===s.matrixAutoUpdate&&s.updateMatrix(),e.uv2Transform.value.copy(s.matrix))}function i(e,i){e.roughness.value=i.roughness,e.metalness.value=i.metalness,i.roughnessMap&&(e.roughnessMap.value=i.roughnessMap),i.metalnessMap&&(e.metalnessMap.value=i.metalnessMap),i.emissiveMap&&(e.emissiveMap.value=i.emissiveMap),i.bumpMap&&(e.bumpMap.value=i.bumpMap,e.bumpScale.value=i.bumpScale,1===i.side&&(e.bumpScale.value*=-1)),i.normalMap&&(e.normalMap.value=i.normalMap,e.normalScale.value.copy(i.normalScale),1===i.side&&e.normalScale.value.negate()),i.displacementMap&&(e.displacementMap.value=i.displacementMap,e.displacementScale.value=i.displacementScale,e.displacementBias.value=i.displacementBias),t.get(i).envMap&&(e.envMapIntensity.value=i.envMapIntensity)}return{refreshFogUniforms:function(t,e){t.fogColor.value.copy(e.color),e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)},refreshMaterialUniforms:function(t,n,r,s){n.isMeshBasicMaterial?e(t,n):n.isMeshLambertMaterial?(e(t,n),function(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}(t,n)):n.isMeshToonMaterial?(e(t,n),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isMeshPhongMaterial?(e(t,n),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isMeshStandardMaterial?(e(t,n),n.isMeshPhysicalMaterial?function(t,e){i(t,e),t.reflectivity.value=e.reflectivity,t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.sheen&&t.sheen.value.copy(e.sheen),e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap),e.clearcoatNormalMap&&(t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),t.clearcoatNormalMap.value=e.clearcoatNormalMap,1===e.side&&t.clearcoatNormalScale.value.negate()),t.transmission.value=e.transmission,e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap)}(t,n):i(t,n)):n.isMeshMatcapMaterial?(e(t,n),function(t,e){e.matcap&&(t.matcap.value=e.matcap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isMeshDepthMaterial?(e(t,n),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isMeshDistanceMaterial?(e(t,n),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}(t,n)):n.isMeshNormalMaterial?(e(t,n),function(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity}(t,n),n.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,n)):n.isPointsMaterial?function(t,e,i,n){let r;t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*i,t.scale.value=.5*n,e.map&&(t.map.value=e.map),e.alphaMap&&(t.alphaMap.value=e.alphaMap),e.map?r=e.map:e.alphaMap&&(r=e.alphaMap),void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),t.uvTransform.value.copy(r.matrix))}(t,n,r,s):n.isSpriteMaterial?function(t,e){let i;t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map),e.alphaMap&&(t.alphaMap.value=e.alphaMap),e.map?i=e.map:e.alphaMap&&(i=e.alphaMap),void 0!==i&&(!0===i.matrixAutoUpdate&&i.updateMatrix(),t.uvTransform.value.copy(i.matrix))}(t,n):n.isShadowMaterial?(t.color.value.copy(n.color),t.opacity.value=n.opacity):n.isShaderMaterial&&(n.uniformsNeedUpdate=!1)}}}Dr.prototype=Object.assign(Object.create(ki.prototype),{constructor:Dr,isArrayCamera:!0}),Gr.prototype=Object.assign(Object.create(Bt.prototype),{constructor:Gr,isGroup:!0}),Object.assign(Ir.prototype,{constructor:Ir,getHandSpace:function(){if(null===this._hand&&(this._hand=new Gr,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints=[],this._hand.inputState={pinching:!1},window.XRHand))for(let t=0;t<=window.XRHand.LITTLE_PHALANX_TIP;t++){const t=new Gr;t.matrixAutoUpdate=!1,t.visible=!1,this._hand.joints.push(t),this._hand.add(t)}return this._hand},getTargetRaySpace:function(){return null===this._targetRay&&(this._targetRay=new Gr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1),this._targetRay},getGripSpace:function(){return null===this._grip&&(this._grip=new Gr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1),this._grip},dispatchEvent:function(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this},disconnect:function(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this},update:function(t,e,i){let n=null,r=null,s=null;const o=this._targetRay,a=this._grip,h=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState)if(h&&t.hand){s=!0;for(let n=0;n<=window.XRHand.LITTLE_PHALANX_TIP;n++)if(t.hand[n]){const r=e.getJointPose(t.hand[n],i),s=h.joints[n];null!==r&&(s.matrix.fromArray(r.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.jointRadius=r.radius),s.visible=null!==r;const o=h.joints[window.XRHand.INDEX_PHALANX_TIP],a=h.joints[window.XRHand.THUMB_PHALANX_TIP],l=o.position.distanceTo(a.position),c=.02,u=.005;h.inputState.pinching&&l>c+u?(h.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!h.inputState.pinching&&l<=c-u&&(h.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}}else null!==o&&(n=e.getPose(t.targetRaySpace,i),null!==n&&(o.matrix.fromArray(n.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale))),null!==a&&t.gripSpace&&(r=e.getPose(t.gripSpace,i),null!==r&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale)));return null!==o&&(o.visible=null!==n),null!==a&&(a.visible=null!==r),null!==h&&(h.visible=null!==s),this}}),Object.assign(kr.prototype,r.prototype);let Vr=0;const Wr=new k,jr=new Bt,Hr=new d;function qr(){Object.defineProperty(this,"id",{value:Vr+=2}),this.uuid=n.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}qr.prototype=Object.assign(Object.create(r.prototype),{constructor:qr,isGeometry:!0,applyMatrix4:function(t){const e=(new o).getNormalMatrix(t);for(let e=0,i=this.vertices.length;e<i;e++)this.vertices[e].applyMatrix4(t);for(let t=0,i=this.faces.length;t<i;t++){const i=this.faces[t];i.normal.applyMatrix3(e).normalize();for(let t=0,n=i.vertexNormals.length;t<n;t++)i.vertexNormals[t].applyMatrix3(e).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(t){return Wr.makeRotationX(t),this.applyMatrix4(Wr),this},rotateY:function(t){return Wr.makeRotationY(t),this.applyMatrix4(Wr),this},rotateZ:function(t){return Wr.makeRotationZ(t),this.applyMatrix4(Wr),this},translate:function(t,e,i){return Wr.makeTranslation(t,e,i),this.applyMatrix4(Wr),this},scale:function(t,e,i){return Wr.makeScale(t,e,i),this.applyMatrix4(Wr),this},lookAt:function(t){return jr.lookAt(t),jr.updateMatrix(),this.applyMatrix4(jr.matrix),this},fromBufferGeometry:function(t){const e=this,i=null!==t.index?t.index:void 0,n=t.attributes;if(void 0===n.position)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;const r=n.position,o=n.normal,a=n.color,h=n.uv,l=n.uv2;void 0!==l&&(this.faceVertexUvs[1]=[]);for(let t=0;t<r.count;t++)e.vertices.push((new d).fromBufferAttribute(r,t)),void 0!==a&&e.colors.push((new et).fromBufferAttribute(a,t));function c(t,i,n,r){const c=void 0===a?[]:[e.colors[t].clone(),e.colors[i].clone(),e.colors[n].clone()],u=void 0===o?[]:[(new d).fromBufferAttribute(o,t),(new d).fromBufferAttribute(o,i),(new d).fromBufferAttribute(o,n)],p=new be(t,i,n,u,c,r);e.faces.push(p),void 0!==h&&e.faceVertexUvs[0].push([(new s).fromBufferAttribute(h,t),(new s).fromBufferAttribute(h,i),(new s).fromBufferAttribute(h,n)]),void 0!==l&&e.faceVertexUvs[1].push([(new s).fromBufferAttribute(l,t),(new s).fromBufferAttribute(l,i),(new s).fromBufferAttribute(l,n)])}const u=t.groups;if(u.length>0)for(let t=0;t<u.length;t++){const e=u[t],n=e.start;for(let t=n,r=n+e.count;t<r;t+=3)void 0!==i?c(i.getX(t),i.getX(t+1),i.getX(t+2),e.materialIndex):c(t,t+1,t+2,e.materialIndex)}else if(void 0!==i)for(let t=0;t<i.count;t+=3)c(i.getX(t),i.getX(t+1),i.getX(t+2));else for(let t=0;t<r.count;t+=3)c(t,t+1,t+2);return this.computeFaceNormals(),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(Hr).negate(),this.translate(Hr.x,Hr.y,Hr.z),this},normalize:function(){this.computeBoundingSphere();const t=this.boundingSphere.center,e=this.boundingSphere.radius,i=0===e?1:1/e,n=new k;return n.set(i,0,0,-i*t.x,0,i,0,-i*t.y,0,0,i,-i*t.z,0,0,0,1),this.applyMatrix4(n),this},computeFaceNormals:function(){const t=new d,e=new d;for(let i=0,n=this.faces.length;i<n;i++){const n=this.faces[i],r=this.vertices[n.a],s=this.vertices[n.b],o=this.vertices[n.c];t.subVectors(o,s),e.subVectors(r,s),t.cross(e),t.normalize(),n.normal.copy(t)}},computeVertexNormals:function(t=!0){const e=new Array(this.vertices.length);for(let t=0,i=this.vertices.length;t<i;t++)e[t]=new d;if(t){const t=new d,i=new d;for(let n=0,r=this.faces.length;n<r;n++){const r=this.faces[n],s=this.vertices[r.a],o=this.vertices[r.b],a=this.vertices[r.c];t.subVectors(a,o),i.subVectors(s,o),t.cross(i),e[r.a].add(t),e[r.b].add(t),e[r.c].add(t)}}else{this.computeFaceNormals();for(let t=0,i=this.faces.length;t<i;t++){const i=this.faces[t];e[i.a].add(i.normal),e[i.b].add(i.normal),e[i.c].add(i.normal)}}for(let t=0,i=this.vertices.length;t<i;t++)e[t].normalize();for(let t=0,i=this.faces.length;t<i;t++){const i=this.faces[t],n=i.vertexNormals;3===n.length?(n[0].copy(e[i.a]),n[1].copy(e[i.b]),n[2].copy(e[i.c])):(n[0]=e[i.a].clone(),n[1]=e[i.b].clone(),n[2]=e[i.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){this.computeFaceNormals();for(let t=0,e=this.faces.length;t<e;t++){const e=this.faces[t],i=e.vertexNormals;3===i.length?(i[0].copy(e.normal),i[1].copy(e.normal),i[2].copy(e.normal)):(i[0]=e.normal.clone(),i[1]=e.normal.clone(),i[2]=e.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){for(let t=0,e=this.faces.length;t<e;t++){const e=this.faces[t];e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone(),e.__originalVertexNormals||(e.__originalVertexNormals=[]);for(let t=0,i=e.vertexNormals.length;t<i;t++)e.__originalVertexNormals[t]?e.__originalVertexNormals[t].copy(e.vertexNormals[t]):e.__originalVertexNormals[t]=e.vertexNormals[t].clone()}const t=new qr;t.faces=this.faces;for(let e=0,i=this.morphTargets.length;e<i;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];const t=this.morphNormals[e].faceNormals,i=this.morphNormals[e].vertexNormals;for(let e=0,n=this.faces.length;e<n;e++){const e=new d,n={a:new d,b:new d,c:new d};t.push(e),i.push(n)}}const i=this.morphNormals[e];t.vertices=this.morphTargets[e].vertices,t.computeFaceNormals(),t.computeVertexNormals();for(let t=0,e=this.faces.length;t<e;t++){const e=this.faces[t],n=i.faceNormals[t],r=i.vertexNormals[t];n.copy(e.normal),r.a.copy(e.vertexNormals[0]),r.b.copy(e.vertexNormals[1]),r.c.copy(e.vertexNormals[2])}}for(let t=0,e=this.faces.length;t<e;t++){const e=this.faces[t];e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals}},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new g),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new O),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,i=0){if(!t||!t.isGeometry)return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t);let n;const r=this.vertices.length,s=this.vertices,a=t.vertices,h=this.faces,l=t.faces,c=this.colors,u=t.colors;void 0!==e&&(n=(new o).getNormalMatrix(e));for(let t=0,i=a.length;t<i;t++){const i=a[t].clone();void 0!==e&&i.applyMatrix4(e),s.push(i)}for(let t=0,e=u.length;t<e;t++)c.push(u[t].clone());for(let t=0,e=l.length;t<e;t++){const e=l[t];let s,o;const a=e.vertexNormals,c=e.vertexColors,u=new be(e.a+r,e.b+r,e.c+r);u.normal.copy(e.normal),void 0!==n&&u.normal.applyMatrix3(n).normalize();for(let t=0,e=a.length;t<e;t++)s=a[t].clone(),void 0!==n&&s.applyMatrix3(n).normalize(),u.vertexNormals.push(s);u.color.copy(e.color);for(let t=0,e=c.length;t<e;t++)o=c[t],u.vertexColors.push(o.clone());u.materialIndex=e.materialIndex+i,h.push(u)}for(let e=0,i=t.faceVertexUvs.length;e<i;e++){const i=t.faceVertexUvs[e];void 0===this.faceVertexUvs[e]&&(this.faceVertexUvs[e]=[]);for(let t=0,n=i.length;t<n;t++){const n=i[t],r=[];for(let t=0,e=n.length;t<e;t++)r.push(n[t].clone());this.faceVertexUvs[e].push(r)}}},mergeMesh:function(t){t&&t.isMesh?(t.matrixAutoUpdate&&t.updateMatrix(),this.merge(t.geometry,t.matrix)):console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",t)},mergeVertices:function(t=4){const e={},i=[],n=[],r=Math.pow(10,t);for(let t=0,s=this.vertices.length;t<s;t++){const s=this.vertices[t],o=Math.round(s.x*r)+"_"+Math.round(s.y*r)+"_"+Math.round(s.z*r);void 0===e[o]?(e[o]=t,i.push(this.vertices[t]),n[t]=i.length-1):n[t]=n[e[o]]}const s=[];for(let t=0,e=this.faces.length;t<e;t++){const e=this.faces[t];e.a=n[e.a],e.b=n[e.b],e.c=n[e.c];const i=[e.a,e.b,e.c];for(let e=0;e<3;e++)if(i[e]===i[(e+1)%3]){s.push(t);break}}for(let t=s.length-1;t>=0;t--){const e=s[t];this.faces.splice(e,1);for(let t=0,i=this.faceVertexUvs.length;t<i;t++)this.faceVertexUvs[t].splice(e,1)}const o=this.vertices.length-i.length;return this.vertices=i,o},setFromPoints:function(t){this.vertices=[];for(let e=0,i=t.length;e<i;e++){const i=t[e];this.vertices.push(new d(i.x,i.y,i.z||0))}return this},sortFacesByMaterialIndex:function(){const t=this.faces,e=t.length;for(let i=0;i<e;i++)t[i]._id=i;t.sort((function(t,e){return t.materialIndex-e.materialIndex}));const i=this.faceVertexUvs[0],n=this.faceVertexUvs[1];let r,s;i&&i.length===e&&(r=[]),n&&n.length===e&&(s=[]);for(let o=0;o<e;o++){const e=t[o]._id;r&&r.push(i[e]),s&&s.push(n[e])}r&&(this.faceVertexUvs[0]=r),s&&(this.faceVertexUvs[1]=s)},toJSON:function(){const t={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),void 0!==this.parameters){const e=this.parameters;for(const i in e)void 0!==e[i]&&(t[i]=e[i]);return t}const e=[];for(let t=0;t<this.vertices.length;t++){const i=this.vertices[t];e.push(i.x,i.y,i.z)}const i=[],n=[],r={},s=[],o={},a=[],h={};for(let t=0;t<this.faces.length;t++){const e=this.faces[t],n=!0,r=!1,s=void 0!==this.faceVertexUvs[0][t],o=e.normal.length()>0,a=e.vertexNormals.length>0,h=1!==e.color.r||1!==e.color.g||1!==e.color.b,d=e.vertexColors.length>0;let m=0;if(m=l(m,0,0),m=l(m,1,n),m=l(m,2,r),m=l(m,3,s),m=l(m,4,o),m=l(m,5,a),m=l(m,6,h),m=l(m,7,d),i.push(m),i.push(e.a,e.b,e.c),i.push(e.materialIndex),s){const e=this.faceVertexUvs[0][t];i.push(p(e[0]),p(e[1]),p(e[2]))}if(o&&i.push(c(e.normal)),a){const t=e.vertexNormals;i.push(c(t[0]),c(t[1]),c(t[2]))}if(h&&i.push(u(e.color)),d){const t=e.vertexColors;i.push(u(t[0]),u(t[1]),u(t[2]))}}function l(t,e,i){return i?t|1<<e:t&~(1<<e)}function c(t){const e=t.x.toString()+t.y.toString()+t.z.toString();return void 0!==r[e]||(r[e]=n.length/3,n.push(t.x,t.y,t.z)),r[e]}function u(t){const e=t.r.toString()+t.g.toString()+t.b.toString();return void 0!==o[e]||(o[e]=s.length,s.push(t.getHex())),o[e]}function p(t){const e=t.x.toString()+t.y.toString();return void 0!==h[e]||(h[e]=a.length/2,a.push(t.x,t.y)),h[e]}return t.data={},t.data.vertices=e,t.data.normals=n,s.length>0&&(t.data.colors=s),a.length>0&&(t.data.uvs=[a]),t.data.faces=i,t},clone:function(){return(new qr).copy(this)},copy:function(t){this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;const e=t.vertices;for(let t=0,i=e.length;t<i;t++)this.vertices.push(e[t].clone());const i=t.colors;for(let t=0,e=i.length;t<e;t++)this.colors.push(i[t].clone());const n=t.faces;for(let t=0,e=n.length;t<e;t++)this.faces.push(n[t].clone());for(let e=0,i=t.faceVertexUvs.length;e<i;e++){const i=t.faceVertexUvs[e];void 0===this.faceVertexUvs[e]&&(this.faceVertexUvs[e]=[]);for(let t=0,n=i.length;t<n;t++){const n=i[t],r=[];for(let t=0,e=n.length;t<e;t++){const e=n[t];r.push(e.clone())}this.faceVertexUvs[e].push(r)}}const r=t.morphTargets;for(let t=0,e=r.length;t<e;t++){const e={};if(e.name=r[t].name,void 0!==r[t].vertices){e.vertices=[];for(let i=0,n=r[t].vertices.length;i<n;i++)e.vertices.push(r[t].vertices[i].clone())}if(void 0!==r[t].normals){e.normals=[];for(let i=0,n=r[t].normals.length;i<n;i++)e.normals.push(r[t].normals[i].clone())}this.morphTargets.push(e)}const s=t.morphNormals;for(let t=0,e=s.length;t<e;t++){const e={};if(void 0!==s[t].vertexNormals){e.vertexNormals=[];for(let i=0,n=s[t].vertexNormals.length;i<n;i++){const n=s[t].vertexNormals[i],r={};r.a=n.a.clone(),r.b=n.b.clone(),r.c=n.c.clone(),e.vertexNormals.push(r)}}if(void 0!==s[t].faceNormals){e.faceNormals=[];for(let i=0,n=s[t].faceNormals.length;i<n;i++)e.faceNormals.push(s[t].faceNormals[i].clone())}this.morphNormals.push(e)}const o=t.skinWeights;for(let t=0,e=o.length;t<e;t++)this.skinWeights.push(o[t].clone());const a=t.skinIndices;for(let t=0,e=a.length;t<e;t++)this.skinIndices.push(a[t].clone());const h=t.lineDistances;for(let t=0,e=h.length;t<e;t++)this.lineDistances.push(h[t]);const l=t.boundingBox;null!==l&&(this.boundingBox=l.clone());const c=t.boundingSphere;return null!==c&&(this.boundingSphere=c.clone()),this.elementsNeedUpdate=t.elementsNeedUpdate,this.verticesNeedUpdate=t.verticesNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.lineDistancesNeedUpdate=t.lineDistancesNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});const Xr=new d,Jr=new d,Yr=new d,Zr=new ve;class Qr extends jt{constructor(t=1,e=1,i=1,n=8,r=1,o=!1,a=0,h=2*Math.PI){super(),this.type="CylinderBufferGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:i,radialSegments:n,heightSegments:r,openEnded:o,thetaStart:a,thetaLength:h};const l=this;n=Math.floor(n),r=Math.floor(r);const c=[],u=[],p=[],m=[];let f=0;const g=[],y=i/2;let x=0;function v(i){const r=f,o=new s,g=new d;let v=0;const b=!0===i?t:e,M=!0===i?1:-1;for(let t=1;t<=n;t++)u.push(0,y*M,0),p.push(0,M,0),m.push(.5,.5),f++;const w=f;for(let t=0;t<=n;t++){const e=t/n*h+a,i=Math.cos(e),r=Math.sin(e);g.x=b*r,g.y=y*M,g.z=b*i,u.push(g.x,g.y,g.z),p.push(0,M,0),o.x=.5*i+.5,o.y=.5*r*M+.5,m.push(o.x,o.y),f++}for(let t=0;t<n;t++){const e=r+t,n=w+t;!0===i?c.push(n,n+1,e):c.push(n+1,n,e),v+=3}l.addGroup(x,v,!0===i?1:2),x+=v}!function(){const s=new d,o=new d;let v=0;const b=(e-t)/i;for(let l=0;l<=r;l++){const c=[],d=l/r,x=d*(e-t)+t;for(let t=0;t<=n;t++){const e=t/n,r=e*h+a,l=Math.sin(r),g=Math.cos(r);o.x=x*l,o.y=-d*i+y,o.z=x*g,u.push(o.x,o.y,o.z),s.set(l,b,g).normalize(),p.push(s.x,s.y,s.z),m.push(e,1-d),c.push(f++)}g.push(c)}for(let t=0;t<n;t++)for(let e=0;e<r;e++){const i=g[e][t],n=g[e+1][t],r=g[e+1][t+1],s=g[e][t+1];c.push(i,n,s),c.push(n,r,s),v+=6}l.addGroup(x,v,0),x+=v}(),!1===o&&(t>0&&v(!0),e>0&&v(!1)),this.setIndex(c),this.setAttribute("position",new ft(u,3)),this.setAttribute("normal",new ft(p,3)),this.setAttribute("uv",new ft(m,2))}}function Kr(){return("undefined"==typeof performance?Date:performance).now()}function $r(t,e,i,n){this.ray=new he(t,e),this.near=i||0,this.far=n||1/0,this.camera=null,this.layers=new Mt,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function ts(t,e){return t.distance-e.distance}function es(t,e,i,n){if(t.layers.test(e.layers)&&t.raycast(e,i),!0===n){const n=t.children;for(let t=0,r=n.length;t<r;t++)es(n[t],e,i,!0)}}function is(t){Jt.call(this),this.type="LineBasicMaterial",this.color=new et(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.morphTargets=!1,this.setValues(t)}Object.assign($r.prototype,{set:function(t,e){this.ray.set(t,e)},setFromCamera:function(t,e){e&&e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e&&e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):console.error("THREE.Raycaster: Unsupported camera type: "+e.type)},intersectObject:function(t,e,i){const n=i||[];return es(t,this,n,e),n.sort(ts),n},intersectObjects:function(t,e,i){const n=i||[];if(!1===Array.isArray(t))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),n;for(let i=0,r=t.length;i<r;i++)es(t[i],this,n,e);return n.sort(ts),n}}),is.prototype=Object.create(Jt.prototype),is.prototype.constructor=is,is.prototype.isLineBasicMaterial=!0,is.prototype.copy=function(t){return Jt.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.morphTargets=t.morphTargets,this};const ns=new d,rs=new d,ss=new k,os=new he,as=new O;function hs(t=new jt,e=new is){Bt.call(this),this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}hs.prototype=Object.assign(Object.create(Bt.prototype),{constructor:hs,isLine:!0,copy:function(t){return Bt.prototype.copy.call(this,t),this.material=t.material,this.geometry=t.geometry,this},computeLineDistances:function(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,i=[0];for(let t=1,n=e.count;t<n;t++)ns.fromBufferAttribute(e,t-1),rs.fromBufferAttribute(e,t),i[t]=i[t-1],i[t]+=ns.distanceTo(rs);t.setAttribute("lineDistance",new ft(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(t.isGeometry){const e=t.vertices,i=t.lineDistances;i[0]=0;for(let t=1,n=e.length;t<n;t++)i[t]=i[t-1],i[t]+=e[t-1].distanceTo(e[t])}return this},raycast:function(t,e){const i=this.geometry,n=this.matrixWorld,r=t.params.Line.threshold;if(null===i.boundingSphere&&i.computeBoundingSphere(),as.copy(i.boundingSphere),as.applyMatrix4(n),as.radius+=r,!1===t.ray.intersectsSphere(as))return;ss.copy(n).invert(),os.copy(t.ray).applyMatrix4(ss);const s=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s,a=new d,h=new d,l=new d,c=new d,u=this.isLineSegments?2:1;if(i.isBufferGeometry){const n=i.index,r=i.attributes.position;if(null!==n){const i=n.array;for(let n=0,s=i.length-1;n<s;n+=u){const s=i[n],u=i[n+1];if(a.fromBufferAttribute(r,s),h.fromBufferAttribute(r,u),os.distanceSqToSegment(a,h,c,l)>o)continue;c.applyMatrix4(this.matrixWorld);const p=t.ray.origin.distanceTo(c);p<t.near||p>t.far||e.push({distance:p,point:l.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else for(let i=0,n=r.count-1;i<n;i+=u){if(a.fromBufferAttribute(r,i),h.fromBufferAttribute(r,i+1),os.distanceSqToSegment(a,h,c,l)>o)continue;c.applyMatrix4(this.matrixWorld);const n=t.ray.origin.distanceTo(c);n<t.near||n>t.far||e.push({distance:n,point:l.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this})}}else if(i.isGeometry){const n=i.vertices,r=n.length;for(let i=0;i<r-1;i+=u){if(os.distanceSqToSegment(n[i],n[i+1],c,l)>o)continue;c.applyMatrix4(this.matrixWorld);const r=t.ray.origin.distanceTo(c);r<t.near||r>t.far||e.push({distance:r,point:l.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this})}}},updateMorphTargets:function(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,i=Object.keys(e);if(i.length>0){const t=e[i[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,i=t.length;e<i;e++){const i=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}});const ls=new d,cs=new d;function us(t,e){hs.call(this,t,e),this.type="LineSegments"}function ps(t){Jt.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new et(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new et(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new s(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.vertexTangents=!1,this.setValues(t)}function ds(t){ps.call(this),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new s(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,Object.defineProperty(this,"ior",{get:function(){return(1+.4*this.reflectivity)/(1-.4*this.reflectivity)},set:function(t){this.reflectivity=n.clamp(2.5*(t-1)/(t+1),0,1)}}),this.sheen=null,this.transmission=0,this.transmissionMap=null,this.setValues(t)}function ms(t){Jt.call(this),this.type="ShadowMaterial",this.color=new et(0),this.transparent=!0,this.setValues(t)}function fs(t){is.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}us.prototype=Object.assign(Object.create(hs.prototype),{constructor:us,isLineSegments:!0,computeLineDistances:function(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,i=[];for(let t=0,n=e.count;t<n;t+=2)ls.fromBufferAttribute(e,t),cs.fromBufferAttribute(e,t+1),i[t]=0===t?0:i[t-1],i[t+1]=i[t]+ls.distanceTo(cs);t.setAttribute("lineDistance",new ft(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(t.isGeometry){const e=t.vertices,i=t.lineDistances;for(let t=0,n=e.length;t<n;t+=2)ls.copy(e[t]),cs.copy(e[t+1]),i[t]=0===t?0:i[t-1],i[t+1]=i[t]+ls.distanceTo(cs)}return this}}),ps.prototype=Object.create(Jt.prototype),ps.prototype.constructor=ps,ps.prototype.isMeshStandardMaterial=!0,ps.prototype.copy=function(t){return Jt.prototype.copy.call(this,t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.vertexTangents=t.vertexTangents,this},ds.prototype=Object.create(ps.prototype),ds.prototype.constructor=ds,ds.prototype.isMeshPhysicalMaterial=!0,ds.prototype.copy=function(t){return ps.prototype.copy.call(this,t),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.reflectivity=t.reflectivity,t.sheen?this.sheen=(this.sheen||new et).copy(t.sheen):this.sheen=null,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this},ms.prototype=Object.create(Jt.prototype),ms.prototype.constructor=ms,ms.prototype.isShadowMaterial=!0,ms.prototype.copy=function(t){return Jt.prototype.copy.call(this,t),this.color.copy(t.color),this},fs.prototype=Object.create(is.prototype),fs.prototype.constructor=fs,fs.prototype.isLineDashedMaterial=!0,fs.prototype.copy=function(t){return is.prototype.copy.call(this,t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this};const gs=new d;let ys,xs;const vs=new d,bs=new d;function Ms(t,e=1){Bt.call(this),this.type="Light",this.color=new et(t),this.intensity=e}function ws(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.mapSize=new s(512,512),this.map=null,this.mapPass=null,this.matrix=new k,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new I,this._frameExtents=new s(1,1),this._viewportCount=1,this._viewports=[new J(0,0,1,1)]}function _s(t=-1,e=1,i=1,n=-1,r=.1,s=2e3){Ii.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=i,this.bottom=n,this.near=r,this.far=s,this.updateProjectionMatrix()}function Ss(){ws.call(this,new _s(-5,5,5,-5,.5,500))}function Ts(t,e){Ms.call(this,t,e),this.type="DirectionalLight",this.position.copy(Bt.DefaultUp),this.updateMatrix(),this.target=new Bt,this.shadow=new Ss}function Es(t,e){Ms.call(this,t,e),this.type="AmbientLight"}function As(t,e,i){Ms.call(this,t,i),this.type="HemisphereLight",this.position.copy(Bt.DefaultUp),this.updateMatrix(),this.groundColor=new et(e)}Ms.prototype=Object.assign(Object.create(Bt.prototype),{constructor:Ms,isLight:!0,copy:function(t){return Bt.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},toJSON:function(t){const e=Bt.prototype.toJSON.call(this,t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}),Object.assign(ws.prototype,{_projScreenMatrix:new k,_lightPositionWorld:new d,_lookTarget:new d,getViewportCount:function(){return this._viewportCount},getFrustum:function(){return this._frustum},updateMatrices:function(t){const e=this.camera,i=this.matrix,n=this._projScreenMatrix,r=this._lookTarget,s=this._lightPositionWorld;s.setFromMatrixPosition(t.matrixWorld),e.position.copy(s),r.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(r),e.updateMatrixWorld(),n.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(n),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(e.projectionMatrix),i.multiply(e.matrixWorldInverse)},getViewport:function(t){return this._viewports[t]},getFrameExtents:function(){return this._frameExtents},copy:function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){const t={};return 0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}),_s.prototype=Object.assign(Object.create(Ii.prototype),{constructor:_s,isOrthographicCamera:!0,copy:function(t,e){return Ii.prototype.copy.call(this,t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this},setViewOffset:function(t,e,i,n,r,s){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=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,n=(this.top+this.bottom)/2;let r=i-t,s=i+t,o=n+e,a=n-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,s=r+t*this.view.width,o-=e*this.view.offsetY,a=o-e*this.view.height}this.projectionMatrix.makeOrthographic(r,s,o,a,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()},toJSON:function(t){const e=Bt.prototype.toJSON.call(this,t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}),Ss.prototype=Object.assign(Object.create(ws.prototype),{constructor:Ss,isDirectionalLightShadow:!0,updateMatrices:function(t){ws.prototype.updateMatrices.call(this,t)}}),Ts.prototype=Object.assign(Object.create(Ms.prototype),{constructor:Ts,isDirectionalLight:!0,copy:function(t){return Ms.prototype.copy.call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),Es.prototype=Object.assign(Object.create(Ms.prototype),{constructor:Es,isAmbientLight:!0}),As.prototype=Object.assign(Object.create(Ms.prototype),{constructor:As,isHemisphereLight:!0,copy:function(t){return Ms.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}});const Ls={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};function Rs(t,e,i){const n=this;let r=!1,s=0,o=0,a=void 0;const h=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=i,this.itemStart=function(t){o++,!1===r&&void 0!==n.onStart&&n.onStart(t,s,o),r=!0},this.itemEnd=function(t){s++,void 0!==n.onProgress&&n.onProgress(t,s,o),s===o&&(r=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(t){void 0!==n.onError&&n.onError(t)},this.resolveURL=function(t){return a?a(t):t},this.setURLModifier=function(t){return a=t,this},this.addHandler=function(t,e){return h.push(t,e),this},this.removeHandler=function(t){const e=h.indexOf(t);return-1!==e&&h.splice(e,2),this},this.getHandler=function(t){for(let e=0,i=h.length;e<i;e+=2){const i=h[e],n=h[e+1];if(i.global&&(i.lastIndex=0),i.test(t))return n}return null}}const Ps=new Rs;function Cs(t){this.manager=void 0!==t?t:Ps,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}function Os(t){Cs.call(this,t)}function zs(t){Cs.call(this,t)}function Ns(t){Cs.call(this,t)}function Bs(){this.type="Curve",this.arcLengthDivisions=200}function Fs(t,e,i,n,r,s,o,a){Bs.call(this),this.type="EllipseCurve",this.aX=t||0,this.aY=e||0,this.xRadius=i||1,this.yRadius=n||1,this.aStartAngle=r||0,this.aEndAngle=s||2*Math.PI,this.aClockwise=o||!1,this.aRotation=a||0}function Ds(t,e,i,n,r,s){Fs.call(this,t,e,i,i,n,r,s),this.type="ArcCurve"}function Gs(){let t=0,e=0,i=0,n=0;function r(r,s,o,a){t=r,e=o,i=-3*r+3*s-2*o-a,n=2*r-2*s+o+a}return{initCatmullRom:function(t,e,i,n,s){r(e,i,s*(i-t),s*(n-e))},initNonuniformCatmullRom:function(t,e,i,n,s,o,a){let h=(e-t)/s-(i-t)/(s+o)+(i-e)/o,l=(i-e)/o-(n-e)/(o+a)+(n-i)/a;h*=o,l*=o,r(e,i,h,l)},calc:function(r){const s=r*r;return t+e*r+i*s+n*(s*r)}}}Object.assign(Cs.prototype,{load:function(){},loadAsync:function(t,e){const i=this;return new Promise((function(n,r){i.load(t,n,e,r)}))},parse:function(){},setCrossOrigin:function(t){return this.crossOrigin=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setPath:function(t){return this.path=t,this},setResourcePath:function(t){return this.resourcePath=t,this},setRequestHeader:function(t){return this.requestHeader=t,this}}),Os.prototype=Object.assign(Object.create(Cs.prototype),{constructor:Os,load:function(t,e,i,n){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,s=Ls.get(t);if(void 0!==s)return r.manager.itemStart(t),setTimeout((function(){e&&e(s),r.manager.itemEnd(t)}),0),s;const o=document.createElementNS("http://www.w3.org/1999/xhtml","img");function a(){o.removeEventListener("load",a,!1),o.removeEventListener("error",h,!1),Ls.add(t,this),e&&e(this),r.manager.itemEnd(t)}function h(e){o.removeEventListener("load",a,!1),o.removeEventListener("error",h,!1),n&&n(e),r.manager.itemError(t),r.manager.itemEnd(t)}return o.addEventListener("load",a,!1),o.addEventListener("error",h,!1),"data:"!==t.substr(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),r.manager.itemStart(t),o.src=t,o}}),zs.prototype=Object.assign(Object.create(Cs.prototype),{constructor:zs,load:function(t,e,i,n){const r=new l,s=new Os(this.manager);return s.setCrossOrigin(this.crossOrigin),s.setPath(this.path),s.load(t,(function(i){r.image=i;const n=t.search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/);r.format=n?1022:1023,r.needsUpdate=!0,void 0!==e&&e(r)}),i,n),r}}),Ns.prototype=Object.assign(Object.create(Cs.prototype),{constructor:Ns,load:function(t,e,i,n){const r=new Vi,s=new Os(this.manager);s.setCrossOrigin(this.crossOrigin),s.setPath(this.path);let o=0;function a(i){s.load(t[i],(function(t){r.images[i]=t,o++,6===o&&(r.needsUpdate=!0,e&&e(r))}),void 0,n)}for(let e=0;e<t.length;++e)a(e);return r}}),Object.assign(Bs.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(t,e){const i=this.getUtoTmapping(t);return this.getPoint(i,e)},getPoints:function(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return e},getSpacedPoints:function(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e},getLength:function(){const t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let i,n=this.getPoint(0),r=0;e.push(0);for(let s=1;s<=t;s++)i=this.getPoint(s/t),r+=i.distanceTo(n),e.push(r),n=i;return this.cacheArcLengths=e,e},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){const i=this.getLengths();let n=0;const r=i.length;let s;s=e||t*i[r-1];let o,a=0,h=r-1;for(;a<=h;)if(n=Math.floor(a+(h-a)/2),o=i[n]-s,o<0)a=n+1;else{if(!(o>0)){h=n;break}h=n-1}if(n=h,i[n]===s)return n/(r-1);const l=i[n];return(n+(s-l)/(i[n+1]-l))/(r-1)},getTangent:function(t,e){let i=t-1e-4,n=t+1e-4;i<0&&(i=0),n>1&&(n=1);const r=this.getPoint(i),o=this.getPoint(n),a=e||(r.isVector2?new s:new d);return a.copy(o).sub(r).normalize(),a},getTangentAt:function(t,e){const i=this.getUtoTmapping(t);return this.getTangent(i,e)},computeFrenetFrames:function(t,e){const i=new d,r=[],s=[],o=[],a=new d,h=new k;for(let e=0;e<=t;e++){const i=e/t;r[e]=this.getTangentAt(i,new d),r[e].normalize()}s[0]=new d,o[0]=new d;let l=Number.MAX_VALUE;const c=Math.abs(r[0].x),u=Math.abs(r[0].y),p=Math.abs(r[0].z);c<=l&&(l=c,i.set(1,0,0)),u<=l&&(l=u,i.set(0,1,0)),p<=l&&i.set(0,0,1),a.crossVectors(r[0],i).normalize(),s[0].crossVectors(r[0],a),o[0].crossVectors(r[0],s[0]);for(let e=1;e<=t;e++){if(s[e]=s[e-1].clone(),o[e]=o[e-1].clone(),a.crossVectors(r[e-1],r[e]),a.length()>Number.EPSILON){a.normalize();const t=Math.acos(n.clamp(r[e-1].dot(r[e]),-1,1));s[e].applyMatrix4(h.makeRotationAxis(a,t))}o[e].crossVectors(r[e],s[e])}if(!0===e){let e=Math.acos(n.clamp(s[0].dot(s[t]),-1,1));e/=t,r[0].dot(a.crossVectors(s[0],s[t]))>0&&(e=-e);for(let i=1;i<=t;i++)s[i].applyMatrix4(h.makeRotationAxis(r[i],e*i)),o[i].crossVectors(r[i],s[i])}return{tangents:r,normals:s,binormals:o}},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this},toJSON:function(){const t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t},fromJSON:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}),Fs.prototype=Object.create(Bs.prototype),Fs.prototype.constructor=Fs,Fs.prototype.isEllipseCurve=!0,Fs.prototype.getPoint=function(t,e){const i=e||new s,n=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const o=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=n;for(;r>n;)r-=n;r<Number.EPSILON&&(r=o?0:n),!0!==this.aClockwise||o||(r===n?r=-n:r-=n);const a=this.aStartAngle+t*r;let h=this.aX+this.xRadius*Math.cos(a),l=this.aY+this.yRadius*Math.sin(a);if(0!==this.aRotation){const t=Math.cos(this.aRotation),e=Math.sin(this.aRotation),i=h-this.aX,n=l-this.aY;h=i*t-n*e+this.aX,l=i*e+n*t+this.aY}return i.set(h,l)},Fs.prototype.copy=function(t){return Bs.prototype.copy.call(this,t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this},Fs.prototype.toJSON=function(){const t=Bs.prototype.toJSON.call(this);return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t},Fs.prototype.fromJSON=function(t){return Bs.prototype.fromJSON.call(this,t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this},Ds.prototype=Object.create(Fs.prototype),Ds.prototype.constructor=Ds,Ds.prototype.isArcCurve=!0;const Is=new d,ks=new Gs,Us=new Gs,Vs=new Gs;function Ws(t=[],e=!1,i="centripetal",n=.5){Bs.call(this),this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=i,this.tension=n}function js(t,e,i,n,r){const s=.5*(n-e),o=.5*(r-i),a=t*t;return(2*i-2*n+s+o)*(t*a)+(-3*i+3*n-2*s-o)*a+s*t+i}function Hs(t,e,i,n){return function(t,e){const i=1-t;return i*i*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,i)+function(t,e){return t*t*e}(t,n)}function qs(t,e,i,n,r){return function(t,e){const i=1-t;return i*i*i*e}(t,e)+function(t,e){const i=1-t;return 3*i*i*t*e}(t,i)+function(t,e){return 3*(1-t)*t*t*e}(t,n)+function(t,e){return t*t*t*e}(t,r)}function Xs(t=new s,e=new s,i=new s,n=new s){Bs.call(this),this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=i,this.v3=n}function Js(t=new d,e=new d,i=new d,n=new d){Bs.call(this),this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=i,this.v3=n}function Ys(t=new s,e=new s){Bs.call(this),this.type="LineCurve",this.v1=t,this.v2=e}function Zs(t=new d,e=new d){Bs.call(this),this.type="LineCurve3",this.v1=t,this.v2=e}function Qs(t=new s,e=new s,i=new s){Bs.call(this),this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=i}function Ks(t=new d,e=new d,i=new d){Bs.call(this),this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=i}function $s(t=[]){Bs.call(this),this.type="SplineCurve",this.points=t}Ws.prototype=Object.create(Bs.prototype),Ws.prototype.constructor=Ws,Ws.prototype.isCatmullRomCurve3=!0,Ws.prototype.getPoint=function(t,e=new d){const i=e,n=this.points,r=n.length,s=(r-(this.closed?0:1))*t;let o,a,h=Math.floor(s),l=s-h;this.closed?h+=h>0?0:(Math.floor(Math.abs(h)/r)+1)*r:0===l&&h===r-1&&(h=r-2,l=1),this.closed||h>0?o=n[(h-1)%r]:(Is.subVectors(n[0],n[1]).add(n[0]),o=Is);const c=n[h%r],u=n[(h+1)%r];if(this.closed||h+2<r?a=n[(h+2)%r]:(Is.subVectors(n[r-1],n[r-2]).add(n[r-1]),a=Is),"centripetal"===this.curveType||"chordal"===this.curveType){const t="chordal"===this.curveType?.5:.25;let e=Math.pow(o.distanceToSquared(c),t),i=Math.pow(c.distanceToSquared(u),t),n=Math.pow(u.distanceToSquared(a),t);i<1e-4&&(i=1),e<1e-4&&(e=i),n<1e-4&&(n=i),ks.initNonuniformCatmullRom(o.x,c.x,u.x,a.x,e,i,n),Us.initNonuniformCatmullRom(o.y,c.y,u.y,a.y,e,i,n),Vs.initNonuniformCatmullRom(o.z,c.z,u.z,a.z,e,i,n)}else"catmullrom"===this.curveType&&(ks.initCatmullRom(o.x,c.x,u.x,a.x,this.tension),Us.initCatmullRom(o.y,c.y,u.y,a.y,this.tension),Vs.initCatmullRom(o.z,c.z,u.z,a.z,this.tension));return i.set(ks.calc(l),Us.calc(l),Vs.calc(l)),i},Ws.prototype.copy=function(t){Bs.prototype.copy.call(this,t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push(i.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this},Ws.prototype.toJSON=function(){const t=Bs.prototype.toJSON.call(this);t.points=[];for(let e=0,i=this.points.length;e<i;e++){const i=this.points[e];t.points.push(i.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t},Ws.prototype.fromJSON=function(t){Bs.prototype.fromJSON.call(this,t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push((new d).fromArray(i))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this},Xs.prototype=Object.create(Bs.prototype),Xs.prototype.constructor=Xs,Xs.prototype.isCubicBezierCurve=!0,Xs.prototype.getPoint=function(t,e=new s){const i=e,n=this.v0,r=this.v1,o=this.v2,a=this.v3;return i.set(qs(t,n.x,r.x,o.x,a.x),qs(t,n.y,r.y,o.y,a.y)),i},Xs.prototype.copy=function(t){return Bs.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this},Xs.prototype.toJSON=function(){const t=Bs.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t},Xs.prototype.fromJSON=function(t){return Bs.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this},Js.prototype=Object.create(Bs.prototype),Js.prototype.constructor=Js,Js.prototype.isCubicBezierCurve3=!0,Js.prototype.getPoint=function(t,e=new d){const i=e,n=this.v0,r=this.v1,s=this.v2,o=this.v3;return i.set(qs(t,n.x,r.x,s.x,o.x),qs(t,n.y,r.y,s.y,o.y),qs(t,n.z,r.z,s.z,o.z)),i},Js.prototype.copy=function(t){return Bs.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this},Js.prototype.toJSON=function(){const t=Bs.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t},Js.prototype.fromJSON=function(t){return Bs.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this},Ys.prototype=Object.create(Bs.prototype),Ys.prototype.constructor=Ys,Ys.prototype.isLineCurve=!0,Ys.prototype.getPoint=function(t,e=new s){const i=e;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i},Ys.prototype.getPointAt=function(t,e){return this.getPoint(t,e)},Ys.prototype.getTangent=function(t,e){const i=e||new s;return i.copy(this.v2).sub(this.v1).normalize(),i},Ys.prototype.copy=function(t){return Bs.prototype.copy.call(this,t),this.v1.copy(t.v1),this.v2.copy(t.v2),this},Ys.prototype.toJSON=function(){const t=Bs.prototype.toJSON.call(this);return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},Ys.prototype.fromJSON=function(t){return Bs.prototype.fromJSON.call(this,t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},Zs.prototype=Object.create(Bs.prototype),Zs.prototype.constructor=Zs,Zs.prototype.isLineCurve3=!0,Zs.prototype.getPoint=function(t,e=new d){const i=e;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i},Zs.prototype.getPointAt=function(t,e){return this.getPoint(t,e)},Zs.prototype.copy=function(t){return Bs.prototype.copy.call(this,t),this.v1.copy(t.v1),this.v2.copy(t.v2),this},Zs.prototype.toJSON=function(){const t=Bs.prototype.toJSON.call(this);return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},Zs.prototype.fromJSON=function(t){return Bs.prototype.fromJSON.call(this,t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},Qs.prototype=Object.create(Bs.prototype),Qs.prototype.constructor=Qs,Qs.prototype.isQuadraticBezierCurve=!0,Qs.prototype.getPoint=function(t,e=new s){const i=e,n=this.v0,r=this.v1,o=this.v2;return i.set(Hs(t,n.x,r.x,o.x),Hs(t,n.y,r.y,o.y)),i},Qs.prototype.copy=function(t){return Bs.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this},Qs.prototype.toJSON=function(){const t=Bs.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},Qs.prototype.fromJSON=function(t){return Bs.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},Ks.prototype=Object.create(Bs.prototype),Ks.prototype.constructor=Ks,Ks.prototype.isQuadraticBezierCurve3=!0,Ks.prototype.getPoint=function(t,e=new d){const i=e,n=this.v0,r=this.v1,s=this.v2;return i.set(Hs(t,n.x,r.x,s.x),Hs(t,n.y,r.y,s.y),Hs(t,n.z,r.z,s.z)),i},Ks.prototype.copy=function(t){return Bs.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this},Ks.prototype.toJSON=function(){const t=Bs.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},Ks.prototype.fromJSON=function(t){return Bs.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},$s.prototype=Object.create(Bs.prototype),$s.prototype.constructor=$s,$s.prototype.isSplineCurve=!0,$s.prototype.getPoint=function(t,e=new s){const i=e,n=this.points,r=(n.length-1)*t,o=Math.floor(r),a=r-o,h=n[0===o?o:o-1],l=n[o],c=n[o>n.length-2?n.length-1:o+1],u=n[o>n.length-3?n.length-1:o+2];return i.set(js(a,h.x,l.x,c.x,u.x),js(a,h.y,l.y,c.y,u.y)),i},$s.prototype.copy=function(t){Bs.prototype.copy.call(this,t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push(i.clone())}return this},$s.prototype.toJSON=function(){const t=Bs.prototype.toJSON.call(this);t.points=[];for(let e=0,i=this.points.length;e<i;e++){const i=this.points[e];t.points.push(i.toArray())}return t},$s.prototype.fromJSON=function(t){Bs.prototype.fromJSON.call(this,t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push((new s).fromArray(i))}return this};var to=Object.freeze({__proto__:null,ArcCurve:Ds,CatmullRomCurve3:Ws,CubicBezierCurve:Xs,CubicBezierCurve3:Js,EllipseCurve:Fs,LineCurve:Ys,LineCurve3:Zs,QuadraticBezierCurve:Qs,QuadraticBezierCurve3:Ks,SplineCurve:$s});function eo(){Bs.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}function io(t){eo.call(this),this.type="Path",this.currentPoint=new s,t&&this.setFromPoints(t)}function no(t){io.call(this,t),this.uuid=n.generateUUID(),this.type="Shape",this.holes=[]}function ro(t,e,i,n,r){let s,o;if(r===function(t,e,i,n){let r=0;for(let s=e,o=i-n;s<i;s+=n)r+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return r}(t,e,i,n)>0)for(s=e;s<i;s+=n)o=Eo(s,t[s],t[s+1],o);else for(s=i-n;s>=e;s-=n)o=Eo(s,t[s],t[s+1],o);return o&&bo(o,o.next)&&(Ao(o),o=o.next),o}function so(t,e){if(!t)return t;e||(e=t);let i,n=t;do{if(i=!1,n.steiner||!bo(n,n.next)&&0!==vo(n.prev,n,n.next))n=n.next;else{if(Ao(n),n=e=n.prev,n===n.next)break;i=!0}}while(i||n!==e);return e}function oo(t,e,i,n,r,s,o){if(!t)return;!o&&s&&function(t,e,i,n){let r=t;do{null===r.z&&(r.z=fo(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,i,n,r,s,o,a,h,l=1;do{for(i=t,t=null,s=null,o=0;i;){for(o++,n=i,a=0,e=0;e<l&&(a++,n=n.nextZ,n);e++);for(h=l;a>0||h>0&&n;)0!==a&&(0===h||!n||i.z<=n.z)?(r=i,i=i.nextZ,a--):(r=n,n=n.nextZ,h--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;i=n}s.nextZ=null,l*=2}while(o>1)}(r)}(t,n,r,s);let a,h,l=t;for(;t.prev!==t.next;)if(a=t.prev,h=t.next,s?ho(t,n,r,s):ao(t))e.push(a.i/i),e.push(t.i/i),e.push(h.i/i),Ao(t),t=h.next,l=h.next;else if((t=h)===l){o?1===o?oo(t=lo(so(t),e,i),e,i,n,r,s,2):2===o&&co(t,e,i,n,r,s):oo(so(t),e,i,n,r,s,1);break}}function ao(t){const e=t.prev,i=t,n=t.next;if(vo(e,i,n)>=0)return!1;let r=t.next.next;for(;r!==t.prev;){if(yo(e.x,e.y,i.x,i.y,n.x,n.y,r.x,r.y)&&vo(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function ho(t,e,i,n){const r=t.prev,s=t,o=t.next;if(vo(r,s,o)>=0)return!1;const a=r.x<s.x?r.x<o.x?r.x:o.x:s.x<o.x?s.x:o.x,h=r.y<s.y?r.y<o.y?r.y:o.y:s.y<o.y?s.y:o.y,l=r.x>s.x?r.x>o.x?r.x:o.x:s.x>o.x?s.x:o.x,c=r.y>s.y?r.y>o.y?r.y:o.y:s.y>o.y?s.y:o.y,u=fo(a,h,e,i,n),p=fo(l,c,e,i,n);let d=t.prevZ,m=t.nextZ;for(;d&&d.z>=u&&m&&m.z<=p;){if(d!==t.prev&&d!==t.next&&yo(r.x,r.y,s.x,s.y,o.x,o.y,d.x,d.y)&&vo(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,m!==t.prev&&m!==t.next&&yo(r.x,r.y,s.x,s.y,o.x,o.y,m.x,m.y)&&vo(m.prev,m,m.next)>=0)return!1;m=m.nextZ}for(;d&&d.z>=u;){if(d!==t.prev&&d!==t.next&&yo(r.x,r.y,s.x,s.y,o.x,o.y,d.x,d.y)&&vo(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;m&&m.z<=p;){if(m!==t.prev&&m!==t.next&&yo(r.x,r.y,s.x,s.y,o.x,o.y,m.x,m.y)&&vo(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function lo(t,e,i){let n=t;do{const r=n.prev,s=n.next.next;!bo(r,s)&&Mo(r,n,n.next,s)&&So(r,s)&&So(s,r)&&(e.push(r.i/i),e.push(n.i/i),e.push(s.i/i),Ao(n),Ao(n.next),n=t=s),n=n.next}while(n!==t);return so(n)}function co(t,e,i,n,r,s){let o=t;do{let t=o.next.next;for(;t!==o.prev;){if(o.i!==t.i&&xo(o,t)){let a=To(o,t);return o=so(o,o.next),a=so(a,a.next),oo(o,e,i,n,r,s),void oo(a,e,i,n,r,s)}t=t.next}o=o.next}while(o!==t)}function uo(t,e){return t.x-e.x}function po(t,e){if(e=function(t,e){let i=e;const n=t.x,r=t.y;let s,o=-1/0;do{if(r<=i.y&&r>=i.next.y&&i.next.y!==i.y){const t=i.x+(r-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(t<=n&&t>o){if(o=t,t===n){if(r===i.y)return i;if(r===i.next.y)return i.next}s=i.x<i.next.x?i:i.next}}i=i.next}while(i!==e);if(!s)return null;if(n===o)return s;const a=s,h=s.x,l=s.y;let c,u=1/0;i=s;do{n>=i.x&&i.x>=h&&n!==i.x&&yo(r<l?n:o,r,h,l,r<l?o:n,r,i.x,i.y)&&(c=Math.abs(r-i.y)/(n-i.x),So(i,t)&&(c<u||c===u&&(i.x>s.x||i.x===s.x&&mo(s,i)))&&(s=i,u=c)),i=i.next}while(i!==a);return s}(t,e)){const i=To(e,t);so(e,e.next),so(i,i.next)}}function mo(t,e){return vo(t.prev,t,e.prev)<0&&vo(e.next,t,t.next)<0}function fo(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function go(t){let e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function yo(t,e,i,n,r,s,o,a){return(r-o)*(e-a)-(t-o)*(s-a)>=0&&(t-o)*(n-a)-(i-o)*(e-a)>=0&&(i-o)*(s-a)-(r-o)*(n-a)>=0}function xo(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&Mo(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(So(t,e)&&So(e,t)&&function(t,e){let i=t,n=!1;const r=(t.x+e.x)/2,s=(t.y+e.y)/2;do{i.y>s!=i.next.y>s&&i.next.y!==i.y&&r<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)&&(vo(t.prev,t,e.prev)||vo(t,e.prev,e))||bo(t,e)&&vo(t.prev,t,t.next)>0&&vo(e.prev,e,e.next)>0)}function vo(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function bo(t,e){return t.x===e.x&&t.y===e.y}function Mo(t,e,i,n){const r=_o(vo(t,e,i)),s=_o(vo(t,e,n)),o=_o(vo(i,n,t)),a=_o(vo(i,n,e));return r!==s&&o!==a||!(0!==r||!wo(t,i,e))||!(0!==s||!wo(t,n,e))||!(0!==o||!wo(i,t,n))||!(0!==a||!wo(i,e,n))}function wo(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function _o(t){return t>0?1:t<0?-1:0}function So(t,e){return vo(t.prev,t,t.next)<0?vo(t,e,t.next)>=0&&vo(t,t.prev,e)>=0:vo(t,e,t.prev)<0||vo(t,t.next,e)<0}function To(t,e){const i=new Lo(t.i,t.x,t.y),n=new Lo(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,s.next=n,n.prev=s,n}function Eo(t,e,i,n){const r=new Lo(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function Ao(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Lo(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}eo.prototype=Object.assign(Object.create(Bs.prototype),{constructor:eo,add:function(t){this.curves.push(t)},closePath:function(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new Ys(e,t))},getPoint:function(t){const e=t*this.getLength(),i=this.getCurveLengths();let n=0;for(;n<i.length;){if(i[n]>=e){const t=i[n]-e,r=this.curves[n],s=r.getLength(),o=0===s?0:1-t/s;return r.getPointAt(o)}n++}return null},getLength:function(){const t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let i=0,n=this.curves.length;i<n;i++)e+=this.curves[i].getLength(),t.push(e);return this.cacheLengths=t,t},getSpacedPoints:function(t=40){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return this.autoClose&&e.push(e[0]),e},getPoints:function(t=12){const e=[];let i;for(let n=0,r=this.curves;n<r.length;n++){const s=r[n],o=s&&s.isEllipseCurve?2*t:s&&(s.isLineCurve||s.isLineCurve3)?1:s&&s.isSplineCurve?t*s.points.length:t,a=s.getPoints(o);for(let t=0;t<a.length;t++){const n=a[t];i&&i.equals(n)||(e.push(n),i=n)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e},copy:function(t){Bs.prototype.copy.call(this,t),this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){const i=t.curves[e];this.curves.push(i.clone())}return this.autoClose=t.autoClose,this},toJSON:function(){const t=Bs.prototype.toJSON.call(this);t.autoClose=this.autoClose,t.curves=[];for(let e=0,i=this.curves.length;e<i;e++){const i=this.curves[e];t.curves.push(i.toJSON())}return t},fromJSON:function(t){Bs.prototype.fromJSON.call(this,t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){const i=t.curves[e];this.curves.push((new to[i.type]).fromJSON(i))}return this}}),io.prototype=Object.assign(Object.create(eo.prototype),{constructor:io,setFromPoints:function(t){this.moveTo(t[0].x,t[0].y);for(let e=1,i=t.length;e<i;e++)this.lineTo(t[e].x,t[e].y);return this},moveTo:function(t,e){return this.currentPoint.set(t,e),this},lineTo:function(t,e){const i=new Ys(this.currentPoint.clone(),new s(t,e));return this.curves.push(i),this.currentPoint.set(t,e),this},quadraticCurveTo:function(t,e,i,n){const r=new Qs(this.currentPoint.clone(),new s(t,e),new s(i,n));return this.curves.push(r),this.currentPoint.set(i,n),this},bezierCurveTo:function(t,e,i,n,r,o){const a=new Xs(this.currentPoint.clone(),new s(t,e),new s(i,n),new s(r,o));return this.curves.push(a),this.currentPoint.set(r,o),this},splineThru:function(t){const e=new $s([this.currentPoint.clone()].concat(t));return this.curves.push(e),this.currentPoint.copy(t[t.length-1]),this},arc:function(t,e,i,n,r,s){const o=this.currentPoint.x,a=this.currentPoint.y;return this.absarc(t+o,e+a,i,n,r,s),this},absarc:function(t,e,i,n,r,s){return this.absellipse(t,e,i,i,n,r,s),this},ellipse:function(t,e,i,n,r,s,o,a){const h=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(t+h,e+l,i,n,r,s,o,a),this},absellipse:function(t,e,i,n,r,s,o,a){const h=new Fs(t,e,i,n,r,s,o,a);if(this.curves.length>0){const t=h.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(h);const l=h.getPoint(1);return this.currentPoint.copy(l),this},copy:function(t){return eo.prototype.copy.call(this,t),this.currentPoint.copy(t.currentPoint),this},toJSON:function(){const t=eo.prototype.toJSON.call(this);return t.currentPoint=this.currentPoint.toArray(),t},fromJSON:function(t){return eo.prototype.fromJSON.call(this,t),this.currentPoint.fromArray(t.currentPoint),this}}),no.prototype=Object.assign(Object.create(io.prototype),{constructor:no,getPointsHoles:function(t){const e=[];for(let i=0,n=this.holes.length;i<n;i++)e[i]=this.holes[i].getPoints(t);return e},extractPoints:function(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}},copy:function(t){io.prototype.copy.call(this,t),this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){const i=t.holes[e];this.holes.push(i.clone())}return this},toJSON:function(){const t=io.prototype.toJSON.call(this);t.uuid=this.uuid,t.holes=[];for(let e=0,i=this.holes.length;e<i;e++){const i=this.holes[e];t.holes.push(i.toJSON())}return t},fromJSON:function(t){io.prototype.fromJSON.call(this,t),this.uuid=t.uuid,this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){const i=t.holes[e];this.holes.push((new io).fromJSON(i))}return this}});const Ro={area:function(t){const e=t.length;let i=0;for(let n=e-1,r=0;r<e;n=r++)i+=t[n].x*t[r].y-t[r].x*t[n].y;return.5*i},isClockWise:function(t){return Ro.area(t)<0},triangulateShape:function(t,e){const i=[],n=[],r=[];Po(t),Co(i,t);let s=t.length;e.forEach(Po);for(let t=0;t<e.length;t++)n.push(s),s+=e[t].length,Co(i,e[t]);const o=function(t,e,i){i=i||2;const n=e&&e.length,r=n?e[0]*i:t.length;let s=ro(t,0,r,i,!0);const o=[];if(!s||s.next===s.prev)return o;let a,h,l,c,u,p,d;if(n&&(s=function(t,e,i,n){const r=[];let s,o,a,h,l;for(s=0,o=e.length;s<o;s++)a=e[s]*n,h=s<o-1?e[s+1]*n:t.length,l=ro(t,a,h,n,!1),l===l.next&&(l.steiner=!0),r.push(go(l));for(r.sort(uo),s=0;s<r.length;s++)po(r[s],i),i=so(i,i.next);return i}(t,e,s,i)),t.length>80*i){a=l=t[0],h=c=t[1];for(let e=i;e<r;e+=i)u=t[e],p=t[e+1],u<a&&(a=u),p<h&&(h=p),u>l&&(l=u),p>c&&(c=p);d=Math.max(l-a,c-h),d=0!==d?1/d:0}return oo(s,o,i,a,h,d),o}(i,n);for(let t=0;t<o.length;t+=3)r.push(o.slice(t,t+3));return r}};function Po(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function Co(t,e){for(let i=0;i<e.length;i++)t.push(e[i].x),t.push(e[i].y)}function Oo(){this.type="ShapePath",this.color=new et,this.subPaths=[],this.currentPath=null}function zo(t){this.type="Font",this.data=t}function No(t,e,i,n,r){const s=r.glyphs[t]||r.glyphs["?"];if(!s)return void console.error('THREE.Font: character "'+t+'" does not exists in font family '+r.familyName+".");const o=new Oo;let a,h,l,c,u,p,d,m;if(s.o){const t=s._cachedOutline||(s._cachedOutline=s.o.split(" "));for(let r=0,s=t.length;r<s;)switch(t[r++]){case"m":a=t[r++]*e+i,h=t[r++]*e+n,o.moveTo(a,h);break;case"l":a=t[r++]*e+i,h=t[r++]*e+n,o.lineTo(a,h);break;case"q":l=t[r++]*e+i,c=t[r++]*e+n,u=t[r++]*e+i,p=t[r++]*e+n,o.quadraticCurveTo(u,p,l,c);break;case"b":l=t[r++]*e+i,c=t[r++]*e+n,u=t[r++]*e+i,p=t[r++]*e+n,d=t[r++]*e+i,m=t[r++]*e+n,o.bezierCurveTo(u,p,d,m,l,c)}}return{offsetX:s.ha*e,path:o}}Object.assign(Oo.prototype,{moveTo:function(t,e){return this.currentPath=new io,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this},lineTo:function(t,e){return this.currentPath.lineTo(t,e),this},quadraticCurveTo:function(t,e,i,n){return this.currentPath.quadraticCurveTo(t,e,i,n),this},bezierCurveTo:function(t,e,i,n,r,s){return this.currentPath.bezierCurveTo(t,e,i,n,r,s),this},splineThru:function(t){return this.currentPath.splineThru(t),this},toShapes:function(t,e){function i(t){const e=[];for(let i=0,n=t.length;i<n;i++){const n=t[i],r=new no;r.curves=n.curves,e.push(r)}return e}function n(t,e){const i=e.length;let n=!1;for(let r=i-1,s=0;s<i;r=s++){let i=e[r],o=e[s],a=o.x-i.x,h=o.y-i.y;if(Math.abs(h)>Number.EPSILON){if(h<0&&(i=e[s],a=-a,o=e[r],h=-h),t.y<i.y||t.y>o.y)continue;if(t.y===i.y){if(t.x===i.x)return!0}else{const e=h*(t.x-i.x)-a*(t.y-i.y);if(0===e)return!0;if(e<0)continue;n=!n}}else{if(t.y!==i.y)continue;if(o.x<=t.x&&t.x<=i.x||i.x<=t.x&&t.x<=o.x)return!0}}return n}const r=Ro.isClockWise,s=this.subPaths;if(0===s.length)return[];if(!0===e)return i(s);let o,a,h;const l=[];if(1===s.length)return a=s[0],h=new no,h.curves=a.curves,l.push(h),l;let c=!r(s[0].getPoints());c=t?!c:c;const u=[],p=[];let d,m,f=[],g=0;p[g]=void 0,f[g]=[];for(let e=0,i=s.length;e<i;e++)a=s[e],d=a.getPoints(),o=r(d),o=t?!o:o,o?(!c&&p[g]&&g++,p[g]={s:new no,p:d},p[g].s.curves=a.curves,c&&g++,f[g]=[]):f[g].push({h:a,p:d[0]});if(!p[0])return i(s);if(p.length>1){let t=!1;const e=[];for(let t=0,e=p.length;t<e;t++)u[t]=[];for(let i=0,r=p.length;i<r;i++){const r=f[i];for(let s=0;s<r.length;s++){const o=r[s];let a=!0;for(let r=0;r<p.length;r++)n(o.p,p[r].p)&&(i!==r&&e.push({froms:i,tos:r,hole:s}),a?(a=!1,u[r].push(o)):t=!0);a&&u[i].push(o)}}e.length>0&&(t||(f=u))}for(let t=0,e=p.length;t<e;t++){h=p[t].s,l.push(h),m=f[t];for(let t=0,e=m.length;t<e;t++)h.holes.push(m[t].h)}return l}}),Object.assign(zo.prototype,{isFont:!0,generateShapes:function(t,e=100){const i=[],n=function(t,e,i){const n=Array.from?Array.from(t):String(t).split(""),r=e/i.resolution,s=(i.boundingBox.yMax-i.boundingBox.yMin+i.underlineThickness)*r,o=[];let a=0,h=0;for(let t=0;t<n.length;t++){const e=n[t];if("\n"===e)a=0,h-=s;else{const t=No(e,r,a,h,i);a+=t.offsetX,o.push(t.path)}}return o}(t,e,this.data);for(let t=0,e=n.length;t<e;t++)Array.prototype.push.apply(i,n[t].toShapes());return i}});const Bo={};function Fo(t){Cs.call(this,t)}function Do(t){Cs.call(this,t)}Fo.prototype=Object.assign(Object.create(Cs.prototype),{constructor:Fo,load:function(t,e,i,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,s=Ls.get(t);if(void 0!==s)return r.manager.itemStart(t),setTimeout((function(){e&&e(s),r.manager.itemEnd(t)}),0),s;if(void 0!==Bo[t])return void Bo[t].push({onLoad:e,onProgress:i,onError:n});const o=t.match(/^data:(.*?)(;base64)?,(.*)$/);let a;if(o){const i=o[1],s=!!o[2];let a=o[3];a=decodeURIComponent(a),s&&(a=atob(a));try{let n;const s=(this.responseType||"").toLowerCase();switch(s){case"arraybuffer":case"blob":const t=new Uint8Array(a.length);for(let e=0;e<a.length;e++)t[e]=a.charCodeAt(e);n="blob"===s?new Blob([t.buffer],{type:i}):t.buffer;break;case"document":const e=new DOMParser;n=e.parseFromString(a,i);break;case"json":n=JSON.parse(a);break;default:n=a}setTimeout((function(){e&&e(n),r.manager.itemEnd(t)}),0)}catch(e){setTimeout((function(){n&&n(e),r.manager.itemError(t),r.manager.itemEnd(t)}),0)}}else{Bo[t]=[],Bo[t].push({onLoad:e,onProgress:i,onError:n}),a=new XMLHttpRequest,a.open("GET",t,!0),a.addEventListener("load",(function(e){const i=this.response,n=Bo[t];if(delete Bo[t],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),Ls.add(t,i);for(let t=0,e=n.length;t<e;t++){const e=n[t];e.onLoad&&e.onLoad(i)}r.manager.itemEnd(t)}else{for(let t=0,i=n.length;t<i;t++){const i=n[t];i.onError&&i.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)}}),!1),a.addEventListener("progress",(function(e){const i=Bo[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onProgress&&n.onProgress(e)}}),!1),a.addEventListener("error",(function(e){const i=Bo[t];delete Bo[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onError&&n.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)}),!1),a.addEventListener("abort",(function(e){const i=Bo[t];delete Bo[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onError&&n.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)}),!1),void 0!==this.responseType&&(a.responseType=this.responseType),void 0!==this.withCredentials&&(a.withCredentials=this.withCredentials),a.overrideMimeType&&a.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain");for(const t in this.requestHeader)a.setRequestHeader(t,this.requestHeader[t]);a.send(null)}return r.manager.itemStart(t),a},setResponseType:function(t){return this.responseType=t,this},setMimeType:function(t){return this.mimeType=t,this}}),Do.prototype=Object.assign(Object.create(Cs.prototype),{constructor:Do,load:function(t,e,i,n){const r=this,s=new Fo(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(r.withCredentials),s.load(t,(function(t){let i;try{i=JSON.parse(t)}catch(e){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),i=JSON.parse(t.substring(65,t.length-2))}const n=r.parse(i);e&&e(n)}),i,n)},parse:function(t){return new zo(t)}});class Go extends jt{constructor(t,e){super(),this.type="ExtrudeBufferGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];const i=this,n=[],r=[];for(let e=0,i=t.length;e<i;e++)o(t[e]);function o(t){const o=[],a=void 0!==e.curveSegments?e.curveSegments:12,h=void 0!==e.steps?e.steps:1;let l=void 0!==e.depth?e.depth:100,c=void 0===e.bevelEnabled||e.bevelEnabled,u=void 0!==e.bevelThickness?e.bevelThickness:6,p=void 0!==e.bevelSize?e.bevelSize:u-2,m=void 0!==e.bevelOffset?e.bevelOffset:0,f=void 0!==e.bevelSegments?e.bevelSegments:3;const g=e.extrudePath,y=void 0!==e.UVGenerator?e.UVGenerator:Io;void 0!==e.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),l=e.amount);let x,v,b,M,w,_=!1;g&&(x=g.getSpacedPoints(h),_=!0,c=!1,v=g.computeFrenetFrames(h,!1),b=new d,M=new d,w=new d),c||(f=0,u=0,p=0,m=0);const S=t.extractPoints(a);let T=S.shape;const E=S.holes;if(!Ro.isClockWise(T)){T=T.reverse();for(let t=0,e=E.length;t<e;t++){const e=E[t];Ro.isClockWise(e)&&(E[t]=e.reverse())}}const A=Ro.triangulateShape(T,E),L=T;for(let t=0,e=E.length;t<e;t++){const e=E[t];T=T.concat(e)}function R(t,e,i){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(i).add(t)}const P=T.length,C=A.length;function O(t,e,i){let n,r,o;const a=t.x-e.x,h=t.y-e.y,l=i.x-t.x,c=i.y-t.y,u=a*a+h*h,p=a*c-h*l;if(Math.abs(p)>Number.EPSILON){const p=Math.sqrt(u),d=Math.sqrt(l*l+c*c),m=e.x-h/p,f=e.y+a/p,g=((i.x-c/d-m)*c-(i.y+l/d-f)*l)/(a*c-h*l);n=m+a*g-t.x,r=f+h*g-t.y;const y=n*n+r*r;if(y<=2)return new s(n,r);o=Math.sqrt(y/2)}else{let t=!1;a>Number.EPSILON?l>Number.EPSILON&&(t=!0):a<-Number.EPSILON?l<-Number.EPSILON&&(t=!0):Math.sign(h)===Math.sign(c)&&(t=!0),t?(n=-h,r=a,o=Math.sqrt(u)):(n=a,r=h,o=Math.sqrt(u/2))}return new s(n/o,r/o)}const z=[];for(let t=0,e=L.length,i=e-1,n=t+1;t<e;t++,i++,n++)i===e&&(i=0),n===e&&(n=0),z[t]=O(L[t],L[i],L[n]);const N=[];let B,F=z.concat();for(let t=0,e=E.length;t<e;t++){const e=E[t];B=[];for(let t=0,i=e.length,n=i-1,r=t+1;t<i;t++,n++,r++)n===i&&(n=0),r===i&&(r=0),B[t]=O(e[t],e[n],e[r]);N.push(B),F=F.concat(B)}for(let t=0;t<f;t++){const e=t/f,i=u*Math.cos(e*Math.PI/2),n=p*Math.sin(e*Math.PI/2)+m;for(let t=0,e=L.length;t<e;t++){const e=R(L[t],z[t],n);I(e.x,e.y,-i)}for(let t=0,e=E.length;t<e;t++){const e=E[t];B=N[t];for(let t=0,r=e.length;t<r;t++){const r=R(e[t],B[t],n);I(r.x,r.y,-i)}}}const D=p+m;for(let t=0;t<P;t++){const e=c?R(T[t],F[t],D):T[t];_?(M.copy(v.normals[0]).multiplyScalar(e.x),b.copy(v.binormals[0]).multiplyScalar(e.y),w.copy(x[0]).add(M).add(b),I(w.x,w.y,w.z)):I(e.x,e.y,0)}for(let t=1;t<=h;t++)for(let e=0;e<P;e++){const i=c?R(T[e],F[e],D):T[e];_?(M.copy(v.normals[t]).multiplyScalar(i.x),b.copy(v.binormals[t]).multiplyScalar(i.y),w.copy(x[t]).add(M).add(b),I(w.x,w.y,w.z)):I(i.x,i.y,l/h*t)}for(let t=f-1;t>=0;t--){const e=t/f,i=u*Math.cos(e*Math.PI/2),n=p*Math.sin(e*Math.PI/2)+m;for(let t=0,e=L.length;t<e;t++){const e=R(L[t],z[t],n);I(e.x,e.y,l+i)}for(let t=0,e=E.length;t<e;t++){const e=E[t];B=N[t];for(let t=0,r=e.length;t<r;t++){const r=R(e[t],B[t],n);_?I(r.x,r.y+x[h-1].y,x[h-1].x+i):I(r.x,r.y,l+i)}}}function G(t,e){let i=t.length;for(;--i>=0;){const n=i;let r=i-1;r<0&&(r=t.length-1);for(let t=0,i=h+2*f;t<i;t++){const i=P*t,s=P*(t+1);U(e+n+i,e+r+i,e+r+s,e+n+s)}}}function I(t,e,i){o.push(t),o.push(e),o.push(i)}function k(t,e,r){V(t),V(e),V(r);const s=n.length/3,o=y.generateTopUV(i,n,s-3,s-2,s-1);W(o[0]),W(o[1]),W(o[2])}function U(t,e,r,s){V(t),V(e),V(s),V(e),V(r),V(s);const o=n.length/3,a=y.generateSideWallUV(i,n,o-6,o-3,o-2,o-1);W(a[0]),W(a[1]),W(a[3]),W(a[1]),W(a[2]),W(a[3])}function V(t){n.push(o[3*t+0]),n.push(o[3*t+1]),n.push(o[3*t+2])}function W(t){r.push(t.x),r.push(t.y)}!function(){const t=n.length/3;if(c){let t=0,e=P*t;for(let t=0;t<C;t++){const i=A[t];k(i[2]+e,i[1]+e,i[0]+e)}t=h+2*f,e=P*t;for(let t=0;t<C;t++){const i=A[t];k(i[0]+e,i[1]+e,i[2]+e)}}else{for(let t=0;t<C;t++){const e=A[t];k(e[2],e[1],e[0])}for(let t=0;t<C;t++){const e=A[t];k(e[0]+P*h,e[1]+P*h,e[2]+P*h)}}i.addGroup(t,n.length/3-t,0)}(),function(){const t=n.length/3;let e=0;G(L,e),e+=L.length;for(let t=0,i=E.length;t<i;t++){const i=E[t];G(i,e),e+=i.length}i.addGroup(t,n.length/3-t,1)}()}this.setAttribute("position",new ft(n,3)),this.setAttribute("uv",new ft(r,2)),this.computeVertexNormals()}toJSON(){const t=jt.prototype.toJSON.call(this);return function(t,e,i){if(i.shapes=[],Array.isArray(t))for(let e=0,n=t.length;e<n;e++){const n=t[e];i.shapes.push(n.uuid)}else i.shapes.push(t.uuid);return void 0!==e.extrudePath&&(i.options.extrudePath=e.extrudePath.toJSON()),i}(this.parameters.shapes,this.parameters.options,t)}}const Io={generateTopUV:function(t,e,i,n,r){const o=e[3*i],a=e[3*i+1],h=e[3*n],l=e[3*n+1],c=e[3*r],u=e[3*r+1];return[new s(o,a),new s(h,l),new s(c,u)]},generateSideWallUV:function(t,e,i,n,r,o){const a=e[3*i],h=e[3*i+1],l=e[3*i+2],c=e[3*n],u=e[3*n+1],p=e[3*n+2],d=e[3*r],m=e[3*r+1],f=e[3*r+2],g=e[3*o],y=e[3*o+1],x=e[3*o+2];return Math.abs(h-u)<.01?[new s(a,1-l),new s(c,1-p),new s(d,1-f),new s(g,1-x)]:[new s(h,1-l),new s(u,1-p),new s(m,1-f),new s(y,1-x)]}};class ko extends Go{constructor(t,e={}){const i=e.font;if(!i||!i.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new jt;const n=i.generateShapes(t,e.size);e.depth=void 0!==e.height?e.height:50,void 0===e.bevelThickness&&(e.bevelThickness=10),void 0===e.bevelSize&&(e.bevelSize=8),void 0===e.bevelEnabled&&(e.bevelEnabled=!1),super(n,e),this.type="TextBufferGeometry"}}function Uo(t){Jt.call(this),this.type="MeshPhongMaterial",this.color=new et(16777215),this.specular=new et(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new et(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new s(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}Uo.prototype=Object.create(Jt.prototype),Uo.prototype.constructor=Uo,Uo.prototype.isMeshPhongMaterial=!0,Uo.prototype.copy=function(t){return Jt.prototype.copy.call(this,t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this};class Vo{constructor(t){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}clone(){return new Vo(void 0===this.value.clone?this.value:this.value.clone())}}function Wo(t,e,i){Gi.call(this,t,e,i),this.samples=4}Wo.prototype=Object.assign(Object.create(Gi.prototype),{constructor:Wo,isWebGLMultisampleRenderTarget:!0,copy:function(t){return Gi.prototype.copy.call(this,t),this.samples=t.samples,this}});class jo extends jt{constructor(t=1,e=8,i=6,n=0,r=2*Math.PI,s=0,o=Math.PI){super(),this.type="SphereBufferGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:n,phiLength:r,thetaStart:s,thetaLength:o},e=Math.max(3,Math.floor(e)),i=Math.max(2,Math.floor(i));const a=Math.min(s+o,Math.PI);let h=0;const l=[],c=new d,u=new d,p=[],m=[],f=[],g=[];for(let p=0;p<=i;p++){const d=[],y=p/i;let x=0;0==p&&0==s?x=.5/e:p==i&&a==Math.PI&&(x=-.5/e);for(let i=0;i<=e;i++){const a=i/e;c.x=-t*Math.cos(n+a*r)*Math.sin(s+y*o),c.y=t*Math.cos(s+y*o),c.z=t*Math.sin(n+a*r)*Math.sin(s+y*o),m.push(c.x,c.y,c.z),u.copy(c).normalize(),f.push(u.x,u.y,u.z),g.push(a+x,1-y),d.push(h++)}l.push(d)}for(let t=0;t<i;t++)for(let n=0;n<e;n++){const e=l[t][n+1],r=l[t][n],o=l[t+1][n],h=l[t+1][n+1];(0!==t||s>0)&&p.push(e,r,h),(t!==i-1||a<Math.PI)&&p.push(r,o,h)}this.setIndex(p),this.setAttribute("position",new ft(m,3)),this.setAttribute("normal",new ft(f,3)),this.setAttribute("uv",new ft(g,2))}}function Ho(){ws.call(this,new ki(50,1,.5,500)),this.focus=1}function qo(t,e,i,n,r,s){Ms.call(this,t,e),this.type="SpotLight",this.position.copy(Bt.DefaultUp),this.updateMatrix(),this.target=new Bt,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(t){this.intensity=t/Math.PI}}),this.distance=void 0!==i?i:0,this.angle=void 0!==n?n:Math.PI/3,this.penumbra=void 0!==r?r:0,this.decay=void 0!==s?s:1,this.shadow=new Ho}Ho.prototype=Object.assign(Object.create(ws.prototype),{constructor:Ho,isSpotLightShadow:!0,updateMatrices:function(t){const e=this.camera,i=2*n.RAD2DEG*t.angle*this.focus,r=this.mapSize.width/this.mapSize.height,s=t.distance||e.far;i===e.fov&&r===e.aspect&&s===e.far||(e.fov=i,e.aspect=r,e.far=s,e.updateProjectionMatrix()),ws.prototype.updateMatrices.call(this,t)}}),qo.prototype=Object.assign(Object.create(Ms.prototype),{constructor:qo,isSpotLight:!0,copy:function(t){return Ms.prototype.copy.call(this,t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}});const Xo={decodeText:function(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let i=0,n=t.length;i<n;i++)e+=String.fromCharCode(t[i]);try{return decodeURIComponent(escape(e))}catch(t){return e}},extractUrlBase:function(t){const e=t.lastIndexOf("/");return-1===e?"./":t.substr(0,e+1)}};function Jo(t){Cs.call(this,t)}Jo.prototype=Object.assign(Object.create(Cs.prototype),{constructor:Jo,load:function(t,e,i,n){const r=this,s=new u,o=new Fo(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(r.withCredentials),o.load(t,(function(t){const i=r.parse(t);i&&(void 0!==i.image?s.image=i.image:void 0!==i.data&&(s.image.width=i.width,s.image.height=i.height,s.image.data=i.data),s.wrapS=void 0!==i.wrapS?i.wrapS:1001,s.wrapT=void 0!==i.wrapT?i.wrapT:1001,s.magFilter=void 0!==i.magFilter?i.magFilter:1006,s.minFilter=void 0!==i.minFilter?i.minFilter:1006,s.anisotropy=void 0!==i.anisotropy?i.anisotropy:1,void 0!==i.format&&(s.format=i.format),void 0!==i.type&&(s.type=i.type),void 0!==i.mipmaps&&(s.mipmaps=i.mipmaps,s.minFilter=1008),1===i.mipmapCount&&(s.minFilter=1006),s.needsUpdate=!0,e&&e(s,i))}),i,n),s}});const Yo={arraySlice:function(t,e,i){return Yo.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==i?i:t.length)):t.slice(e,i)},convertArray:function(t,e,i){return!t||!i&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){const e=t.length,i=new Array(e);for(let t=0;t!==e;++t)i[t]=t;return i.sort((function(e,i){return t[e]-t[i]})),i},sortedArray:function(t,e,i){const n=t.length,r=new t.constructor(n);for(let s=0,o=0;o!==n;++s){const n=i[s]*e;for(let i=0;i!==e;++i)r[o++]=t[n+i]}return r},flattenJSON:function(t,e,i,n){let r=1,s=t[0];for(;void 0!==s&&void 0===s[n];)s=t[r++];if(void 0===s)return;let o=s[n];if(void 0!==o)if(Array.isArray(o))do{o=s[n],void 0!==o&&(e.push(s.time),i.push.apply(i,o)),s=t[r++]}while(void 0!==s);else if(void 0!==o.toArray)do{o=s[n],void 0!==o&&(e.push(s.time),o.toArray(i,i.length)),s=t[r++]}while(void 0!==s);else do{o=s[n],void 0!==o&&(e.push(s.time),i.push(o)),s=t[r++]}while(void 0!==s)},subclip:function(t,e,i,n,r=30){const s=t.clone();s.name=e;const o=[];for(let t=0;t<s.tracks.length;++t){const e=s.tracks[t],a=e.getValueSize(),h=[],l=[];for(let t=0;t<e.times.length;++t){const s=e.times[t]*r;if(!(s<i||s>=n)){h.push(e.times[t]);for(let i=0;i<a;++i)l.push(e.values[t*a+i])}}0!==h.length&&(e.times=Yo.convertArray(h,e.times.constructor),e.values=Yo.convertArray(l,e.values.constructor),o.push(e))}s.tracks=o;let a=1/0;for(let t=0;t<s.tracks.length;++t)a>s.tracks[t].times[0]&&(a=s.tracks[t].times[0]);for(let t=0;t<s.tracks.length;++t)s.tracks[t].shift(-1*a);return s.resetDuration(),s},makeClipAdditive:function(t,e=0,i=t,n=30){n<=0&&(n=30);const r=i.tracks.length,s=e/n;for(let e=0;e<r;++e){const n=i.tracks[e],r=n.ValueTypeName;if("bool"===r||"string"===r)continue;const o=t.tracks.find((function(t){return t.name===n.name&&t.ValueTypeName===r}));if(void 0===o)continue;let a=0;const h=n.getValueSize();n.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(a=h/3);let l=0;const c=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(l=c/3);const u=n.times.length-1;let d;if(s<=n.times[0]){const t=a,e=h-a;d=Yo.arraySlice(n.values,t,e)}else if(s>=n.times[u]){const t=u*h+a,e=t+h-a;d=Yo.arraySlice(n.values,t,e)}else{const t=n.createInterpolant(),e=a,i=h-a;t.evaluate(s),d=Yo.arraySlice(t.resultBuffer,e,i)}"quaternion"===r&&(new p).fromArray(d).normalize().conjugate().toArray(d);const m=o.times.length;for(let t=0;t<m;++t){const e=t*c+l;if("quaternion"===r)p.multiplyQuaternionsFlat(o.values,e,d,0,o.values,e);else{const t=c-2*l;for(let i=0;i<t;++i)o.values[e+i]-=d[i]}}}return t.blendMode=2501,t}};function Zo(t,e,i,n){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==n?n:new e.constructor(i),this.sampleValues=e,this.valueSize=i}function Qo(t,e,i,n){Zo.call(this,t,e,i,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Ko(t,e,i,n){Zo.call(this,t,e,i,n)}function $o(t,e,i,n){Zo.call(this,t,e,i,n)}function ta(t,e,i,n){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Yo.convertArray(e,this.TimeBufferType),this.values=Yo.convertArray(i,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}function ea(t,e,i){ta.call(this,t,e,i)}function ia(t,e,i,n){ta.call(this,t,e,i,n)}function na(t,e,i,n){ta.call(this,t,e,i,n)}function ra(t,e,i,n){Zo.call(this,t,e,i,n)}function sa(t,e,i,n){ta.call(this,t,e,i,n)}function oa(t,e,i,n){ta.call(this,t,e,i,n)}function aa(t,e,i,n){ta.call(this,t,e,i,n)}function ha(t,e=-1,i,r=2500){this.name=t,this.tracks=i,this.duration=e,this.blendMode=r,this.uuid=n.generateUUID(),this.duration<0&&this.resetDuration()}function la(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return na;case"vector":case"vector2":case"vector3":case"vector4":return aa;case"color":return ia;case"quaternion":return sa;case"bool":case"boolean":return ea;case"string":return oa}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){const e=[],i=[];Yo.flattenJSON(t.keys,e,i,"value"),t.times=e,t.values=i}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}Object.assign(Zo.prototype,{evaluate:function(t){const e=this.parameterPositions;let i=this._cachedIndex,n=e[i],r=e[i-1];t:{e:{let s;i:{n:if(!(t<n)){for(let s=i+2;;){if(void 0===n){if(t<r)break n;return i=e.length,this._cachedIndex=i,this.afterEnd_(i-1,t,r)}if(i===s)break;if(r=n,n=e[++i],t<n)break e}s=e.length;break i}if(t>=r)break t;{const o=e[1];t<o&&(i=2,r=o);for(let s=i-2;;){if(void 0===r)return this._cachedIndex=0,this.beforeStart_(0,t,n);if(i===s)break;if(n=r,r=e[--i-1],t>=r)break e}s=i,i=0}}for(;i<s;){const n=i+s>>>1;t<e[n]?s=n:i=n+1}if(n=e[i],r=e[i-1],void 0===r)return this._cachedIndex=0,this.beforeStart_(0,t,n);if(void 0===n)return i=e.length,this._cachedIndex=i,this.afterEnd_(i-1,r,t)}this._cachedIndex=i,this.intervalChanged_(i,r,n)}return this.interpolate_(i,r,t,n)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(t){const e=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=t*n;for(let t=0;t!==n;++t)e[t]=i[r+t];return e},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}}),Object.assign(Zo.prototype,{beforeStart_:Zo.prototype.copySampleValue_,afterEnd_:Zo.prototype.copySampleValue_}),Qo.prototype=Object.assign(Object.create(Zo.prototype),{constructor:Qo,DefaultSettings_:{endingStart:2400,endingEnd:2400},intervalChanged_:function(t,e,i){const n=this.parameterPositions;let r=t-2,s=t+1,o=n[r],a=n[s];if(void 0===o)switch(this.getSettings_().endingStart){case 2401:r=t,o=2*e-i;break;case 2402:r=n.length-2,o=e+n[r]-n[r+1];break;default:r=t,o=i}if(void 0===a)switch(this.getSettings_().endingEnd){case 2401:s=t,a=2*i-e;break;case 2402:s=1,a=i+n[1]-n[0];break;default:s=t-1,a=e}const h=.5*(i-e),l=this.valueSize;this._weightPrev=h/(e-o),this._weightNext=h/(a-i),this._offsetPrev=r*l,this._offsetNext=s*l},interpolate_:function(t,e,i,n){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=t*o,h=a-o,l=this._offsetPrev,c=this._offsetNext,u=this._weightPrev,p=this._weightNext,d=(i-e)/(n-e),m=d*d,f=m*d,g=-u*f+2*u*m-u*d,y=(1+u)*f+(-1.5-2*u)*m+(-.5+u)*d+1,x=(-1-p)*f+(1.5+p)*m+.5*d,v=p*f-p*m;for(let t=0;t!==o;++t)r[t]=g*s[l+t]+y*s[h+t]+x*s[a+t]+v*s[c+t];return r}}),Ko.prototype=Object.assign(Object.create(Zo.prototype),{constructor:Ko,interpolate_:function(t,e,i,n){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=t*o,h=a-o,l=(i-e)/(n-e),c=1-l;for(let t=0;t!==o;++t)r[t]=s[h+t]*c+s[a+t]*l;return r}}),$o.prototype=Object.assign(Object.create(Zo.prototype),{constructor:$o,interpolate_:function(t){return this.copySampleValue_(t-1)}}),Object.assign(ta,{toJSON:function(t){const e=t.constructor;let i;if(void 0!==e.toJSON)i=e.toJSON(t);else{i={name:t.name,times:Yo.convertArray(t.times,Array),values:Yo.convertArray(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(i.interpolation=e)}return i.type=t.ValueTypeName,i}}),Object.assign(ta.prototype,{constructor:ta,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:2301,InterpolantFactoryMethodDiscrete:function(t){return new $o(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodLinear:function(t){return new Ko(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:function(t){return new Qo(this.times,this.values,this.getValueSize(),t)},setInterpolation:function(t){let e;switch(t){case 2300:e=this.InterpolantFactoryMethodDiscrete;break;case 2301:e=this.InterpolantFactoryMethodLinear;break;case 2302:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){const e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",e),this}return this.createInterpolant=e,this},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}},getValueSize:function(){return this.values.length/this.times.length},shift:function(t){if(0!==t){const e=this.times;for(let i=0,n=e.length;i!==n;++i)e[i]+=t}return this},scale:function(t){if(1!==t){const e=this.times;for(let i=0,n=e.length;i!==n;++i)e[i]*=t}return this},trim:function(t,e){const i=this.times,n=i.length;let r=0,s=n-1;for(;r!==n&&i[r]<t;)++r;for(;-1!==s&&i[s]>e;)--s;if(++s,0!==r||s!==n){r>=s&&(s=Math.max(s,1),r=s-1);const t=this.getValueSize();this.times=Yo.arraySlice(i,r,s),this.values=Yo.arraySlice(this.values,r*t,s*t)}return this},validate:function(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const i=this.times,n=this.values,r=i.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let s=null;for(let e=0;e!==r;e++){const n=i[e];if("number"==typeof n&&isNaN(n)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,e,n),t=!1;break}if(null!==s&&s>n){console.error("THREE.KeyframeTrack: Out of order keys.",this,e,n,s),t=!1;break}s=n}if(void 0!==n&&Yo.isTypedArray(n))for(let e=0,i=n.length;e!==i;++e){const i=n[e];if(isNaN(i)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,e,i),t=!1;break}}return t},optimize:function(){const t=Yo.arraySlice(this.times),e=Yo.arraySlice(this.values),i=this.getValueSize(),n=2302===this.getInterpolation(),r=t.length-1;let s=1;for(let o=1;o<r;++o){let r=!1;const a=t[o];if(a!==t[o+1]&&(1!==o||a!==a[0]))if(n)r=!0;else{const t=o*i,n=t-i,s=t+i;for(let o=0;o!==i;++o){const i=e[t+o];if(i!==e[n+o]||i!==e[s+o]){r=!0;break}}}if(r){if(o!==s){t[s]=t[o];const n=o*i,r=s*i;for(let t=0;t!==i;++t)e[r+t]=e[n+t]}++s}}if(r>0){t[s]=t[r];for(let t=r*i,n=s*i,o=0;o!==i;++o)e[n+o]=e[t+o];++s}return s!==t.length?(this.times=Yo.arraySlice(t,0,s),this.values=Yo.arraySlice(e,0,s*i)):(this.times=t,this.values=e),this},clone:function(){const t=Yo.arraySlice(this.times,0),e=Yo.arraySlice(this.values,0),i=new(0,this.constructor)(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}),ea.prototype=Object.assign(Object.create(ta.prototype),{constructor:ea,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),ia.prototype=Object.assign(Object.create(ta.prototype),{constructor:ia,ValueTypeName:"color"}),na.prototype=Object.assign(Object.create(ta.prototype),{constructor:na,ValueTypeName:"number"}),ra.prototype=Object.assign(Object.create(Zo.prototype),{constructor:ra,interpolate_:function(t,e,i,n){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=(i-e)/(n-e);let h=t*o;for(let t=h+o;h!==t;h+=4)p.slerpFlat(r,0,s,h-o,s,h,a);return r}}),sa.prototype=Object.assign(Object.create(ta.prototype),{constructor:sa,ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(t){return new ra(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),oa.prototype=Object.assign(Object.create(ta.prototype),{constructor:oa,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),aa.prototype=Object.assign(Object.create(ta.prototype),{constructor:aa,ValueTypeName:"vector"}),Object.assign(ha,{parse:function(t){const e=[],i=t.tracks,n=1/(t.fps||1);for(let t=0,r=i.length;t!==r;++t)e.push(la(i[t]).scale(n));const r=new ha(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r},toJSON:function(t){const e=[],i=t.tracks,n={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let t=0,n=i.length;t!==n;++t)e.push(ta.toJSON(i[t]));return n},CreateFromMorphTargetSequence:function(t,e,i,n){const r=e.length,s=[];for(let t=0;t<r;t++){let o=[],a=[];o.push((t+r-1)%r,t,(t+1)%r),a.push(0,1,0);const h=Yo.getKeyframeOrder(o);o=Yo.sortedArray(o,1,h),a=Yo.sortedArray(a,1,h),n||0!==o[0]||(o.push(r),a.push(a[0])),s.push(new na(".morphTargetInfluences["+e[t].name+"]",o,a).scale(1/i))}return new ha(t,-1,s)},findByName:function(t,e){let i=t;if(!Array.isArray(t)){const e=t;i=e.geometry&&e.geometry.animations||e.animations}for(let t=0;t<i.length;t++)if(i[t].name===e)return i[t];return null},CreateClipsFromMorphTargetSequences:function(t,e,i){const n={},r=/^([\w-]*?)([\d]+)$/;for(let e=0,i=t.length;e<i;e++){const i=t[e],s=i.name.match(r);if(s&&s.length>1){const t=s[1];let e=n[t];e||(n[t]=e=[]),e.push(i)}}const s=[];for(const t in n)s.push(ha.CreateFromMorphTargetSequence(t,n[t],e,i));return s},parseAnimation:function(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(t,e,i,n,r){if(0!==i.length){const s=[],o=[];Yo.flattenJSON(i,s,o,n),0!==s.length&&r.push(new t(e,s,o))}},n=[],r=t.name||"default",s=t.fps||30,o=t.blendMode;let a=t.length||-1;const h=t.hierarchy||[];for(let t=0;t<h.length;t++){const r=h[t].keys;if(r&&0!==r.length)if(r[0].morphTargets){const t={};let e;for(e=0;e<r.length;e++)if(r[e].morphTargets)for(let i=0;i<r[e].morphTargets.length;i++)t[r[e].morphTargets[i]]=-1;for(const i in t){const t=[],s=[];for(let n=0;n!==r[e].morphTargets.length;++n){const n=r[e];t.push(n.time),s.push(n.morphTarget===i?1:0)}n.push(new na(".morphTargetInfluence["+i+"]",t,s))}a=t.length*(s||1)}else{const s=".bones["+e[t].name+"]";i(aa,s+".position",r,"pos",n),i(sa,s+".quaternion",r,"rot",n),i(aa,s+".scale",r,"scl",n)}}return 0===n.length?null:new ha(r,a,n,o)}}),Object.assign(ha.prototype,{resetDuration:function(){let t=0;for(let e=0,i=this.tracks.length;e!==i;++e){const i=this.tracks[e];t=Math.max(t,i.times[i.times.length-1])}return this.duration=t,this},trim:function(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this},validate:function(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t},optimize:function(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this},clone:function(){const t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new ha(this.name,this.duration,t,this.blendMode)},toJSON:function(){return ha.toJSON(this)}});const ca=new RegExp("[\\[\\]\\.:\\/]","g"),ua="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",pa=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),da=/(WCOD+)?/.source.replace("WCOD",ua),ma=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),fa=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),ga=new RegExp("^"+pa+da+ma+fa+"$"),ya=["material","materials","bones"];function xa(t,e,i){const n=i||va.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,n)}function va(t,e,i){this.path=e,this.parsedPath=i||va.parseTrackName(e),this.node=va.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}function ba(t){Jt.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new s(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Ma(t){te.call(this,t),this.type="RawShaderMaterial"}Object.assign(xa.prototype,{getValue:function(t,e){this.bind();const i=this._targetGroup.nCachedObjects_,n=this._bindings[i];void 0!==n&&n.getValue(t,e)},setValue:function(t,e){const i=this._bindings;for(let n=this._targetGroup.nCachedObjects_,r=i.length;n!==r;++n)i[n].setValue(t,e)},bind:function(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].bind()},unbind:function(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].unbind()}}),Object.assign(va,{Composite:xa,create:function(t,e,i){return t&&t.isAnimationObjectGroup?new va.Composite(t,e,i):new va(t,e,i)},sanitizeNodeName:function(t){return t.replace(/\s/g,"_").replace(ca,"")},parseTrackName:function(t){const e=ga.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const i={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},n=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==n&&-1!==n){const t=i.nodeName.substring(n+1);-1!==ya.indexOf(t)&&(i.nodeName=i.nodeName.substring(0,n),i.objectName=t)}if(null===i.propertyName||0===i.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return i},findNode:function(t,e){if(!e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const i=t.skeleton.getBoneByName(e);if(void 0!==i)return i}if(t.children){const i=function(t){for(let n=0;n<t.length;n++){const r=t[n];if(r.name===e||r.uuid===e)return r;const s=i(r.children);if(s)return s}return null},n=i(t.children);if(n)return n}return null}}),Object.assign(va.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(t,e){t[e]=this.node[this.propertyName]},function(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)t[e++]=i[n]},function(t,e){t[e]=this.resolvedProperty[this.propertyIndex]},function(t,e){this.resolvedProperty.toArray(t,e)}],SetterByBindingTypeAndVersioning:[[function(t,e){this.targetObject[this.propertyName]=t[e]},function(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=t[e++]},function(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=t[e++];this.targetObject.needsUpdate=!0},function(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty[this.propertyIndex]=t[e]},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty.fromArray(t,e)},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(t,e){this.bind(),this.getValue(t,e)},setValue:function(t,e){this.bind(),this.setValue(t,e)},bind:function(){let t=this.node;const e=this.parsedPath,i=e.objectName,n=e.propertyName;let r=e.propertyIndex;if(t||(t=va.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");if(i){let n=e.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(let e=0;e<t.length;e++)if(t[e].name===n){n=e;break}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!==n){if(void 0===t[n])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[n]}}const s=t[n];if(void 0===s){const i=e.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+i+"."+n+" but it wasn't found.",t)}let o=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?o=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(o=this.Versioning.MatrixWorldNeedsUpdate);let a=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===n){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.isBufferGeometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",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[r]&&(r=t.morphTargetDictionary[r])}a=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else void 0!==s.fromArray&&void 0!==s.toArray?(a=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(a=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=n;this.getValue=this.GetterByBindingType[a],this.setValue=this.SetterByBindingTypeAndVersioning[a][o]},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),Object.assign(va.prototype,{_getValue_unbound:va.prototype.getValue,_setValue_unbound:va.prototype.setValue}),ba.prototype=Object.create(Jt.prototype),ba.prototype.constructor=ba,ba.prototype.isMeshNormalMaterial=!0,ba.prototype.copy=function(t){return Jt.prototype.copy.call(this,t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Ma.prototype=Object.create(te.prototype),Ma.prototype.constructor=Ma,Ma.prototype.isRawShaderMaterial=!0;const wa=Math.pow(2,8),_a=[.125,.215,.35,.446,.526,.582],Sa=5+_a.length,Ta={3e3:0,3001:1,3002:2,3004:3,3005:4,3006:5,3007:6,3003:7},Ea=new _s,{_lodPlanes:Aa,_sizeLods:La,_sigmas:Ra}=function(){const t=[],e=[],i=[];let n=8;for(let r=0;r<Sa;r++){const s=Math.pow(2,n);e.push(s);let o=1/s;r>4?o=_a[r-8+4-1]:0==r&&(o=0),i.push(o);const a=1/(s-1),h=-a/2,l=1+a/2,c=[h,h,l,h,l,l,h,h,l,l,h,l],u=6,p=6,d=3,m=2,f=1,g=new Float32Array(d*p*u),y=new Float32Array(m*p*u),x=new Float32Array(f*p*u);for(let t=0;t<u;t++){const e=t%3*2/3-1,i=t>2?0:-1,n=[e,i,0,e+2/3,i,0,e+2/3,i+1,0,e,i,0,e+2/3,i+1,0,e,i+1,0];g.set(n,d*p*t),y.set(c,m*p*t);const r=[t,t,t,t,t,t];x.set(r,f*p*t)}const v=new jt;v.setAttribute("position",new ot(g,d)),v.setAttribute("uv",new ot(y,m)),v.setAttribute("faceIndex",new ot(x,f)),t.push(v),n>4&&n--}return{_lodPlanes:t,_sizeLods:e,_sigmas:i}}(),Pa=new et;let Ca=null;const Oa=(1+Math.sqrt(5))/2,za=1/Oa,Na=[new d(1,1,1),new d(-1,1,1),new d(1,1,-1),new d(-1,1,-1),new d(0,Oa,za),new d(0,Oa,-za),new d(za,0,Oa),new d(-za,0,Oa),new d(Oa,za,0),new d(-Oa,za,0)];function Ba(t){return void 0!==t&&1009===t.type&&(3e3===t.encoding||3001===t.encoding||3007===t.encoding)}function Fa(t){const e=new Gi(3*wa,3*wa,t);return e.texture.mapping=306,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function Da(t,e,i,n,r){t.viewport.set(e,i,n,r),t.scissor.set(e,i,n,r)}function Ga(){return new Ma({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:new s(1,1)},inputEncoding:{value:Ta[3e3]},outputEncoding:{value:Ta[3e3]}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\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 vec2 texelSize;\n\n\t\t\t\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include <encodings_pars_fragment>\n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else if ( inputEncoding == 6 ) {\n\n\t\t return LinearToLogLuv(value);\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else if ( outputEncoding == 6 ) {\n\n\t\t return LogLuvToLinear(value);\n\n\t\t\t}\n\n\t\t\telse {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tvec2 f = fract( uv / texelSize - 0.5 );\n\t\t\t\tuv -= f * texelSize;\n\t\t\t\tvec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x += texelSize.x;\n\t\t\t\tvec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.y += texelSize.y;\n\t\t\t\tvec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x -= texelSize.x;\n\t\t\t\tvec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\n\t\t\t\tvec3 tm = mix( tl, tr, f.x );\n\t\t\t\tvec3 bm = mix( bl, br, f.x );\n\t\t\t\tgl_FragColor.rgb = mix( tm, bm, f.y );\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function Ia(){return new Ma({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:Ta[3e3]},outputEncoding:{value:Ta[3e3]}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\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 samplerCube envMap;\n\n\t\t\t\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include <encodings_pars_fragment>\n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else if ( inputEncoding == 6 ) {\n\n\t\t return LinearToLogLuv(value);\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else if ( outputEncoding == 6 ) {\n\n\t\t return LogLuvToLinear(value);\n\n\t\t\t}\n\n\t\t\telse {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}class ka{constructor(t,e,i){Object.defineProperty(this,"isFog",{value:!0}),this.name="",this.color=new et(t),this.near=void 0!==e?e:1,this.far=void 0!==i?i:1e3}clone(){return new ka(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}function Ua(t,e,i,n){Ms.call(this,t,e),this.type="RectAreaLight",this.target=new Bt,this.width=void 0!==i?i:10,this.height=void 0!==n?n:10,this.areaTexture=null}return Ua.prototype=Object.assign(Object.create(Ms.prototype),{constructor:Ua,isRectAreaLight:!0,copy:function(t){return Ms.prototype.copy.call(this,t),this.width=t.width,this.height=t.height,this},toJSON:function(t){const e=Ms.prototype.toJSON.call(this,t);return e.object.width=this.width,e.object.height=this.height,e}}),t.ACESFilmicToneMapping=4,t.AddEquation=100,t.AddOperation=2,t.AdditiveAnimationBlendMode=2501,t.AdditiveBlending=2,t.AlphaFormat=1021,t.AlwaysDepth=1,t.AlwaysStencilFunc=519,t.AmbientLight=Es,t.AnimationClip=ha,t.AnimationUtils=Yo,t.ArrowHelper=class extends Bt{constructor(t,e,i,n,r,s){super(),this.type="ArrowHelper",void 0===t&&(t=new d(0,0,1)),void 0===e&&(e=new d(0,0,0)),void 0===i&&(i=1),void 0===n&&(n=16776960),void 0===r&&(r=.2*i),void 0===s&&(s=.2*r),void 0===ys&&(ys=new jt,ys.setAttribute("position",new ft([0,0,0,0,1,0],3)),xs=new Qr(0,.5,1,5,1),xs.translate(0,-.5,0)),this.position.copy(e),this.line=new hs(ys,new is({color:n,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Ie(xs,new Me({color:n,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(i,r,s)}setDirection(t){if(t.y>.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{gs.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(gs,e)}}setLength(t,e,i){void 0===e&&(e=.2*t),void 0===i&&(i=.2*e),this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(i,e,i),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}},t.BackSide=1,t.BasicDepthPacking=3200,t.BasicShadowMap=0,t.Box3=g,t.BoxBufferGeometry=Ht,t.BoxGeometry=class extends qr{constructor(t,e,i,n,r,s){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:n,heightSegments:r,depthSegments:s},this.fromBufferGeometry(new Ht(t,e,i,n,r,s)),this.mergeVertices()}},t.BufferAttribute=ot,t.BufferGeometry=jt,t.ByteType=1010,t.CineonToneMapping=3,t.ClampToEdgeWrapping=1001,t.Clock=class{constructor(t){this.autoStart=void 0===t||t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Kr(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const e=Kr();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}},t.Color=et,t.CubeReflectionMapping=301,t.CubeRefractionMapping=302,t.CubeTexture=Vi,t.CubeTextureLoader=Ns,t.CubeUVReflectionMapping=306,t.CubeUVRefractionMapping=307,t.CullFaceBack=1,t.CullFaceFront=2,t.CullFaceFrontBack=3,t.CullFaceNone=0,t.CustomBlending=5,t.CustomToneMapping=5,t.CylinderGeometry=class extends qr{constructor(t,e,i,n,r,s,o,a){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:i,radialSegments:n,heightSegments:r,openEnded:s,thetaStart:o,thetaLength:a},this.fromBufferGeometry(new Qr(t,e,i,n,r,s,o,a)),this.mergeVertices()}},t.DataTexture=u,t.DataTextureLoader=Jo,t.DecrementStencilOp=7683,t.DecrementWrapStencilOp=34056,t.DefaultLoadingManager=Ps,t.DepthFormat=1026,t.DepthStencilFormat=1027,t.DirectionalLight=Ts,t.DoubleSide=2,t.DstAlphaFactor=206,t.DstColorFactor=208,t.DynamicCopyUsage=35050,t.DynamicDrawUsage=35048,t.DynamicReadUsage=35049,t.EdgesGeometry=class extends jt{constructor(t,e){super(),this.type="EdgesGeometry",this.parameters={thresholdAngle:e},e=void 0!==e?e:1,t.isGeometry&&(t=(new jt).fromGeometry(t));const i=Math.pow(10,4),r=Math.cos(n.DEG2RAD*e),s=t.getIndex(),o=t.getAttribute("position"),a=s?s.count:o.count,h=[0,0,0],l=["a","b","c"],c=new Array(3),u={},p=[];for(let t=0;t<a;t+=3){s?(h[0]=s.getX(t),h[1]=s.getX(t+1),h[2]=s.getX(t+2)):(h[0]=t,h[1]=t+1,h[2]=t+2);const{a:e,b:n,c:a}=Zr;if(e.fromBufferAttribute(o,h[0]),n.fromBufferAttribute(o,h[1]),a.fromBufferAttribute(o,h[2]),Zr.getNormal(Yr),c[0]=`${Math.round(e.x*i)},${Math.round(e.y*i)},${Math.round(e.z*i)}`,c[1]=`${Math.round(n.x*i)},${Math.round(n.y*i)},${Math.round(n.z*i)}`,c[2]=`${Math.round(a.x*i)},${Math.round(a.y*i)},${Math.round(a.z*i)}`,c[0]!==c[1]&&c[1]!==c[2]&&c[2]!==c[0])for(let t=0;t<3;t++){const e=(t+1)%3,i=c[t],n=c[e],s=Zr[l[t]],o=Zr[l[e]],a=`${i}_${n}`,d=`${n}_${i}`;d in u&&u[d]?(Yr.dot(u[d].normal)<=r&&(p.push(s.x,s.y,s.z),p.push(o.x,o.y,o.z)),u[d]=null):a in u||(u[a]={index0:h[t],index1:h[e],normal:Yr.clone()})}}for(const t in u)if(u[t]){const{index0:e,index1:i}=u[t];Xr.fromBufferAttribute(o,e),Jr.fromBufferAttribute(o,i),p.push(Xr.x,Xr.y,Xr.z),p.push(Jr.x,Jr.y,Jr.z)}this.setAttribute("position",new ft(p,3))}},t.EqualDepth=4,t.EqualStencilFunc=514,t.EquirectangularReflectionMapping=303,t.EquirectangularRefractionMapping=304,t.Euler=xt,t.EventDispatcher=r,t.Face3=be,t.FileLoader=Fo,t.FlatShading=1,t.Float32BufferAttribute=ft,t.Float64BufferAttribute=gt,t.FloatType=1015,t.Fog=ka,t.FontLoader=Do,t.FrontSide=0,t.GLSL1="100",t.GLSL3="300 es",t.GammaEncoding=3007,t.Geometry=qr,t.GreaterDepth=6,t.GreaterEqualDepth=5,t.GreaterEqualStencilFunc=518,t.GreaterStencilFunc=516,t.Group=Gr,t.HalfFloatType=1016,t.HemisphereLight=As,t.IncrementStencilOp=7682,t.IncrementWrapStencilOp=34055,t.Int16BufferAttribute=ct,t.Int32BufferAttribute=pt,t.Int8BufferAttribute=at,t.IntType=1013,t.Interpolant=Zo,t.InterpolateDiscrete=2300,t.InterpolateLinear=2301,t.InterpolateSmooth=2302,t.InvertStencilOp=5386,t.KeepStencilOp=7680,t.Layers=Mt,t.LessDepth=2,t.LessEqualDepth=3,t.LessEqualStencilFunc=515,t.LessStencilFunc=513,t.Line=hs,t.Line3=class{constructor(t,e){this.start=void 0!==t?t:new d,this.end=void 0!==e?e:new d}set(t,e){return this.start.copy(t),this.end.copy(e),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return void 0===t&&(console.warn("THREE.Line3: .getCenter() target is now required"),t=new d),t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return void 0===t&&(console.warn("THREE.Line3: .delta() target is now required"),t=new d),t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return void 0===e&&(console.warn("THREE.Line3: .at() target is now required"),e=new d),this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){vs.subVectors(t,this.start),bs.subVectors(this.end,this.start);const i=bs.dot(bs);let r=bs.dot(vs)/i;return e&&(r=n.clamp(r,0,1)),r}closestPointToPoint(t,e,i){const n=this.closestPointToPointParameter(t,e);return void 0===i&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),i=new d),this.delta(i).multiplyScalar(n).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}},t.LineBasicMaterial=is,t.LineDashedMaterial=fs,t.LineSegments=us,t.LinearEncoding=3e3,t.LinearFilter=1006,t.LinearMipMapLinearFilter=1008,t.LinearMipMapNearestFilter=1007,t.LinearMipmapLinearFilter=1008,t.LinearMipmapNearestFilter=1007,t.LinearToneMapping=1,t.Loader=Cs,t.LoaderUtils=Xo,t.LoadingManager=Rs,t.LogLuvEncoding=3003,t.LoopOnce=2200,t.LoopPingPong=2202,t.LoopRepeat=2201,t.LuminanceAlphaFormat=1025,t.LuminanceFormat=1024,t.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},t.Material=Jt,t.MathUtils=n,t.Matrix4=k,t.MaxEquation=104,t.Mesh=Ie,t.MeshBasicMaterial=Me,t.MeshDepthMaterial=Rr,t.MeshNormalMaterial=ba,t.MeshPhongMaterial=Uo,t.MeshPhysicalMaterial=ds,t.MeshStandardMaterial=ps,t.MinEquation=103,t.MirroredRepeatWrapping=1002,t.MixOperation=1,t.MultiplyBlending=4,t.MultiplyOperation=0,t.NearestFilter=1003,t.NearestMipMapLinearFilter=1005,t.NearestMipMapNearestFilter=1004,t.NearestMipmapLinearFilter=1005,t.NearestMipmapNearestFilter=1004,t.NeverDepth=0,t.NeverStencilFunc=512,t.NoBlending=0,t.NoToneMapping=0,t.NormalAnimationBlendMode=2500,t.NormalBlending=1,t.NotEqualDepth=7,t.NotEqualStencilFunc=517,t.NumberKeyframeTrack=na,t.Object3D=Bt,t.ObjectSpaceNormalMap=1,t.OneFactor=201,t.OneMinusDstAlphaFactor=207,t.OneMinusDstColorFactor=209,t.OneMinusSrcAlphaFactor=205,t.OneMinusSrcColorFactor=203,t.OrthographicCamera=_s,t.PCFShadowMap=1,t.PCFSoftShadowMap=2,t.PMREMGenerator=class{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._blurMaterial=new Ma({name:"SphericalGaussianBlur",defines:{n:20},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:new Float32Array(20)},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:new d(0,1,0)},inputEncoding:{value:Ta[3e3]},outputEncoding:{value:Ta[3e3]}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\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\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include <encodings_pars_fragment>\n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else if ( inputEncoding == 6 ) {\n\n\t\t return LinearToLogLuv(value);\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else if ( outputEncoding == 6 ) {\n\n\t\t return LogLuvToLinear(value);\n\n\t\t\t}\n\n\t\t\telse {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t\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\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1}),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,i=.1,n=100){Ca=this._renderer.getRenderTarget();const r=this._allocateTargets();return this._sceneToCubeUV(t,i,n,r),e>0&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(t){return this._fromTexture(t)}fromCubemap(t){return this._fromTexture(t)}compileCubemapShader(){null===this._cubemapShader&&(this._cubemapShader=Ia(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){null===this._equirectShader&&(this._equirectShader=Ga(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(let t=0;t<Aa.length;t++)Aa[t].dispose()}_cleanup(t){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(Ca),t.scissorTest=!1,Da(t,0,0,t.width,t.height)}_fromTexture(t){Ca=this._renderer.getRenderTarget();const e=this._allocateTargets(t);return this._textureToCubeUV(t,e),this._applyPMREM(e),this._cleanup(e),e}_allocateTargets(t){const e={magFilter:1003,minFilter:1003,generateMipmaps:!1,type:1009,format:1023,encoding:Ba(t)?t.encoding:3002,depthBuffer:!1},i=Fa(e);return i.depthBuffer=!t,this._pingPongRenderTarget=Fa(e),i}_compileMaterial(t){const e=new Ie(Aa[0],t);this._renderer.compile(e,Ea)}_sceneToCubeUV(t,e,i,n){const r=new ki(90,1,e,i),s=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],a=this._renderer,h=a.outputEncoding,l=a.toneMapping;a.getClearColor(Pa);const c=a.getClearAlpha();a.toneMapping=0,a.outputEncoding=3e3;let u=t.background;if(u&&u.isColor){u.convertSRGBToLinear();const e=Math.max(u.r,u.g,u.b),i=Math.min(Math.max(Math.ceil(Math.log2(e)),-128),127);u=u.multiplyScalar(Math.pow(2,-i));const n=(i+128)/255;a.setClearColor(u,n),t.background=null}for(let e=0;e<6;e++){const i=e%3;0==i?(r.up.set(0,s[e],0),r.lookAt(o[e],0,0)):1==i?(r.up.set(0,0,s[e]),r.lookAt(0,o[e],0)):(r.up.set(0,s[e],0),r.lookAt(0,0,o[e])),Da(n,i*wa,e>2?wa:0,wa,wa),a.setRenderTarget(n),a.render(t,r)}a.toneMapping=l,a.outputEncoding=h,a.setClearColor(Pa,c)}_textureToCubeUV(t,e){const i=this._renderer;t.isCubeTexture?null==this._cubemapShader&&(this._cubemapShader=Ia()):null==this._equirectShader&&(this._equirectShader=Ga());const n=t.isCubeTexture?this._cubemapShader:this._equirectShader,r=new Ie(Aa[0],n),s=n.uniforms;s.envMap.value=t,t.isCubeTexture||s.texelSize.value.set(1/t.image.width,1/t.image.height),s.inputEncoding.value=Ta[t.encoding],s.outputEncoding.value=Ta[e.texture.encoding],Da(e,0,0,3*wa,2*wa),i.setRenderTarget(e),i.render(r,Ea)}_applyPMREM(t){const e=this._renderer,i=e.autoClear;e.autoClear=!1;for(let e=1;e<Sa;e++){const i=Math.sqrt(Ra[e]*Ra[e]-Ra[e-1]*Ra[e-1]),n=Na[(e-1)%Na.length];this._blur(t,e-1,e,i,n)}e.autoClear=i}_blur(t,e,i,n,r){const s=this._pingPongRenderTarget;this._halfBlur(t,s,e,i,n,"latitudinal",r),this._halfBlur(s,t,i,i,n,"longitudinal",r)}_halfBlur(t,e,i,n,r,s,o){const a=this._renderer,h=this._blurMaterial;"latitudinal"!==s&&"longitudinal"!==s&&console.error("blur direction must be either latitudinal or longitudinal!");const l=new Ie(Aa[n],h),c=h.uniforms,u=La[i]-1,p=isFinite(r)?Math.PI/(2*u):2*Math.PI/39,d=r/p,m=isFinite(r)?1+Math.floor(3*d):20;m>20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${m} samples when the maximum is set to 20`);const f=[];let g=0;for(let t=0;t<20;++t){const e=t/d,i=Math.exp(-e*e/2);f.push(i),0==t?g+=i:t<m&&(g+=2*i)}for(let t=0;t<f.length;t++)f[t]=f[t]/g;c.envMap.value=t.texture,c.samples.value=m,c.weights.value=f,c.latitudinal.value="latitudinal"===s,o&&(c.poleAxis.value=o),c.dTheta.value=p,c.mipInt.value=8-i,c.inputEncoding.value=Ta[t.texture.encoding],c.outputEncoding.value=Ta[t.texture.encoding];const y=La[n];Da(e,3*Math.max(0,wa-2*y),(0===n?0:2*wa)+2*y*(n>4?n-8+4:0),3*y,2*y),a.setRenderTarget(e),a.render(l,Ea)}},t.Path=io,t.PerspectiveCamera=ki,t.Plane=F,t.PlaneBufferGeometry=qt,t.PlaneGeometry=class extends qr{constructor(t,e,i,n){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:n},this.fromBufferGeometry(new qt(t,e,i,n)),this.mergeVertices()}},t.PropertyBinding=va,t.Quaternion=p,t.QuaternionKeyframeTrack=sa,t.REVISION="124",t.RGBADepthPacking=3201,t.RGBAFormat=1023,t.RGBAIntegerFormat=1033,t.RGBA_ASTC_10x10_Format=37819,t.RGBA_ASTC_10x5_Format=37816,t.RGBA_ASTC_10x6_Format=37817,t.RGBA_ASTC_10x8_Format=37818,t.RGBA_ASTC_12x10_Format=37820,t.RGBA_ASTC_12x12_Format=37821,t.RGBA_ASTC_4x4_Format=37808,t.RGBA_ASTC_5x4_Format=37809,t.RGBA_ASTC_5x5_Format=37810,t.RGBA_ASTC_6x5_Format=37811,t.RGBA_ASTC_6x6_Format=37812,t.RGBA_ASTC_8x5_Format=37813,t.RGBA_ASTC_8x6_Format=37814,t.RGBA_ASTC_8x8_Format=37815,t.RGBA_BPTC_Format=36492,t.RGBA_ETC2_EAC_Format=37496,t.RGBA_PVRTC_2BPPV1_Format=35843,t.RGBA_PVRTC_4BPPV1_Format=35842,t.RGBA_S3TC_DXT1_Format=33777,t.RGBA_S3TC_DXT3_Format=33778,t.RGBA_S3TC_DXT5_Format=33779,t.RGBDEncoding=3006,t.RGBEEncoding=3002,t.RGBEFormat=1023,t.RGBFormat=1022,t.RGBIntegerFormat=1032,t.RGBM16Encoding=3005,t.RGBM7Encoding=3004,t.RGB_ETC1_Format=36196,t.RGB_ETC2_Format=37492,t.RGB_PVRTC_2BPPV1_Format=35841,t.RGB_PVRTC_4BPPV1_Format=35840,t.RGB_S3TC_DXT1_Format=33776,t.RGFormat=1030,t.RGIntegerFormat=1031,t.Ray=he,t.Raycaster=$r,t.RectAreaLight=Ua,t.RedFormat=1028,t.RedIntegerFormat=1029,t.ReinhardToneMapping=2,t.RepeatWrapping=1e3,t.ReplaceStencilOp=7681,t.ReverseSubtractEquation=102,t.SRGB8_ALPHA8_ASTC_10x10_Format=37851,t.SRGB8_ALPHA8_ASTC_10x5_Format=37848,t.SRGB8_ALPHA8_ASTC_10x6_Format=37849,t.SRGB8_ALPHA8_ASTC_10x8_Format=37850,t.SRGB8_ALPHA8_ASTC_12x10_Format=37852,t.SRGB8_ALPHA8_ASTC_12x12_Format=37853,t.SRGB8_ALPHA8_ASTC_4x4_Format=37840,t.SRGB8_ALPHA8_ASTC_5x4_Format=37841,t.SRGB8_ALPHA8_ASTC_5x5_Format=37842,t.SRGB8_ALPHA8_ASTC_6x5_Format=37843,t.SRGB8_ALPHA8_ASTC_6x6_Format=37844,t.SRGB8_ALPHA8_ASTC_8x5_Format=37845,t.SRGB8_ALPHA8_ASTC_8x6_Format=37846,t.SRGB8_ALPHA8_ASTC_8x8_Format=37847,t.Scene=class extends Bt{constructor(){super(),Object.defineProperty(this,"isScene",{value:!0}),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.background&&(e.object.background=this.background.toJSON(t)),null!==this.environment&&(e.object.environment=this.environment.toJSON(t)),null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}},t.ShaderChunk=Pi,t.ShaderLib=Oi,t.ShaderMaterial=te,t.ShadowMaterial=ms,t.Shape=no,t.ShapeBufferGeometry=class extends jt{constructor(t,e=12){super(),this.type="ShapeBufferGeometry",this.parameters={shapes:t,curveSegments:e};const i=[],n=[],r=[],s=[];let o=0,a=0;if(!1===Array.isArray(t))h(t);else for(let e=0;e<t.length;e++)h(t[e]),this.addGroup(o,a,e),o+=a,a=0;function h(t){const o=n.length/3,h=t.extractPoints(e);let l=h.shape;const c=h.holes;!1===Ro.isClockWise(l)&&(l=l.reverse());for(let t=0,e=c.length;t<e;t++){const e=c[t];!0===Ro.isClockWise(e)&&(c[t]=e.reverse())}const u=Ro.triangulateShape(l,c);for(let t=0,e=c.length;t<e;t++){const e=c[t];l=l.concat(e)}for(let t=0,e=l.length;t<e;t++){const e=l[t];n.push(e.x,e.y,0),r.push(0,0,1),s.push(e.x,e.y)}for(let t=0,e=u.length;t<e;t++){const e=u[t],n=e[0]+o,r=e[1]+o,s=e[2]+o;i.push(n,r,s),a+=3}}this.setIndex(i),this.setAttribute("position",new ft(n,3)),this.setAttribute("normal",new ft(r,3)),this.setAttribute("uv",new ft(s,2))}toJSON(){const t=jt.prototype.toJSON.call(this);return function(t,e){if(e.shapes=[],Array.isArray(t))for(let i=0,n=t.length;i<n;i++){const n=t[i];e.shapes.push(n.uuid)}else e.shapes.push(t.uuid);return e}(this.parameters.shapes,t)}},t.ShortType=1011,t.SmoothShading=2,t.Sphere=O,t.SphereBufferGeometry=jo,t.SphereGeometry=class extends qr{constructor(t,e,i,n,r,s,o){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:n,phiLength:r,thetaStart:s,thetaLength:o},this.fromBufferGeometry(new jo(t,e,i,n,r,s,o)),this.mergeVertices()}},t.SpotLight=qo,t.SrcAlphaFactor=204,t.SrcAlphaSaturateFactor=210,t.SrcColorFactor=202,t.StaticCopyUsage=35046,t.StaticDrawUsage=35044,t.StaticReadUsage=35045,t.StreamCopyUsage=35042,t.StreamDrawUsage=35040,t.StreamReadUsage=35041,t.SubtractEquation=101,t.SubtractiveBlending=3,t.TOUCH={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},t.TangentSpaceNormalMap=0,t.TextGeometry=class extends qr{constructor(t,e){super(),this.type="TextGeometry",this.parameters={text:t,parameters:e},this.fromBufferGeometry(new ko(t,e)),this.mergeVertices()}},t.Texture=l,t.TextureLoader=zs,t.TriangleFanDrawMode=2,t.TriangleStripDrawMode=1,t.TrianglesDrawMode=0,t.UVMapping=300,t.Uint16BufferAttribute=ut,t.Uint32BufferAttribute=dt,t.Uint8BufferAttribute=ht,t.Uint8ClampedBufferAttribute=lt,t.Uniform=Vo,t.UniformsLib=Ci,t.UniformsUtils=Qt,t.UnsignedByteType=1009,t.UnsignedInt248Type=1020,t.UnsignedIntType=1014,t.UnsignedShort4444Type=1017,t.UnsignedShort5551Type=1018,t.UnsignedShort565Type=1019,t.UnsignedShortType=1012,t.VSMShadowMap=3,t.Vector2=s,t.Vector3=d,t.Vector4=J,t.VectorKeyframeTrack=aa,t.WebGLCubeRenderTarget=Wi,t.WebGLMultisampleRenderTarget=Wo,t.WebGLRenderTarget=Gi,t.WebGLRenderer=function(t){const e=void 0!==(t=t||{}).canvas?t.canvas:function(){const t=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return t.style.display="block",t}(),i=void 0!==t.context?t.context:null,r=void 0!==t.alpha&&t.alpha,o=void 0===t.depth||t.depth,a=void 0===t.stencil||t.stencil,h=void 0!==t.antialias&&t.antialias,l=void 0===t.premultipliedAlpha||t.premultipliedAlpha,c=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,p=void 0!==t.powerPreference?t.powerPreference:"default",m=void 0!==t.failIfMajorPerformanceCaveat&&t.failIfMajorPerformanceCaveat;let f=null,g=null;const y=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.outputEncoding=3e3,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1,this.saoBuffer=null,this.indirectDiffuseBuffer=null,this.screenBufferSize=new THREE.Vector2(0,0),this.maxMorphTargets=8,this.maxMorphNormals=4;const x=this;let v=!1,b=null,M=0,w=0,_=null,S=null,T=-1,E=null;const A=new J,L=new J;let R=null,P=e.width,C=e.height,O=1,z=null,N=null;const B=new J(0,0,P,C),F=new J(0,0,P,C);let D=!1;const G=new I;let U=!1,V=!1;const W=new k,j=new d,H={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function q(){return null===_?O:1}let X,Y,Z,Q,K,$,tt,rt,st,ot,at,ht,lt,ct,ut,pt,dt,mt,ft,gt,yt,xt=i;function vt(t,i){for(let n=0;n<t.length;n++){const r=t[n],s=e.getContext(r,i);if(null!==s)return s}return null}try{const t={alpha:r,depth:o,stencil:a,antialias:h,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:p,failIfMajorPerformanceCaveat:m};if(e.addEventListener("webglcontextlost",_t,!1),e.addEventListener("webglcontextrestored",St,!1),null===xt){const e=["webgl2","webgl","experimental-webgl"];if(!0===x.isWebGL1Renderer&&e.shift(),xt=vt(e,t),null===xt)throw vt(e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}void 0===xt.getShaderPrecisionFormat&&(xt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(t){throw console.error("THREE.WebGLRenderer: "+t.message),t}function bt(){X=new Hi(xt),Y=new Fi(xt,X,t),!1===Y.isWebGL2&&(X.get("WEBGL_depth_texture"),X.get("OES_texture_float"),X.get("OES_texture_half_float"),X.get("OES_texture_half_float_linear"),X.get("OES_standard_derivatives"),X.get("OES_element_index_uint"),X.get("OES_vertex_array_object"),X.get("ANGLE_instanced_arrays")),X.get("OES_texture_float_linear"),gt=new Fr(xt,X,Y),Z=new Nr(xt,X,Y),Z.scissor(L.copy(F).multiplyScalar(O).floor()),Z.viewport(A.copy(B).multiplyScalar(O).floor()),Q=new Ji(xt),K=new xr,$=new Br(xt,X,Z,K,Y,gt,Q),tt=new ji(x),rt=new nt(xt,Y),yt=new Ni(xt,X,rt,Y),st=new qi(xt,rt,Q,yt),ot=new Ki(xt,st,rt,Q),dt=new Qi(xt),ut=new Di(K),at=new yr(x,tt,X,Y,yt,ut),ht=new Ur(K),lt=new wr(K),ct=new Lr(X,Y),pt=new zi(x,tt,Z,ot,l),mt=new Bi(xt,X,Q,Y),ft=new Xi(xt,X,Q,Y),Q.programs=at.programs,x.capabilities=Y,x.extensions=X,x.properties=K,x.renderLists=lt,x.state=Z,x.info=Q}bt();const Mt=new kr(x,xt);this.xr=Mt;const wt=new zr(x,ot,Y.maxTextureSize);function _t(t){t.preventDefault(),v=!0}function St(){v=!1,bt()}function Tt(t){const e=t.target;e.removeEventListener("dispose",Tt),function(t){Et(t),K.remove(t)}(e)}function Et(t){const e=K.get(t).program;void 0!==e&&at.releaseProgram(e)}this.shadowMap=wt,this.getContext=function(){return xt},this.getContextAttributes=function(){return xt.getContextAttributes()},this.forceContextLoss=function(){const t=X.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){const t=X.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return O},this.setPixelRatio=function(t){void 0!==t&&(O=t,this.setSize(P,C,!1))},this.getSize=function(t){return void 0===t&&(console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),t=new s),t.set(P,C)},this.setSize=function(t,i,n){Mt.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(P=t,C=i,e.width=Math.floor(t*O),e.height=Math.floor(i*O),!1!==n&&(e.style.width=t+"px",e.style.height=i+"px"),this.setViewport(0,0,t,i))},this.getDrawingBufferSize=function(t){return void 0===t&&(console.warn("WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument"),t=new s),t.set(P*O,C*O).floor()},this.setDrawingBufferSize=function(t,i,n){P=t,C=i,O=n,e.width=Math.floor(t*n),e.height=Math.floor(i*n),this.setViewport(0,0,t,i)},this.getCurrentViewport=function(t){return void 0===t&&(console.warn("WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument"),t=new J),t.copy(A)},this.getViewport=function(t){return t.copy(B)},this.setViewport=function(t,e,i,n){t.isVector4?B.set(t.x,t.y,t.z,t.w):B.set(t,e,i,n),Z.viewport(A.copy(B).multiplyScalar(O).floor())},this.getScissor=function(t){return t.copy(F)},this.setScissor=function(t,e,i,n){t.isVector4?F.set(t.x,t.y,t.z,t.w):F.set(t,e,i,n),Z.scissor(L.copy(F).multiplyScalar(O).floor())},this.getScissorTest=function(){return D},this.setScissorTest=function(t){Z.setScissorTest(D=t)},this.setOpaqueSort=function(t){z=t},this.setTransparentSort=function(t){N=t},this.getClearColor=function(t){return void 0===t&&(console.warn("WebGLRenderer: .getClearColor() now requires a Color as an argument"),t=new et),t.copy(pt.getClearColor())},this.setClearColor=function(){pt.setClearColor.apply(pt,arguments)},this.getClearAlpha=function(){return pt.getClearAlpha()},this.setClearAlpha=function(){pt.setClearAlpha.apply(pt,arguments)},this.clear=function(t,e,i){let n=0;(void 0===t||t)&&(n|=16384),(void 0===e||e)&&(n|=256),(void 0===i||i)&&(n|=1024),xt.clear(n)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",_t,!1),e.removeEventListener("webglcontextrestored",St,!1),lt.dispose(),ct.dispose(),K.dispose(),tt.dispose(),ot.dispose(),yt.dispose(),Mt.dispose(),Lt.stop()},this.renderBufferImmediate=function(t,e){yt.initAttributes();const i=K.get(t);t.hasPositions&&!i.position&&(i.position=xt.createBuffer()),t.hasNormals&&!i.normal&&(i.normal=xt.createBuffer()),t.hasUvs&&!i.uv&&(i.uv=xt.createBuffer()),t.hasColors&&!i.color&&(i.color=xt.createBuffer());const n=e.getAttributes();t.hasPositions&&(xt.bindBuffer(34962,i.position),xt.bufferData(34962,t.positionArray,35048),yt.enableAttribute(n.position),xt.vertexAttribPointer(n.position,3,5126,!1,0,0)),t.hasNormals&&(xt.bindBuffer(34962,i.normal),xt.bufferData(34962,t.normalArray,35048),yt.enableAttribute(n.normal),xt.vertexAttribPointer(n.normal,3,5126,!1,0,0)),t.hasUvs&&(xt.bindBuffer(34962,i.uv),xt.bufferData(34962,t.uvArray,35048),yt.enableAttribute(n.uv),xt.vertexAttribPointer(n.uv,2,5126,!1,0,0)),t.hasColors&&(xt.bindBuffer(34962,i.color),xt.bufferData(34962,t.colorArray,35048),yt.enableAttribute(n.color),xt.vertexAttribPointer(n.color,3,5126,!1,0,0)),yt.disableUnusedAttributes(),xt.drawArrays(4,0,t.count),t.count=0},this.renderBufferDirect=function(t,e,i,n,r,s){null===e&&(e=H);const o=r.isMesh&&r.matrixWorld.determinant()<0,a=zt(t,e,n,r);Z.setMaterial(n,o);let h=i.index;const l=i.attributes.position;if(null===h){if(void 0===l||0===l.count)return}else if(0===h.count)return;let c,u=1;!0===n.wireframe&&(h=st.getWireframeAttribute(i),u=2),(n.morphTargets||n.morphNormals)&&dt.update(r,i,n,a),yt.setup(r,n,a,i,h);let p=mt;null!==h&&(c=rt.get(h),p=ft,p.setIndex(c));const d=null!==h?h.count:l.count,m=i.drawRange.start*u,f=i.drawRange.count*u,g=null!==s?s.start*u:0,y=null!==s?s.count*u:1/0,x=Math.max(m,g),v=Math.min(d,m+f,g+y)-1,b=Math.max(0,v-x+1);if(0!==b){if(r.isMesh)!0===n.wireframe?(Z.setLineWidth(n.wireframeLinewidth*q()),p.setMode(1)):p.setMode(4);else if(r.isLine){let t=n.linewidth;void 0===t&&(t=1),Z.setLineWidth(t*q()),r.isLineSegments?p.setMode(1):r.isLineLoop?p.setMode(2):p.setMode(3)}else r.isPoints?p.setMode(0):r.isSprite&&p.setMode(4);if(r.isInstancedMesh)p.renderInstances(x,b,r.count);else if(i.isInstancedBufferGeometry){const t=Math.min(i.instanceCount,i._maxInstanceCount);p.renderInstances(x,b,t)}else p.render(x,b)}},this.compile=function(t,e){g=ct.get(t),g.init(),t.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(g.pushLight(t),t.castShadow&&g.pushShadow(t))})),g.setupLights();const i=new WeakMap;t.traverse((function(e){const n=e.material;if(n)if(Array.isArray(n))for(let r=0;r<n.length;r++){const s=n[r];!1===i.has(s)&&(Ot(s,t,e),i.set(s))}else!1===i.has(n)&&(Ot(n,t,e),i.set(n))}))};let At=null;const Lt=new it;function Rt(t,e,i,n){if(!1===t.visible)return;if(t.layers.test(e.layers))if(t.isGroup)i=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(e);else if(t.isLight)g.pushLight(t),t.castShadow&&g.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||G.intersectsSprite(t)){n&&j.setFromMatrixPosition(t.matrixWorld).applyMatrix4(W);const e=ot.update(t),r=t.material;r.visible&&f.push(t,e,r,i,j.z,null)}}else if(t.isImmediateRenderObject)n&&j.setFromMatrixPosition(t.matrixWorld).applyMatrix4(W),f.push(t,null,t.material,i,j.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.frame!==Q.render.frame&&(t.skeleton.update(),t.skeleton.frame=Q.render.frame),!t.frustumCulled||G.intersectsObject(t))){n&&j.setFromMatrixPosition(t.matrixWorld).applyMatrix4(W);const e=ot.update(t),r=t.material;if(Array.isArray(r)){const n=e.groups;for(let s=0,o=n.length;s<o;s++){const o=n[s],a=r[o.materialIndex];a&&a.visible&&f.push(t,e,a,i,j.z,o)}}else r.visible&&f.push(t,e,r,i,j.z,null)}const r=t.children;for(let t=0,s=r.length;t<s;t++)Rt(r[t],e,i,n)}function Pt(t,e,i){const n=!0===e.isScene?e.overrideMaterial:null;for(let r=0,s=t.length;r<s;r++){const s=t[r],o=s.object,a=s.geometry,h=null===n?s.material:n,l=s.group;if(i.isArrayCamera){const t=i.cameras;for(let i=0,n=t.length;i<n;i++){const n=t[i];o.layers.test(n.layers)&&(Z.viewport(A.copy(n.viewport)),g.setupLightsView(n),Ct(o,e,n,a,h,l))}}else Ct(o,e,i,a,h,l)}}function Ct(t,e,i,n,r,s){if(t.onBeforeRender(x,e,i,n,r,s),t.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),t.isImmediateRenderObject){const n=zt(i,e,r,t);Z.setMaterial(r),yt.reset(),function(t,e){t.render((function(t){x.renderBufferImmediate(t,e)}))}(t,n)}else x.renderBufferDirect(i,e,n,r,t,s);t.onAfterRender(x,e,i,n,r,s)}function Ot(t,e,i){!0!==e.isScene&&(e=H);const n=K.get(t),r=g.state.lights,s=g.state.shadowsArray,o=r.state.version,a=at.getParameters(t,r.state,s,e,i),h=at.getProgramCacheKey(a);let l=n.program,c=!0;if(void 0===l)t.addEventListener("dispose",Tt);else if(l.cacheKey!==h)Et(t);else if(n.lightsStateVersion!==o)c=!1;else{if(void 0!==a.shaderID){const i=t.isMeshStandardMaterial?e.environment:null;return void(n.envMap=tt.get(t.envMap||i))}c=!1}c&&(a.uniforms=at.getUniforms(t),t.onBeforeCompile(a,x),l=at.acquireProgram(a,h),n.program=l,n.uniforms=a.uniforms,n.outputEncoding=a.outputEncoding);const u=n.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(n.numClippingPlanes=ut.numPlanes,n.numIntersection=ut.numIntersection,u.clippingPlanes=ut.uniform),n.environment=t.isMeshStandardMaterial?e.environment:null,n.fog=e.fog,n.envMap=tt.get(t.envMap||n.environment),n.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),n.lightsStateVersion=o,n.needsLights&&(u.ambientLightColor.value=r.state.ambient,u.lightProbe.value=r.state.probe,u.directionalLights.value=r.state.directional,u.directionalLightShadows.value=r.state.directionalShadow,u.spotLights.value=r.state.spot,u.spotLightShadows.value=r.state.spotShadow,u.rectAreaLights.value=r.state.rectArea,u.rectAreaTexture.value=r.state.rectAreaTexture,u.ltc_1.value=r.state.rectAreaLTC1,u.ltc_2.value=r.state.rectAreaLTC2,u.pointLights.value=r.state.point,u.pointLightShadows.value=r.state.pointShadow,u.hemisphereLights.value=r.state.hemi,u.directionalShadowMap.value=r.state.directionalShadowMap,u.directionalShadowMatrix.value=r.state.directionalShadowMatrix,u.spotShadowMap.value=r.state.spotShadowMap,u.spotShadowMatrix.value=r.state.spotShadowMatrix,u.spotPosition.value=r.state.spotPosition,u.pointShadowMap.value=r.state.pointShadowMap,u.pointShadowMatrix.value=r.state.pointShadowMatrix,u.rectShadowMap.value=r.state.rectShadowMap);const p=n.program.getUniforms(),d=Zn.seqWithValue(p.seq,u);n.uniformsList=d}function zt(t,e,i,r){!0!==e.isScene&&(e=H),$.resetTextureUnits();const s=e.fog,o=i.isMeshStandardMaterial?e.environment:null,a=null===_?x.outputEncoding:_.texture.encoding,h=tt.get(i.envMap||o),l=K.get(i),c=g.state.lights,p=i.transparent||i.alphaTest>0,d=void 0!==i.transmission&&i.transmission>0;var m=!p&&!d;if(U&&(!0===V||t!==E)){const e=t===E&&i.id===T;ut.setState(i,t,e)}i.version===l.__version?i.fog&&l.fog!==s||l.environment!==o||l.needsLights&&l.lightsStateVersion!==c.state.version?Ot(i,e,r):void 0===l.numClippingPlanes||l.numClippingPlanes===ut.numPlanes&&l.numIntersection===ut.numIntersection?(l.outputEncoding!==a||l.envMap!==h)&&Ot(i,e,r):Ot(i,e,r):(Ot(i,e,r),l.__version=i.version);let f=!1,y=!1,v=!1;const b=l.program,M=b.getUniforms(),w=l.uniforms;if(Z.useProgram(b.program)&&(f=!0,y=!0,v=!0),i.id!==T&&(T=i.id,y=!0),f||E!==t){if(M.setValue(xt,"projectionMatrix",t.projectionMatrix),Y.logarithmicDepthBuffer&&M.setValue(xt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),E!==t&&(E=t,y=!0,v=!0),i.isShaderMaterial||i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshStandardMaterial||i.envMap){const e=M.map.cameraPosition;void 0!==e&&e.setValue(xt,j.setFromMatrixPosition(t.matrixWorld))}(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&M.setValue(xt,"isOrthographic",!0===t.isOrthographicCamera),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial||i.isShadowMaterial||i.skinning)&&M.setValue(xt,"viewMatrix",t.matrixWorldInverse)}if(i.skinning){M.setOptional(xt,r,"bindMatrix"),M.setOptional(xt,r,"bindMatrixInverse");const t=r.skeleton;if(t){const e=t.bones;if(Y.floatVertexTextures){if(null===t.boneTexture){let i=Math.sqrt(4*e.length);i=n.ceilPowerOfTwo(i),i=Math.max(i,4);const r=new Float32Array(i*i*4);r.set(t.boneMatrices);const s=new u(r,i,i,1023,1015);t.boneMatrices=r,t.boneTexture=s,t.boneTextureSize=i}M.setValue(xt,"boneTexture",t.boneTexture,$),M.setValue(xt,"boneTextureSize",t.boneTextureSize)}else M.setOptional(xt,t,"boneMatrices")}}var S,A;return(y||l.receiveShadow!==r.receiveShadow)&&(l.receiveShadow=r.receiveShadow,M.setValue(xt,"receiveShadow",r.receiveShadow)),y&&(M.setValue(xt,"toneMappingExposure",x.toneMappingExposure),M.setValue(xt,"screenBufferSize",x.screenBufferSize),M.setValue(xt,"useAO",m),M.setValue(xt,"saoBuffer",x.saoBuffer,$),M.setValue(xt,"indirectDiffuseBuffer",x.indirectDiffuseBuffer,$),l.needsLights&&(A=v,(S=w).ambientLightColor.needsUpdate=A,S.lightProbe.needsUpdate=A,S.directionalLights.needsUpdate=A,S.directionalLightShadows.needsUpdate=A,S.pointLights.needsUpdate=A,S.pointLightShadows.needsUpdate=A,S.spotLights.needsUpdate=A,S.spotLightShadows.needsUpdate=A,S.rectAreaLights.needsUpdate=A,S.hemisphereLights.needsUpdate=A),s&&i.fog&&ht.refreshFogUniforms(w,s),ht.refreshMaterialUniforms(w,i,O,C),Zn.upload(xt,l.uniformsList,w,$)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(Zn.upload(xt,l.uniformsList,w,$),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&M.setValue(xt,"center",r.center),M.setValue(xt,"modelViewMatrix",r.modelViewMatrix),M.setValue(xt,"normalMatrix",r.normalMatrix),M.setValue(xt,"modelMatrix",r.matrixWorld),b}Lt.setAnimationLoop((function(t){Mt.isPresenting||At&&At(t)})),"undefined"!=typeof window&&Lt.setContext(window),this.setAnimationLoop=function(t){At=t,Mt.setAnimationLoop(t),null===t?Lt.stop():Lt.start()},this.render=function(t,e){let i,n;if(void 0!==arguments[2]&&(console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead."),i=arguments[2]),void 0!==arguments[3]&&(console.warn("THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead."),n=arguments[3]),void 0!==e&&!0!==e.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===v)return;yt.resetDefaultState(),T=-1,E=null,!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),!0===Mt.enabled&&!0===Mt.isPresenting&&(e=Mt.getCamera(e)),!0===t.isScene&&t.onBeforeRender(x,t,e,i||_),g=ct.get(t,y.length),g.init(),y.push(g),W.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),G.setFromProjectionMatrix(W),V=this.localClippingEnabled,U=ut.init(this.clippingPlanes,V,e),f=lt.get(t,e),f.init(),Rt(t,e,0,x.sortObjects),f.finish(),!0===x.sortObjects&&f.sort(z,N),!0===U&&ut.beginShadows();const r=g.state.shadowsArray;wt.render(r,t,e),g.setupLights(),g.setupLightsView(e),!0===U&&ut.endShadows(),!0===this.info.autoReset&&this.info.reset(),void 0!==i&&this.setRenderTarget(i),pt.render(f,t,e,n);const s=f.opaque,o=f.transparent;s.length>0&&Pt(s,t,e),o.length>0&&Pt(o,t,e),!0===t.isScene&&t.onAfterRender(x,t,e),null!==_&&($.updateRenderTargetMipmap(_),$.updateMultisampleRenderTarget(_)),Z.buffers.depth.setTest(!0),Z.buffers.depth.setMask(!0),Z.buffers.color.setMask(!0),Z.setPolygonOffset(!1),y.pop(),g=y.length>0?y[y.length-1]:null,f=null},this.setFramebuffer=function(t){b!==t&&null===_&&xt.bindFramebuffer(36160,t),b=t},this.getActiveCubeFace=function(){return M},this.getActiveMipmapLevel=function(){return w},this.getRenderList=function(){return f},this.setRenderList=function(t){f=t},this.getRenderTarget=function(){return _},this.setRenderTarget=function(t,e=0,i=0){_=t,M=e,w=i,t&&void 0===K.get(t).__webglFramebuffer&&$.setupRenderTarget(t);let n=b,r=!1;if(t){const i=K.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(n=i[e],r=!0):n=t.isWebGLMultisampleRenderTarget?K.get(t).__webglMultisampledFramebuffer:i,A.copy(t.viewport),L.copy(t.scissor),R=t.scissorTest}else A.copy(B).multiplyScalar(O).floor(),L.copy(F).multiplyScalar(O).floor(),R=D;if(S!==n&&(xt.bindFramebuffer(36160,n),S=n),Z.viewport(A),Z.scissor(L),Z.setScissorTest(R),r){const n=K.get(t.texture);xt.framebufferTexture2D(36160,36064,34069+e,n.__webglTexture,i)}},this.readRenderTargetPixels=function(t,e,i,n,r,s,o){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=K.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==o&&(a=a[o]),a){let o=!1;a!==S&&(xt.bindFramebuffer(36160,a),o=!0);try{const a=t.texture,h=a.format,l=a.type;if(1023!==h&&gt.convert(h)!==xt.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(1009===l||gt.convert(l)===xt.getParameter(35738)||1015===l&&(Y.isWebGL2||X.get("OES_texture_float")||X.get("WEBGL_color_buffer_float"))||1016===l&&(Y.isWebGL2?X.get("EXT_color_buffer_float"):X.get("EXT_color_buffer_half_float"))))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===xt.checkFramebufferStatus(36160)?e>=0&&e<=t.width-n&&i>=0&&i<=t.height-r&&xt.readPixels(e,i,n,r,gt.convert(h),gt.convert(l),s):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{o&&xt.bindFramebuffer(36160,S)}}},this.copyFramebufferToTexture=function(t,e,i=0){const n=Math.pow(2,-i),r=Math.floor(e.image.width*n),s=Math.floor(e.image.height*n),o=gt.convert(e.format);$.setTexture2D(e,0),xt.copyTexImage2D(3553,i,o,t.x,t.y,r,s,0),Z.unbindTexture()},this.copyTextureToTexture=function(t,e,i,n=0){const r=e.image.width,s=e.image.height,o=gt.convert(i.format),a=gt.convert(i.type);$.setTexture2D(i,0),xt.pixelStorei(37440,i.flipY),xt.pixelStorei(37441,i.premultiplyAlpha),xt.pixelStorei(3317,i.unpackAlignment),e.isDataTexture?xt.texSubImage2D(3553,n,t.x,t.y,r,s,o,a,e.image.data):e.isCompressedTexture?xt.compressedTexSubImage2D(3553,n,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,o,e.mipmaps[0].data):xt.texSubImage2D(3553,n,t.x,t.y,o,a,e.image),0===n&&i.generateMipmaps&&xt.generateMipmap(3553),Z.unbindTexture()},this.initTexture=function(t){$.setTexture2D(t,0),Z.unbindTexture()},this.resetState=function(){Z.reset(),yt.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))},t.WrapAroundEnding=2402,t.ZeroCurvatureEnding=2400,t.ZeroFactor=200,t.ZeroSlopeEnding=2401,t.ZeroStencilOp=0,t.sRGBEncoding=3001,t}({});