diff --git a/modules/dreamview/backend/dreamview.cc b/modules/dreamview/backend/dreamview.cc index e67ddd8771c369f339556cbef8afdb6e3bf74062..4a2454d49dc8c853b237d92d657794bb9bb4e9e8 100644 --- a/modules/dreamview/backend/dreamview.cc +++ b/modules/dreamview/backend/dreamview.cc @@ -56,9 +56,13 @@ Status Dreamview::Init() { // Initialize and run the web server which serves the dreamview htmls and // javascripts and handles websocket requests. std::vector options = { - "document_root", FLAGS_static_file_dir, "listening_ports", - FLAGS_server_ports, "websocket_timeout_ms", FLAGS_websocket_timeout_ms, - "request_timeout_ms", FLAGS_request_timeout_ms}; + "document_root", FLAGS_static_file_dir, + "listening_ports", FLAGS_server_ports, + "websocket_timeout_ms", FLAGS_websocket_timeout_ms, + "request_timeout_ms", FLAGS_request_timeout_ms, + "enable_keep_alive", "yes", + "tcp_nodelay", "1", + "keep_alive_timeout_ms", "500"}; if (PathExists(FLAGS_ssl_certificate)) { options.push_back("ssl_certificate"); options.push_back(FLAGS_ssl_certificate); @@ -84,7 +88,8 @@ Status Dreamview::Init() { websocket_.get(), map_ws_.get(), camera_ws_.get(), sim_control_.get(), map_service_.get(), data_collection_monitor_.get(), perception_camera_updater_.get(), FLAGS_routing_from_file)); - point_cloud_updater_.reset(new PointCloudUpdater(point_cloud_ws_.get())); + point_cloud_updater_.reset( + new PointCloudUpdater(point_cloud_ws_.get(), sim_world_updater_.get())); hmi_.reset(new HMI(websocket_.get(), map_service_.get(), data_collection_monitor_.get())); diff --git a/modules/dreamview/backend/point_cloud/BUILD b/modules/dreamview/backend/point_cloud/BUILD index da9d90cc5741167b1946939a0862e508842eec3a..9d77fe1139d99818eb6857599e96bb1f3bf999eb 100644 --- a/modules/dreamview/backend/point_cloud/BUILD +++ b/modules/dreamview/backend/point_cloud/BUILD @@ -12,6 +12,7 @@ cc_library( "//modules/common/math", "//modules/dreamview/backend/common:dreamview_gflags", "//modules/dreamview/backend/handlers:websocket_handler", + "//modules/dreamview/backend/simulation_world:simulation_world_updater", "//modules/dreamview/proto:point_cloud_proto", "//modules/drivers/proto:sensor_proto", "//modules/localization/proto:localization_proto", diff --git a/modules/dreamview/backend/point_cloud/point_cloud_updater.cc b/modules/dreamview/backend/point_cloud/point_cloud_updater.cc index eb2bcd406be3cf69a30b618e955fd985d5789a85..ab349cf488c5ba85e9a16066f7252a1eb41e9c76 100644 --- a/modules/dreamview/backend/point_cloud/point_cloud_updater.cc +++ b/modules/dreamview/backend/point_cloud/point_cloud_updater.cc @@ -37,11 +37,13 @@ using Json = nlohmann::json; float PointCloudUpdater::lidar_height_ = kDefaultLidarHeight; boost::shared_mutex PointCloudUpdater::mutex_; -PointCloudUpdater::PointCloudUpdater(WebSocketHandler *websocket) +PointCloudUpdater::PointCloudUpdater(WebSocketHandler *websocket, + SimulationWorldUpdater *simworld_updater) : node_(cyber::CreateNode("point_cloud")), websocket_(websocket), point_cloud_str_(""), - future_ready_(true) { + future_ready_(true), + simworld_updater_(simworld_updater) { RegisterMessageHandlers(); } @@ -138,53 +140,78 @@ void PointCloudUpdater::Stop() { } } +pcl::PointCloud::Ptr PointCloudUpdater::ConvertPCLPointCloud( + const std::shared_ptr &point_cloud) { + pcl::PointCloud::Ptr pcl_ptr( + new pcl::PointCloud); + pcl_ptr->width = point_cloud->width(); + pcl_ptr->height = point_cloud->height(); + pcl_ptr->is_dense = false; + + if (point_cloud->width() * point_cloud->height() != + static_cast(point_cloud->point_size())) { + pcl_ptr->width = 1; + pcl_ptr->height = point_cloud->point_size(); + } + pcl_ptr->points.resize(point_cloud->point_size()); + + for (size_t i = 0; i < pcl_ptr->points.size(); ++i) { + const auto &point = point_cloud->point(static_cast(i)); + pcl_ptr->points[i].x = point.x(); + pcl_ptr->points[i].y = point.y(); + pcl_ptr->points[i].z = point.z(); + } + return pcl_ptr; +} + void PointCloudUpdater::UpdatePointCloud( const std::shared_ptr &point_cloud) { if (!enabled_) { return; } - last_point_cloud_time_ = point_cloud->header().timestamp_sec(); + if (simworld_updater_->LastAdcTimestampSec() == 0.0 || + simworld_updater_->LastAdcTimestampSec() - last_point_cloud_time_ > 0.1) { + AWARN << "skipping outdated point cloud data"; + return; + } + pcl::PointCloud::Ptr pcl_ptr; // Check if last filter process has finished before processing new data. - if (future_ready_) { - future_ready_ = false; - // transform from drivers::PointCloud to pcl::PointCloud - pcl::PointCloud::Ptr pcl_ptr( - new pcl::PointCloud); - pcl_ptr->width = point_cloud->width(); - pcl_ptr->height = point_cloud->height(); - pcl_ptr->is_dense = false; - - if (point_cloud->width() * point_cloud->height() != - static_cast(point_cloud->point_size())) { - pcl_ptr->width = 1; - pcl_ptr->height = point_cloud->point_size(); - } - pcl_ptr->points.resize(point_cloud->point_size()); - - for (size_t i = 0; i < pcl_ptr->points.size(); ++i) { - const auto &point = point_cloud->point(static_cast(i)); - pcl_ptr->points[i].x = point.x(); - pcl_ptr->points[i].y = point.y(); - pcl_ptr->points[i].z = point.z(); + if (enable_voxel_filter_) { + if (future_ready_) { + future_ready_ = false; + // transform from drivers::PointCloud to pcl::PointCloud + pcl_ptr = ConvertPCLPointCloud(point_cloud); + std::future f = + cyber::Async(&PointCloudUpdater::FilterPointCloud, this, pcl_ptr); + async_future_ = std::move(f); } - std::future f = - cyber::Async(&PointCloudUpdater::FilterPointCloud, this, pcl_ptr); - async_future_ = std::move(f); + } else { + pcl_ptr = ConvertPCLPointCloud(point_cloud); + this->FilterPointCloud(pcl_ptr); } } void PointCloudUpdater::FilterPointCloud( pcl::PointCloud::Ptr pcl_ptr) { - pcl::VoxelGrid voxel_grid; - voxel_grid.setInputCloud(pcl_ptr); - voxel_grid.setLeafSize(static_cast(FLAGS_voxel_filter_size), - static_cast(FLAGS_voxel_filter_size), - static_cast(FLAGS_voxel_filter_height)); pcl::PointCloud::Ptr pcl_filtered_ptr( new pcl::PointCloud); - voxel_grid.filter(*pcl_filtered_ptr); - AINFO << "filtered point cloud data size: " << pcl_filtered_ptr->size(); + + /* + By default, disable voxel filter since it's taking more than 500ms + ideally the most efficient sampling method is to + use per beam random sample for organized cloud(TODO) + */ + if (enable_voxel_filter_) { + pcl::VoxelGrid voxel_grid; + voxel_grid.setInputCloud(pcl_ptr); + voxel_grid.setLeafSize(static_cast(FLAGS_voxel_filter_size), + static_cast(FLAGS_voxel_filter_size), + static_cast(FLAGS_voxel_filter_height)); + voxel_grid.filter(*pcl_filtered_ptr); + } else { + pcl_filtered_ptr = pcl_ptr; + } float z_offset; { @@ -208,9 +235,8 @@ void PointCloudUpdater::FilterPointCloud( } void PointCloudUpdater::UpdateLocalizationTime( - const std::shared_ptr &localization) { - last_localization_time_ = localization->header().timestamp_sec(); + const std::shared_ptr &localization) { + last_localization_time_ = localization->header().timestamp_sec(); } - } // namespace dreamview } // namespace apollo diff --git a/modules/dreamview/backend/point_cloud/point_cloud_updater.h b/modules/dreamview/backend/point_cloud/point_cloud_updater.h index 1c8389f653c2c71c05650e17ff2e42da96e6840e..f5f283798f83d6e685113882dc65abe9ef713d0b 100644 --- a/modules/dreamview/backend/point_cloud/point_cloud_updater.h +++ b/modules/dreamview/backend/point_cloud/point_cloud_updater.h @@ -29,6 +29,7 @@ #include "cyber/cyber.h" #include "modules/common/util/string_util.h" #include "modules/dreamview/backend/handlers/websocket_handler.h" +#include "modules/dreamview/backend/simulation_world/simulation_world_updater.h" #include "modules/drivers/proto/pointcloud.pb.h" #include "modules/localization/proto/localization.pb.h" #include "pcl/point_cloud.h" @@ -52,8 +53,11 @@ class PointCloudUpdater { * @brief Constructor with the websocket handler. * @param websocket Pointer of the websocket handler that has been attached to * the server. + * @param simulationworldupdater pointer */ - explicit PointCloudUpdater(WebSocketHandler *websocket); + explicit PointCloudUpdater(WebSocketHandler *websocket, + SimulationWorldUpdater *sim_world_updater); + ~PointCloudUpdater(); static void LoadLidarHeight(const std::string &file_path); @@ -82,6 +86,8 @@ class PointCloudUpdater { void UpdateLocalizationTime( const std::shared_ptr &localization); + pcl::PointCloud::Ptr ConvertPCLPointCloud( + const std::shared_ptr &point_cloud); constexpr static float kDefaultLidarHeight = 1.91f; @@ -101,10 +107,10 @@ class PointCloudUpdater { std::shared_ptr> localization_reader_; std::shared_ptr> point_cloud_reader_; - double last_point_cloud_time_ = 0.0; double last_localization_time_ = 0.0; + SimulationWorldUpdater *simworld_updater_; + bool enable_voxel_filter_ = false; }; - } // namespace dreamview } // namespace apollo diff --git a/modules/dreamview/backend/simulation_world/simulation_world_service.cc b/modules/dreamview/backend/simulation_world/simulation_world_service.cc index fdf9593ad5c811c16ce5a162344b471468451adc..9cb957b6fd3e2179aba879472a0b4341696a8ea8 100644 --- a/modules/dreamview/backend/simulation_world/simulation_world_service.cc +++ b/modules/dreamview/backend/simulation_world/simulation_world_service.cc @@ -461,7 +461,6 @@ void SimulationWorldService::UpdateSimulationWorld( // message header. It is done on both the SimulationWorld object // itself and its auto_driving_car() field. auto_driving_car->set_timestamp_sec(localization.header().timestamp_sec()); - ready_to_push_.store(true); } diff --git a/modules/dreamview/backend/simulation_world/simulation_world_updater.cc b/modules/dreamview/backend/simulation_world/simulation_world_updater.cc index a8f2d8d3510247f2bd774cd9d41c739550231d14..f8c0839687b5adacb18c6339f32be3a8dd89e7b4 100644 --- a/modules/dreamview/backend/simulation_world/simulation_world_updater.cc +++ b/modules/dreamview/backend/simulation_world/simulation_world_updater.cc @@ -412,6 +412,8 @@ void SimulationWorldUpdater::OnTimer() { { boost::unique_lock writer_lock(mutex_); + last_pushed_adc_timestamp_sec_ = + sim_world_service_.world().auto_driving_car().timestamp_sec(); sim_world_service_.GetWireFormatString( FLAGS_sim_map_radius, &simulation_world_, &simulation_world_with_planning_data_); diff --git a/modules/dreamview/backend/simulation_world/simulation_world_updater.h b/modules/dreamview/backend/simulation_world/simulation_world_updater.h index 8cc8c966b2c4e1a85cc4fba9c66b435a3c36049f..eb9100f0985bee8543626f1948773033ba84ee75 100644 --- a/modules/dreamview/backend/simulation_world/simulation_world_updater.h +++ b/modules/dreamview/backend/simulation_world/simulation_world_updater.h @@ -77,6 +77,10 @@ class SimulationWorldUpdater { // frontend. static constexpr double kSimWorldTimeIntervalMs = 100; + double LastAdcTimestampSec() { + return last_pushed_adc_timestamp_sec_; + } + private: /** * @brief The callback function to get updates from SimulationWorldService, @@ -138,6 +142,8 @@ class SimulationWorldUpdater { boost::shared_mutex mutex_; std::unique_ptr timer_; + + volatile double last_pushed_adc_timestamp_sec_ = 0.0f; }; } // namespace dreamview diff --git a/modules/dreamview/frontend/dist/2.bundle.js b/modules/dreamview/frontend/dist/2.bundle.js index db9fc490789d1f1cefedacb441c48c96e50d4129..7139f8a86866910cb9fd272a0219c0bfa4969e8a 100644 --- a/modules/dreamview/frontend/dist/2.bundle.js +++ b/modules/dreamview/frontend/dist/2.bundle.js @@ -1,2 +1,2 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[2],{468:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=m(a(3)),l=m(a(1)),i=m(a(2)),o=m(a(4)),r=m(a(5)),d=m(a(0)),u=m(a(109)),c=m(a(20)),f=a(177),s=m(a(469)),p=m(a(470));function m(e){return e&&e.__esModule?e:{default:e}}var v=function(e){function t(e){(0,l.default)(this,t);var a=(0,o.default)(this,(t.__proto__||(0,n.default)(t)).call(this,e));if(a.scriptOnLoadHandler=a.scriptOnLoadHandler.bind(a),!u.default.mapAPILoaded){var i=function(){console.log("Map API script loaded.")};"BaiduMap"===PARAMETERS.navigation.map?window.initMap=a.scriptOnLoadHandler:"GoogleMap"===PARAMETERS.navigation.map&&(i=a.scriptOnLoadHandler),(0,s.default)({url:PARAMETERS.navigation.mapAPiUrl,onLoad:i,onError:function(){console.log("Failed to load map api")}})}return a}return(0,r.default)(t,e),(0,i.default)(t,[{key:"componentDidMount",value:function(){u.default.mapAPILoaded&&this.scriptOnLoadHandler()}},{key:"componentDidUpdate",value:function(){var e=this.props,t=e.hasRoutingControls,a=e.size;t&&a===f.MAP_SIZE.FULL?u.default.enableControls():u.default.disableControls()}},{key:"scriptOnLoadHandler",value:function(){a(471)("./"+PARAMETERS.navigation.map+"Adapter").then((function(e){var t=new(0,e.default);u.default.mapAPILoaded=!0,u.default.initialize(c.default,t),u.default.disableControls()}))}},{key:"componentWillUnmount",value:function(){u.default.reset()}},{key:"render",value:function(){var e=this.props,t=e.width,a=e.height,n=e.size,l=e.onResize;return["GoogleMap","BaiduMap"].includes(PARAMETERS.navigation.map)?d.default.createElement("div",{displayname:"navigation",className:"navigation-view",style:{width:t,height:a}},d.default.createElement("div",{id:"map_canvas"}),d.default.createElement(p.default,{type:n,onClick:l})):(console.error("Map API "+PARAMETERS.navigation.map+" is not supported."),null)}}]),t}(d.default.Component);t.default=v},469:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.url,a=e.onLoad,n=e.onError,l=document.createElement("script");l.src=t,l.type="text/javascript",l.async=!0,l.onload=a,l.onerror=n,document.body.appendChild(l)}},470:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=c(a(3)),l=c(a(1)),i=c(a(2)),o=c(a(4)),r=c(a(5)),d=c(a(0)),u=a(177);function c(e){return e&&e.__esModule?e:{default:e}}var f=function(e){function t(){return(0,l.default)(this,t),(0,o.default)(this,(t.__proto__||(0,n.default)(t)).apply(this,arguments))}return(0,r.default)(t,e),(0,i.default)(t,[{key:"getMinimizingIcon",value:function(){return d.default.createElement("svg",{viewBox:"0 0 20 20"},d.default.createElement("defs",null,d.default.createElement("path",{d:"M20 0L0 20h20V0z",id:"a"}),d.default.createElement("path",{d:"M11.53 18.5l-.03-7h7",id:"b"}),d.default.createElement("path",{d:"M12 12l7 7",id:"c"})),d.default.createElement("use",{xlinkHref:"#a",opacity:".8",fill:"#84b7FF"}),d.default.createElement("use",{xlinkHref:"#b",fillOpacity:"0",stroke:"#006AFF",strokeWidth:"2"}),d.default.createElement("use",{xlinkHref:"#c",fillOpacity:"0",stroke:"#006AFF",strokeWidth:"2"}))}},{key:"getMaximizingIcon",value:function(){return d.default.createElement("svg",{viewBox:"0 0 20 20"},d.default.createElement("defs",null,d.default.createElement("path",{d:"M20 0L0 20h20V0z",id:"a"}),d.default.createElement("path",{d:"M18.47 11.5l.03 7h-7",id:"b"}),d.default.createElement("path",{d:"M11 11l7 7",id:"c"})),d.default.createElement("use",{xlinkHref:"#a",opacity:".8",fill:"#84b7FF"}),d.default.createElement("use",{xlinkHref:"#b",fillOpacity:"0",stroke:"#006AFF",strokeWidth:"2"}),d.default.createElement("use",{xlinkHref:"#c",fillOpacity:"0",stroke:"#006AFF",strokeWidth:"2"}))}},{key:"render",value:function(){var e=this.props,t=e.type,a=e.onClick,n=null;switch(t){case u.MAP_SIZE.FULL:n=this.getMinimizingIcon();break;case u.MAP_SIZE.DEFAULT:n=this.getMaximizingIcon();break;default:console.error("Unknown window size found:",t)}return d.default.createElement("div",{className:"window-resize-control",onClick:a},n)}}]),t}(d.default.PureComponent);t.default=f},471:function(e,t,a){var n={"./BaiduMapAdapter":[472,3],"./GoogleMapAdapter":[473,4]};function l(e){var t=n[e];return t?a.e(t[1]).then((function(){var e=t[0];return a.t(e,7)})):Promise.resolve().then((function(){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}))}l.keys=function(){return Object.keys(n)},l.id=471,e.exports=l}}]); +(window.webpackJsonp=window.webpackJsonp||[]).push([[2],{481:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=m(a(3)),l=m(a(1)),i=m(a(2)),o=m(a(4)),r=m(a(5)),d=m(a(0)),u=m(a(109)),c=m(a(20)),f=a(179),s=m(a(482)),p=m(a(483));function m(e){return e&&e.__esModule?e:{default:e}}var v=function(e){function t(e){(0,l.default)(this,t);var a=(0,o.default)(this,(t.__proto__||(0,n.default)(t)).call(this,e));if(a.scriptOnLoadHandler=a.scriptOnLoadHandler.bind(a),!u.default.mapAPILoaded){var i=function(){console.log("Map API script loaded.")};"BaiduMap"===PARAMETERS.navigation.map?window.initMap=a.scriptOnLoadHandler:"GoogleMap"===PARAMETERS.navigation.map&&(i=a.scriptOnLoadHandler),(0,s.default)({url:PARAMETERS.navigation.mapAPiUrl,onLoad:i,onError:function(){console.log("Failed to load map api")}})}return a}return(0,r.default)(t,e),(0,i.default)(t,[{key:"componentDidMount",value:function(){u.default.mapAPILoaded&&this.scriptOnLoadHandler()}},{key:"componentDidUpdate",value:function(){var e=this.props,t=e.hasRoutingControls,a=e.size;t&&a===f.MAP_SIZE.FULL?u.default.enableControls():u.default.disableControls()}},{key:"scriptOnLoadHandler",value:function(){a(484)("./"+PARAMETERS.navigation.map+"Adapter").then((function(e){var t=new(0,e.default);u.default.mapAPILoaded=!0,u.default.initialize(c.default,t),u.default.disableControls()}))}},{key:"componentWillUnmount",value:function(){u.default.reset()}},{key:"render",value:function(){var e=this.props,t=e.width,a=e.height,n=e.size,l=e.onResize;return["GoogleMap","BaiduMap"].includes(PARAMETERS.navigation.map)?d.default.createElement("div",{displayname:"navigation",className:"navigation-view",style:{width:t,height:a}},d.default.createElement("div",{id:"map_canvas"}),d.default.createElement(p.default,{type:n,onClick:l})):(console.error("Map API "+PARAMETERS.navigation.map+" is not supported."),null)}}]),t}(d.default.Component);t.default=v},482:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.url,a=e.onLoad,n=e.onError,l=document.createElement("script");l.src=t,l.type="text/javascript",l.async=!0,l.onload=a,l.onerror=n,document.body.appendChild(l)}},483:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=c(a(3)),l=c(a(1)),i=c(a(2)),o=c(a(4)),r=c(a(5)),d=c(a(0)),u=a(179);function c(e){return e&&e.__esModule?e:{default:e}}var f=function(e){function t(){return(0,l.default)(this,t),(0,o.default)(this,(t.__proto__||(0,n.default)(t)).apply(this,arguments))}return(0,r.default)(t,e),(0,i.default)(t,[{key:"getMinimizingIcon",value:function(){return d.default.createElement("svg",{viewBox:"0 0 20 20"},d.default.createElement("defs",null,d.default.createElement("path",{d:"M20 0L0 20h20V0z",id:"a"}),d.default.createElement("path",{d:"M11.53 18.5l-.03-7h7",id:"b"}),d.default.createElement("path",{d:"M12 12l7 7",id:"c"})),d.default.createElement("use",{xlinkHref:"#a",opacity:".8",fill:"#84b7FF"}),d.default.createElement("use",{xlinkHref:"#b",fillOpacity:"0",stroke:"#006AFF",strokeWidth:"2"}),d.default.createElement("use",{xlinkHref:"#c",fillOpacity:"0",stroke:"#006AFF",strokeWidth:"2"}))}},{key:"getMaximizingIcon",value:function(){return d.default.createElement("svg",{viewBox:"0 0 20 20"},d.default.createElement("defs",null,d.default.createElement("path",{d:"M20 0L0 20h20V0z",id:"a"}),d.default.createElement("path",{d:"M18.47 11.5l.03 7h-7",id:"b"}),d.default.createElement("path",{d:"M11 11l7 7",id:"c"})),d.default.createElement("use",{xlinkHref:"#a",opacity:".8",fill:"#84b7FF"}),d.default.createElement("use",{xlinkHref:"#b",fillOpacity:"0",stroke:"#006AFF",strokeWidth:"2"}),d.default.createElement("use",{xlinkHref:"#c",fillOpacity:"0",stroke:"#006AFF",strokeWidth:"2"}))}},{key:"render",value:function(){var e=this.props,t=e.type,a=e.onClick,n=null;switch(t){case u.MAP_SIZE.FULL:n=this.getMinimizingIcon();break;case u.MAP_SIZE.DEFAULT:n=this.getMaximizingIcon();break;default:console.error("Unknown window size found:",t)}return d.default.createElement("div",{className:"window-resize-control",onClick:a},n)}}]),t}(d.default.PureComponent);t.default=f},484:function(e,t,a){var n={"./BaiduMapAdapter":[485,3],"./GoogleMapAdapter":[486,4]};function l(e){var t=n[e];return t?a.e(t[1]).then((function(){var e=t[0];return a.t(e,7)})):Promise.resolve().then((function(){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}))}l.keys=function(){return Object.keys(n)},l.id=484,e.exports=l}}]); //# sourceMappingURL=2.bundle.js.map \ No newline at end of file diff --git a/modules/dreamview/frontend/dist/2.bundle.js.map b/modules/dreamview/frontend/dist/2.bundle.js.map index 3e2592c38bf26b2ecfe8666f5e8012b14bd4e2e4..6856c7644aadadda9860a52bc916943f479eca08 100644 --- a/modules/dreamview/frontend/dist/2.bundle.js.map +++ b/modules/dreamview/frontend/dist/2.bundle.js.map @@ -1 +1 @@ -{"version":3,"file":"2.bundle.js","sources":["webpack:///2.bundle.js"],"sourcesContent":["(window.webpackJsonp=window.webpackJsonp||[]).push([[2],{468:function(e,t,a){\"use strict\";Object.defineProperty(t,\"__esModule\",{value:!0}),t.default=void 0;var n=m(a(3)),l=m(a(1)),i=m(a(2)),o=m(a(4)),r=m(a(5)),d=m(a(0)),u=m(a(109)),c=m(a(20)),f=a(177),s=m(a(469)),p=m(a(470));function m(e){return e&&e.__esModule?e:{default:e}}var v=function(e){function t(e){(0,l.default)(this,t);var a=(0,o.default)(this,(t.__proto__||(0,n.default)(t)).call(this,e));if(a.scriptOnLoadHandler=a.scriptOnLoadHandler.bind(a),!u.default.mapAPILoaded){var i=function(){console.log(\"Map API script loaded.\")};\"BaiduMap\"===PARAMETERS.navigation.map?window.initMap=a.scriptOnLoadHandler:\"GoogleMap\"===PARAMETERS.navigation.map&&(i=a.scriptOnLoadHandler),(0,s.default)({url:PARAMETERS.navigation.mapAPiUrl,onLoad:i,onError:function(){console.log(\"Failed to load map api\")}})}return a}return(0,r.default)(t,e),(0,i.default)(t,[{key:\"componentDidMount\",value:function(){u.default.mapAPILoaded&&this.scriptOnLoadHandler()}},{key:\"componentDidUpdate\",value:function(){var e=this.props,t=e.hasRoutingControls,a=e.size;t&&a===f.MAP_SIZE.FULL?u.default.enableControls():u.default.disableControls()}},{key:\"scriptOnLoadHandler\",value:function(){a(471)(\"./\"+PARAMETERS.navigation.map+\"Adapter\").then((function(e){var t=new(0,e.default);u.default.mapAPILoaded=!0,u.default.initialize(c.default,t),u.default.disableControls()}))}},{key:\"componentWillUnmount\",value:function(){u.default.reset()}},{key:\"render\",value:function(){var e=this.props,t=e.width,a=e.height,n=e.size,l=e.onResize;return[\"GoogleMap\",\"BaiduMap\"].includes(PARAMETERS.navigation.map)?d.default.createElement(\"div\",{displayname:\"navigation\",className:\"navigation-view\",style:{width:t,height:a}},d.default.createElement(\"div\",{id:\"map_canvas\"}),d.default.createElement(p.default,{type:n,onClick:l})):(console.error(\"Map API \"+PARAMETERS.navigation.map+\" is not supported.\"),null)}}]),t}(d.default.Component);t.default=v},469:function(e,t,a){\"use strict\";Object.defineProperty(t,\"__esModule\",{value:!0}),t.default=function(e){var t=e.url,a=e.onLoad,n=e.onError,l=document.createElement(\"script\");l.src=t,l.type=\"text/javascript\",l.async=!0,l.onload=a,l.onerror=n,document.body.appendChild(l)}},470:function(e,t,a){\"use strict\";Object.defineProperty(t,\"__esModule\",{value:!0}),t.default=void 0;var n=c(a(3)),l=c(a(1)),i=c(a(2)),o=c(a(4)),r=c(a(5)),d=c(a(0)),u=a(177);function c(e){return e&&e.__esModule?e:{default:e}}var f=function(e){function t(){return(0,l.default)(this,t),(0,o.default)(this,(t.__proto__||(0,n.default)(t)).apply(this,arguments))}return(0,r.default)(t,e),(0,i.default)(t,[{key:\"getMinimizingIcon\",value:function(){return d.default.createElement(\"svg\",{viewBox:\"0 0 20 20\"},d.default.createElement(\"defs\",null,d.default.createElement(\"path\",{d:\"M20 0L0 20h20V0z\",id:\"a\"}),d.default.createElement(\"path\",{d:\"M11.53 18.5l-.03-7h7\",id:\"b\"}),d.default.createElement(\"path\",{d:\"M12 12l7 7\",id:\"c\"})),d.default.createElement(\"use\",{xlinkHref:\"#a\",opacity:\".8\",fill:\"#84b7FF\"}),d.default.createElement(\"use\",{xlinkHref:\"#b\",fillOpacity:\"0\",stroke:\"#006AFF\",strokeWidth:\"2\"}),d.default.createElement(\"use\",{xlinkHref:\"#c\",fillOpacity:\"0\",stroke:\"#006AFF\",strokeWidth:\"2\"}))}},{key:\"getMaximizingIcon\",value:function(){return d.default.createElement(\"svg\",{viewBox:\"0 0 20 20\"},d.default.createElement(\"defs\",null,d.default.createElement(\"path\",{d:\"M20 0L0 20h20V0z\",id:\"a\"}),d.default.createElement(\"path\",{d:\"M18.47 11.5l.03 7h-7\",id:\"b\"}),d.default.createElement(\"path\",{d:\"M11 11l7 7\",id:\"c\"})),d.default.createElement(\"use\",{xlinkHref:\"#a\",opacity:\".8\",fill:\"#84b7FF\"}),d.default.createElement(\"use\",{xlinkHref:\"#b\",fillOpacity:\"0\",stroke:\"#006AFF\",strokeWidth:\"2\"}),d.default.createElement(\"use\",{xlinkHref:\"#c\",fillOpacity:\"0\",stroke:\"#006AFF\",strokeWidth:\"2\"}))}},{key:\"render\",value:function(){var e=this.props,t=e.type,a=e.onClick,n=null;switch(t){case u.MAP_SIZE.FULL:n=this.getMinimizingIcon();break;case u.MAP_SIZE.DEFAULT:n=this.getMaximizingIcon();break;default:console.error(\"Unknown window size found:\",t)}return d.default.createElement(\"div\",{className:\"window-resize-control\",onClick:a},n)}}]),t}(d.default.PureComponent);t.default=f},471:function(e,t,a){var n={\"./BaiduMapAdapter\":[472,3],\"./GoogleMapAdapter\":[473,4]};function l(e){var t=n[e];return t?a.e(t[1]).then((function(){var e=t[0];return a.t(e,7)})):Promise.resolve().then((function(){var t=new Error(\"Cannot find module '\"+e+\"'\");throw t.code=\"MODULE_NOT_FOUND\",t}))}l.keys=function(){return Object.keys(n)},l.id=471,e.exports=l}}]);"],"mappings":"AAAA","sourceRoot":""} \ No newline at end of file +{"version":3,"file":"2.bundle.js","sources":["webpack:///2.bundle.js"],"sourcesContent":["(window.webpackJsonp=window.webpackJsonp||[]).push([[2],{481:function(e,t,a){\"use strict\";Object.defineProperty(t,\"__esModule\",{value:!0}),t.default=void 0;var n=m(a(3)),l=m(a(1)),i=m(a(2)),o=m(a(4)),r=m(a(5)),d=m(a(0)),u=m(a(109)),c=m(a(20)),f=a(179),s=m(a(482)),p=m(a(483));function m(e){return e&&e.__esModule?e:{default:e}}var v=function(e){function t(e){(0,l.default)(this,t);var a=(0,o.default)(this,(t.__proto__||(0,n.default)(t)).call(this,e));if(a.scriptOnLoadHandler=a.scriptOnLoadHandler.bind(a),!u.default.mapAPILoaded){var i=function(){console.log(\"Map API script loaded.\")};\"BaiduMap\"===PARAMETERS.navigation.map?window.initMap=a.scriptOnLoadHandler:\"GoogleMap\"===PARAMETERS.navigation.map&&(i=a.scriptOnLoadHandler),(0,s.default)({url:PARAMETERS.navigation.mapAPiUrl,onLoad:i,onError:function(){console.log(\"Failed to load map api\")}})}return a}return(0,r.default)(t,e),(0,i.default)(t,[{key:\"componentDidMount\",value:function(){u.default.mapAPILoaded&&this.scriptOnLoadHandler()}},{key:\"componentDidUpdate\",value:function(){var e=this.props,t=e.hasRoutingControls,a=e.size;t&&a===f.MAP_SIZE.FULL?u.default.enableControls():u.default.disableControls()}},{key:\"scriptOnLoadHandler\",value:function(){a(484)(\"./\"+PARAMETERS.navigation.map+\"Adapter\").then((function(e){var t=new(0,e.default);u.default.mapAPILoaded=!0,u.default.initialize(c.default,t),u.default.disableControls()}))}},{key:\"componentWillUnmount\",value:function(){u.default.reset()}},{key:\"render\",value:function(){var e=this.props,t=e.width,a=e.height,n=e.size,l=e.onResize;return[\"GoogleMap\",\"BaiduMap\"].includes(PARAMETERS.navigation.map)?d.default.createElement(\"div\",{displayname:\"navigation\",className:\"navigation-view\",style:{width:t,height:a}},d.default.createElement(\"div\",{id:\"map_canvas\"}),d.default.createElement(p.default,{type:n,onClick:l})):(console.error(\"Map API \"+PARAMETERS.navigation.map+\" is not supported.\"),null)}}]),t}(d.default.Component);t.default=v},482:function(e,t,a){\"use strict\";Object.defineProperty(t,\"__esModule\",{value:!0}),t.default=function(e){var t=e.url,a=e.onLoad,n=e.onError,l=document.createElement(\"script\");l.src=t,l.type=\"text/javascript\",l.async=!0,l.onload=a,l.onerror=n,document.body.appendChild(l)}},483:function(e,t,a){\"use strict\";Object.defineProperty(t,\"__esModule\",{value:!0}),t.default=void 0;var n=c(a(3)),l=c(a(1)),i=c(a(2)),o=c(a(4)),r=c(a(5)),d=c(a(0)),u=a(179);function c(e){return e&&e.__esModule?e:{default:e}}var f=function(e){function t(){return(0,l.default)(this,t),(0,o.default)(this,(t.__proto__||(0,n.default)(t)).apply(this,arguments))}return(0,r.default)(t,e),(0,i.default)(t,[{key:\"getMinimizingIcon\",value:function(){return d.default.createElement(\"svg\",{viewBox:\"0 0 20 20\"},d.default.createElement(\"defs\",null,d.default.createElement(\"path\",{d:\"M20 0L0 20h20V0z\",id:\"a\"}),d.default.createElement(\"path\",{d:\"M11.53 18.5l-.03-7h7\",id:\"b\"}),d.default.createElement(\"path\",{d:\"M12 12l7 7\",id:\"c\"})),d.default.createElement(\"use\",{xlinkHref:\"#a\",opacity:\".8\",fill:\"#84b7FF\"}),d.default.createElement(\"use\",{xlinkHref:\"#b\",fillOpacity:\"0\",stroke:\"#006AFF\",strokeWidth:\"2\"}),d.default.createElement(\"use\",{xlinkHref:\"#c\",fillOpacity:\"0\",stroke:\"#006AFF\",strokeWidth:\"2\"}))}},{key:\"getMaximizingIcon\",value:function(){return d.default.createElement(\"svg\",{viewBox:\"0 0 20 20\"},d.default.createElement(\"defs\",null,d.default.createElement(\"path\",{d:\"M20 0L0 20h20V0z\",id:\"a\"}),d.default.createElement(\"path\",{d:\"M18.47 11.5l.03 7h-7\",id:\"b\"}),d.default.createElement(\"path\",{d:\"M11 11l7 7\",id:\"c\"})),d.default.createElement(\"use\",{xlinkHref:\"#a\",opacity:\".8\",fill:\"#84b7FF\"}),d.default.createElement(\"use\",{xlinkHref:\"#b\",fillOpacity:\"0\",stroke:\"#006AFF\",strokeWidth:\"2\"}),d.default.createElement(\"use\",{xlinkHref:\"#c\",fillOpacity:\"0\",stroke:\"#006AFF\",strokeWidth:\"2\"}))}},{key:\"render\",value:function(){var e=this.props,t=e.type,a=e.onClick,n=null;switch(t){case u.MAP_SIZE.FULL:n=this.getMinimizingIcon();break;case u.MAP_SIZE.DEFAULT:n=this.getMaximizingIcon();break;default:console.error(\"Unknown window size found:\",t)}return d.default.createElement(\"div\",{className:\"window-resize-control\",onClick:a},n)}}]),t}(d.default.PureComponent);t.default=f},484:function(e,t,a){var n={\"./BaiduMapAdapter\":[485,3],\"./GoogleMapAdapter\":[486,4]};function l(e){var t=n[e];return t?a.e(t[1]).then((function(){var e=t[0];return a.t(e,7)})):Promise.resolve().then((function(){var t=new Error(\"Cannot find module '\"+e+\"'\");throw t.code=\"MODULE_NOT_FOUND\",t}))}l.keys=function(){return Object.keys(n)},l.id=484,e.exports=l}}]);"],"mappings":"AAAA","sourceRoot":""} \ No newline at end of file diff --git a/modules/dreamview/frontend/dist/3.bundle.js b/modules/dreamview/frontend/dist/3.bundle.js index 76805bcb7cc994584ce04a39d7203a94013c2472..2d0fbb4604625096a8de005e07f4be76b96c7f59 100644 --- a/modules/dreamview/frontend/dist/3.bundle.js +++ b/modules/dreamview/frontend/dist/3.bundle.js @@ -1,2 +1,2 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[3],{472:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=c(n(3)),o=c(n(4)),i=c(n(5)),l=c(n(36)),r=c(n(23)),s=c(n(1)),u=c(n(2)),d=n(176);function c(e){return e&&e.__esModule?e:{default:e}}var p=function(){function e(){(0,s.default)(this,e),this.map=null,this.controls=[],this.initializedCenter=!1}return(0,u.default)(e,[{key:"isInitialized",value:function(){return null!==this.map&&(0,r.default)(this.map).length>0}},{key:"loadMap",value:function(e,t){this.map=new BMap.Map(t,{enableMapClick:!1}),this.map.enableScrollWheelZoom(),this.map.addControl(new BMap.MapTypeControl({anchor:BMAP_ANCHOR_TOP_LEFT,type:BMAP_NAVIGATION_CONTROL_SMALL})),this.map.addControl(new BMap.NavigationControl({anchor:BMAP_ANCHOR_BOTTOM_RIGHT,type:BMAP_NAVIGATION_CONTROL_SMALL,enableGeolocation:!1}))}},{key:"setCenter",value:function(e){this.initializedCenter?this.map.setCenter(e):(this.map.centerAndZoom(e,19),this.initializedCenter=!0)}},{key:"setZoom",value:function(e){this.map.setZoom(e)}},{key:"addEventHandler",value:function(e,t){this.map.addEventListener(e,(function(e){var n=e.point;t(n)}))}},{key:"createPoint",value:function(e){var t=e.lat,n=e.lng;return new BMap.Point(n,t)}},{key:"createMarker",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=null;t&&(a=new BMap.Label(t,{point:e,offset:new BMap.Size(15,-15)}));var o=new BMap.Marker(e,{label:a,enableDragging:n,rotation:5});return o.setLabel(a),this.map.addOverlay(o),o}},{key:"createPolyline",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2,o={geodesic:!0,strokeColor:t,strokeOpacity:n,strokeWeight:a},i=new BMap.Polyline(e,o);return this.map.addOverlay(i),i}},{key:"createControl",value:function(e){var t=e.text,n=e.tip,a=e.color,o=e.offsetX,i=e.offsetY,l=e.onClickHandler,r=new f(t,n,a,new BMap.Size(o,i),l);this.map.addControl(r),this.controls.push(r)}},{key:"disableControls",value:function(){var e=this;this.controls.forEach((function(t){e.map.removeControl(t)}))}},{key:"enableControls",value:function(){var e=this;this.controls.forEach((function(t){e.map.addControl(t)}))}},{key:"getMarkerPosition",value:function(e){return e.getPosition()}},{key:"updatePolyline",value:function(e,t){e.setPath(t)}},{key:"removePolyline",value:function(e){this.map.removeOverlay(e)}},{key:"applyCoordinateOffset",value:function(e){var t=(0,l.default)(e,2),n=t[0],a=t[1];return(0,d.WGS84ToBD09LL)(n,a)}}]),e}();t.default=p;var f=function(e){function t(e,n,i,l,r){var u;(0,s.default)(this,t);for(var d=arguments.length,c=Array(d>5?d-5:0),p=5;p0}},{key:"loadMap",value:function(e,t){this.map=new BMap.Map(t,{enableMapClick:!1}),this.map.enableScrollWheelZoom(),this.map.addControl(new BMap.MapTypeControl({anchor:BMAP_ANCHOR_TOP_LEFT,type:BMAP_NAVIGATION_CONTROL_SMALL})),this.map.addControl(new BMap.NavigationControl({anchor:BMAP_ANCHOR_BOTTOM_RIGHT,type:BMAP_NAVIGATION_CONTROL_SMALL,enableGeolocation:!1}))}},{key:"setCenter",value:function(e){this.initializedCenter?this.map.setCenter(e):(this.map.centerAndZoom(e,19),this.initializedCenter=!0)}},{key:"setZoom",value:function(e){this.map.setZoom(e)}},{key:"addEventHandler",value:function(e,t){this.map.addEventListener(e,(function(e){var n=e.point;t(n)}))}},{key:"createPoint",value:function(e){var t=e.lat,n=e.lng;return new BMap.Point(n,t)}},{key:"createMarker",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=null;t&&(a=new BMap.Label(t,{point:e,offset:new BMap.Size(15,-15)}));var o=new BMap.Marker(e,{label:a,enableDragging:n,rotation:5});return o.setLabel(a),this.map.addOverlay(o),o}},{key:"createPolyline",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2,o={geodesic:!0,strokeColor:t,strokeOpacity:n,strokeWeight:a},i=new BMap.Polyline(e,o);return this.map.addOverlay(i),i}},{key:"createControl",value:function(e){var t=e.text,n=e.tip,a=e.color,o=e.offsetX,i=e.offsetY,l=e.onClickHandler,r=new f(t,n,a,new BMap.Size(o,i),l);this.map.addControl(r),this.controls.push(r)}},{key:"disableControls",value:function(){var e=this;this.controls.forEach((function(t){e.map.removeControl(t)}))}},{key:"enableControls",value:function(){var e=this;this.controls.forEach((function(t){e.map.addControl(t)}))}},{key:"getMarkerPosition",value:function(e){return e.getPosition()}},{key:"updatePolyline",value:function(e,t){e.setPath(t)}},{key:"removePolyline",value:function(e){this.map.removeOverlay(e)}},{key:"applyCoordinateOffset",value:function(e){var t=(0,l.default)(e,2),n=t[0],a=t[1];return(0,d.WGS84ToBD09LL)(n,a)}}]),e}();t.default=p;var f=function(e){function t(e,n,i,l,r){var u;(0,s.default)(this,t);for(var d=arguments.length,c=Array(d>5?d-5:0),p=5;p0}},{key:\"loadMap\",value:function(e,t){this.map=new BMap.Map(t,{enableMapClick:!1}),this.map.enableScrollWheelZoom(),this.map.addControl(new BMap.MapTypeControl({anchor:BMAP_ANCHOR_TOP_LEFT,type:BMAP_NAVIGATION_CONTROL_SMALL})),this.map.addControl(new BMap.NavigationControl({anchor:BMAP_ANCHOR_BOTTOM_RIGHT,type:BMAP_NAVIGATION_CONTROL_SMALL,enableGeolocation:!1}))}},{key:\"setCenter\",value:function(e){this.initializedCenter?this.map.setCenter(e):(this.map.centerAndZoom(e,19),this.initializedCenter=!0)}},{key:\"setZoom\",value:function(e){this.map.setZoom(e)}},{key:\"addEventHandler\",value:function(e,t){this.map.addEventListener(e,(function(e){var n=e.point;t(n)}))}},{key:\"createPoint\",value:function(e){var t=e.lat,n=e.lng;return new BMap.Point(n,t)}},{key:\"createMarker\",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=null;t&&(a=new BMap.Label(t,{point:e,offset:new BMap.Size(15,-15)}));var o=new BMap.Marker(e,{label:a,enableDragging:n,rotation:5});return o.setLabel(a),this.map.addOverlay(o),o}},{key:\"createPolyline\",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2,o={geodesic:!0,strokeColor:t,strokeOpacity:n,strokeWeight:a},i=new BMap.Polyline(e,o);return this.map.addOverlay(i),i}},{key:\"createControl\",value:function(e){var t=e.text,n=e.tip,a=e.color,o=e.offsetX,i=e.offsetY,l=e.onClickHandler,r=new f(t,n,a,new BMap.Size(o,i),l);this.map.addControl(r),this.controls.push(r)}},{key:\"disableControls\",value:function(){var e=this;this.controls.forEach((function(t){e.map.removeControl(t)}))}},{key:\"enableControls\",value:function(){var e=this;this.controls.forEach((function(t){e.map.addControl(t)}))}},{key:\"getMarkerPosition\",value:function(e){return e.getPosition()}},{key:\"updatePolyline\",value:function(e,t){e.setPath(t)}},{key:\"removePolyline\",value:function(e){this.map.removeOverlay(e)}},{key:\"applyCoordinateOffset\",value:function(e){var t=(0,l.default)(e,2),n=t[0],a=t[1];return(0,d.WGS84ToBD09LL)(n,a)}}]),e}();t.default=p;var f=function(e){function t(e,n,i,l,r){var u;(0,s.default)(this,t);for(var d=arguments.length,c=Array(d>5?d-5:0),p=5;p0}},{key:\"loadMap\",value:function(e,t){this.map=new BMap.Map(t,{enableMapClick:!1}),this.map.enableScrollWheelZoom(),this.map.addControl(new BMap.MapTypeControl({anchor:BMAP_ANCHOR_TOP_LEFT,type:BMAP_NAVIGATION_CONTROL_SMALL})),this.map.addControl(new BMap.NavigationControl({anchor:BMAP_ANCHOR_BOTTOM_RIGHT,type:BMAP_NAVIGATION_CONTROL_SMALL,enableGeolocation:!1}))}},{key:\"setCenter\",value:function(e){this.initializedCenter?this.map.setCenter(e):(this.map.centerAndZoom(e,19),this.initializedCenter=!0)}},{key:\"setZoom\",value:function(e){this.map.setZoom(e)}},{key:\"addEventHandler\",value:function(e,t){this.map.addEventListener(e,(function(e){var n=e.point;t(n)}))}},{key:\"createPoint\",value:function(e){var t=e.lat,n=e.lng;return new BMap.Point(n,t)}},{key:\"createMarker\",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=null;t&&(a=new BMap.Label(t,{point:e,offset:new BMap.Size(15,-15)}));var o=new BMap.Marker(e,{label:a,enableDragging:n,rotation:5});return o.setLabel(a),this.map.addOverlay(o),o}},{key:\"createPolyline\",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2,o={geodesic:!0,strokeColor:t,strokeOpacity:n,strokeWeight:a},i=new BMap.Polyline(e,o);return this.map.addOverlay(i),i}},{key:\"createControl\",value:function(e){var t=e.text,n=e.tip,a=e.color,o=e.offsetX,i=e.offsetY,l=e.onClickHandler,r=new f(t,n,a,new BMap.Size(o,i),l);this.map.addControl(r),this.controls.push(r)}},{key:\"disableControls\",value:function(){var e=this;this.controls.forEach((function(t){e.map.removeControl(t)}))}},{key:\"enableControls\",value:function(){var e=this;this.controls.forEach((function(t){e.map.addControl(t)}))}},{key:\"getMarkerPosition\",value:function(e){return e.getPosition()}},{key:\"updatePolyline\",value:function(e,t){e.setPath(t)}},{key:\"removePolyline\",value:function(e){this.map.removeOverlay(e)}},{key:\"applyCoordinateOffset\",value:function(e){var t=(0,l.default)(e,2),n=t[0],a=t[1];return(0,d.WGS84ToBD09LL)(n,a)}}]),e}();t.default=p;var f=function(e){function t(e,n,i,l,r){var u;(0,s.default)(this,t);for(var d=arguments.length,c=Array(d>5?d-5:0),p=5;p2&&void 0!==arguments[2])||arguments[2],o=new google.maps.Marker({position:e,label:t,draggable:n,map:this.map});return o}},{key:"createPolyline",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2,l=new google.maps.Polyline({path:e,geodesic:!0,strokeColor:t,strokeOpacity:n,strokeWeight:o,map:this.map});return l}},{key:"createControl",value:function(e){var t=e.text,n=e.tip,o=e.color,l=(e.offsetX,e.offsetY,e.onClickHandler),a=document.createElement("div"),i=document.createElement("div");i.style.backgroundColor=o,i.style.border="2px solid #fff",i.style.borderRadius="3px",i.style.boxShadow="0 2px 6px rgba(0,0,0,.3)",i.style.cursor="pointer",i.style.marginBottom="22px",i.style.textAlign="center",i.title=n,a.appendChild(i);var r=document.createElement("div");r.style.color="rgb(25,25,25)",r.style.fontFamily="Roboto,Arial,sans-serif",r.style.fontSize="16px",r.style.lineHeight="38px",r.style.paddingLeft="5px",r.style.paddingRight="5px",r.innerHTML=t,i.appendChild(r),i.addEventListener("click",(function(){l(r)})),this.map.controls[google.maps.ControlPosition.TOP_LEFT].push(a),this.controls.push(a)}},{key:"disableControls",value:function(){this.controls.forEach((function(e){e.style.display="none"}))}},{key:"enableControls",value:function(){this.controls.forEach((function(e){e.style.display="block"}))}},{key:"getMarkerPosition",value:function(e){var t=e.getPosition();return{lat:t.lat(),lng:t.lng()}}},{key:"updatePolyline",value:function(e,t){e.setPath(t)}},{key:"removePolyline",value:function(e){e.setMap(null)}},{key:"applyCoordinateOffset",value:function(e){var t=(0,o.default)(e,2),n=t[0],l=t[1];return(0,i.WGS84ToGCJ02)(n,l)}}]),e}();t.default=s}}]); +(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{486:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(n(36)),l=r(n(1)),a=r(n(2)),i=n(178);function r(e){return e&&e.__esModule?e:{default:e}}var s=function(){function e(){(0,l.default)(this,e),this.map=null,this.controls=[]}return(0,a.default)(e,[{key:"isInitialized",value:function(){return null!==this.map}},{key:"loadMap",value:function(e,t){var n={center:e,zoom:20,mapTypeId:google.maps.MapTypeId.ROADMAP,fullscreenControl:!1};this.map=new google.maps.Map(document.getElementById(t),n)}},{key:"setCenter",value:function(e){this.map.setCenter(e)}},{key:"setZoom",value:function(e){this.map.setZoom(e)}},{key:"addEventHandler",value:function(e,t){google.maps.event.addListener(this.map,e,(function(e){var n=e.latLng;t(n)}))}},{key:"createPoint",value:function(e){var t=e.lat,n=e.lng;return new google.maps.LatLng(t,n)}},{key:"createMarker",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=new google.maps.Marker({position:e,label:t,draggable:n,map:this.map});return o}},{key:"createPolyline",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2,l=new google.maps.Polyline({path:e,geodesic:!0,strokeColor:t,strokeOpacity:n,strokeWeight:o,map:this.map});return l}},{key:"createControl",value:function(e){var t=e.text,n=e.tip,o=e.color,l=(e.offsetX,e.offsetY,e.onClickHandler),a=document.createElement("div"),i=document.createElement("div");i.style.backgroundColor=o,i.style.border="2px solid #fff",i.style.borderRadius="3px",i.style.boxShadow="0 2px 6px rgba(0,0,0,.3)",i.style.cursor="pointer",i.style.marginBottom="22px",i.style.textAlign="center",i.title=n,a.appendChild(i);var r=document.createElement("div");r.style.color="rgb(25,25,25)",r.style.fontFamily="Roboto,Arial,sans-serif",r.style.fontSize="16px",r.style.lineHeight="38px",r.style.paddingLeft="5px",r.style.paddingRight="5px",r.innerHTML=t,i.appendChild(r),i.addEventListener("click",(function(){l(r)})),this.map.controls[google.maps.ControlPosition.TOP_LEFT].push(a),this.controls.push(a)}},{key:"disableControls",value:function(){this.controls.forEach((function(e){e.style.display="none"}))}},{key:"enableControls",value:function(){this.controls.forEach((function(e){e.style.display="block"}))}},{key:"getMarkerPosition",value:function(e){var t=e.getPosition();return{lat:t.lat(),lng:t.lng()}}},{key:"updatePolyline",value:function(e,t){e.setPath(t)}},{key:"removePolyline",value:function(e){e.setMap(null)}},{key:"applyCoordinateOffset",value:function(e){var t=(0,o.default)(e,2),n=t[0],l=t[1];return(0,i.WGS84ToGCJ02)(n,l)}}]),e}();t.default=s}}]); //# sourceMappingURL=4.bundle.js.map \ No newline at end of file diff --git a/modules/dreamview/frontend/dist/4.bundle.js.map b/modules/dreamview/frontend/dist/4.bundle.js.map index 101574b2b3607d67a59dd8055f48cd991f4d2f4b..9e9bffd132b268e6b364e5246819fe5ddf5d8989 100644 --- a/modules/dreamview/frontend/dist/4.bundle.js.map +++ b/modules/dreamview/frontend/dist/4.bundle.js.map @@ -1 +1 @@ -{"version":3,"file":"4.bundle.js","sources":["webpack:///4.bundle.js"],"sourcesContent":["(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{473:function(e,t,n){\"use strict\";Object.defineProperty(t,\"__esModule\",{value:!0}),t.default=void 0;var o=r(n(36)),l=r(n(1)),a=r(n(2)),i=n(176);function r(e){return e&&e.__esModule?e:{default:e}}var s=function(){function e(){(0,l.default)(this,e),this.map=null,this.controls=[]}return(0,a.default)(e,[{key:\"isInitialized\",value:function(){return null!==this.map}},{key:\"loadMap\",value:function(e,t){var n={center:e,zoom:20,mapTypeId:google.maps.MapTypeId.ROADMAP,fullscreenControl:!1};this.map=new google.maps.Map(document.getElementById(t),n)}},{key:\"setCenter\",value:function(e){this.map.setCenter(e)}},{key:\"setZoom\",value:function(e){this.map.setZoom(e)}},{key:\"addEventHandler\",value:function(e,t){google.maps.event.addListener(this.map,e,(function(e){var n=e.latLng;t(n)}))}},{key:\"createPoint\",value:function(e){var t=e.lat,n=e.lng;return new google.maps.LatLng(t,n)}},{key:\"createMarker\",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=new google.maps.Marker({position:e,label:t,draggable:n,map:this.map});return o}},{key:\"createPolyline\",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2,l=new google.maps.Polyline({path:e,geodesic:!0,strokeColor:t,strokeOpacity:n,strokeWeight:o,map:this.map});return l}},{key:\"createControl\",value:function(e){var t=e.text,n=e.tip,o=e.color,l=(e.offsetX,e.offsetY,e.onClickHandler),a=document.createElement(\"div\"),i=document.createElement(\"div\");i.style.backgroundColor=o,i.style.border=\"2px solid #fff\",i.style.borderRadius=\"3px\",i.style.boxShadow=\"0 2px 6px rgba(0,0,0,.3)\",i.style.cursor=\"pointer\",i.style.marginBottom=\"22px\",i.style.textAlign=\"center\",i.title=n,a.appendChild(i);var r=document.createElement(\"div\");r.style.color=\"rgb(25,25,25)\",r.style.fontFamily=\"Roboto,Arial,sans-serif\",r.style.fontSize=\"16px\",r.style.lineHeight=\"38px\",r.style.paddingLeft=\"5px\",r.style.paddingRight=\"5px\",r.innerHTML=t,i.appendChild(r),i.addEventListener(\"click\",(function(){l(r)})),this.map.controls[google.maps.ControlPosition.TOP_LEFT].push(a),this.controls.push(a)}},{key:\"disableControls\",value:function(){this.controls.forEach((function(e){e.style.display=\"none\"}))}},{key:\"enableControls\",value:function(){this.controls.forEach((function(e){e.style.display=\"block\"}))}},{key:\"getMarkerPosition\",value:function(e){var t=e.getPosition();return{lat:t.lat(),lng:t.lng()}}},{key:\"updatePolyline\",value:function(e,t){e.setPath(t)}},{key:\"removePolyline\",value:function(e){e.setMap(null)}},{key:\"applyCoordinateOffset\",value:function(e){var t=(0,o.default)(e,2),n=t[0],l=t[1];return(0,i.WGS84ToGCJ02)(n,l)}}]),e}();t.default=s}}]);"],"mappings":"AAAA","sourceRoot":""} \ No newline at end of file +{"version":3,"file":"4.bundle.js","sources":["webpack:///4.bundle.js"],"sourcesContent":["(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{486:function(e,t,n){\"use strict\";Object.defineProperty(t,\"__esModule\",{value:!0}),t.default=void 0;var o=r(n(36)),l=r(n(1)),a=r(n(2)),i=n(178);function r(e){return e&&e.__esModule?e:{default:e}}var s=function(){function e(){(0,l.default)(this,e),this.map=null,this.controls=[]}return(0,a.default)(e,[{key:\"isInitialized\",value:function(){return null!==this.map}},{key:\"loadMap\",value:function(e,t){var n={center:e,zoom:20,mapTypeId:google.maps.MapTypeId.ROADMAP,fullscreenControl:!1};this.map=new google.maps.Map(document.getElementById(t),n)}},{key:\"setCenter\",value:function(e){this.map.setCenter(e)}},{key:\"setZoom\",value:function(e){this.map.setZoom(e)}},{key:\"addEventHandler\",value:function(e,t){google.maps.event.addListener(this.map,e,(function(e){var n=e.latLng;t(n)}))}},{key:\"createPoint\",value:function(e){var t=e.lat,n=e.lng;return new google.maps.LatLng(t,n)}},{key:\"createMarker\",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=new google.maps.Marker({position:e,label:t,draggable:n,map:this.map});return o}},{key:\"createPolyline\",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2,l=new google.maps.Polyline({path:e,geodesic:!0,strokeColor:t,strokeOpacity:n,strokeWeight:o,map:this.map});return l}},{key:\"createControl\",value:function(e){var t=e.text,n=e.tip,o=e.color,l=(e.offsetX,e.offsetY,e.onClickHandler),a=document.createElement(\"div\"),i=document.createElement(\"div\");i.style.backgroundColor=o,i.style.border=\"2px solid #fff\",i.style.borderRadius=\"3px\",i.style.boxShadow=\"0 2px 6px rgba(0,0,0,.3)\",i.style.cursor=\"pointer\",i.style.marginBottom=\"22px\",i.style.textAlign=\"center\",i.title=n,a.appendChild(i);var r=document.createElement(\"div\");r.style.color=\"rgb(25,25,25)\",r.style.fontFamily=\"Roboto,Arial,sans-serif\",r.style.fontSize=\"16px\",r.style.lineHeight=\"38px\",r.style.paddingLeft=\"5px\",r.style.paddingRight=\"5px\",r.innerHTML=t,i.appendChild(r),i.addEventListener(\"click\",(function(){l(r)})),this.map.controls[google.maps.ControlPosition.TOP_LEFT].push(a),this.controls.push(a)}},{key:\"disableControls\",value:function(){this.controls.forEach((function(e){e.style.display=\"none\"}))}},{key:\"enableControls\",value:function(){this.controls.forEach((function(e){e.style.display=\"block\"}))}},{key:\"getMarkerPosition\",value:function(e){var t=e.getPosition();return{lat:t.lat(),lng:t.lng()}}},{key:\"updatePolyline\",value:function(e,t){e.setPath(t)}},{key:\"removePolyline\",value:function(e){e.setMap(null)}},{key:\"applyCoordinateOffset\",value:function(e){var t=(0,o.default)(e,2),n=t[0],l=t[1];return(0,i.WGS84ToGCJ02)(n,l)}}]),e}();t.default=s}}]);"],"mappings":"AAAA","sourceRoot":""} \ No newline at end of file diff --git a/modules/dreamview/frontend/dist/app.bundle.js b/modules/dreamview/frontend/dist/app.bundle.js index 2e84a797288015fb3a2d105ef6686d0cbde8cfaf..d6344dad7a40edbd879f54e6e315abb900e7687e 100644 --- a/modules/dreamview/frontend/dist/app.bundle.js +++ b/modules/dreamview/frontend/dist/app.bundle.js @@ -1,4 +1,4 @@ -!function(e){function t(t){for(var n,r,o=t[0],a=t[1],s=0,u=[];s6?l-6:0),c=6;c>",s=s||r,null==n[r]){if(t){var i=null===n[r]?"null":"undefined";return new Error("The "+a+" `"+s+"` is marked as required in `"+o+"`, but its value is `"+i+"`.")}return null}return e.apply(void 0,[n,r,o,a,s].concat(u))}))}var n=t.bind(null,!1);return n.isRequired=t.bind(null,!0),n}function w(e){var t=void 0===e?"undefined":s(e);return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,t){return"symbol"===e||("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}(t,e)?"symbol":t}function M(e,t){return x((function(n,r,o,a,s){return Object(i.untracked)((function(){if(e&&w(n[r])===t.toLowerCase())return null;var a=void 0;switch(t){case"Array":a=i.isObservableArray;break;case"Object":a=i.isObservableObject;break;case"Map":a=i.isObservableMap;break;default:throw new Error("Unexpected mobxType: "+t)}var l=n[r];if(!a(l)){var u=function(e){var t=w(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}(l),c=e?" or javascript `"+t.toLowerCase()+"`":"";return new Error("Invalid prop `"+s+"` of type `"+u+"` supplied to `"+o+"`, expected `mobx.Observable"+t+"`"+c+".")}return null}))}))}function S(e,t){return x((function(n,r,o,a,s){for(var l=arguments.length,u=Array(l>5?l-5:0),c=5;c2&&void 0!==arguments[2]&&arguments[2],i=e[t],r=J[t],o=i?!0===n?function(){r.apply(this,arguments),i.apply(this,arguments)}:function(){i.apply(this,arguments),r.apply(this,arguments)}:r;e[t]=o}function K(e,t){if(Z(e,t))return!0;if("object"!==(void 0===e?"undefined":s(e))||null===e||"object"!==(void 0===t?"undefined":s(t))||null===t)return!1;var n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(var r=0;r",n=this._reactInternalInstance&&this._reactInternalInstance._rootNodeID||this._reactInternalFiber&&this._reactInternalFiber._debugID,o=!1,a=!1;d.call(this,"props"),d.call(this,"state");var s=this.render.bind(this),l=null,u=!1,c=function(){u=!1;var t=void 0,n=void 0;if(l.track((function(){z&&(e.__$mobRenderStart=Date.now());try{n=i.extras.allowStateChanges(!1,s)}catch(e){t=e}z&&(e.__$mobRenderEnd=Date.now())})),t)throw q.emit(t),t;return n};this.render=function(){return(l=new i.Reaction(t+"#"+n+".render()",(function(){if(!u&&(u=!0,"function"==typeof e.componentWillReact&&e.componentWillReact(),!0!==e.__$mobxIsUnmounted)){var t=!0;try{a=!0,o||r.Component.prototype.forceUpdate.call(e),t=!1}finally{a=!1,t&&l.dispose()}}}))).reactComponent=e,c.$mobx=l,e.render=c,c()}}function d(e){var t=this[e],n=new i.Atom("reactive "+e);Object.defineProperty(this,e,{configurable:!0,enumerable:!0,get:function(){return n.reportObserved(),t},set:function(e){a||K(t,e)?t=e:(t=e,o=!0,n.reportChanged(),o=!1)}})}},componentWillUnmount:function(){if(!0!==B&&(this.render.$mobx&&this.render.$mobx.dispose(),this.__$mobxIsUnmounted=!0,z)){var e=G(this);e&&U&&U.delete(e),W.emit({event:"destroy",component:this,node:e})}},componentDidMount:function(){z&&V(this)},componentDidUpdate:function(){z&&V(this)},shouldComponentUpdate:function(e,t){return B&&console.warn("[mobx-react] It seems that a re-rendering of a React component is triggered while in static (server-side) mode. Please make sure components are rendered only once server-side."),this.state!==t||!K(this.props,e)}};function $(e,t){if("string"==typeof e)throw new Error("Store names should be provided as array");if(Array.isArray(e))return j||(j=!0,console.warn('Mobx observer: Using observer to inject stores is deprecated since 4.0. Use `@inject("store1", "store2") @observer ComponentClass` or `inject("store1", "store2")(observer(componentClass))` instead of `@observer(["store1", "store2"]) ComponentClass`')),t?F.apply(null,e)($(t)):function(t){return $(e,t)};var n,i,o=e;if(!0===o.isMobxInjector&&console.warn("Mobx observer: You are trying to use 'observer' on a component that already has 'inject'. Please apply 'observer' before applying 'inject'"),!("function"!=typeof o||o.prototype&&o.prototype.render||o.isReactClass||r.Component.isPrototypeOf(o)))return $((i=n=function(e){function t(){return l(this,t),d(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return c(t,e),u(t,[{key:"render",value:function(){return o.call(this,this.props,this.context)}}]),t}(r.Component),n.displayName=o.displayName||o.name,n.contextTypes=o.contextTypes,n.propTypes=o.propTypes,n.defaultProps=o.defaultProps,i));if(!o)throw new Error("Please pass a valid component to 'observer'");return function(e){X(e,"componentWillMount",!0),["componentDidMount","componentWillUnmount","componentDidUpdate"].forEach((function(t){X(e,t)})),e.shouldComponentUpdate||(e.shouldComponentUpdate=J.shouldComponentUpdate)}(o.prototype||o),o.isMobXReactObserver=!0,o}var Q=$((function(e){var t=e.children,n=e.inject,i=e.render,r=t||i;if(void 0===r)return null;if(!n)return r();var a=F(n)(r);return o.a.createElement(a,null)}));Q.displayName="Observer";var ee,te,ne=function(e,t,n,i,r){var o="children"===t?"render":"children";return"function"==typeof e[t]&&"function"==typeof e[o]?new Error("Invalid prop,do not use children and render in the same time in`"+n):"function"!=typeof e[t]&&"function"!=typeof e[o]?new Error("Invalid prop `"+r+"` of type `"+s(e[t])+"` supplied to `"+n+"`, expected `function`."):void 0};Q.propTypes={render:ne,children:ne};var ie={children:!0,key:!0,ref:!0},re=(te=ee=function(e){function t(){return l(this,t),d(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return c(t,e),u(t,[{key:"render",value:function(){return r.Children.only(this.props.children)}},{key:"getChildContext",value:function(){var e={},t=this.context.mobxStores;if(t)for(var n in t)e[n]=t[n];for(var i in this.props)ie[i]||"suppressChangedStoreWarning"===i||(e[i]=this.props[i]);return{mobxStores:e}}},{key:"componentWillReceiveProps",value:function(e){if(Object.keys(e).length!==Object.keys(this.props).length&&console.warn("MobX Provider: The set of provided stores has changed. Please avoid changing stores as the change might not propagate to all children"),!e.suppressChangedStoreWarning)for(var t in e)ie[t]||this.props[t]===e[t]||console.warn("MobX Provider: Provided store '"+t+"' has changed. Please avoid replacing stores as the change might not propagate to all children")}}]),t}(r.Component),ee.contextTypes={mobxStores:A},ee.childContextTypes={mobxStores:A.isRequired},te);if(!r.Component)throw new Error("mobx-react requires React to be available");if(!i.extras)throw new Error("mobx-react requires mobx to be available");"function"==typeof a.unstable_batchedUpdates&&i.extras.setReactionScheduler(a.unstable_batchedUpdates);var oe=function(e){return q.on(e)};if("object"===("undefined"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__?"undefined":s(__MOBX_DEVTOOLS_GLOBAL_HOOK__))){var ae={spy:i.spy,extras:i.extras},se={renderReporter:W,componentByNodeRegistery:U,trackComponents:H};__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobxReact(se,ae)}},function(e,t,n){"use strict";n.r(t),function(e){n.d(t,"extras",(function(){return On})),n.d(t,"Reaction",(function(){return ln})),n.d(t,"untracked",(function(){return Qt})),n.d(t,"IDerivationState",(function(){return Mt})),n.d(t,"Atom",(function(){return a})),n.d(t,"BaseAtom",(function(){return o})),n.d(t,"useStrict",(function(){return W})),n.d(t,"isStrictModeEnabled",(function(){return G})),n.d(t,"spy",(function(){return b})),n.d(t,"comparer",(function(){return ue})),n.d(t,"asReference",(function(){return fn})),n.d(t,"asFlat",(function(){return gn})),n.d(t,"asStructure",(function(){return mn})),n.d(t,"asMap",(function(){return vn})),n.d(t,"isModifierDescriptor",(function(){return je})),n.d(t,"isObservableObject",(function(){return Te})),n.d(t,"isBoxedObservable",(function(){return F})),n.d(t,"isObservableArray",(function(){return I})),n.d(t,"ObservableMap",(function(){return Ke})),n.d(t,"isObservableMap",(function(){return Je})),n.d(t,"map",(function(){return Ze})),n.d(t,"transaction",(function(){return qe})),n.d(t,"observable",(function(){return ze})),n.d(t,"computed",(function(){return xn})),n.d(t,"isObservable",(function(){return Ce})),n.d(t,"isComputed",(function(){return wn})),n.d(t,"extendObservable",(function(){return ke})),n.d(t,"extendShallowObservable",(function(){return Pe})),n.d(t,"observe",(function(){return Mn})),n.d(t,"intercept",(function(){return Sn})),n.d(t,"autorun",(function(){return ce})),n.d(t,"autorunAsync",(function(){return he})),n.d(t,"when",(function(){return de})),n.d(t,"reaction",(function(){return pe})),n.d(t,"action",(function(){return $})),n.d(t,"isAction",(function(){return te})),n.d(t,"runInAction",(function(){return ee})),n.d(t,"expr",(function(){return En})),n.d(t,"toJS",(function(){return Tn})),n.d(t,"createTransformer",(function(){return Cn})),n.d(t,"whyRun",(function(){return on})),n.d(t,"trace",(function(){return an})),n.d(t,"isArrayLike",(function(){return bt})); +!function(e){function t(t){for(var n,r,o=t[0],a=t[1],s=0,u=[];s6?l-6:0),c=6;c>",s=s||r,null==n[r]){if(t){var i=null===n[r]?"null":"undefined";return new Error("The "+a+" `"+s+"` is marked as required in `"+o+"`, but its value is `"+i+"`.")}return null}return e.apply(void 0,[n,r,o,a,s].concat(u))}))}var n=t.bind(null,!1);return n.isRequired=t.bind(null,!0),n}function M(e){var t=void 0===e?"undefined":s(e);return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,t){return"symbol"===e||("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}(t,e)?"symbol":t}function S(e,t){return w((function(n,r,o,a,s){return Object(i.untracked)((function(){if(e&&M(n[r])===t.toLowerCase())return null;var a=void 0;switch(t){case"Array":a=i.isObservableArray;break;case"Object":a=i.isObservableObject;break;case"Map":a=i.isObservableMap;break;default:throw new Error("Unexpected mobxType: "+t)}var l=n[r];if(!a(l)){var u=function(e){var t=M(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}(l),c=e?" or javascript `"+t.toLowerCase()+"`":"";return new Error("Invalid prop `"+s+"` of type `"+u+"` supplied to `"+o+"`, expected `mobx.Observable"+t+"`"+c+".")}return null}))}))}function E(e,t){return w((function(n,r,o,a,s){for(var l=arguments.length,u=Array(l>5?l-5:0),c=5;c2&&void 0!==arguments[2]&&arguments[2],i=e[t],r=J[t],o=i?!0===n?function(){r.apply(this,arguments),i.apply(this,arguments)}:function(){i.apply(this,arguments),r.apply(this,arguments)}:r;e[t]=o}function K(e,t){if(Z(e,t))return!0;if("object"!==(void 0===e?"undefined":s(e))||null===e||"object"!==(void 0===t?"undefined":s(t))||null===t)return!1;var n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(var r=0;r",n=this._reactInternalInstance&&this._reactInternalInstance._rootNodeID||this._reactInternalFiber&&this._reactInternalFiber._debugID,o=!1,a=!1;d.call(this,"props"),d.call(this,"state");var s=this.render.bind(this),l=null,u=!1,c=function(){u=!1;var t=void 0,n=void 0;if(l.track((function(){z&&(e.__$mobRenderStart=Date.now());try{n=i.extras.allowStateChanges(!1,s)}catch(e){t=e}z&&(e.__$mobRenderEnd=Date.now())})),t)throw q.emit(t),t;return n};this.render=function(){return(l=new i.Reaction(t+"#"+n+".render()",(function(){if(!u&&(u=!0,"function"==typeof e.componentWillReact&&e.componentWillReact(),!0!==e.__$mobxIsUnmounted)){var t=!0;try{a=!0,o||r.Component.prototype.forceUpdate.call(e),t=!1}finally{a=!1,t&&l.dispose()}}}))).reactComponent=e,c.$mobx=l,e.render=c,c()}}function d(e){var t=this[e],n=new i.Atom("reactive "+e);Object.defineProperty(this,e,{configurable:!0,enumerable:!0,get:function(){return n.reportObserved(),t},set:function(e){a||K(t,e)?t=e:(t=e,o=!0,n.reportChanged(),o=!1)}})}},componentWillUnmount:function(){if(!0!==B&&(this.render.$mobx&&this.render.$mobx.dispose(),this.__$mobxIsUnmounted=!0,z)){var e=G(this);e&&U&&U.delete(e),W.emit({event:"destroy",component:this,node:e})}},componentDidMount:function(){z&&V(this)},componentDidUpdate:function(){z&&V(this)},shouldComponentUpdate:function(e,t){return B&&console.warn("[mobx-react] It seems that a re-rendering of a React component is triggered while in static (server-side) mode. Please make sure components are rendered only once server-side."),this.state!==t||!K(this.props,e)}};function $(e,t){if("string"==typeof e)throw new Error("Store names should be provided as array");if(Array.isArray(e))return j||(j=!0,console.warn('Mobx observer: Using observer to inject stores is deprecated since 4.0. Use `@inject("store1", "store2") @observer ComponentClass` or `inject("store1", "store2")(observer(componentClass))` instead of `@observer(["store1", "store2"]) ComponentClass`')),t?F.apply(null,e)($(t)):function(t){return $(e,t)};var n,i,o=e;if(!0===o.isMobxInjector&&console.warn("Mobx observer: You are trying to use 'observer' on a component that already has 'inject'. Please apply 'observer' before applying 'inject'"),!("function"!=typeof o||o.prototype&&o.prototype.render||o.isReactClass||r.Component.isPrototypeOf(o)))return $((i=n=function(e){function t(){return l(this,t),d(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return c(t,e),u(t,[{key:"render",value:function(){return o.call(this,this.props,this.context)}}]),t}(r.Component),n.displayName=o.displayName||o.name,n.contextTypes=o.contextTypes,n.propTypes=o.propTypes,n.defaultProps=o.defaultProps,i));if(!o)throw new Error("Please pass a valid component to 'observer'");return function(e){X(e,"componentWillMount",!0),["componentDidMount","componentWillUnmount","componentDidUpdate"].forEach((function(t){X(e,t)})),e.shouldComponentUpdate||(e.shouldComponentUpdate=J.shouldComponentUpdate)}(o.prototype||o),o.isMobXReactObserver=!0,o}var Q=$((function(e){var t=e.children,n=e.inject,i=e.render,r=t||i;if(void 0===r)return null;if(!n)return r();var a=F(n)(r);return o.a.createElement(a,null)}));Q.displayName="Observer";var ee,te,ne=function(e,t,n,i,r){var o="children"===t?"render":"children";return"function"==typeof e[t]&&"function"==typeof e[o]?new Error("Invalid prop,do not use children and render in the same time in`"+n):"function"!=typeof e[t]&&"function"!=typeof e[o]?new Error("Invalid prop `"+r+"` of type `"+s(e[t])+"` supplied to `"+n+"`, expected `function`."):void 0};Q.propTypes={render:ne,children:ne};var ie={children:!0,key:!0,ref:!0},re=(te=ee=function(e){function t(){return l(this,t),d(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return c(t,e),u(t,[{key:"render",value:function(){return r.Children.only(this.props.children)}},{key:"getChildContext",value:function(){var e={},t=this.context.mobxStores;if(t)for(var n in t)e[n]=t[n];for(var i in this.props)ie[i]||"suppressChangedStoreWarning"===i||(e[i]=this.props[i]);return{mobxStores:e}}},{key:"componentWillReceiveProps",value:function(e){if(Object.keys(e).length!==Object.keys(this.props).length&&console.warn("MobX Provider: The set of provided stores has changed. Please avoid changing stores as the change might not propagate to all children"),!e.suppressChangedStoreWarning)for(var t in e)ie[t]||this.props[t]===e[t]||console.warn("MobX Provider: Provided store '"+t+"' has changed. Please avoid replacing stores as the change might not propagate to all children")}}]),t}(r.Component),ee.contextTypes={mobxStores:R},ee.childContextTypes={mobxStores:R.isRequired},te);if(!r.Component)throw new Error("mobx-react requires React to be available");if(!i.extras)throw new Error("mobx-react requires mobx to be available");"function"==typeof a.unstable_batchedUpdates&&i.extras.setReactionScheduler(a.unstable_batchedUpdates);var oe=function(e){return q.on(e)};if("object"===("undefined"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__?"undefined":s(__MOBX_DEVTOOLS_GLOBAL_HOOK__))){var ae={spy:i.spy,extras:i.extras},se={renderReporter:W,componentByNodeRegistery:U,trackComponents:H};__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobxReact(se,ae)}},function(e,t,n){"use strict";n.r(t),function(e){n.d(t,"extras",(function(){return Pn})),n.d(t,"Reaction",(function(){return un})),n.d(t,"untracked",(function(){return en})),n.d(t,"IDerivationState",(function(){return St})),n.d(t,"Atom",(function(){return a})),n.d(t,"BaseAtom",(function(){return o})),n.d(t,"useStrict",(function(){return G})),n.d(t,"isStrictModeEnabled",(function(){return V})),n.d(t,"spy",(function(){return b})),n.d(t,"comparer",(function(){return ce})),n.d(t,"asReference",(function(){return gn})),n.d(t,"asFlat",(function(){return vn})),n.d(t,"asStructure",(function(){return yn})),n.d(t,"asMap",(function(){return bn})),n.d(t,"isModifierDescriptor",(function(){return Ue})),n.d(t,"isObservableObject",(function(){return Ce})),n.d(t,"isBoxedObservable",(function(){return z})),n.d(t,"isObservableArray",(function(){return D})),n.d(t,"ObservableMap",(function(){return Ze})),n.d(t,"isObservableMap",(function(){return $e})),n.d(t,"map",(function(){return Je})),n.d(t,"transaction",(function(){return Xe})),n.d(t,"observable",(function(){return Be})),n.d(t,"computed",(function(){return Mn})),n.d(t,"isObservable",(function(){return Oe})),n.d(t,"isComputed",(function(){return Sn})),n.d(t,"extendObservable",(function(){return Pe})),n.d(t,"extendShallowObservable",(function(){return Ae})),n.d(t,"observe",(function(){return En})),n.d(t,"intercept",(function(){return Tn})),n.d(t,"autorun",(function(){return de})),n.d(t,"autorunAsync",(function(){return pe})),n.d(t,"when",(function(){return he})),n.d(t,"reaction",(function(){return fe})),n.d(t,"action",(function(){return Q})),n.d(t,"isAction",(function(){return ne})),n.d(t,"runInAction",(function(){return te})),n.d(t,"expr",(function(){return Cn})),n.d(t,"toJS",(function(){return On})),n.d(t,"createTransformer",(function(){return kn})),n.d(t,"whyRun",(function(){return an})),n.d(t,"trace",(function(){return sn})),n.d(t,"isArrayLike",(function(){return _t})); /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use @@ -13,12 +13,12 @@ MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ -var i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};function r(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var o=function(){function e(e){void 0===e&&(e="Atom@"+et()),this.name=e,this.isPendingUnobservation=!0,this.observers=[],this.observersIndexes={},this.diffValue=0,this.lastAccessedBy=0,this.lowestObserverState=Mt.NOT_TRACKING}return e.prototype.onBecomeUnobserved=function(){},e.prototype.reportObserved=function(){Vt(this)},e.prototype.reportChanged=function(){Wt(),function(e){if(e.lowestObserverState===Mt.STALE)return;e.lowestObserverState=Mt.STALE;var t=e.observers,n=t.length;for(;n--;){var i=t[n];i.dependenciesState===Mt.UP_TO_DATE&&(i.isTracing!==St.NONE&&Ht(i,e),i.onBecomeStale()),i.dependenciesState=Mt.STALE}}(this),Gt()},e.prototype.toString=function(){return this.name},e}(),a=function(e){function t(t,n,i){void 0===t&&(t="Atom@"+et()),void 0===n&&(n=at),void 0===i&&(i=at);var r=e.call(this,t)||this;return r.name=t,r.onBecomeObservedHandler=n,r.onBecomeUnobservedHandler=i,r.isPendingUnobservation=!1,r.isBeingTracked=!1,r}return r(t,e),t.prototype.reportObserved=function(){return Wt(),e.prototype.reportObserved.call(this),this.isBeingTracked||(this.isBeingTracked=!0,this.onBecomeObservedHandler()),Gt(),!!Ct.trackingDerivation},t.prototype.onBecomeUnobserved=function(){this.isBeingTracked=!1,this.onBecomeUnobservedHandler()},t}(o),s=yt("Atom",o);function l(e){return e.interceptors&&e.interceptors.length>0}function u(e,t){var n=e.interceptors||(e.interceptors=[]);return n.push(t),ot((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function c(e,t){var n=en();try{var i=e.interceptors;if(i)for(var r=0,o=i.length;r0}function h(e,t){var n=e.changeListeners||(e.changeListeners=[]);return n.push(t),ot((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function p(e,t){var n=en(),i=e.changeListeners;if(i){for(var r=0,o=(i=i.slice()).length;r=this.length,value:tt){for(var n=new Array(e-t),i=0;i0&&e+t+1>E&&R(e+t+1)},e.prototype.spliceWithArray=function(e,t,n){var i=this;Zt(this.atom);var r=this.values.length;if(void 0===e?e=0:e>r?e=r:e<0&&(e=Math.max(0,r+e)),t=1===arguments.length?r-e:null==t?0:Math.max(0,Math.min(t,r-e)),void 0===n&&(n=[]),l(this)){var o=c(this,{object:this.array,type:"splice",index:e,removedCount:t,added:n});if(!o)return $e;t=o.removedCount,n=o.added}var a=(n=n.map((function(e){return i.enhancer(e,void 0)}))).length-t;this.updateArrayLength(r,a);var s=this.spliceItemsIntoValues(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice(e,n,s),this.dehanceValues(s)},e.prototype.spliceItemsIntoValues=function(e,t,n){if(n.length<1e4)return(i=this.values).splice.apply(i,[e,t].concat(n));var i,r=this.values.slice(e,e+t);return this.values=this.values.slice(0,e).concat(n,this.values.slice(e+t)),r},e.prototype.notifyArrayChildUpdate=function(e,t,n){var i=!this.owned&&f(),r=d(this),o=r||i?{object:this.array,type:"update",index:e,newValue:t,oldValue:n}:null;i&&g(o),this.atom.reportChanged(),r&&p(this,o),i&&y()},e.prototype.notifyArraySplice=function(e,t,n){var i=!this.owned&&f(),r=d(this),o=r||i?{object:this.array,type:"splice",index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;i&&g(o),this.atom.reportChanged(),r&&p(this,o),i&&y()},e}(),O=function(e){function t(t,n,i,r){void 0===i&&(i="ObservableArray@"+et()),void 0===r&&(r=!1);var o=e.call(this)||this,a=new C(i,n,o,r);return mt(o,"$mobx",a),t&&t.length&&o.spliceWithArray(0,0,t),S&&Object.defineProperty(a.array,"0",k),o}return r(t,e),t.prototype.intercept=function(e){return this.$mobx.intercept(e)},t.prototype.observe=function(e,t){return void 0===t&&(t=!1),this.$mobx.observe(e,t)},t.prototype.clear=function(){return this.splice(0)},t.prototype.concat=function(){for(var e=[],t=0;t-1&&(this.splice(t,1),!0)},t.prototype.move=function(e,t){function n(e){if(e<0)throw new Error("[mobx.array] Index out of bounds: "+e+" is negative");var t=this.$mobx.values.length;if(e>=t)throw new Error("[mobx.array] Index out of bounds: "+e+" is not smaller than "+t)}if(n.call(this,e),n.call(this,t),e!==t){var i,r=this.$mobx.values;i=e0,"actions should have valid names, got: '"+e+"'");var n=function(){return U(e,t,this,arguments)};return n.originalFn=t,n.isMobxAction=!0,n}function U(e,t,n,i){var r=function(e,t,n,i){var r=f()&&!!e,o=0;if(r){o=Date.now();var a=i&&i.length||0,s=new Array(a);if(a>0)for(var l=0;l";ft(e,t,$(o,n))}),(function(e){return this[e]}),(function(){nt(!1,B("m001"))}),!1,!0),J=Y((function(e,t,n){ne(e,t,n)}),(function(e){return this[e]}),(function(){nt(!1,B("m001"))}),!1,!1),$=function(e,t,n,i){return 1===arguments.length&&"function"==typeof e?j(e.name||"",e):2===arguments.length&&"function"==typeof t?j(e,t):1===arguments.length&&"string"==typeof e?Q(e):Q(t).apply(null,arguments)};function Q(e){return function(t,n,i){if(i&&"function"==typeof i.value)return i.value=j(e,i.value),i.enumerable=!1,i.configurable=!0,i;if(void 0!==i&&void 0!==i.get)throw new Error("[mobx] action is not expected to be used with getters");return Z(e).apply(this,arguments)}}function ee(e,t,n){var i="string"==typeof e?e:e.name||"",r="function"==typeof e?e:t,o="function"==typeof e?t:n;return nt("function"==typeof r,B("m002")),nt(0===r.length,B("m003")),nt("string"==typeof i&&i.length>0,"actions should have valid names, got: '"+i+"'"),U(i,r,o,void 0)}function te(e){return"function"==typeof e&&!0===e.isMobxAction}function ne(e,t,n){var i=function(){return U(t,n,e,arguments)};i.isMobxAction=!0,ft(e,t,i)}$.bound=function(e,t,n){if("function"==typeof e){var i=j("",e);return i.autoBind=!0,i}return J.apply(null,arguments)};var ie=Object.prototype.toString;function re(e,t){return oe(e,t)}function oe(e,t,n,i){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return!1;if(e!=e)return t!=t;var r=typeof e;return("function"===r||"object"===r||"object"==typeof t)&&function(e,t,n,i){e=ae(e),t=ae(t);var r=ie.call(e);if(r!==ie.call(t))return!1;switch(r){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!=+e?+t!=+t:0==+e?1/+e==1/t:+e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object Symbol]":return"undefined"!=typeof Symbol&&Symbol.valueOf.call(e)===Symbol.valueOf.call(t)}var o="[object Array]"===r;if(!o){if("object"!=typeof e||"object"!=typeof t)return!1;var a=e.constructor,s=t.constructor;if(a!==s&&!("function"==typeof a&&a instanceof a&&"function"==typeof s&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}i=i||[];var l=(n=n||[]).length;for(;l--;)if(n[l]===e)return i[l]===t;if(n.push(e),i.push(t),o){if((l=e.length)!==t.length)return!1;for(;l--;)if(!oe(e[l],t[l],n,i))return!1}else{var u,c=Object.keys(e);if(l=c.length,Object.keys(t).length!==l)return!1;for(;l--;)if(u=c[l],!se(t,u)||!oe(e[u],t[u],n,i))return!1}return n.pop(),i.pop(),!0}(e,t,n,i)}function ae(e){return I(e)?e.peek():Je(e)?e.entries():_t(e)?function(e){var t=[];for(;;){var n=e.next();if(n.done)break;t.push(n.value)}return t}(e.entries()):e}function se(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function le(e,t){return e===t}var ue={identity:le,structural:function(e,t){return re(e,t)},default:function(e,t){return function(e,t){return"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)}(e,t)||le(e,t)}};function ce(e,t,n){var i,r,o;"string"==typeof e?(i=e,r=t,o=n):(i=e.name||"Autorun@"+et(),r=e,o=t),nt("function"==typeof r,B("m004")),nt(!1===te(r),B("m005")),o&&(r=r.bind(o));var a=new ln(i,(function(){this.track(s)}));function s(){r(a)}return a.schedule(),a.getDisposer()}function de(e,t,n,i){var r,o,a,s;return"string"==typeof e?(r=e,o=t,a=n,s=i):(r="When@"+et(),o=e,a=t,s=n),ce(r,(function(e){if(o.call(s)){e.dispose();var t=en();a.call(s),tn(t)}}))}function he(e,t,n,i){var r,o,a,s;"string"==typeof e?(r=e,o=t,a=n,s=i):(r=e.name||"AutorunAsync@"+et(),o=e,a=t,s=n),nt(!1===te(o),B("m006")),void 0===a&&(a=1),s&&(o=o.bind(s));var l=!1,u=new ln(r,(function(){l||(l=!0,setTimeout((function(){l=!1,u.isDisposed||u.track(c)}),a))}));function c(){o(u)}return u.schedule(),u.getDisposer()}function pe(e,t,n){var i;arguments.length>3&&tt(B("m007")),je(e)&&tt(B("m008")),(i="object"==typeof n?n:{}).name=i.name||e.name||t.name||"Reaction@"+et(),i.fireImmediately=!0===n||!0===i.fireImmediately,i.delay=i.delay||0,i.compareStructural=i.compareStructural||i.struct||!1,t=$(i.name,i.context?t.bind(i.context):t),i.context&&(e=e.bind(i.context));var r,o=!0,a=!1,s=i.equals?i.equals:i.compareStructural||i.struct?ue.structural:ue.default,l=new ln(i.name,(function(){o||i.delay<1?u():a||(a=!0,setTimeout((function(){a=!1,u()}),i.delay))}));function u(){if(!l.isDisposed){var n=!1;l.track((function(){var t=e(l);n=o||!s(r,t),r=t})),o&&i.fireImmediately&&t(r,l),o||!0!==n||t(r,l),o&&(o=!1)}}return l.schedule(),l.getDisposer()}var fe=function(){function e(e,t,n,i,r){this.derivation=e,this.scope=t,this.equals=n,this.dependenciesState=Mt.NOT_TRACKING,this.observing=[],this.newObserving=null,this.isPendingUnobservation=!1,this.observers=[],this.observersIndexes={},this.diffValue=0,this.runId=0,this.lastAccessedBy=0,this.lowestObserverState=Mt.UP_TO_DATE,this.unboundDepsCount=0,this.__mapid="#"+et(),this.value=new Yt(null),this.isComputing=!1,this.isRunningSetter=!1,this.isTracing=St.NONE,this.name=i||"ComputedValue@"+et(),r&&(this.setter=j(i+"-setter",r))}return e.prototype.onBecomeStale=function(){!function(e){if(e.lowestObserverState!==Mt.UP_TO_DATE)return;e.lowestObserverState=Mt.POSSIBLY_STALE;var t=e.observers,n=t.length;for(;n--;){var i=t[n];i.dependenciesState===Mt.UP_TO_DATE&&(i.dependenciesState=Mt.POSSIBLY_STALE,i.isTracing!==St.NONE&&Ht(i,e),i.onBecomeStale())}}(this)},e.prototype.onBecomeUnobserved=function(){$t(this),this.value=void 0},e.prototype.get=function(){nt(!this.isComputing,"Cycle detected in computation "+this.name,this.derivation),0===Ct.inBatch?(Wt(),Xt(this)&&(this.isTracing!==St.NONE&&console.log("[mobx.trace] '"+this.name+"' is being read outside a reactive context and doing a full recompute"),this.value=this.computeValue(!1)),Gt()):(Vt(this),Xt(this)&&this.trackAndCompute()&&function(e){if(e.lowestObserverState===Mt.STALE)return;e.lowestObserverState=Mt.STALE;var t=e.observers,n=t.length;for(;n--;){var i=t[n];i.dependenciesState===Mt.POSSIBLY_STALE?i.dependenciesState=Mt.STALE:i.dependenciesState===Mt.UP_TO_DATE&&(e.lowestObserverState=Mt.UP_TO_DATE)}}(this));var e=this.value;if(qt(e))throw e.cause;return e},e.prototype.peek=function(){var e=this.computeValue(!1);if(qt(e))throw e.cause;return e},e.prototype.set=function(e){if(this.setter){nt(!this.isRunningSetter,"The setter of computed value '"+this.name+"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?"),this.isRunningSetter=!0;try{this.setter.call(this.scope,e)}finally{this.isRunningSetter=!1}}else nt(!1,"[ComputedValue '"+this.name+"'] It is not possible to assign a new value to a computed value.")},e.prototype.trackAndCompute=function(){f()&&m({object:this.scope,type:"compute",fn:this.derivation});var e=this.value,t=this.dependenciesState===Mt.NOT_TRACKING,n=this.value=this.computeValue(!0);return t||qt(e)||qt(n)||!this.equals(e,n)},e.prototype.computeValue=function(e){var t;if(this.isComputing=!0,Ct.computationDepth++,e)t=Jt(this,this.derivation,this.scope);else try{t=this.derivation.call(this.scope)}catch(e){t=new Yt(e)}return Ct.computationDepth--,this.isComputing=!1,t},e.prototype.observe=function(e,t){var n=this,i=!0,r=void 0;return ce((function(){var o=n.get();if(!i||t){var a=en();e({type:"update",object:n,newValue:o,oldValue:r}),tn(a)}i=!1,r=o}))},e.prototype.toJSON=function(){return this.get()},e.prototype.toString=function(){return this.name+"["+this.derivation.toString()+"]"},e.prototype.valueOf=function(){return wt(this.get())},e.prototype.whyRun=function(){var e=Boolean(Ct.trackingDerivation),t=st(this.isComputing?this.newObserving:this.observing).map((function(e){return e.name})),n=st(zt(this).map((function(e){return e.name})));return"\nWhyRun? computation '"+this.name+"':\n * Running because: "+(e?"[active] the value of this computation is needed by a reaction":this.isComputing?"[get] The value of this computed was requested outside a reaction":"[idle] not running at the moment")+"\n"+(this.dependenciesState===Mt.NOT_TRACKING?B("m032"):" * This computation will re-run if any of the following observables changes:\n "+lt(t)+"\n "+(this.isComputing&&e?" (... or any observable accessed during the remainder of the current run)":"")+"\n "+B("m038")+"\n\n * If the outcome of this computation changes, the following observers will be re-run:\n "+lt(n)+"\n")},e}();fe.prototype[xt()]=fe.prototype.valueOf;var me=yt("ComputedValue",fe),ge=function(){function e(e,t){this.target=e,this.name=t,this.values={},this.changeListeners=null,this.interceptors=null}return e.prototype.observe=function(e,t){return nt(!0!==t,"`observe` doesn't support the fire immediately property for observable objects."),h(this,e)},e.prototype.intercept=function(e){return u(this,e)},e}();function ve(e,t){if(Te(e)&&e.hasOwnProperty("$mobx"))return e.$mobx;nt(Object.isExtensible(e),B("m035")),ct(e)||(t=(e.constructor.name||"ObservableObject")+"@"+et()),t||(t="ObservableObject@"+et());var n=new ge(e,t);return mt(e,"$mobx",n),n}function ye(e,t,n,i){if(e.values[t]&&!me(e.values[t]))return nt("value"in n,"The property "+t+" in "+e.name+" is already observable, cannot redefine it as computed property"),void(e.target[t]=n.value);if("value"in n)if(je(n.value)){var r=n.value;be(e,t,r.initialValue,r.enhancer)}else te(n.value)&&!0===n.value.autoBind?ne(e.target,t,n.value.originalFn):me(n.value)?function(e,t,n){var i=e.name+"."+t;n.name=i,n.scope||(n.scope=e.target);e.values[t]=n,Object.defineProperty(e.target,t,Me(t))}(e,t,n.value):be(e,t,n.value,i);else _e(e,t,n.get,n.set,ue.default,!0)}function be(e,t,n,i){if(vt(e.target,t),l(e)){var r=c(e,{object:e.target,name:t,type:"add",newValue:n});if(!r)return;n=r.newValue}n=(e.values[t]=new N(n,i,e.name+"."+t,!1)).value,Object.defineProperty(e.target,t,function(e){return xe[e]||(xe[e]={configurable:!0,enumerable:!0,get:function(){return this.$mobx.values[e].get()},set:function(t){Se(this,e,t)}})}(t)),function(e,t,n,i){var r=d(e),o=f(),a=r||o?{type:"add",object:t,name:n,newValue:i}:null;o&&g(a);r&&p(e,a);o&&y()}(e,e.target,t,n)}function _e(e,t,n,i,r,o){o&&vt(e.target,t),e.values[t]=new fe(n,e.target,r,e.name+"."+t,i),o&&Object.defineProperty(e.target,t,Me(t))}var xe={},we={};function Me(e){return we[e]||(we[e]={configurable:!0,enumerable:!1,get:function(){return this.$mobx.values[e].get()},set:function(t){return this.$mobx.values[e].set(t)}})}function Se(e,t,n){var i=e.$mobx,r=i.values[t];if(l(i)){if(!(s=c(i,{type:"update",object:e,name:t,newValue:n})))return;n=s.newValue}if((n=r.prepareNewValue(n))!==D){var o=d(i),a=f(),s=o||a?{type:"update",object:e,oldValue:r.value,name:t,newValue:n}:null;a&&g(s),r.setNewValue(n),o&&p(i,s),a&&y()}}var Ee=yt("ObservableObjectAdministration",ge);function Te(e){return!!ut(e)&&(X(e),Ee(e.$mobx))}function Ce(e,t){if(null==e)return!1;if(void 0!==t){if(I(e)||Je(e))throw new Error(B("m019"));if(Te(e)){var n=e.$mobx;return n.values&&!!n.values[t]}return!1}return Te(e)||!!e.$mobx||s(e)||pn(e)||me(e)}function Oe(e){return nt(!!e,":("),Y((function(t,n,i,r,o){vt(t,n),nt(!o||!o.get,B("m022")),be(ve(t,void 0),n,i,e)}),(function(e){var t=this.$mobx.values[e];if(void 0!==t)return t.get()}),(function(e,t){Se(this,e,t)}),!0,!1)}function ke(e){for(var t=[],n=1;n=2,B("m014")),nt("object"==typeof e,B("m015")),nt(!Je(e),B("m016")),n.forEach((function(e){nt("object"==typeof e,B("m017")),nt(!Ce(e),B("m018"))}));for(var i=ve(e),r={},o=n.length-1;o>=0;o--){var a=n[o];for(var s in a)if(!0!==r[s]&&pt(a,s)){if(r[s]=!0,e===a&&!gt(e,s))continue;var l=Object.getOwnPropertyDescriptor(a,s);ye(i,s,l,t)}}return e}var Re=Oe(We),Le=Oe(Ge),Ie=Oe(Ve),De=Oe(He),Ne=Oe(Ye);var Fe={box:function(e,t){return arguments.length>2&&Be("box"),new N(e,We,t)},shallowBox:function(e,t){return arguments.length>2&&Be("shallowBox"),new N(e,Ve,t)},array:function(e,t){return arguments.length>2&&Be("array"),new O(e,We,t)},shallowArray:function(e,t){return arguments.length>2&&Be("shallowArray"),new O(e,Ve,t)},map:function(e,t){return arguments.length>2&&Be("map"),new Ke(e,We,t)},shallowMap:function(e,t){return arguments.length>2&&Be("shallowMap"),new Ke(e,Ve,t)},object:function(e,t){arguments.length>2&&Be("object");var n={};return ve(n,t),ke(n,e),n},shallowObject:function(e,t){arguments.length>2&&Be("shallowObject");var n={};return ve(n,t),Pe(n,e),n},ref:function(){return arguments.length<2?Ue(Ve,arguments[0]):Ie.apply(null,arguments)},shallow:function(){return arguments.length<2?Ue(Ge,arguments[0]):Le.apply(null,arguments)},deep:function(){return arguments.length<2?Ue(We,arguments[0]):Re.apply(null,arguments)},struct:function(){return arguments.length<2?Ue(He,arguments[0]):De.apply(null,arguments)}},ze=function(e){if(void 0===e&&(e=void 0),"string"==typeof arguments[1])return Re.apply(null,arguments);if(nt(arguments.length<=1,B("m021")),nt(!je(e),B("m020")),Ce(e))return e;var t=We(e,void 0,void 0);return t!==e?t:ze.box(e)};function Be(e){tt("Expected one or two arguments to observable."+e+". Did you accidentally try to use observable."+e+" as decorator?")}function je(e){return"object"==typeof e&&null!==e&&!0===e.isMobxModifierDescriptor}function Ue(e,t){return nt(!je(t),"Modifiers cannot be nested"),{isMobxModifierDescriptor:!0,initialValue:t,enhancer:e}}function We(e,t,n){return je(e)&&tt("You tried to assign a modifier wrapped value to a collection, please define modifiers when creating the collection, not when modifying it"),Ce(e)?e:Array.isArray(e)?ze.array(e,n):ct(e)?ze.object(e,n):_t(e)?ze.map(e,n):e}function Ge(e,t,n){return je(e)&&tt("You tried to assign a modifier wrapped value to a collection, please define modifiers when creating the collection, not when modifying it"),null==e||Te(e)||I(e)||Je(e)?e:Array.isArray(e)?ze.shallowArray(e,n):ct(e)?ze.shallowObject(e,n):_t(e)?ze.shallowMap(e,n):tt("The shallow modifier / decorator can only used in combination with arrays, objects and maps")}function Ve(e){return e}function He(e,t,n){if(re(e,t))return t;if(Ce(e))return e;if(Array.isArray(e))return new O(e,He,n);if(_t(e))return new Ke(e,He,n);if(ct(e)){var i={};return ve(i,n),Ae(i,He,[e]),i}return e}function Ye(e,t,n){return re(e,t)?t:e}function qe(e,t){void 0===t&&(t=void 0),Wt();try{return e.apply(t)}finally{Gt()}}Object.keys(Fe).forEach((function(e){return ze[e]=Fe[e]})),ze.deep.struct=ze.struct,ze.ref.struct=function(){return arguments.length<2?Ue(Ye,arguments[0]):Ne.apply(null,arguments)};var Xe={},Ke=function(){function e(e,t,n){void 0===t&&(t=We),void 0===n&&(n="ObservableMap@"+et()),this.enhancer=t,this.name=n,this.$mobx=Xe,this._data=Object.create(null),this._hasMap=Object.create(null),this._keys=new O(void 0,Ve,this.name+".keys()",!0),this.interceptors=null,this.changeListeners=null,this.dehancer=void 0,this.merge(e)}return e.prototype._has=function(e){return void 0!==this._data[e]},e.prototype.has=function(e){return!!this.isValidKey(e)&&(e=""+e,this._hasMap[e]?this._hasMap[e].get():this._updateHasMapEntry(e,!1).get())},e.prototype.set=function(e,t){this.assertValidKey(e),e=""+e;var n=this._has(e);if(l(this)){var i=c(this,{type:n?"update":"add",object:this,newValue:t,name:e});if(!i)return this;t=i.newValue}return n?this._updateValue(e,t):this._addValue(e,t),this},e.prototype.delete=function(e){var t=this;if((this.assertValidKey(e),e=""+e,l(this))&&!(r=c(this,{type:"delete",object:this,name:e})))return!1;if(this._has(e)){var n=f(),i=d(this),r=i||n?{type:"delete",object:this,oldValue:this._data[e].value,name:e}:null;return n&&g(r),qe((function(){t._keys.remove(e),t._updateHasMapEntry(e,!1),t._data[e].setNewValue(void 0),t._data[e]=void 0})),i&&p(this,r),n&&y(),!0}return!1},e.prototype._updateHasMapEntry=function(e,t){var n=this._hasMap[e];return n?n.setNewValue(t):n=this._hasMap[e]=new N(t,Ve,this.name+"."+e+"?",!1),n},e.prototype._updateValue=function(e,t){var n=this._data[e];if((t=n.prepareNewValue(t))!==D){var i=f(),r=d(this),o=r||i?{type:"update",object:this,oldValue:n.value,name:e,newValue:t}:null;i&&g(o),n.setNewValue(t),r&&p(this,o),i&&y()}},e.prototype._addValue=function(e,t){var n=this;qe((function(){var i=n._data[e]=new N(t,n.enhancer,n.name+"."+e,!1);t=i.value,n._updateHasMapEntry(e,!0),n._keys.push(e)}));var i=f(),r=d(this),o=r||i?{type:"add",object:this,name:e,newValue:t}:null;i&&g(o),r&&p(this,o),i&&y()},e.prototype.get=function(e){return e=""+e,this.has(e)?this.dehanceValue(this._data[e].get()):this.dehanceValue(void 0)},e.prototype.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},e.prototype.keys=function(){return _(this._keys.slice())},e.prototype.values=function(){return _(this._keys.map(this.get,this))},e.prototype.entries=function(){var e=this;return _(this._keys.map((function(t){return[t,e.get(t)]})))},e.prototype.forEach=function(e,t){var n=this;this.keys().forEach((function(i){return e.call(t,n.get(i),i,n)}))},e.prototype.merge=function(e){var t=this;return Je(e)&&(e=e.toJS()),qe((function(){ct(e)?Object.keys(e).forEach((function(n){return t.set(n,e[n])})):Array.isArray(e)?e.forEach((function(e){var n=e[0],i=e[1];return t.set(n,i)})):_t(e)?e.forEach((function(e,n){return t.set(n,e)})):null!=e&&tt("Cannot initialize map from "+e)})),this},e.prototype.clear=function(){var e=this;qe((function(){Qt((function(){e.keys().forEach(e.delete,e)}))}))},e.prototype.replace=function(e){var t=this;return qe((function(){var n,i=ct(n=e)?Object.keys(n):Array.isArray(n)?n.map((function(e){return e[0]})):_t(n)?Array.from(n.keys()):Je(n)?n.keys():tt("Cannot get keys from "+n);t.keys().filter((function(e){return-1===i.indexOf(e)})).forEach((function(e){return t.delete(e)})),t.merge(e)})),this},Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),e.prototype.toJS=function(){var e=this,t={};return this.keys().forEach((function(n){return t[n]=e.get(n)})),t},e.prototype.toJSON=function(){return this.toJS()},e.prototype.isValidKey=function(e){return null!=e&&("string"==typeof e||"number"==typeof e||"boolean"==typeof e)},e.prototype.assertValidKey=function(e){if(!this.isValidKey(e))throw new Error("[mobx.map] Invalid key: '"+e+"', only strings, numbers and booleans are accepted as key in observable maps.")},e.prototype.toString=function(){var e=this;return this.name+"[{ "+this.keys().map((function(t){return t+": "+e.get(t)})).join(", ")+" }]"},e.prototype.observe=function(e,t){return nt(!0!==t,B("m033")),h(this,e)},e.prototype.intercept=function(e){return u(this,e)},e}();function Ze(e){return rt("`mobx.map` is deprecated, use `new ObservableMap` or `mobx.observable.map` instead"),ze.map(e)}x(Ke.prototype,(function(){return this.entries()}));var Je=yt("ObservableMap",Ke),$e=[];function Qe(){return"undefined"!=typeof window?window:e}function et(){return++Ct.mobxGuid}function tt(e,t){throw nt(!1,e,t),"X"}function nt(e,t,n){if(!e)throw new Error("[mobx] Invariant failed: "+t+(n?" in '"+n+"'":""))}Object.freeze($e);var it=[];function rt(e){return-1===it.indexOf(e)&&(it.push(e),console.error("[mobx] Deprecated: "+e),!0)}function ot(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var at=function(){};function st(e){var t=[];return e.forEach((function(e){-1===t.indexOf(e)&&t.push(e)})),t}function lt(e,t,n){return void 0===t&&(t=100),void 0===n&&(n=" - "),e?e.slice(0,t).join(n)+(e.length>t?" (... and "+(e.length-t)+"more)":""):""}function ut(e){return null!==e&&"object"==typeof e}function ct(e){if(null===e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function dt(){for(var e=arguments[0],t=1,n=arguments.length;t0&&(t.dependencies=st(e.observing).map(Nt)),t}function Ft(e){var t={name:e.name};return function(e){return e.observers&&e.observers.length>0}(e)&&(t.observers=zt(e).map(Ft)),t}function zt(e){return e.observers}function Bt(e,t){var n=e.observers.length;n&&(e.observersIndexes[t.__mapid]=n),e.observers[n]=t,e.lowestObserverState>t.dependenciesState&&(e.lowestObserverState=t.dependenciesState)}function jt(e,t){if(1===e.observers.length)e.observers.length=0,Ut(e);else{var n=e.observers,i=e.observersIndexes,r=n.pop();if(r!==t){var o=i[t.__mapid]||0;o?i[r.__mapid]=o:delete i[r.__mapid],n[o]=r}delete i[t.__mapid]}}function Ut(e){e.isPendingUnobservation||(e.isPendingUnobservation=!0,Ct.pendingUnobservations.push(e))}function Wt(){Ct.inBatch++}function Gt(){if(0==--Ct.inBatch){dn();for(var e=Ct.pendingUnobservations,t=0;t=1e3)return void n.push("(and many more)");n.push(""+new Array(i).join("\t")+t.name),t.dependencies&&t.dependencies.forEach((function(t){return e(t,n,i+1)}))}(Dt(e),n,1),new Function("debugger;\n/*\nTracing '"+e.name+"'\n\nYou are entering this break point because derivation '"+e.name+"' is being traced and '"+t.name+"' is now forcing it to update.\nJust follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update\nThe stackframe you are looking for is at least ~6-8 stack-frames up.\n\n"+(e instanceof fe?e.derivation.toString():"")+"\n\nThe dependencies for this derivation are:\n\n"+n.join("\n")+"\n*/\n ")()}}At.__mobxInstanceCount?(At.__mobxInstanceCount++,setTimeout((function(){Ot||kt||Pt||(Pt=!0,console.warn("[mobx] Warning: there are multiple mobx instances active. This might lead to unexpected results. See https://github.com/mobxjs/mobx/issues/1082 for details."))}),1)):At.__mobxInstanceCount=1,function(e){e[e.NOT_TRACKING=-1]="NOT_TRACKING",e[e.UP_TO_DATE=0]="UP_TO_DATE",e[e.POSSIBLY_STALE=1]="POSSIBLY_STALE",e[e.STALE=2]="STALE"}(Mt||(Mt={})),function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"}(St||(St={}));var Yt=function(e){this.cause=e};function qt(e){return e instanceof Yt}function Xt(e){switch(e.dependenciesState){case Mt.UP_TO_DATE:return!1;case Mt.NOT_TRACKING:case Mt.STALE:return!0;case Mt.POSSIBLY_STALE:for(var t=en(),n=e.observing,i=n.length,r=0;r0;Ct.computationDepth>0&&t&&tt(B("m031")+e.name),!Ct.allowStateChanges&&t&&tt(B(Ct.strictMode?"m030a":"m030b")+e.name)}function Jt(e,t,n){nn(e),e.newObserving=new Array(e.observing.length+100),e.unboundDepsCount=0,e.runId=++Ct.runId;var i,r=Ct.trackingDerivation;Ct.trackingDerivation=e;try{i=t.call(n)}catch(e){i=new Yt(e)}return Ct.trackingDerivation=r,function(e){for(var t=e.observing,n=e.observing=e.newObserving,i=Mt.UP_TO_DATE,r=0,o=e.unboundDepsCount,a=0;ai&&(i=s.dependenciesState)}n.length=r,e.newObserving=null,o=t.length;for(;o--;){0===(s=t[o]).diffValue&&jt(s,e),s.diffValue=0}for(;r--;){var s;1===(s=n[r]).diffValue&&(s.diffValue=0,Bt(s,e))}i!==Mt.UP_TO_DATE&&(e.dependenciesState=i,e.onBecomeStale())}(e),i}function $t(e){var t=e.observing;e.observing=[];for(var n=t.length;n--;)jt(t[n],e);e.dependenciesState=Mt.NOT_TRACKING}function Qt(e){var t=en(),n=e();return tn(t),n}function en(){var e=Ct.trackingDerivation;return Ct.trackingDerivation=null,e}function tn(e){Ct.trackingDerivation=e}function nn(e){if(e.dependenciesState!==Mt.UP_TO_DATE){e.dependenciesState=Mt.UP_TO_DATE;for(var t=e.observing,n=t.length;n--;)t[n].lowestObserverState=Mt.UP_TO_DATE}}function rn(e){return console.log(e),e}function on(e,t){return rt("`whyRun` is deprecated in favor of `trace`"),(e=sn(arguments))?me(e)||pn(e)?rn(e.whyRun()):tt(B("m025")):rn(B("m024"))}function an(){for(var e=[],t=0;t0||Ct.isRunningReactions||cn(hn)}function hn(){Ct.isRunningReactions=!0;for(var e=Ct.pendingReactions,t=0;e.length>0;){100==++t&&(console.error("Reaction doesn't converge to a stable state after 100 iterations. Probably there is a cycle in the reactive function: "+e[0]),e.splice(0));for(var n=e.splice(0),i=0,r=n.length;i=0&&Ct.globalReactionErrorHandlers.splice(t,1)}},reserveArrayBuffer:R,resetGlobalState:function(){Ct.resetId++;var e=new Tt;for(var t in e)-1===Et.indexOf(t)&&(Ct[t]=e[t]);Ct.allowStateChanges=!Ct.strictMode},isolateGlobalState:function(){kt=!0,Qe().__mobxInstanceCount--},shareGlobalState:function(){rt("Using `shareGlobalState` is not recommended, use peer dependencies instead. See https://github.com/mobxjs/mobx/issues/1082 for details."),Ot=!0;var e=Qe(),t=Ct;if(e.__mobservableTrackingStack||e.__mobservableViewStack)throw new Error("[mobx] An incompatible version of mobservable is already loaded.");if(e.__mobxGlobal&&e.__mobxGlobal.version!==t.version)throw new Error("[mobx] An incompatible version of mobx is already loaded.");e.__mobxGlobal?Ct=e.__mobxGlobal:e.__mobxGlobal=t},spyReport:m,spyReportEnd:y,spyReportStart:g,setReactionScheduler:function(e){var t=cn;cn=function(n){return e((function(){return t(n)}))}}},kn={Reaction:ln,untracked:Qt,Atom:a,BaseAtom:o,useStrict:W,isStrictModeEnabled:G,spy:b,comparer:ue,asReference:fn,asFlat:gn,asStructure:mn,asMap:vn,isModifierDescriptor:je,isObservableObject:Te,isBoxedObservable:F,isObservableArray:I,ObservableMap:Ke,isObservableMap:Je,map:Ze,transaction:qe,observable:ze,computed:xn,isObservable:Ce,isComputed:wn,extendObservable:ke,extendShallowObservable:Pe,observe:Mn,intercept:Sn,autorun:ce,autorunAsync:he,when:de,reaction:pe,action:$,isAction:te,runInAction:ee,expr:En,toJS:Tn,createTransformer:Cn,whyRun:on,isArrayLike:bt,extras:On},Pn=!1,An=function(e){var t=kn[e];Object.defineProperty(kn,e,{get:function(){return Pn||(Pn=!0,console.warn("Using default export (`import mobx from 'mobx'`) is deprecated and won’t work in mobx@4.0.0\nUse `import * as mobx from 'mobx'` instead")),t}})};for(var Rn in kn)An(Rn);"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:b,extras:On}),t.default=kn}.call(this,n(47))},function(e,t){var n=e.exports={version:"2.6.11"};"number"==typeof __e&&(__e=n)},function(e,t,n){var i; +var i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};function r(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var o=function(){function e(e){void 0===e&&(e="Atom@"+tt()),this.name=e,this.isPendingUnobservation=!0,this.observers=[],this.observersIndexes={},this.diffValue=0,this.lastAccessedBy=0,this.lowestObserverState=St.NOT_TRACKING}return e.prototype.onBecomeUnobserved=function(){},e.prototype.reportObserved=function(){Ht(this)},e.prototype.reportChanged=function(){Gt(),function(e){if(e.lowestObserverState===St.STALE)return;e.lowestObserverState=St.STALE;var t=e.observers,n=t.length;for(;n--;){var i=t[n];i.dependenciesState===St.UP_TO_DATE&&(i.isTracing!==Et.NONE&&Yt(i,e),i.onBecomeStale()),i.dependenciesState=St.STALE}}(this),Vt()},e.prototype.toString=function(){return this.name},e}(),a=function(e){function t(t,n,i){void 0===t&&(t="Atom@"+tt()),void 0===n&&(n=st),void 0===i&&(i=st);var r=e.call(this,t)||this;return r.name=t,r.onBecomeObservedHandler=n,r.onBecomeUnobservedHandler=i,r.isPendingUnobservation=!1,r.isBeingTracked=!1,r}return r(t,e),t.prototype.reportObserved=function(){return Gt(),e.prototype.reportObserved.call(this),this.isBeingTracked||(this.isBeingTracked=!0,this.onBecomeObservedHandler()),Vt(),!!Ot.trackingDerivation},t.prototype.onBecomeUnobserved=function(){this.isBeingTracked=!1,this.onBecomeUnobservedHandler()},t}(o),s=bt("Atom",o);function l(e){return e.interceptors&&e.interceptors.length>0}function u(e,t){var n=e.interceptors||(e.interceptors=[]);return n.push(t),at((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function c(e,t){var n=tn();try{var i=e.interceptors;if(i)for(var r=0,o=i.length;r0}function h(e,t){var n=e.changeListeners||(e.changeListeners=[]);return n.push(t),at((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function p(e,t){var n=tn(),i=e.changeListeners;if(i){for(var r=0,o=(i=i.slice()).length;r=this.length,value:tt){for(var n=new Array(e-t),i=0;i0&&e+t+1>T&&L(e+t+1)},e.prototype.spliceWithArray=function(e,t,n){var i=this;Jt(this.atom);var r=this.values.length;if(void 0===e?e=0:e>r?e=r:e<0&&(e=Math.max(0,r+e)),t=1===arguments.length?r-e:null==t?0:Math.max(0,Math.min(t,r-e)),void 0===n&&(n=[]),l(this)){var o=c(this,{object:this.array,type:"splice",index:e,removedCount:t,added:n});if(!o)return Qe;t=o.removedCount,n=o.added}var a=(n=n.map((function(e){return i.enhancer(e,void 0)}))).length-t;this.updateArrayLength(r,a);var s=this.spliceItemsIntoValues(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice(e,n,s),this.dehanceValues(s)},e.prototype.spliceItemsIntoValues=function(e,t,n){if(n.length<1e4)return(i=this.values).splice.apply(i,[e,t].concat(n));var i,r=this.values.slice(e,e+t);return this.values=this.values.slice(0,e).concat(n,this.values.slice(e+t)),r},e.prototype.notifyArrayChildUpdate=function(e,t,n){var i=!this.owned&&f(),r=d(this),o=r||i?{object:this.array,type:"update",index:e,newValue:t,oldValue:n}:null;i&&g(o),this.atom.reportChanged(),r&&p(this,o),i&&v()},e.prototype.notifyArraySplice=function(e,t,n){var i=!this.owned&&f(),r=d(this),o=r||i?{object:this.array,type:"splice",index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;i&&g(o),this.atom.reportChanged(),r&&p(this,o),i&&v()},e}(),k=function(e){function t(t,n,i,r){void 0===i&&(i="ObservableArray@"+tt()),void 0===r&&(r=!1);var o=e.call(this)||this,a=new O(i,n,o,r);return gt(o,"$mobx",a),t&&t.length&&o.spliceWithArray(0,0,t),E&&Object.defineProperty(a.array,"0",P),o}return r(t,e),t.prototype.intercept=function(e){return this.$mobx.intercept(e)},t.prototype.observe=function(e,t){return void 0===t&&(t=!1),this.$mobx.observe(e,t)},t.prototype.clear=function(){return this.splice(0)},t.prototype.concat=function(){for(var e=[],t=0;t-1&&(this.splice(t,1),!0)},t.prototype.move=function(e,t){function n(e){if(e<0)throw new Error("[mobx.array] Index out of bounds: "+e+" is negative");var t=this.$mobx.values.length;if(e>=t)throw new Error("[mobx.array] Index out of bounds: "+e+" is not smaller than "+t)}if(n.call(this,e),n.call(this,t),e!==t){var i,r=this.$mobx.values;i=e0,"actions should have valid names, got: '"+e+"'");var n=function(){return W(e,t,this,arguments)};return n.originalFn=t,n.isMobxAction=!0,n}function W(e,t,n,i){var r=function(e,t,n,i){var r=f()&&!!e,o=0;if(r){o=Date.now();var a=i&&i.length||0,s=new Array(a);if(a>0)for(var l=0;l";mt(e,t,Q(o,n))}),(function(e){return this[e]}),(function(){it(!1,j("m001"))}),!1,!0),$=q((function(e,t,n){ie(e,t,n)}),(function(e){return this[e]}),(function(){it(!1,j("m001"))}),!1,!1),Q=function(e,t,n,i){return 1===arguments.length&&"function"==typeof e?U(e.name||"",e):2===arguments.length&&"function"==typeof t?U(e,t):1===arguments.length&&"string"==typeof e?ee(e):ee(t).apply(null,arguments)};function ee(e){return function(t,n,i){if(i&&"function"==typeof i.value)return i.value=U(e,i.value),i.enumerable=!1,i.configurable=!0,i;if(void 0!==i&&void 0!==i.get)throw new Error("[mobx] action is not expected to be used with getters");return J(e).apply(this,arguments)}}function te(e,t,n){var i="string"==typeof e?e:e.name||"",r="function"==typeof e?e:t,o="function"==typeof e?t:n;return it("function"==typeof r,j("m002")),it(0===r.length,j("m003")),it("string"==typeof i&&i.length>0,"actions should have valid names, got: '"+i+"'"),W(i,r,o,void 0)}function ne(e){return"function"==typeof e&&!0===e.isMobxAction}function ie(e,t,n){var i=function(){return W(t,n,e,arguments)};i.isMobxAction=!0,mt(e,t,i)}Q.bound=function(e,t,n){if("function"==typeof e){var i=U("",e);return i.autoBind=!0,i}return $.apply(null,arguments)};var re=Object.prototype.toString;function oe(e,t){return ae(e,t)}function ae(e,t,n,i){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return!1;if(e!=e)return t!=t;var r=typeof e;return("function"===r||"object"===r||"object"==typeof t)&&function(e,t,n,i){e=se(e),t=se(t);var r=re.call(e);if(r!==re.call(t))return!1;switch(r){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!=+e?+t!=+t:0==+e?1/+e==1/t:+e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object Symbol]":return"undefined"!=typeof Symbol&&Symbol.valueOf.call(e)===Symbol.valueOf.call(t)}var o="[object Array]"===r;if(!o){if("object"!=typeof e||"object"!=typeof t)return!1;var a=e.constructor,s=t.constructor;if(a!==s&&!("function"==typeof a&&a instanceof a&&"function"==typeof s&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}i=i||[];var l=(n=n||[]).length;for(;l--;)if(n[l]===e)return i[l]===t;if(n.push(e),i.push(t),o){if((l=e.length)!==t.length)return!1;for(;l--;)if(!ae(e[l],t[l],n,i))return!1}else{var u,c=Object.keys(e);if(l=c.length,Object.keys(t).length!==l)return!1;for(;l--;)if(u=c[l],!le(t,u)||!ae(e[u],t[u],n,i))return!1}return n.pop(),i.pop(),!0}(e,t,n,i)}function se(e){return D(e)?e.peek():$e(e)?e.entries():xt(e)?function(e){var t=[];for(;;){var n=e.next();if(n.done)break;t.push(n.value)}return t}(e.entries()):e}function le(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ue(e,t){return e===t}var ce={identity:ue,structural:function(e,t){return oe(e,t)},default:function(e,t){return function(e,t){return"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)}(e,t)||ue(e,t)}};function de(e,t,n){var i,r,o;"string"==typeof e?(i=e,r=t,o=n):(i=e.name||"Autorun@"+tt(),r=e,o=t),it("function"==typeof r,j("m004")),it(!1===ne(r),j("m005")),o&&(r=r.bind(o));var a=new un(i,(function(){this.track(s)}));function s(){r(a)}return a.schedule(),a.getDisposer()}function he(e,t,n,i){var r,o,a,s;return"string"==typeof e?(r=e,o=t,a=n,s=i):(r="When@"+tt(),o=e,a=t,s=n),de(r,(function(e){if(o.call(s)){e.dispose();var t=tn();a.call(s),nn(t)}}))}function pe(e,t,n,i){var r,o,a,s;"string"==typeof e?(r=e,o=t,a=n,s=i):(r=e.name||"AutorunAsync@"+tt(),o=e,a=t,s=n),it(!1===ne(o),j("m006")),void 0===a&&(a=1),s&&(o=o.bind(s));var l=!1,u=new un(r,(function(){l||(l=!0,setTimeout((function(){l=!1,u.isDisposed||u.track(c)}),a))}));function c(){o(u)}return u.schedule(),u.getDisposer()}function fe(e,t,n){var i;arguments.length>3&&nt(j("m007")),Ue(e)&&nt(j("m008")),(i="object"==typeof n?n:{}).name=i.name||e.name||t.name||"Reaction@"+tt(),i.fireImmediately=!0===n||!0===i.fireImmediately,i.delay=i.delay||0,i.compareStructural=i.compareStructural||i.struct||!1,t=Q(i.name,i.context?t.bind(i.context):t),i.context&&(e=e.bind(i.context));var r,o=!0,a=!1,s=i.equals?i.equals:i.compareStructural||i.struct?ce.structural:ce.default,l=new un(i.name,(function(){o||i.delay<1?u():a||(a=!0,setTimeout((function(){a=!1,u()}),i.delay))}));function u(){if(!l.isDisposed){var n=!1;l.track((function(){var t=e(l);n=o||!s(r,t),r=t})),o&&i.fireImmediately&&t(r,l),o||!0!==n||t(r,l),o&&(o=!1)}}return l.schedule(),l.getDisposer()}var me=function(){function e(e,t,n,i,r){this.derivation=e,this.scope=t,this.equals=n,this.dependenciesState=St.NOT_TRACKING,this.observing=[],this.newObserving=null,this.isPendingUnobservation=!1,this.observers=[],this.observersIndexes={},this.diffValue=0,this.runId=0,this.lastAccessedBy=0,this.lowestObserverState=St.UP_TO_DATE,this.unboundDepsCount=0,this.__mapid="#"+tt(),this.value=new qt(null),this.isComputing=!1,this.isRunningSetter=!1,this.isTracing=Et.NONE,this.name=i||"ComputedValue@"+tt(),r&&(this.setter=U(i+"-setter",r))}return e.prototype.onBecomeStale=function(){!function(e){if(e.lowestObserverState!==St.UP_TO_DATE)return;e.lowestObserverState=St.POSSIBLY_STALE;var t=e.observers,n=t.length;for(;n--;){var i=t[n];i.dependenciesState===St.UP_TO_DATE&&(i.dependenciesState=St.POSSIBLY_STALE,i.isTracing!==Et.NONE&&Yt(i,e),i.onBecomeStale())}}(this)},e.prototype.onBecomeUnobserved=function(){Qt(this),this.value=void 0},e.prototype.get=function(){it(!this.isComputing,"Cycle detected in computation "+this.name,this.derivation),0===Ot.inBatch?(Gt(),Kt(this)&&(this.isTracing!==Et.NONE&&console.log("[mobx.trace] '"+this.name+"' is being read outside a reactive context and doing a full recompute"),this.value=this.computeValue(!1)),Vt()):(Ht(this),Kt(this)&&this.trackAndCompute()&&function(e){if(e.lowestObserverState===St.STALE)return;e.lowestObserverState=St.STALE;var t=e.observers,n=t.length;for(;n--;){var i=t[n];i.dependenciesState===St.POSSIBLY_STALE?i.dependenciesState=St.STALE:i.dependenciesState===St.UP_TO_DATE&&(e.lowestObserverState=St.UP_TO_DATE)}}(this));var e=this.value;if(Xt(e))throw e.cause;return e},e.prototype.peek=function(){var e=this.computeValue(!1);if(Xt(e))throw e.cause;return e},e.prototype.set=function(e){if(this.setter){it(!this.isRunningSetter,"The setter of computed value '"+this.name+"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?"),this.isRunningSetter=!0;try{this.setter.call(this.scope,e)}finally{this.isRunningSetter=!1}}else it(!1,"[ComputedValue '"+this.name+"'] It is not possible to assign a new value to a computed value.")},e.prototype.trackAndCompute=function(){f()&&m({object:this.scope,type:"compute",fn:this.derivation});var e=this.value,t=this.dependenciesState===St.NOT_TRACKING,n=this.value=this.computeValue(!0);return t||Xt(e)||Xt(n)||!this.equals(e,n)},e.prototype.computeValue=function(e){var t;if(this.isComputing=!0,Ot.computationDepth++,e)t=$t(this,this.derivation,this.scope);else try{t=this.derivation.call(this.scope)}catch(e){t=new qt(e)}return Ot.computationDepth--,this.isComputing=!1,t},e.prototype.observe=function(e,t){var n=this,i=!0,r=void 0;return de((function(){var o=n.get();if(!i||t){var a=tn();e({type:"update",object:n,newValue:o,oldValue:r}),nn(a)}i=!1,r=o}))},e.prototype.toJSON=function(){return this.get()},e.prototype.toString=function(){return this.name+"["+this.derivation.toString()+"]"},e.prototype.valueOf=function(){return Mt(this.get())},e.prototype.whyRun=function(){var e=Boolean(Ot.trackingDerivation),t=lt(this.isComputing?this.newObserving:this.observing).map((function(e){return e.name})),n=lt(Bt(this).map((function(e){return e.name})));return"\nWhyRun? computation '"+this.name+"':\n * Running because: "+(e?"[active] the value of this computation is needed by a reaction":this.isComputing?"[get] The value of this computed was requested outside a reaction":"[idle] not running at the moment")+"\n"+(this.dependenciesState===St.NOT_TRACKING?j("m032"):" * This computation will re-run if any of the following observables changes:\n "+ut(t)+"\n "+(this.isComputing&&e?" (... or any observable accessed during the remainder of the current run)":"")+"\n "+j("m038")+"\n\n * If the outcome of this computation changes, the following observers will be re-run:\n "+ut(n)+"\n")},e}();me.prototype[wt()]=me.prototype.valueOf;var ge=bt("ComputedValue",me),ye=function(){function e(e,t){this.target=e,this.name=t,this.values={},this.changeListeners=null,this.interceptors=null}return e.prototype.observe=function(e,t){return it(!0!==t,"`observe` doesn't support the fire immediately property for observable objects."),h(this,e)},e.prototype.intercept=function(e){return u(this,e)},e}();function ve(e,t){if(Ce(e)&&e.hasOwnProperty("$mobx"))return e.$mobx;it(Object.isExtensible(e),j("m035")),dt(e)||(t=(e.constructor.name||"ObservableObject")+"@"+tt()),t||(t="ObservableObject@"+tt());var n=new ye(e,t);return gt(e,"$mobx",n),n}function be(e,t,n,i){if(e.values[t]&&!ge(e.values[t]))return it("value"in n,"The property "+t+" in "+e.name+" is already observable, cannot redefine it as computed property"),void(e.target[t]=n.value);if("value"in n)if(Ue(n.value)){var r=n.value;_e(e,t,r.initialValue,r.enhancer)}else ne(n.value)&&!0===n.value.autoBind?ie(e.target,t,n.value.originalFn):ge(n.value)?function(e,t,n){var i=e.name+"."+t;n.name=i,n.scope||(n.scope=e.target);e.values[t]=n,Object.defineProperty(e.target,t,Se(t))}(e,t,n.value):_e(e,t,n.value,i);else xe(e,t,n.get,n.set,ce.default,!0)}function _e(e,t,n,i){if(vt(e.target,t),l(e)){var r=c(e,{object:e.target,name:t,type:"add",newValue:n});if(!r)return;n=r.newValue}n=(e.values[t]=new F(n,i,e.name+"."+t,!1)).value,Object.defineProperty(e.target,t,function(e){return we[e]||(we[e]={configurable:!0,enumerable:!0,get:function(){return this.$mobx.values[e].get()},set:function(t){Ee(this,e,t)}})}(t)),function(e,t,n,i){var r=d(e),o=f(),a=r||o?{type:"add",object:t,name:n,newValue:i}:null;o&&g(a);r&&p(e,a);o&&v()}(e,e.target,t,n)}function xe(e,t,n,i,r,o){o&&vt(e.target,t),e.values[t]=new me(n,e.target,r,e.name+"."+t,i),o&&Object.defineProperty(e.target,t,Se(t))}var we={},Me={};function Se(e){return Me[e]||(Me[e]={configurable:!0,enumerable:!1,get:function(){return this.$mobx.values[e].get()},set:function(t){return this.$mobx.values[e].set(t)}})}function Ee(e,t,n){var i=e.$mobx,r=i.values[t];if(l(i)){if(!(s=c(i,{type:"update",object:e,name:t,newValue:n})))return;n=s.newValue}if((n=r.prepareNewValue(n))!==N){var o=d(i),a=f(),s=o||a?{type:"update",object:e,oldValue:r.value,name:t,newValue:n}:null;a&&g(s),r.setNewValue(n),o&&p(i,s),a&&v()}}var Te=bt("ObservableObjectAdministration",ye);function Ce(e){return!!ct(e)&&(K(e),Te(e.$mobx))}function Oe(e,t){if(null==e)return!1;if(void 0!==t){if(D(e)||$e(e))throw new Error(j("m019"));if(Ce(e)){var n=e.$mobx;return n.values&&!!n.values[t]}return!1}return Ce(e)||!!e.$mobx||s(e)||mn(e)||ge(e)}function ke(e){return it(!!e,":("),q((function(t,n,i,r,o){vt(t,n),it(!o||!o.get,j("m022")),_e(ve(t,void 0),n,i,e)}),(function(e){var t=this.$mobx.values[e];if(void 0!==t)return t.get()}),(function(e,t){Ee(this,e,t)}),!0,!1)}function Pe(e){for(var t=[],n=1;n=2,j("m014")),it("object"==typeof e,j("m015")),it(!$e(e),j("m016")),n.forEach((function(e){it("object"==typeof e,j("m017")),it(!Oe(e),j("m018"))}));for(var i=ve(e),r={},o=n.length-1;o>=0;o--){var a=n[o];for(var s in a)if(!0!==r[s]&&ft(a,s)){if(r[s]=!0,e===a&&!yt(e,s))continue;be(i,s,Object.getOwnPropertyDescriptor(a,s),t)}}return e}var Le=ke(Ge),Ie=ke(Ve),De=ke(He),Ne=ke(Ye),Fe=ke(qe);var ze={box:function(e,t){return arguments.length>2&&je("box"),new F(e,Ge,t)},shallowBox:function(e,t){return arguments.length>2&&je("shallowBox"),new F(e,He,t)},array:function(e,t){return arguments.length>2&&je("array"),new k(e,Ge,t)},shallowArray:function(e,t){return arguments.length>2&&je("shallowArray"),new k(e,He,t)},map:function(e,t){return arguments.length>2&&je("map"),new Ze(e,Ge,t)},shallowMap:function(e,t){return arguments.length>2&&je("shallowMap"),new Ze(e,He,t)},object:function(e,t){arguments.length>2&&je("object");var n={};return ve(n,t),Pe(n,e),n},shallowObject:function(e,t){arguments.length>2&&je("shallowObject");var n={};return ve(n,t),Ae(n,e),n},ref:function(){return arguments.length<2?We(He,arguments[0]):De.apply(null,arguments)},shallow:function(){return arguments.length<2?We(Ve,arguments[0]):Ie.apply(null,arguments)},deep:function(){return arguments.length<2?We(Ge,arguments[0]):Le.apply(null,arguments)},struct:function(){return arguments.length<2?We(Ye,arguments[0]):Ne.apply(null,arguments)}},Be=function(e){if(void 0===e&&(e=void 0),"string"==typeof arguments[1])return Le.apply(null,arguments);if(it(arguments.length<=1,j("m021")),it(!Ue(e),j("m020")),Oe(e))return e;var t=Ge(e,void 0,void 0);return t!==e?t:Be.box(e)};function je(e){nt("Expected one or two arguments to observable."+e+". Did you accidentally try to use observable."+e+" as decorator?")}function Ue(e){return"object"==typeof e&&null!==e&&!0===e.isMobxModifierDescriptor}function We(e,t){return it(!Ue(t),"Modifiers cannot be nested"),{isMobxModifierDescriptor:!0,initialValue:t,enhancer:e}}function Ge(e,t,n){return Ue(e)&&nt("You tried to assign a modifier wrapped value to a collection, please define modifiers when creating the collection, not when modifying it"),Oe(e)?e:Array.isArray(e)?Be.array(e,n):dt(e)?Be.object(e,n):xt(e)?Be.map(e,n):e}function Ve(e,t,n){return Ue(e)&&nt("You tried to assign a modifier wrapped value to a collection, please define modifiers when creating the collection, not when modifying it"),null==e?e:Ce(e)||D(e)||$e(e)?e:Array.isArray(e)?Be.shallowArray(e,n):dt(e)?Be.shallowObject(e,n):xt(e)?Be.shallowMap(e,n):nt("The shallow modifier / decorator can only used in combination with arrays, objects and maps")}function He(e){return e}function Ye(e,t,n){if(oe(e,t))return t;if(Oe(e))return e;if(Array.isArray(e))return new k(e,Ye,n);if(xt(e))return new Ze(e,Ye,n);if(dt(e)){var i={};return ve(i,n),Re(i,Ye,[e]),i}return e}function qe(e,t,n){return oe(e,t)?t:e}function Xe(e,t){void 0===t&&(t=void 0),Gt();try{return e.apply(t)}finally{Vt()}}Object.keys(ze).forEach((function(e){return Be[e]=ze[e]})),Be.deep.struct=Be.struct,Be.ref.struct=function(){return arguments.length<2?We(qe,arguments[0]):Fe.apply(null,arguments)};var Ke={},Ze=function(){function e(e,t,n){void 0===t&&(t=Ge),void 0===n&&(n="ObservableMap@"+tt()),this.enhancer=t,this.name=n,this.$mobx=Ke,this._data=Object.create(null),this._hasMap=Object.create(null),this._keys=new k(void 0,He,this.name+".keys()",!0),this.interceptors=null,this.changeListeners=null,this.dehancer=void 0,this.merge(e)}return e.prototype._has=function(e){return void 0!==this._data[e]},e.prototype.has=function(e){return!!this.isValidKey(e)&&(e=""+e,this._hasMap[e]?this._hasMap[e].get():this._updateHasMapEntry(e,!1).get())},e.prototype.set=function(e,t){this.assertValidKey(e),e=""+e;var n=this._has(e);if(l(this)){var i=c(this,{type:n?"update":"add",object:this,newValue:t,name:e});if(!i)return this;t=i.newValue}return n?this._updateValue(e,t):this._addValue(e,t),this},e.prototype.delete=function(e){var t=this;if((this.assertValidKey(e),e=""+e,l(this))&&!(r=c(this,{type:"delete",object:this,name:e})))return!1;if(this._has(e)){var n=f(),i=d(this),r=i||n?{type:"delete",object:this,oldValue:this._data[e].value,name:e}:null;return n&&g(r),Xe((function(){t._keys.remove(e),t._updateHasMapEntry(e,!1),t._data[e].setNewValue(void 0),t._data[e]=void 0})),i&&p(this,r),n&&v(),!0}return!1},e.prototype._updateHasMapEntry=function(e,t){var n=this._hasMap[e];return n?n.setNewValue(t):n=this._hasMap[e]=new F(t,He,this.name+"."+e+"?",!1),n},e.prototype._updateValue=function(e,t){var n=this._data[e];if((t=n.prepareNewValue(t))!==N){var i=f(),r=d(this),o=r||i?{type:"update",object:this,oldValue:n.value,name:e,newValue:t}:null;i&&g(o),n.setNewValue(t),r&&p(this,o),i&&v()}},e.prototype._addValue=function(e,t){var n=this;Xe((function(){var i=n._data[e]=new F(t,n.enhancer,n.name+"."+e,!1);t=i.value,n._updateHasMapEntry(e,!0),n._keys.push(e)}));var i=f(),r=d(this),o=r||i?{type:"add",object:this,name:e,newValue:t}:null;i&&g(o),r&&p(this,o),i&&v()},e.prototype.get=function(e){return e=""+e,this.has(e)?this.dehanceValue(this._data[e].get()):this.dehanceValue(void 0)},e.prototype.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},e.prototype.keys=function(){return x(this._keys.slice())},e.prototype.values=function(){return x(this._keys.map(this.get,this))},e.prototype.entries=function(){var e=this;return x(this._keys.map((function(t){return[t,e.get(t)]})))},e.prototype.forEach=function(e,t){var n=this;this.keys().forEach((function(i){return e.call(t,n.get(i),i,n)}))},e.prototype.merge=function(e){var t=this;return $e(e)&&(e=e.toJS()),Xe((function(){dt(e)?Object.keys(e).forEach((function(n){return t.set(n,e[n])})):Array.isArray(e)?e.forEach((function(e){var n=e[0],i=e[1];return t.set(n,i)})):xt(e)?e.forEach((function(e,n){return t.set(n,e)})):null!=e&&nt("Cannot initialize map from "+e)})),this},e.prototype.clear=function(){var e=this;Xe((function(){en((function(){e.keys().forEach(e.delete,e)}))}))},e.prototype.replace=function(e){var t=this;return Xe((function(){var n,i=dt(n=e)?Object.keys(n):Array.isArray(n)?n.map((function(e){return e[0]})):xt(n)?Array.from(n.keys()):$e(n)?n.keys():nt("Cannot get keys from "+n);t.keys().filter((function(e){return-1===i.indexOf(e)})).forEach((function(e){return t.delete(e)})),t.merge(e)})),this},Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),e.prototype.toJS=function(){var e=this,t={};return this.keys().forEach((function(n){return t[n]=e.get(n)})),t},e.prototype.toJSON=function(){return this.toJS()},e.prototype.isValidKey=function(e){return null!=e&&("string"==typeof e||"number"==typeof e||"boolean"==typeof e)},e.prototype.assertValidKey=function(e){if(!this.isValidKey(e))throw new Error("[mobx.map] Invalid key: '"+e+"', only strings, numbers and booleans are accepted as key in observable maps.")},e.prototype.toString=function(){var e=this;return this.name+"[{ "+this.keys().map((function(t){return t+": "+e.get(t)})).join(", ")+" }]"},e.prototype.observe=function(e,t){return it(!0!==t,j("m033")),h(this,e)},e.prototype.intercept=function(e){return u(this,e)},e}();function Je(e){return ot("`mobx.map` is deprecated, use `new ObservableMap` or `mobx.observable.map` instead"),Be.map(e)}w(Ze.prototype,(function(){return this.entries()}));var $e=bt("ObservableMap",Ze),Qe=[];function et(){return"undefined"!=typeof window?window:e}function tt(){return++Ot.mobxGuid}function nt(e,t){throw it(!1,e,t),"X"}function it(e,t,n){if(!e)throw new Error("[mobx] Invariant failed: "+t+(n?" in '"+n+"'":""))}Object.freeze(Qe);var rt=[];function ot(e){return-1===rt.indexOf(e)&&(rt.push(e),console.error("[mobx] Deprecated: "+e),!0)}function at(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var st=function(){};function lt(e){var t=[];return e.forEach((function(e){-1===t.indexOf(e)&&t.push(e)})),t}function ut(e,t,n){return void 0===t&&(t=100),void 0===n&&(n=" - "),e?e.slice(0,t).join(n)+(e.length>t?" (... and "+(e.length-t)+"more)":""):""}function ct(e){return null!==e&&"object"==typeof e}function dt(e){if(null===e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function ht(){for(var e=arguments[0],t=1,n=arguments.length;t0&&(t.dependencies=lt(e.observing).map(Ft)),t}function zt(e){var t={name:e.name};return function(e){return e.observers&&e.observers.length>0}(e)&&(t.observers=Bt(e).map(zt)),t}function Bt(e){return e.observers}function jt(e,t){var n=e.observers.length;n&&(e.observersIndexes[t.__mapid]=n),e.observers[n]=t,e.lowestObserverState>t.dependenciesState&&(e.lowestObserverState=t.dependenciesState)}function Ut(e,t){if(1===e.observers.length)e.observers.length=0,Wt(e);else{var n=e.observers,i=e.observersIndexes,r=n.pop();if(r!==t){var o=i[t.__mapid]||0;o?i[r.__mapid]=o:delete i[r.__mapid],n[o]=r}delete i[t.__mapid]}}function Wt(e){e.isPendingUnobservation||(e.isPendingUnobservation=!0,Ot.pendingUnobservations.push(e))}function Gt(){Ot.inBatch++}function Vt(){if(0==--Ot.inBatch){pn();for(var e=Ot.pendingUnobservations,t=0;t=1e3)return void n.push("(and many more)");n.push(""+new Array(i).join("\t")+t.name);t.dependencies&&t.dependencies.forEach((function(t){return e(t,n,i+1)}))}(Nt(e),n,1),new Function("debugger;\n/*\nTracing '"+e.name+"'\n\nYou are entering this break point because derivation '"+e.name+"' is being traced and '"+t.name+"' is now forcing it to update.\nJust follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update\nThe stackframe you are looking for is at least ~6-8 stack-frames up.\n\n"+(e instanceof me?e.derivation.toString():"")+"\n\nThe dependencies for this derivation are:\n\n"+n.join("\n")+"\n*/\n ")()}}Rt.__mobxInstanceCount?(Rt.__mobxInstanceCount++,setTimeout((function(){kt||Pt||At||(At=!0,console.warn("[mobx] Warning: there are multiple mobx instances active. This might lead to unexpected results. See https://github.com/mobxjs/mobx/issues/1082 for details."))}),1)):Rt.__mobxInstanceCount=1,function(e){e[e.NOT_TRACKING=-1]="NOT_TRACKING",e[e.UP_TO_DATE=0]="UP_TO_DATE",e[e.POSSIBLY_STALE=1]="POSSIBLY_STALE",e[e.STALE=2]="STALE"}(St||(St={})),function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"}(Et||(Et={}));var qt=function(e){this.cause=e};function Xt(e){return e instanceof qt}function Kt(e){switch(e.dependenciesState){case St.UP_TO_DATE:return!1;case St.NOT_TRACKING:case St.STALE:return!0;case St.POSSIBLY_STALE:for(var t=tn(),n=e.observing,i=n.length,r=0;r0;Ot.computationDepth>0&&t&&nt(j("m031")+e.name),!Ot.allowStateChanges&&t&&nt(j(Ot.strictMode?"m030a":"m030b")+e.name)}function $t(e,t,n){rn(e),e.newObserving=new Array(e.observing.length+100),e.unboundDepsCount=0,e.runId=++Ot.runId;var i,r=Ot.trackingDerivation;Ot.trackingDerivation=e;try{i=t.call(n)}catch(e){i=new qt(e)}return Ot.trackingDerivation=r,function(e){for(var t=e.observing,n=e.observing=e.newObserving,i=St.UP_TO_DATE,r=0,o=e.unboundDepsCount,a=0;ai&&(i=s.dependenciesState)}n.length=r,e.newObserving=null,o=t.length;for(;o--;){0===(s=t[o]).diffValue&&Ut(s,e),s.diffValue=0}for(;r--;){var s;1===(s=n[r]).diffValue&&(s.diffValue=0,jt(s,e))}i!==St.UP_TO_DATE&&(e.dependenciesState=i,e.onBecomeStale())}(e),i}function Qt(e){var t=e.observing;e.observing=[];for(var n=t.length;n--;)Ut(t[n],e);e.dependenciesState=St.NOT_TRACKING}function en(e){var t=tn(),n=e();return nn(t),n}function tn(){var e=Ot.trackingDerivation;return Ot.trackingDerivation=null,e}function nn(e){Ot.trackingDerivation=e}function rn(e){if(e.dependenciesState!==St.UP_TO_DATE){e.dependenciesState=St.UP_TO_DATE;for(var t=e.observing,n=t.length;n--;)t[n].lowestObserverState=St.UP_TO_DATE}}function on(e){return console.log(e),e}function an(e,t){return ot("`whyRun` is deprecated in favor of `trace`"),(e=ln(arguments))?ge(e)||mn(e)?on(e.whyRun()):nt(j("m025")):on(j("m024"))}function sn(){for(var e=[],t=0;t0||Ot.isRunningReactions||hn(fn)}function fn(){Ot.isRunningReactions=!0;for(var e=Ot.pendingReactions,t=0;e.length>0;){++t===dn&&(console.error("Reaction doesn't converge to a stable state after "+dn+" iterations. Probably there is a cycle in the reactive function: "+e[0]),e.splice(0));for(var n=e.splice(0),i=0,r=n.length;i=0&&Ot.globalReactionErrorHandlers.splice(t,1)}},reserveArrayBuffer:L,resetGlobalState:function(){Ot.resetId++;var e=new Ct;for(var t in e)-1===Tt.indexOf(t)&&(Ot[t]=e[t]);Ot.allowStateChanges=!Ot.strictMode},isolateGlobalState:function(){Pt=!0,et().__mobxInstanceCount--},shareGlobalState:function(){ot("Using `shareGlobalState` is not recommended, use peer dependencies instead. See https://github.com/mobxjs/mobx/issues/1082 for details."),kt=!0;var e=et(),t=Ot;if(e.__mobservableTrackingStack||e.__mobservableViewStack)throw new Error("[mobx] An incompatible version of mobservable is already loaded.");if(e.__mobxGlobal&&e.__mobxGlobal.version!==t.version)throw new Error("[mobx] An incompatible version of mobx is already loaded.");e.__mobxGlobal?Ot=e.__mobxGlobal:e.__mobxGlobal=t},spyReport:m,spyReportEnd:v,spyReportStart:g,setReactionScheduler:function(e){var t=hn;hn=function(n){return e((function(){return t(n)}))}}},An={Reaction:un,untracked:en,Atom:a,BaseAtom:o,useStrict:G,isStrictModeEnabled:V,spy:b,comparer:ce,asReference:gn,asFlat:vn,asStructure:yn,asMap:bn,isModifierDescriptor:Ue,isObservableObject:Ce,isBoxedObservable:z,isObservableArray:D,ObservableMap:Ze,isObservableMap:$e,map:Je,transaction:Xe,observable:Be,computed:Mn,isObservable:Oe,isComputed:Sn,extendObservable:Pe,extendShallowObservable:Ae,observe:En,intercept:Tn,autorun:de,autorunAsync:pe,when:he,reaction:fe,action:Q,isAction:ne,runInAction:te,expr:Cn,toJS:On,createTransformer:kn,whyRun:an,isArrayLike:_t,extras:Pn},Rn=!1,Ln=function(e){var t=An[e];Object.defineProperty(An,e,{get:function(){return Rn||(Rn=!0,console.warn("Using default export (`import mobx from 'mobx'`) is deprecated and won’t work in mobx@4.0.0\nUse `import * as mobx from 'mobx'` instead")),t}})};for(var In in An)Ln(In);"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:b,extras:Pn}),t.default=An}.call(this,n(47))},function(e,t,n){var i; /*! Copyright (c) 2017 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames -*/!function(){"use strict";var n={}.hasOwnProperty;function r(){for(var e=[],t=0;t0?1:+e}),void 0===Function.prototype.name&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(Object.assign=function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n>=4,a[e]=o[19===e?3&r|8:r]);return a.join("")}),clamp:function(e,t,n){return Math.max(t,Math.min(n,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)},lerp:function(e,t,n){return(1-n)*e+n*t},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*Ct.DEG2RAD},radToDeg:function(e){return e*Ct.RAD2DEG},isPowerOfTwo:function(e){return 0==(e&e-1)&&0!==e},nearestPowerOfTwo:function(e){return Math.pow(2,Math.round(Math.log(e)/Math.LN2))},nextPowerOfTwo:function(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e}};function Ot(e,t){this.x=e||0,this.y=t||0}Ot.prototype={constructor:Ot,isVector2:!0,get width(){return this.x},set width(e){this.x=e},get height(){return this.y},set height(e){this.y=e},set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e):(this.x=0,this.y=0),this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:function(e,t){return void 0===l&&(l=new Ot,u=new Ot),l.set(e,e),u.set(t,t),this.clamp(l,u)},clampLength:function(e,t){var n=this.length();return this.multiplyScalar(Math.max(e,Math.min(t,n))/n)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length())},angle:function(){var e=Math.atan2(this.y,this.x);return e<0&&(e+=2*Math.PI),e},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},distanceToManhattan:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this},rotateAround:function(e,t){var n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,o=this.y-e.y;return this.x=r*n-o*i+e.x,this.y=r*i+o*n+e.y,this}};var kt,Pt,At,Rt,Lt,It,Dt=0;function Nt(e,t,n,i,r,o,a,s,l,u){Object.defineProperty(this,"id",{value:Dt++}),this.uuid=Ct.generateUUID(),this.name="",this.image=void 0!==e?e:Nt.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==t?t:Nt.DEFAULT_MAPPING,this.wrapS=void 0!==n?n:we,this.wrapT=void 0!==i?i:we,this.magFilter=void 0!==r?r:Ce,this.minFilter=void 0!==o?o:ke,this.anisotropy=void 0!==l?l:1,this.format=void 0!==a?a:Ve,this.type=void 0!==s?s:Pe,this.offset=new Ot(0,0),this.repeat=new Ot(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==u?u:vt,this.version=0,this.onUpdate=null}function Ft(e,t,n,i){this.x=e||0,this.y=t||0,this.z=n||0,this.w=void 0!==i?i:1}function zt(e,t,n){this.uuid=Ct.generateUUID(),this.width=e,this.height=t,this.scissor=new Ft(0,0,e,t),this.scissorTest=!1,this.viewport=new Ft(0,0,e,t),void 0===(n=n||{}).minFilter&&(n.minFilter=Ce),this.texture=new Nt(void 0,void 0,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0===n.stencilBuffer||n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}function Bt(e,t,n){zt.call(this,e,t,n),this.activeCubeFace=0,this.activeMipMapLevel=0}function jt(e,t,n,i){this._x=e||0,this._y=t||0,this._z=n||0,this._w=void 0!==i?i:1}function Ut(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0}function Wt(){this.elements=new Float32Array([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.")}function Gt(e,t,n,i,r,o,a,s,l,u){e=void 0!==e?e:[],t=void 0!==t?t:fe,Nt.call(this,e,t,n,i,r,o,a,s,l,u),this.flipY=!1}Nt.DEFAULT_IMAGE=void 0,Nt.DEFAULT_MAPPING=pe,Nt.prototype={constructor:Nt,isTexture:!0,set needsUpdate(e){!0===e&&this.version++},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){if(void 0!==e.textures[this.uuid])return e.textures[this.uuid];var t={metadata:{version:4.4,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],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var n=this.image;void 0===n.uuid&&(n.uuid=Ct.generateUUID()),void 0===e.images[n.uuid]&&(e.images[n.uuid]={uuid:n.uuid,url:function(e){var t;return void 0!==e.toDataURL?t=e:((t=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")).width=e.width,t.height=e.height,t.getContext("2d").drawImage(e,0,0,e.width,e.height)),t.width>2048||t.height>2048?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}(n)}),t.image=n.uuid}return e.textures[this.uuid]=t,t},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(this.mapping===pe){if(e.multiply(this.repeat),e.add(this.offset),e.x<0||e.x>1)switch(this.wrapS){case xe:e.x=e.x-Math.floor(e.x);break;case we:e.x=e.x<0?0:1;break;case Me:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case xe:e.y=e.y-Math.floor(e.y);break;case we:e.y=e.y<0?0:1;break;case Me:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}this.flipY&&(e.y=1-e.y)}}},Object.assign(Nt.prototype,i.prototype),Ft.prototype={constructor:Ft,isVector4:!0,set:function(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e,this.z*=e,this.w*=e):(this.x=0,this.y=0,this.z=0,this.w=0),this},applyMatrix4:function(e){var t=this.x,n=this.y,i=this.z,r=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i+o[12]*r,this.y=o[1]*t+o[5]*n+o[9]*i+o[13]*r,this.z=o[2]*t+o[6]*n+o[10]*i+o[14]*r,this.w=o[3]*t+o[7]*n+o[11]*i+o[15]*r,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,n,i,r,o=e.elements,a=o[0],s=o[4],l=o[8],u=o[1],c=o[5],d=o[9],h=o[2],p=o[6],f=o[10];if(Math.abs(s-u)<.01&&Math.abs(l-h)<.01&&Math.abs(d-p)<.01){if(Math.abs(s+u)<.1&&Math.abs(l+h)<.1&&Math.abs(d+p)<.1&&Math.abs(a+c+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;var m=(a+1)/2,g=(c+1)/2,v=(f+1)/2,y=(s+u)/4,b=(l+h)/4,_=(d+p)/4;return m>g&&m>v?m<.01?(n=0,i=.707106781,r=.707106781):(i=y/(n=Math.sqrt(m)),r=b/n):g>v?g<.01?(n=.707106781,i=0,r=.707106781):(n=y/(i=Math.sqrt(g)),r=_/i):v<.01?(n=.707106781,i=.707106781,r=0):(n=b/(r=Math.sqrt(v)),i=_/r),this.set(n,i,r,t),this}var x=Math.sqrt((p-d)*(p-d)+(l-h)*(l-h)+(u-s)*(u-s));return Math.abs(x)<.001&&(x=1),this.x=(p-d)/x,this.y=(l-h)/x,this.z=(u-s)/x,this.w=Math.acos((a+c+f-1)/2),this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(){var e,t;return function(n,i){return void 0===e&&(e=new Ft,t=new Ft),e.set(n,n,n,n),t.set(i,i,i,i),this.clamp(e,t)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}},zt.prototype={constructor:zt,isWebGLRenderTarget:!0,setSize:function(e,t){this.width===e&&this.height===t||(this.width=e,this.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}},Object.assign(zt.prototype,i.prototype),Bt.prototype=Object.create(zt.prototype),Bt.prototype.constructor=Bt,Bt.prototype.isWebGLRenderTargetCube=!0,jt.prototype={constructor:jt,get x(){return this._x},set x(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get w(){return this._w},set w(e){this._w=e,this.onChangeCallback()},set:function(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this.onChangeCallback(),this},setFromEuler:function(e,t){if(!1===(e&&e.isEuler))throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=Math.cos(e._x/2),i=Math.cos(e._y/2),r=Math.cos(e._z/2),o=Math.sin(e._x/2),a=Math.sin(e._y/2),s=Math.sin(e._z/2),l=e.order;return"XYZ"===l?(this._x=o*i*r+n*a*s,this._y=n*a*r-o*i*s,this._z=n*i*s+o*a*r,this._w=n*i*r-o*a*s):"YXZ"===l?(this._x=o*i*r+n*a*s,this._y=n*a*r-o*i*s,this._z=n*i*s-o*a*r,this._w=n*i*r+o*a*s):"ZXY"===l?(this._x=o*i*r-n*a*s,this._y=n*a*r+o*i*s,this._z=n*i*s+o*a*r,this._w=n*i*r-o*a*s):"ZYX"===l?(this._x=o*i*r-n*a*s,this._y=n*a*r+o*i*s,this._z=n*i*s-o*a*r,this._w=n*i*r+o*a*s):"YZX"===l?(this._x=o*i*r+n*a*s,this._y=n*a*r+o*i*s,this._z=n*i*s-o*a*r,this._w=n*i*r-o*a*s):"XZY"===l&&(this._x=o*i*r-n*a*s,this._y=n*a*r-o*i*s,this._z=n*i*s+o*a*r,this._w=n*i*r+o*a*s),!1!==t&&this.onChangeCallback(),this},setFromAxisAngle:function(e,t){var n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this.onChangeCallback(),this},setFromRotationMatrix:function(e){var t,n=e.elements,i=n[0],r=n[4],o=n[8],a=n[1],s=n[5],l=n[9],u=n[2],c=n[6],d=n[10],h=i+s+d;return h>0?(t=.5/Math.sqrt(h+1),this._w=.25/t,this._x=(c-l)*t,this._y=(o-u)*t,this._z=(a-r)*t):i>s&&i>d?(t=2*Math.sqrt(1+i-s-d),this._w=(c-l)/t,this._x=.25*t,this._y=(r+a)/t,this._z=(o+u)/t):s>d?(t=2*Math.sqrt(1+s-i-d),this._w=(o-u)/t,this._x=(r+a)/t,this._y=.25*t,this._z=(l+c)/t):(t=2*Math.sqrt(1+d-i-s),this._w=(a-r)/t,this._x=(o+u)/t,this._y=(l+c)/t,this._z=.25*t),this.onChangeCallback(),this},setFromUnitVectors:function(){var e,t;return function(n,i){return void 0===e&&(e=new Ut),(t=n.dot(i)+1)<1e-6?(t=0,Math.abs(n.x)>Math.abs(n.z)?e.set(-n.y,n.x,0):e.set(0,-n.z,n.y)):e.crossVectors(n,i),this._x=e.x,this._y=e.y,this._z=e.z,this._w=t,this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this.onChangeCallback(),this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var n=e._x,i=e._y,r=e._z,o=e._w,a=t._x,s=t._y,l=t._z,u=t._w;return this._x=n*u+o*a+i*l-r*s,this._y=i*u+o*s+r*a-n*l,this._z=r*u+o*l+n*s-i*a,this._w=o*u-n*a-i*s-r*l,this.onChangeCallback(),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var n=this._x,i=this._y,r=this._z,o=this._w,a=o*e._w+n*e._x+i*e._y+r*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=n,this._y=i,this._z=r,this;var s=Math.sqrt(1-a*a);if(Math.abs(s)<.001)return this._w=.5*(o+this._w),this._x=.5*(n+this._x),this._y=.5*(i+this._y),this._z=.5*(r+this._z),this;var l=Math.atan2(s,a),u=Math.sin((1-t)*l)/s,c=Math.sin(t*l)/s;return this._w=o*u+this._w*c,this._x=n*u+this._x*c,this._y=i*u+this._y*c,this._z=r*u+this._z*c,this.onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}},Object.assign(jt,{slerp:function(e,t,n,i){return n.copy(e).slerp(t,i)},slerpFlat:function(e,t,n,i,r,o,a){var s=n[i+0],l=n[i+1],u=n[i+2],c=n[i+3],d=r[o+0],h=r[o+1],p=r[o+2],f=r[o+3];if(c!==f||s!==d||l!==h||u!==p){var m=1-a,g=s*d+l*h+u*p+c*f,v=g>=0?1:-1,y=1-g*g;if(y>Number.EPSILON){var b=Math.sqrt(y),_=Math.atan2(b,g*v);m=Math.sin(m*_)/b,a=Math.sin(a*_)/b}var x=a*v;if(s=s*m+d*x,l=l*m+h*x,u=u*m+p*x,c=c*m+f*x,m===1-a){var w=1/Math.sqrt(s*s+l*l+u*u+c*c);s*=w,l*=w,u*=w,c*=w}}e[t]=s,e[t+1]=l,e[t+2]=u,e[t+3]=c}}),Ut.prototype={constructor:Ut,isVector3:!0,set:function(e,t,n){return this.x=e,this.y=t,this.z=n,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e,this.z*=e):(this.x=0,this.y=0,this.z=0),this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(e){return!1===(e&&e.isEuler)&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),void 0===At&&(At=new jt),this.applyQuaternion(At.setFromEuler(e))},applyAxisAngle:function(){var e;return function(t,n){return void 0===e&&(e=new jt),this.applyQuaternion(e.setFromAxisAngle(t,n))}}(),applyMatrix3:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this},applyMatrix4:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements;this.x=r[0]*t+r[4]*n+r[8]*i+r[12],this.y=r[1]*t+r[5]*n+r[9]*i+r[13],this.z=r[2]*t+r[6]*n+r[10]*i+r[14];var o=r[3]*t+r[7]*n+r[11]*i+r[15];return this.divideScalar(o)},applyQuaternion:function(e){var t=this.x,n=this.y,i=this.z,r=e.x,o=e.y,a=e.z,s=e.w,l=s*t+o*i-a*n,u=s*n+a*t-r*i,c=s*i+r*n-o*t,d=-r*t-o*n-a*i;return this.x=l*s+d*-r+u*-a-c*-o,this.y=u*s+d*-o+c*-r-l*-a,this.z=c*s+d*-a+l*-o-u*-r,this},project:function(e){return void 0===Pt&&(Pt=new Wt),Pt.multiplyMatrices(e.projectionMatrix,Pt.getInverse(e.matrixWorld)),this.applyMatrix4(Pt)},unproject:function(){var e;return function(t){return void 0===e&&(e=new Wt),e.multiplyMatrices(t.matrixWorld,e.getInverse(t.projectionMatrix)),this.applyMatrix4(e)}}(),transformDirection:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:function(){var e,t;return function(n,i){return void 0===e&&(e=new Ut,t=new Ut),e.set(n,n,n),t.set(i,i,i),this.clamp(e,t)}}(),clampLength:function(e,t){var n=this.length();return this.multiplyScalar(Math.max(e,Math.min(t,n))/n)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},cross:function(e,t){if(void 0!==t)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t);var n=this.x,i=this.y,r=this.z;return this.x=i*e.z-r*e.y,this.y=r*e.x-n*e.z,this.z=n*e.y-i*e.x,this},crossVectors:function(e,t){var n=e.x,i=e.y,r=e.z,o=t.x,a=t.y,s=t.z;return this.x=i*s-r*a,this.y=r*o-n*s,this.z=n*a-i*o,this},projectOnVector:function(e){var t=e.dot(this)/e.lengthSq();return this.copy(e).multiplyScalar(t)},projectOnPlane:function(e){return void 0===kt&&(kt=new Ut),kt.copy(this).projectOnVector(e),this.sub(kt)},reflect:function(){var e;return function(t){return void 0===e&&(e=new Ut),this.sub(e.copy(t).multiplyScalar(2*this.dot(t)))}}(),angleTo:function(e){var t=this.dot(e)/Math.sqrt(this.lengthSq()*e.lengthSq());return Math.acos(Ct.clamp(t,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i},distanceToManhattan:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){var t=Math.sin(e.phi)*e.radius;return this.x=t*Math.sin(e.theta),this.y=Math.cos(e.phi)*e.radius,this.z=t*Math.cos(e.theta),this},setFromCylindrical:function(e){return this.x=e.radius*Math.sin(e.theta),this.y=e.y,this.z=e.radius*Math.cos(e.theta),this},setFromMatrixPosition:function(e){return this.setFromMatrixColumn(e,3)},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this},setFromMatrixColumn:function(e,t){if("number"==typeof e){console.warn("THREE.Vector3: setFromMatrixColumn now expects ( matrix, index ).");var n=e;e=t,t=n}return this.fromArray(e.elements,4*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}},Wt.prototype={constructor:Wt,isMatrix4:!0,set:function(e,t,n,i,r,o,a,s,l,u,c,d,h,p,f,m){var g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=r,g[5]=o,g[9]=a,g[13]=s,g[2]=l,g[6]=u,g[10]=c,g[14]=d,g[3]=h,g[7]=p,g[11]=f,g[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new Wt).fromArray(this.elements)},copy:function(e){return this.elements.set(e.elements),this},copyPosition:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this},extractBasis:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this},extractRotation:function(){var e;return function(t){void 0===e&&(e=new Ut);var n=this.elements,i=t.elements,r=1/e.setFromMatrixColumn(t,0).length(),o=1/e.setFromMatrixColumn(t,1).length(),a=1/e.setFromMatrixColumn(t,2).length();return n[0]=i[0]*r,n[1]=i[1]*r,n[2]=i[2]*r,n[4]=i[4]*o,n[5]=i[5]*o,n[6]=i[6]*o,n[8]=i[8]*a,n[9]=i[9]*a,n[10]=i[10]*a,this}}(),makeRotationFromEuler:function(e){!1===(e&&e.isEuler)&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,n=e.x,i=e.y,r=e.z,o=Math.cos(n),a=Math.sin(n),s=Math.cos(i),l=Math.sin(i),u=Math.cos(r),c=Math.sin(r);if("XYZ"===e.order){var d=o*u,h=o*c,p=a*u,f=a*c;t[0]=s*u,t[4]=-s*c,t[8]=l,t[1]=h+p*l,t[5]=d-f*l,t[9]=-a*s,t[2]=f-d*l,t[6]=p+h*l,t[10]=o*s}else if("YXZ"===e.order){var m=s*u,g=s*c,v=l*u,y=l*c;t[0]=m+y*a,t[4]=v*a-g,t[8]=o*l,t[1]=o*c,t[5]=o*u,t[9]=-a,t[2]=g*a-v,t[6]=y+m*a,t[10]=o*s}else if("ZXY"===e.order){m=s*u,g=s*c,v=l*u,y=l*c;t[0]=m-y*a,t[4]=-o*c,t[8]=v+g*a,t[1]=g+v*a,t[5]=o*u,t[9]=y-m*a,t[2]=-o*l,t[6]=a,t[10]=o*s}else if("ZYX"===e.order){d=o*u,h=o*c,p=a*u,f=a*c;t[0]=s*u,t[4]=p*l-h,t[8]=d*l+f,t[1]=s*c,t[5]=f*l+d,t[9]=h*l-p,t[2]=-l,t[6]=a*s,t[10]=o*s}else if("YZX"===e.order){var b=o*s,_=o*l,x=a*s,w=a*l;t[0]=s*u,t[4]=w-b*c,t[8]=x*c+_,t[1]=c,t[5]=o*u,t[9]=-a*u,t[2]=-l*u,t[6]=_*c+x,t[10]=b-w*c}else if("XZY"===e.order){b=o*s,_=o*l,x=a*s,w=a*l;t[0]=s*u,t[4]=-c,t[8]=l*u,t[1]=b*c+w,t[5]=o*u,t[9]=_*c-x,t[2]=x*c-_,t[6]=a*u,t[10]=w*c+b}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(e){var t=this.elements,n=e.x,i=e.y,r=e.z,o=e.w,a=n+n,s=i+i,l=r+r,u=n*a,c=n*s,d=n*l,h=i*s,p=i*l,f=r*l,m=o*a,g=o*s,v=o*l;return t[0]=1-(h+f),t[4]=c-v,t[8]=d+g,t[1]=c+v,t[5]=1-(u+f),t[9]=p-m,t[2]=d-g,t[6]=p+m,t[10]=1-(u+h),t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},lookAt:function(e,t,n){void 0===Rt&&(Rt=new Ut,Lt=new Ut,It=new Ut);var i=this.elements;return It.subVectors(e,t).normalize(),0===It.lengthSq()&&(It.z=1),Rt.crossVectors(n,It).normalize(),0===Rt.lengthSq()&&(It.z+=1e-4,Rt.crossVectors(n,It).normalize()),Lt.crossVectors(It,Rt),i[0]=Rt.x,i[4]=Lt.x,i[8]=It.x,i[1]=Rt.y,i[5]=Lt.y,i[9]=It.y,i[2]=Rt.z,i[6]=Lt.z,i[10]=It.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,i=t.elements,r=this.elements,o=n[0],a=n[4],s=n[8],l=n[12],u=n[1],c=n[5],d=n[9],h=n[13],p=n[2],f=n[6],m=n[10],g=n[14],v=n[3],y=n[7],b=n[11],_=n[15],x=i[0],w=i[4],M=i[8],S=i[12],E=i[1],T=i[5],C=i[9],O=i[13],k=i[2],P=i[6],A=i[10],R=i[14],L=i[3],I=i[7],D=i[11],N=i[15];return r[0]=o*x+a*E+s*k+l*L,r[4]=o*w+a*T+s*P+l*I,r[8]=o*M+a*C+s*A+l*D,r[12]=o*S+a*O+s*R+l*N,r[1]=u*x+c*E+d*k+h*L,r[5]=u*w+c*T+d*P+h*I,r[9]=u*M+c*C+d*A+h*D,r[13]=u*S+c*O+d*R+h*N,r[2]=p*x+f*E+m*k+g*L,r[6]=p*w+f*T+m*P+g*I,r[10]=p*M+f*C+m*A+g*D,r[14]=p*S+f*O+m*R+g*N,r[3]=v*x+y*E+b*k+_*L,r[7]=v*w+y*T+b*P+_*I,r[11]=v*M+y*C+b*A+_*D,r[15]=v*S+y*O+b*R+_*N,this},multiplyToArray:function(e,t,n){var i=this.elements;return this.multiplyMatrices(e,t),n[0]=i[0],n[1]=i[1],n[2]=i[2],n[3]=i[3],n[4]=i[4],n[5]=i[5],n[6]=i[6],n[7]=i[7],n[8]=i[8],n[9]=i[9],n[10]=i[10],n[11]=i[11],n[12]=i[12],n[13]=i[13],n[14]=i[14],n[15]=i[15],this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},applyToBufferAttribute:function(){var e;return function(t){void 0===e&&(e=new Ut);for(var n=0,i=t.count;n0)return e;var r=t*n,o=qt[r];if(void 0===o&&(o=new Float32Array(r),qt[r]=o),0!==t){i.toArray(o,0);for(var a=1,s=0;a!==t;++a)s+=n,e[a].toArray(o,s)}return o}function Zt(e,t){var n=Xt[t];void 0===n&&(n=new Int32Array(t),Xt[t]=n);for(var i=0;i!==t;++i)n[i]=e.allocTextureUnit();return n}function Jt(e,t){e.uniform1f(this.addr,t)}function $t(e,t){e.uniform1i(this.addr,t)}function Qt(e,t){void 0===t.x?e.uniform2fv(this.addr,t):e.uniform2f(this.addr,t.x,t.y)}function en(e,t){void 0!==t.x?e.uniform3f(this.addr,t.x,t.y,t.z):void 0!==t.r?e.uniform3f(this.addr,t.r,t.g,t.b):e.uniform3fv(this.addr,t)}function tn(e,t){void 0===t.x?e.uniform4fv(this.addr,t):e.uniform4f(this.addr,t.x,t.y,t.z,t.w)}function nn(e,t){e.uniformMatrix2fv(this.addr,!1,t.elements||t)}function rn(e,t){e.uniformMatrix3fv(this.addr,!1,t.elements||t)}function on(e,t){e.uniformMatrix4fv(this.addr,!1,t.elements||t)}function an(e,t,n){var i=n.allocTextureUnit();e.uniform1i(this.addr,i),n.setTexture2D(t||Vt,i)}function sn(e,t,n){var i=n.allocTextureUnit();e.uniform1i(this.addr,i),n.setTextureCube(t||Ht,i)}function ln(e,t){e.uniform2iv(this.addr,t)}function un(e,t){e.uniform3iv(this.addr,t)}function cn(e,t){e.uniform4iv(this.addr,t)}function dn(e,t){e.uniform1fv(this.addr,t)}function hn(e,t){e.uniform1iv(this.addr,t)}function pn(e,t){e.uniform2fv(this.addr,Kt(t,this.size,2))}function fn(e,t){e.uniform3fv(this.addr,Kt(t,this.size,3))}function mn(e,t){e.uniform4fv(this.addr,Kt(t,this.size,4))}function gn(e,t){e.uniformMatrix2fv(this.addr,!1,Kt(t,this.size,4))}function vn(e,t){e.uniformMatrix3fv(this.addr,!1,Kt(t,this.size,9))}function yn(e,t){e.uniformMatrix4fv(this.addr,!1,Kt(t,this.size,16))}function bn(e,t,n){var i=t.length,r=Zt(n,i);e.uniform1iv(this.addr,r);for(var o=0;o!==i;++o)n.setTexture2D(t[o]||Vt,r[o])}function _n(e,t,n){var i=t.length,r=Zt(n,i);e.uniform1iv(this.addr,r);for(var o=0;o!==i;++o)n.setTextureCube(t[o]||Ht,r[o])}function xn(e,t,n){this.id=e,this.addr=n,this.setValue=function(e){switch(e){case 5126:return Jt;case 35664:return Qt;case 35665:return en;case 35666:return tn;case 35674:return nn;case 35675:return rn;case 35676:return on;case 35678:return an;case 35680:return sn;case 5124:case 35670:return $t;case 35667:case 35671:return ln;case 35668:case 35672:return un;case 35669:case 35673:return cn}}(t.type)}function wn(e,t,n){this.id=e,this.addr=n,this.size=t.size,this.setValue=function(e){switch(e){case 5126:return dn;case 35664:return pn;case 35665:return fn;case 35666:return mn;case 35674:return gn;case 35675:return vn;case 35676:return yn;case 35678:return bn;case 35680:return _n;case 5124:case 35670:return hn;case 35667:case 35671:return ln;case 35668:case 35672:return un;case 35669:case 35673:return cn}}(t.type)}function Mn(e){this.id=e,Yt.call(this)}Mn.prototype.setValue=function(e,t){for(var n=this.seq,i=0,r=n.length;i!==r;++i){var o=n[i];o.setValue(e,t[o.id])}};var Sn=/([\w\d_]+)(\])?(\[|\.)?/g;function En(e,t){e.seq.push(t),e.map[t.id]=t}function Tn(e,t,n){var i=e.name,r=i.length;for(Sn.lastIndex=0;;){var o=Sn.exec(i),a=Sn.lastIndex,s=o[1],l="]"===o[2],u=o[3];if(l&&(s|=0),void 0===u||"["===u&&a+2===r){En(n,void 0===u?new xn(s,e,t):new wn(s,e,t));break}var c=n.map[s];void 0===c&&En(n,c=new Mn(s)),n=c}}function Cn(e,t,n){Yt.call(this),this.renderer=n;for(var i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS),r=0;r 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t\t}\n\t\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 ltcTextureCoords( const in GeometricContext geometry, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = (LUT_SIZE - 1.0)/LUT_SIZE;\n\tconst float LUT_BIAS = 0.5/LUT_SIZE;\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 P = geometry.position;\n\tfloat theta = acos( dot( N, V ) );\n\tvec2 uv = vec2(\n\t\tsqrt( saturate( roughness ) ),\n\t\tsaturate( theta / ( 0.5 * PI ) ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nvoid clipQuadToHorizon( inout vec3 L[5], out int n ) {\n\tint config = 0;\n\tif ( L[0].z > 0.0 ) config += 1;\n\tif ( L[1].z > 0.0 ) config += 2;\n\tif ( L[2].z > 0.0 ) config += 4;\n\tif ( L[3].z > 0.0 ) config += 8;\n\tn = 0;\n\tif ( config == 0 ) {\n\t} else if ( config == 1 ) {\n\t\tn = 3;\n\t\tL[1] = -L[1].z * L[0] + L[0].z * L[1];\n\t\tL[2] = -L[3].z * L[0] + L[0].z * L[3];\n\t} else if ( config == 2 ) {\n\t\tn = 3;\n\t\tL[0] = -L[0].z * L[1] + L[1].z * L[0];\n\t\tL[2] = -L[2].z * L[1] + L[1].z * L[2];\n\t} else if ( config == 3 ) {\n\t\tn = 4;\n\t\tL[2] = -L[2].z * L[1] + L[1].z * L[2];\n\t\tL[3] = -L[3].z * L[0] + L[0].z * L[3];\n\t} else if ( config == 4 ) {\n\t\tn = 3;\n\t\tL[0] = -L[3].z * L[2] + L[2].z * L[3];\n\t\tL[1] = -L[1].z * L[2] + L[2].z * L[1];\n\t} else if ( config == 5 ) {\n\t\tn = 0;\n\t} else if ( config == 6 ) {\n\t\tn = 4;\n\t\tL[0] = -L[0].z * L[1] + L[1].z * L[0];\n\t\tL[3] = -L[3].z * L[2] + L[2].z * L[3];\n\t} else if ( config == 7 ) {\n\t\tn = 5;\n\t\tL[4] = -L[3].z * L[0] + L[0].z * L[3];\n\t\tL[3] = -L[3].z * L[2] + L[2].z * L[3];\n\t} else if ( config == 8 ) {\n\t\tn = 3;\n\t\tL[0] = -L[0].z * L[3] + L[3].z * L[0];\n\t\tL[1] = -L[2].z * L[3] + L[3].z * L[2];\n\t\tL[2] = L[3];\n\t} else if ( config == 9 ) {\n\t\tn = 4;\n\t\tL[1] = -L[1].z * L[0] + L[0].z * L[1];\n\t\tL[2] = -L[2].z * L[3] + L[3].z * L[2];\n\t} else if ( config == 10 ) {\n\t\tn = 0;\n\t} else if ( config == 11 ) {\n\t\tn = 5;\n\t\tL[4] = L[3];\n\t\tL[3] = -L[2].z * L[3] + L[3].z * L[2];\n\t\tL[2] = -L[2].z * L[1] + L[1].z * L[2];\n\t} else if ( config == 12 ) {\n\t\tn = 4;\n\t\tL[1] = -L[1].z * L[2] + L[2].z * L[1];\n\t\tL[0] = -L[0].z * L[3] + L[3].z * L[0];\n\t} else if ( config == 13 ) {\n\t\tn = 5;\n\t\tL[4] = L[3];\n\t\tL[3] = L[2];\n\t\tL[2] = -L[1].z * L[2] + L[2].z * L[1];\n\t\tL[1] = -L[1].z * L[0] + L[0].z * L[1];\n\t} else if ( config == 14 ) {\n\t\tn = 5;\n\t\tL[4] = -L[0].z * L[3] + L[3].z * L[0];\n\t\tL[0] = -L[0].z * L[1] + L[1].z * L[0];\n\t} else if ( config == 15 ) {\n\t\tn = 4;\n\t}\n\tif ( n == 3 )\n\t\tL[3] = L[0];\n\tif ( n == 4 )\n\t\tL[4] = L[0];\n}\nfloat integrateLtcBrdfOverRectEdge( vec3 v1, vec3 v2 ) {\n\tfloat cosTheta = dot( v1, v2 );\n\tfloat theta = acos( cosTheta );\n\tfloat res = cross( v1, v2 ).z * ( ( theta > 0.001 ) ? theta / sin( theta ) : 1.0 );\n\treturn res;\n}\nvoid initRectPoints( const in vec3 pos, const in vec3 halfWidth, const in vec3 halfHeight, out vec3 rectPoints[4] ) {\n\trectPoints[0] = pos - halfWidth - halfHeight;\n\trectPoints[1] = pos + halfWidth - halfHeight;\n\trectPoints[2] = pos + halfWidth + halfHeight;\n\trectPoints[3] = pos - halfWidth + halfHeight;\n}\nvec3 integrateLtcBrdfOverRect( const in GeometricContext geometry, const in mat3 brdfMat, const in vec3 rectPoints[4] ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 P = geometry.position;\n\tvec3 T1, T2;\n\tT1 = normalize(V - N * dot( V, N ));\n\tT2 = - cross( N, T1 );\n\tmat3 brdfWrtSurface = brdfMat * transpose( mat3( T1, T2, N ) );\n\tvec3 clippedRect[5];\n\tclippedRect[0] = brdfWrtSurface * ( rectPoints[0] - P );\n\tclippedRect[1] = brdfWrtSurface * ( rectPoints[1] - P );\n\tclippedRect[2] = brdfWrtSurface * ( rectPoints[2] - P );\n\tclippedRect[3] = brdfWrtSurface * ( rectPoints[3] - P );\n\tint n;\n\tclipQuadToHorizon(clippedRect, n);\n\tif ( n == 0 )\n\t\treturn vec3( 0, 0, 0 );\n\tclippedRect[0] = normalize( clippedRect[0] );\n\tclippedRect[1] = normalize( clippedRect[1] );\n\tclippedRect[2] = normalize( clippedRect[2] );\n\tclippedRect[3] = normalize( clippedRect[3] );\n\tclippedRect[4] = normalize( clippedRect[4] );\n\tfloat sum = 0.0;\n\tsum += integrateLtcBrdfOverRectEdge( clippedRect[0], clippedRect[1] );\n\tsum += integrateLtcBrdfOverRectEdge( clippedRect[1], clippedRect[2] );\n\tsum += integrateLtcBrdfOverRectEdge( clippedRect[2], clippedRect[3] );\n\tif (n >= 4)\n\t\tsum += integrateLtcBrdfOverRectEdge( clippedRect[3], clippedRect[4] );\n\tif (n == 5)\n\t\tsum += integrateLtcBrdfOverRectEdge( clippedRect[4], clippedRect[0] );\n\tsum = max( 0.0, sum );\n\tvec3 Lo_i = vec3( sum, sum, sum );\n\treturn Lo_i;\n}\nvec3 Rect_Area_Light_Specular_Reflectance(\n\t\tconst in GeometricContext geometry,\n\t\tconst in vec3 lightPos, const in vec3 lightHalfWidth, const in vec3 lightHalfHeight,\n\t\tconst in float roughness,\n\t\tconst in sampler2D ltcMat, const in sampler2D ltcMag ) {\n\tvec3 rectPoints[4];\n\tinitRectPoints( lightPos, lightHalfWidth, lightHalfHeight, rectPoints );\n\tvec2 uv = ltcTextureCoords( geometry, roughness );\n\tvec4 brdfLtcApproxParams, t;\n\tbrdfLtcApproxParams = texture2D( ltcMat, uv );\n\tt = texture2D( ltcMat, uv );\n\tfloat brdfLtcScalar = texture2D( ltcMag, uv ).a;\n\tmat3 brdfLtcApproxMat = mat3(\n\t\tvec3( 1, 0, t.y ),\n\t\tvec3( 0, t.z, 0 ),\n\t\tvec3( t.w, 0, t.x )\n\t);\n\tvec3 specularReflectance = integrateLtcBrdfOverRect( geometry, brdfLtcApproxMat, rectPoints );\n\tspecularReflectance *= brdfLtcScalar;\n\treturn specularReflectance;\n}\nvec3 Rect_Area_Light_Diffuse_Reflectance(\n\t\tconst in GeometricContext geometry,\n\t\tconst in vec3 lightPos, const in vec3 lightHalfWidth, const in vec3 lightHalfHeight ) {\n\tvec3 rectPoints[4];\n\tinitRectPoints( lightPos, lightHalfWidth, lightHalfHeight, rectPoints );\n\tmat3 diffuseBrdfMat = mat3(1);\n\tvec3 diffuseReflectance = integrateLtcBrdfOverRect( geometry, diffuseBrdfMat, rectPoints );\n\treturn diffuseReflectance;\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = dFdx( surf_pos );\n\t\tvec3 vSigmaY = dFdy( surf_pos );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; ++ i ) {\n\t\tvec4 plane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t\t\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; ++ i ) {\n\t\t\tvec4 plane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t\n\t#endif\n#endif\n",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transpose( const in mat3 v ) {\n\tmat3 tmp;\n\ttmp[0] = vec3(v[0].x, v[1].x, v[2].x);\n\ttmp[1] = vec3(v[0].y, v[1].y, v[2].y);\n\ttmp[2] = vec3(v[0].z, v[1].z, v[2].z);\n\treturn tmp;\n}\n",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n",defaultnormal_vertex:"#ifdef FLIP_SIDED\n\tobjectNormal = -objectNormal;\n#endif\nvec3 transformedNormal = normalMatrix * objectNormal;\n",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",encodings_fragment:" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n\tXp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract(Le);\n\tvResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n\treturn vec4( max(vRGB, 0.0), 1.0 );\n}\n",envmap_fragment:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\tvec3 reflectView = flipNormal * normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif\n",envmap_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif\n",fog_vertex:"\n#ifdef USE_FOG\nfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float fogDepth;\n#endif\n",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif\n",gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif\n",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n",lights_pars:"uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltcMat;\tuniform sampler2D ltcMag;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = saturate( reflectVec.y * 0.5 + 0.5 );\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_BlinnPhong( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 matDiffColor = material.diffuseColor;\n\t\tvec3 matSpecColor = material.specularColor;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = BlinnExponentToGGXRoughness( material.specularShininess );\n\t\tvec3 spec = Rect_Area_Light_Specular_Reflectance(\n\t\t\t\tgeometry,\n\t\t\t\trectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight,\n\t\t\t\troughness,\n\t\t\t\tltcMat, ltcMag );\n\t\tvec3 diff = Rect_Area_Light_Diffuse_Reflectance(\n\t\t\t\tgeometry,\n\t\t\t\trectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight );\n\t\treflectedLight.directSpecular += lightColor * matSpecColor * spec / PI2;\n\t\treflectedLight.directDiffuse += lightColor * matDiffColor * diff / PI2;\n\t}\n#endif\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 matDiffColor = material.diffuseColor;\n\t\tvec3 matSpecColor = material.specularColor;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 spec = Rect_Area_Light_Specular_Reflectance(\n\t\t\t\tgeometry,\n\t\t\t\trectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight,\n\t\t\t\troughness,\n\t\t\t\tltcMat, ltcMag );\n\t\tvec3 diff = Rect_Area_Light_Diffuse_Reflectance(\n\t\t\t\tgeometry,\n\t\t\t\trectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight );\n\t\treflectedLight.directSpecular += lightColor * matSpecColor * spec;\n\t\treflectedLight.directDiffuse += lightColor * matDiffColor * diff;\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n",lights_template:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tvec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n\t#ifndef STANDARD\n\t\tvec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );\n\t#else\n\t\tvec3 clearCoatRadiance = vec3( 0.0 );\n\t#endif\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n",logdepthbuf_fragment:"#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\t#endif\n#endif\n",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n",map_particle_fragment:"#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n#endif\n",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.r;\n#endif\n",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n",normal_flip:"#ifdef DOUBLE_SIDED\n\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n#else\n\tfloat flipNormal = 1.0;\n#endif\n",normal_fragment:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal ) * flipNormal;\n#endif\n#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 1.0 - 2.0 * rgb.xyz;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",project_vertex:"#ifdef USE_SKINNING\n\tvec4 mvPosition = modelViewMatrix * skinned;\n#else\n\tvec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n#endif\ngl_Position = projectionMatrix * mvPosition;\n",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.r;\n#endif\n",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn 1.0;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\tfloat dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif\n",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\n",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureWidth;\n\t\tuniform int boneTextureHeight;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureWidth ) );\n\t\t\tfloat y = floor( j / float( boneTextureWidth ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureWidth );\n\t\t\tfloat dy = 1.0 / float( boneTextureHeight );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\tskinned = bindMatrixInverse * skinned;\n#endif\n",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",tonemapping_pars_fragment:"#define saturate(a) clamp( a, 0.0, 1.0 )\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n",uv_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n#endif\n",uv_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( PHYSICAL ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\t#ifdef USE_SKINNING\n\t\tvec4 worldPosition = modelMatrix * skinned;\n\t#else\n\t\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\t#endif\n#endif\n",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\n#include \nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n",cube_vert:"varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}\n",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",distanceRGBA_frag:"uniform vec3 lightPos;\nvarying vec4 vWorldPosition;\n#include \n#include \n#include \nvoid main () {\n\t#include \n\tgl_FragColor = packDepthToRGBA( length( vWorldPosition.xyz - lightPos.xyz ) / 1000.0 );\n}\n",distanceRGBA_vert:"varying vec4 vWorldPosition;\n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition;\n}\n",equirect_frag:"uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n",equirect_vert:"varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}\n",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}\n",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_ENVMAP\n\t#include \n\t#include \n\t#include \n\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include \n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}\n",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}\n",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}\n",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",shadow_frag:"uniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( 0.0, 0.0, 0.0, opacity * ( 1.0 - getShadowMask() ) );\n}\n",shadow_vert:"#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n}\n"};function Pn(e,t,n){return void 0===t&&void 0===n?this.set(e):this.setRGB(e,t,n)}Pn.prototype={constructor:Pn,isColor:!0,r:1,g:1,b:1,set:function(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setScalar:function(e){return this.r=e,this.g=e,this.b=e,this},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,n){return this.r=e,this.g=t,this.b=n,this},setHSL:function(){function e(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}return function(t,n,i){if(t=Ct.euclideanModulo(t,1),n=Ct.clamp(n,0,1),i=Ct.clamp(i,0,1),0===n)this.r=this.g=this.b=i;else{var r=i<=.5?i*(1+n):i+n-i*n,o=2*i-r;this.r=e(o,r,t+1/3),this.g=e(o,r,t),this.b=e(o,r,t-1/3)}return this}}(),setStyle:function(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var i,r=n[1],o=n[2];switch(r){case"rgb":case"rgba":if(i=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,t(i[5]),this;if(i=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,t(i[5]),this;break;case"hsl":case"hsla":if(i=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o)){var a=parseFloat(i[1])/360,s=parseInt(i[2],10)/100,l=parseInt(i[3],10)/100;return t(i[5]),this.setHSL(a,s,l)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(e)){var u,c=(u=n[1]).length;if(3===c)return this.r=parseInt(u.charAt(0)+u.charAt(0),16)/255,this.g=parseInt(u.charAt(1)+u.charAt(1),16)/255,this.b=parseInt(u.charAt(2)+u.charAt(2),16)/255,this;if(6===c)return this.r=parseInt(u.charAt(0)+u.charAt(1),16)/255,this.g=parseInt(u.charAt(2)+u.charAt(3),16)/255,this.b=parseInt(u.charAt(4)+u.charAt(5),16)/255,this}e&&e.length>0&&(void 0!==(u=An[e])?this.setHex(u):console.warn("THREE.Color: Unknown color "+e));return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var n=t>0?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this},convertGammaToLinear:function(){var e=this.r,t=this.g,n=this.b;return this.r=e*e,this.g=t*t,this.b=n*n,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){var t,n,i=e||{h:0,s:0,l:0},r=this.r,o=this.g,a=this.b,s=Math.max(r,o,a),l=Math.min(r,o,a),u=(l+s)/2;if(l===s)t=0,n=0;else{var c=s-l;switch(n=u<=.5?c/(s+l):c/(2-s-l),s){case r:t=(o-a)/c+(o.001&&k.scale>.001&&(x.x=k.x,x.y=k.y,x.z=k.z,b=k.size*k.scale/f.w,_.x=b*g,_.y=b,c.uniform3f(s.screenPosition,x.x,x.y,x.z),c.uniform2f(s.scale,_.x,_.y),c.uniform1f(s.rotation,k.rotation),c.uniform1f(s.opacity,k.opacity),c.uniform3f(s.color,k.color.r,k.color.g,k.color.b),d.setBlending(k.blending,k.blendEquation,k.blendSrc,k.blendDst),e.setTexture2D(k.texture,1),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0))}}}d.enable(c.CULL_FACE),d.enable(c.DEPTH_TEST),d.setDepthWrite(!0),e.resetGLState()}}}function Fn(e,t){var n,i,r,o,a,s,l=e.context,u=e.state,c=new Ut,d=new jt,h=new Ut;function p(){var t=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),u=new Uint16Array([0,1,2,0,2,3]);n=l.createBuffer(),i=l.createBuffer(),l.bindBuffer(l.ARRAY_BUFFER,n),l.bufferData(l.ARRAY_BUFFER,t,l.STATIC_DRAW),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,i),l.bufferData(l.ELEMENT_ARRAY_BUFFER,u,l.STATIC_DRAW),r=function(){var t=l.createProgram(),n=l.createShader(l.VERTEX_SHADER),i=l.createShader(l.FRAGMENT_SHADER);return l.shaderSource(n,["precision "+e.getPrecision()+" float;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uvOffset + uv * uvScale;","vec2 alignedPosition = position * scale;","vec2 rotatedPosition;","rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","vec4 finalPosition;","finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","finalPosition.xy += rotatedPosition;","finalPosition = projectionMatrix * finalPosition;","gl_Position = finalPosition;","}"].join("\n")),l.shaderSource(i,["precision "+e.getPrecision()+" float;","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","void main() {","vec4 texture = texture2D( map, vUV );","if ( texture.a < alphaTest ) discard;","gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","if ( fogType > 0 ) {","float depth = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = 0.0;","if ( fogType == 1 ) {","fogFactor = smoothstep( fogNear, fogFar, depth );","} else {","const float LOG2 = 1.442695;","fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );","fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","}","gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );","}","}"].join("\n")),l.compileShader(n),l.compileShader(i),l.attachShader(t,n),l.attachShader(t,i),l.linkProgram(t),t}(),o={position:l.getAttribLocation(r,"position"),uv:l.getAttribLocation(r,"uv")},a={uvOffset:l.getUniformLocation(r,"uvOffset"),uvScale:l.getUniformLocation(r,"uvScale"),rotation:l.getUniformLocation(r,"rotation"),scale:l.getUniformLocation(r,"scale"),color:l.getUniformLocation(r,"color"),map:l.getUniformLocation(r,"map"),opacity:l.getUniformLocation(r,"opacity"),modelViewMatrix:l.getUniformLocation(r,"modelViewMatrix"),projectionMatrix:l.getUniformLocation(r,"projectionMatrix"),fogType:l.getUniformLocation(r,"fogType"),fogDensity:l.getUniformLocation(r,"fogDensity"),fogNear:l.getUniformLocation(r,"fogNear"),fogFar:l.getUniformLocation(r,"fogFar"),fogColor:l.getUniformLocation(r,"fogColor"),alphaTest:l.getUniformLocation(r,"alphaTest")};var c=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");c.width=8,c.height=8;var d=c.getContext("2d");d.fillStyle="white",d.fillRect(0,0,8,8),(s=new Nt(c)).needsUpdate=!0}function f(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:t.id-e.id}this.render=function(m,g){if(0!==t.length){void 0===r&&p(),l.useProgram(r),u.initAttributes(),u.enableAttribute(o.position),u.enableAttribute(o.uv),u.disableUnusedAttributes(),u.disable(l.CULL_FACE),u.enable(l.BLEND),l.bindBuffer(l.ARRAY_BUFFER,n),l.vertexAttribPointer(o.position,2,l.FLOAT,!1,16,0),l.vertexAttribPointer(o.uv,2,l.FLOAT,!1,16,8),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,i),l.uniformMatrix4fv(a.projectionMatrix,!1,g.projectionMatrix.elements),u.activeTexture(l.TEXTURE0),l.uniform1i(a.map,0);var v=0,y=0,b=m.fog;b?(l.uniform3f(a.fogColor,b.color.r,b.color.g,b.color.b),b.isFog?(l.uniform1f(a.fogNear,b.near),l.uniform1f(a.fogFar,b.far),l.uniform1i(a.fogType,1),v=1,y=1):b.isFogExp2&&(l.uniform1f(a.fogDensity,b.density),l.uniform1i(a.fogType,2),v=2,y=2)):(l.uniform1i(a.fogType,0),v=0,y=0);for(var _=0,x=t.length;_this.max.x||e.ythis.max.y)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){return(t||new Ot).set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)},clampPoint:function(e,t){return(t||new Ot).copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new Ot;return function(t){return e.copy(t).clamp(this.min,this.max).sub(t).length()}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}};var zn,Bn,jn,Un,Wn,Gn,Vn,Hn,Yn,qn,Xn,Kn=0;function Zn(){Object.defineProperty(this,"id",{value:Kn++}),this.uuid=Ct.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=P,this.side=x,this.shading=E,this.vertexColors=T,this.opacity=1,this.transparent=!1,this.blendSrc=V,this.blendDst=H,this.blendEquation=D,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=ee,this.depthTest=!0,this.depthWrite=!0,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.alphaTest=0,this.premultipliedAlpha=!1,this.overdraw=0,this.visible=!0,this._needsUpdate=!0}function Jn(e){Zn.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.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,void 0!==e&&(void 0!==e.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))}function $n(e){Zn.call(this),this.type="MeshDepthMaterial",this.depthPacking=Et,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.lights=!1,this.setValues(e)}function Qn(e,t){this.min=void 0!==e?e:new Ut(1/0,1/0,1/0),this.max=void 0!==t?t:new Ut(-1/0,-1/0,-1/0)}function ei(e,t){this.center=void 0!==e?e:new Ut,this.radius=void 0!==t?t:0}function ti(){this.elements=new Float32Array([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.")}function ni(e,t){this.normal=void 0!==e?e:new Ut(1,0,0),this.constant=void 0!==t?t:0}function ii(e,t,n,i,r,o){this.planes=[void 0!==e?e:new ni,void 0!==t?t:new ni,void 0!==n?n:new ni,void 0!==i?i:new ni,void 0!==r?r:new ni,void 0!==o?o:new ni]}function ri(e,t,n,i){var r=e.context,o=e.state,a=new ii,s=new Wt,l=t.shadows,u=new Ot,c=new Ot(i.maxTextureSize,i.maxTextureSize),d=new Ut,h=new Ut,p=[],f=new Array(4),m=new Array(4),g={},v=[new Ut(1,0,0),new Ut(-1,0,0),new Ut(0,0,1),new Ut(0,0,-1),new Ut(0,1,0),new Ut(0,-1,0)],y=[new Ut(0,1,0),new Ut(0,1,0),new Ut(0,1,0),new Ut(0,1,0),new Ut(0,0,1),new Ut(0,0,-1)],_=[new Ft,new Ft,new Ft,new Ft,new Ft,new Ft],S=new $n;S.depthPacking=Tt,S.clipping=!0;for(var E=In.distanceRGBA,T=On.clone(E.uniforms),C=0;4!==C;++C){var O=0!=(1&C),k=0!=(2&C),P=S.clone();P.morphTargets=O,P.skinning=k,f[C]=P;var A=new Jn({defines:{USE_SHADOWMAP:""},uniforms:T,vertexShader:E.vertexShader,fragmentShader:E.fragmentShader,morphTargets:O,skinning:k,clipping:!0});m[C]=A}var R=this;function L(t,n,i,r){var o=t.geometry,a=null,s=f,l=t.customDepthMaterial;if(i&&(s=m,l=t.customDistanceMaterial),l)a=l;else{var u=!1;n.morphTargets&&(o&&o.isBufferGeometry?u=o.morphAttributes&&o.morphAttributes.position&&o.morphAttributes.position.length>0:o&&o.isGeometry&&(u=o.morphTargets&&o.morphTargets.length>0));var c=0;u&&(c|=1),t.isSkinnedMesh&&n.skinning&&(c|=2),a=s[c]}if(e.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length){var d=a.uuid,h=n.uuid,p=g[d];void 0===p&&(p={},g[d]=p);var v=p[h];void 0===v&&(v=a.clone(),p[h]=v),a=v}a.visible=n.visible,a.wireframe=n.wireframe;var y=n.side;return R.renderSingleSided&&y==M&&(y=x),R.renderReverseSided&&(y===x?y=w:y===w&&(y=x)),a.side=y,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,i&&void 0!==a.uniforms.lightPos&&a.uniforms.lightPos.value.copy(r),a}function I(e,t,n){if(!1!==e.visible){if(0!=(e.layers.mask&t.layers.mask)&&(e.isMesh||e.isLine||e.isPoints))if(e.castShadow&&(!1===e.frustumCulled||!0===a.intersectsObject(e)))!0===e.material.visible&&(e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),p.push(e));for(var i=e.children,r=0,o=i.length;r0&&(n.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),n.skinning=this.skinning,n.morphTargets=this.morphTargets,t){var r=i(e.textures),o=i(e.images);r.length>0&&(n.textures=r),o.length>0&&(n.images=o)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.lights=e.lights,this.blending=e.blending,this.side=e.side,this.shading=e.shading,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.overdraw=e.overdraw,this.visible=e.visible,this.clipShadows=e.clipShadows,this.clipIntersection=e.clipIntersection;var t=e.clippingPlanes,n=null;if(null!==t){var i=t.length;n=new Array(i);for(var r=0;r!==i;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}},Object.assign(Zn.prototype,i.prototype),Jn.prototype=Object.create(Zn.prototype),Jn.prototype.constructor=Jn,Jn.prototype.isShaderMaterial=!0,Jn.prototype.copy=function(e){return Zn.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=On.clone(e.uniforms),this.defines=e.defines,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=e.extensions,this},Jn.prototype.toJSON=function(e){var t=Zn.prototype.toJSON.call(this,e);return t.uniforms=this.uniforms,t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t},$n.prototype=Object.create(Zn.prototype),$n.prototype.constructor=$n,$n.prototype.isMeshDepthMaterial=!0,$n.prototype.copy=function(e){return Zn.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},Qn.prototype={constructor:Qn,isBox3:!0,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){for(var t=1/0,n=1/0,i=1/0,r=-1/0,o=-1/0,a=-1/0,s=0,l=e.length;sr&&(r=u),c>o&&(o=c),d>a&&(a=d)}return this.min.set(t,n,i),this.max.set(r,o,a),this},setFromBufferAttribute:function(e){for(var t=1/0,n=1/0,i=1/0,r=-1/0,o=-1/0,a=-1/0,s=0,l=e.count;sr&&(r=u),c>o&&(o=c),d>a&&(a=d)}return this.min.set(t,n,i),this.max.set(r,o,a),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){return(t||new Ut).set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)},intersectsSphere:function(e){return void 0===Bn&&(Bn=new Ut),this.clampPoint(e.center,Bn),Bn.distanceToSquared(e.center)<=e.radius*e.radius},intersectsPlane:function(e){var t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=e.constant&&n>=e.constant},clampPoint:function(e,t){return(t||new Ut).copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new Ut;return function(t){return e.copy(t).clamp(this.min,this.max).sub(t).length()}}(),getBoundingSphere:function(){var e=new Ut;return function(t){var n=t||new ei;return this.getCenter(n.center),n.radius=.5*this.getSize(e).length(),n}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:(zn=[new Ut,new Ut,new Ut,new Ut,new Ut,new Ut,new Ut,new Ut],function(e){return this.isEmpty()||(zn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),zn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),zn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),zn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),zn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),zn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),zn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),zn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(zn)),this}),translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},ei.prototype={constructor:ei,set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(e,t){void 0===jn&&(jn=new Qn);var n=this.center;void 0!==t?n.copy(t):jn.setFromPoints(e).getCenter(n);for(var i=0,r=0,o=e.length;rthis.radius*this.radius&&(i.sub(this.center).normalize(),i.multiplyScalar(this.radius).add(this.center)),i},getBoundingBox:function(e){var t=e||new Qn;return t.set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}},ti.prototype={constructor:ti,isMatrix3:!0,set:function(e,t,n,i,r,o,a,s,l){var u=this.elements;return u[0]=e,u[1]=i,u[2]=a,u[3]=t,u[4]=r,u[5]=s,u[6]=n,u[7]=o,u[8]=l,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(e){var t=e.elements;return this.set(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8]),this},setFromMatrix4:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},applyToBufferAttribute:function(){var e;return function(t){void 0===e&&(e=new Ut);for(var n=0,i=t.count;n1?void 0:i.copy(r).multiplyScalar(a).add(t.start)}}(),intersectsLine:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return(e||new Ut).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var e=new Ut,t=new ti;return function(n,i){var r=this.coplanarPoint(e).applyMatrix4(n),o=i||t.getNormalMatrix(n),a=this.normal.applyMatrix3(o).normalize();return this.constant=-r.dot(a),this}}(),translate:function(e){return this.constant=this.constant-e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}},ii.prototype={constructor:ii,set:function(e,t,n,i,r,o){var a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(i),a[4].copy(r),a[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this},setFromMatrix:function(e){var t=this.planes,n=e.elements,i=n[0],r=n[1],o=n[2],a=n[3],s=n[4],l=n[5],u=n[6],c=n[7],d=n[8],h=n[9],p=n[10],f=n[11],m=n[12],g=n[13],v=n[14],y=n[15];return t[0].setComponents(a-i,c-s,f-d,y-m).normalize(),t[1].setComponents(a+i,c+s,f+d,y+m).normalize(),t[2].setComponents(a+r,c+l,f+h,y+g).normalize(),t[3].setComponents(a-r,c-l,f-h,y-g).normalize(),t[4].setComponents(a-o,c-u,f-p,y-v).normalize(),t[5].setComponents(a+o,c+u,f+p,y+v).normalize(),this},intersectsObject:(Gn=new ei,function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),Gn.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Gn)}),intersectsSprite:function(){var e=new ei;return function(t){return e.center.set(0,0,0),e.radius=.7071067811865476,e.applyMatrix4(t.matrixWorld),this.intersectsSphere(e)}}(),intersectsSphere:function(e){for(var t=this.planes,n=e.center,i=-e.radius,r=0;r<6;r++){if(t[r].distanceToPoint(n)0?e.min.x:e.max.x,Wn.x=i.normal.x>0?e.max.x:e.min.x,Un.y=i.normal.y>0?e.min.y:e.max.y,Wn.y=i.normal.y>0?e.max.y:e.min.y,Un.z=i.normal.z>0?e.min.z:e.max.z,Wn.z=i.normal.z>0?e.max.z:e.min.z;var r=i.distanceToPoint(Un),o=i.distanceToPoint(Wn);if(r<0&&o<0)return!1}return!0}),containsPoint:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}},oi.prototype={constructor:oi,set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return(t||new Ut).copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:function(){var e=new Ut;return function(t){return this.origin.copy(this.at(t,e)),this}}(),closestPointToPoint:function(e,t){var n=t||new Ut;n.subVectors(e,this.origin);var i=n.dot(this.direction);return i<0?n.copy(this.origin):n.copy(this.direction).multiplyScalar(i).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(){var e=new Ut;return function(t){var n=e.subVectors(t,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(t):(e.copy(this.direction).multiplyScalar(n).add(this.origin),e.distanceToSquared(t))}}(),distanceSqToSegment:(Hn=new Ut,Yn=new Ut,qn=new Ut,function(e,t,n,i){Hn.copy(e).add(t).multiplyScalar(.5),Yn.copy(t).sub(e).normalize(),qn.copy(this.origin).sub(Hn);var r,o,a,s,l=.5*e.distanceTo(t),u=-this.direction.dot(Yn),c=qn.dot(this.direction),d=-qn.dot(Yn),h=qn.lengthSq(),p=Math.abs(1-u*u);if(p>0)if(o=u*c-d,s=l*p,(r=u*d-c)>=0)if(o>=-s)if(o<=s){var f=1/p;a=(r*=f)*(r+u*(o*=f)+2*c)+o*(u*r+o+2*d)+h}else o=l,a=-(r=Math.max(0,-(u*o+c)))*r+o*(o+2*d)+h;else o=-l,a=-(r=Math.max(0,-(u*o+c)))*r+o*(o+2*d)+h;else o<=-s?a=-(r=Math.max(0,-(-u*l+c)))*r+(o=r>0?-l:Math.min(Math.max(-l,-d),l))*(o+2*d)+h:o<=s?(r=0,a=(o=Math.min(Math.max(-l,-d),l))*(o+2*d)+h):a=-(r=Math.max(0,-(u*l+c)))*r+(o=r>0?l:Math.min(Math.max(-l,-d),l))*(o+2*d)+h;else o=u>0?-l:l,a=-(r=Math.max(0,-(u*o+c)))*r+o*(o+2*d)+h;return n&&n.copy(this.direction).multiplyScalar(r).add(this.origin),i&&i.copy(Yn).multiplyScalar(o).add(Hn),a}),intersectSphere:function(){var e=new Ut;return function(t,n){e.subVectors(t.center,this.origin);var i=e.dot(this.direction),r=e.dot(e)-i*i,o=t.radius*t.radius;if(r>o)return null;var a=Math.sqrt(o-r),s=i-a,l=i+a;return s<0&&l<0?null:s<0?this.at(l,n):this.at(s,n)}}(),intersectsSphere:function(e){return this.distanceToPoint(e.center)<=e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null},intersectPlane:function(e,t){var n=this.distanceToPlane(e);return null===n?null:this.at(n,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0},intersectBox:function(e,t){var n,i,r,o,a,s,l=1/this.direction.x,u=1/this.direction.y,c=1/this.direction.z,d=this.origin;return l>=0?(n=(e.min.x-d.x)*l,i=(e.max.x-d.x)*l):(n=(e.max.x-d.x)*l,i=(e.min.x-d.x)*l),u>=0?(r=(e.min.y-d.y)*u,o=(e.max.y-d.y)*u):(r=(e.max.y-d.y)*u,o=(e.min.y-d.y)*u),n>o||r>i?null:((r>n||n!=n)&&(n=r),(o=0?(a=(e.min.z-d.z)*c,s=(e.max.z-d.z)*c):(a=(e.max.z-d.z)*c,s=(e.min.z-d.z)*c),n>s||a>i?null:((a>n||n!=n)&&(n=a),(s=0?n:i,t)))},intersectsBox:(Vn=new Ut,function(e){return null!==this.intersectBox(e,Vn)}),intersectTriangle:function(){var e=new Ut,t=new Ut,n=new Ut,i=new Ut;return function(r,o,a,s,l){t.subVectors(o,r),n.subVectors(a,r),i.crossVectors(t,n);var u,c=this.direction.dot(i);if(c>0){if(s)return null;u=1}else{if(!(c<0))return null;u=-1,c=-c}e.subVectors(this.origin,r);var d=u*this.direction.dot(n.crossVectors(e,n));if(d<0)return null;var h=u*this.direction.dot(t.cross(e));if(h<0)return null;if(d+h>c)return null;var p=-u*e.dot(i);return p<0?null:this.at(p/c,l)}}(),applyMatrix4:function(e){return this.direction.add(this.origin).applyMatrix4(e),this.origin.applyMatrix4(e),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}},ai.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],ai.DefaultOrder="XYZ",ai.prototype={constructor:ai,isEuler:!0,get x(){return this._x},set x(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get order(){return this._order},set order(e){this._order=e,this.onChangeCallback()},set:function(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._order=i||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this.onChangeCallback(),this},setFromRotationMatrix:function(e,t,n){var i=Ct.clamp,r=e.elements,o=r[0],a=r[4],s=r[8],l=r[1],u=r[5],c=r[9],d=r[2],h=r[6],p=r[10];return"XYZ"===(t=t||this._order)?(this._y=Math.asin(i(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-c,p),this._z=Math.atan2(-a,o)):(this._x=Math.atan2(h,u),this._z=0)):"YXZ"===t?(this._x=Math.asin(-i(c,-1,1)),Math.abs(c)<.99999?(this._y=Math.atan2(s,p),this._z=Math.atan2(l,u)):(this._y=Math.atan2(-d,o),this._z=0)):"ZXY"===t?(this._x=Math.asin(i(h,-1,1)),Math.abs(h)<.99999?(this._y=Math.atan2(-d,p),this._z=Math.atan2(-a,u)):(this._y=0,this._z=Math.atan2(l,o))):"ZYX"===t?(this._y=Math.asin(-i(d,-1,1)),Math.abs(d)<.99999?(this._x=Math.atan2(h,p),this._z=Math.atan2(l,o)):(this._x=0,this._z=Math.atan2(-a,u))):"YZX"===t?(this._z=Math.asin(i(l,-1,1)),Math.abs(l)<.99999?(this._x=Math.atan2(-c,u),this._y=Math.atan2(-d,o)):(this._x=0,this._y=Math.atan2(s,p))):"XZY"===t?(this._z=Math.asin(-i(a,-1,1)),Math.abs(a)<.99999?(this._x=Math.atan2(h,u),this._y=Math.atan2(s,o)):(this._x=Math.atan2(-c,p),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+t),this._order=t,!1!==n&&this.onChangeCallback(),this},setFromQuaternion:function(){var e;return function(t,n,i){return void 0===e&&(e=new Wt),e.makeRotationFromQuaternion(t),this.setFromRotationMatrix(e,n,i)}}(),setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:(Xn=new jt,function(e){return Xn.setFromEuler(this),this.setFromQuaternion(Xn,e)}),equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new Ut(this._x,this._y,this._z)},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}},si.prototype={constructor:si,set:function(e){this.mask=1<n&&(n=e[t]);return n}gi.DefaultUp=new Ut(0,1,0),gi.DefaultMatrixAutoUpdate=!0,gi.prototype={constructor:gi,isObject3D:!0,applyMatrix:function(e){this.matrix.multiplyMatrices(e,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:(di=new jt,function(e,t){return di.setFromAxisAngle(e,t),this.quaternion.multiply(di),this}),rotateX:function(){var e=new Ut(1,0,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateY:function(){var e=new Ut(0,1,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateZ:function(){var e=new Ut(0,0,1);return function(t){return this.rotateOnAxis(e,t)}}(),translateOnAxis:function(){var e=new Ut;return function(t,n){return e.copy(t).applyQuaternion(this.quaternion),this.position.add(e.multiplyScalar(n)),this}}(),translateX:function(){var e=new Ut(1,0,0);return function(t){return this.translateOnAxis(e,t)}}(),translateY:function(){var e=new Ut(0,1,0);return function(t){return this.translateOnAxis(e,t)}}(),translateZ:function(){var e=new Ut(0,0,1);return function(t){return this.translateOnAxis(e,t)}}(),localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:(ci=new Wt,function(e){return e.applyMatrix4(ci.getInverse(this.matrixWorld))}),lookAt:function(){var e=new Wt;return function(t){e.lookAt(t,this.position,this.up),this.quaternion.setFromRotationMatrix(e)}}(),add:function(e){if(arguments.length>1){for(var t=0;t1)for(var t=0;t0){i.children=[];for(var r=0;r0&&(n.geometries=o),a.length>0&&(n.materials=a),s.length>0&&(n.textures=s),l.length>0&&(n.images=l)}return n.object=i,n;function u(e){var t=[];for(var n in e){var i=e[n];delete i.metadata,t.push(i)}return t}},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(var n=0;n0?r.multiplyScalar(1/Math.sqrt(o)):r.set(0,0,0)}),yi.barycoordFromPoint=function(){var e=new Ut,t=new Ut,n=new Ut;return function(i,r,o,a,s){e.subVectors(a,r),t.subVectors(o,r),n.subVectors(i,r);var l=e.dot(e),u=e.dot(t),c=e.dot(n),d=t.dot(t),h=t.dot(n),p=l*d-u*u,f=s||new Ut;if(0===p)return f.set(-2,-1,-1);var m=1/p,g=(d*c-u*h)*m,v=(l*h-u*c)*m;return f.set(1-g-v,v,g)}}(),yi.containsPoint=function(){var e=new Ut;return function(t,n,i,r){var o=yi.barycoordFromPoint(t,n,i,r,e);return o.x>=0&&o.y>=0&&o.x+o.y<=1}}(),yi.prototype={constructor:yi,set:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this},setFromPointsAndIndices:function(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},area:function(){var e=new Ut,t=new Ut;return function(){return e.subVectors(this.c,this.b),t.subVectors(this.a,this.b),.5*e.cross(t).length()}}(),midpoint:function(e){return(e||new Ut).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(e){return yi.normal(this.a,this.b,this.c,e)},plane:function(e){return(e||new ni).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(e,t){return yi.barycoordFromPoint(e,this.a,this.b,this.c,t)},containsPoint:function(e){return yi.containsPoint(e,this.a,this.b,this.c)},closestPointToPoint:function(){var e,t,n,i;return function(r,o){void 0===e&&(e=new ni,t=[new vi,new vi,new vi],n=new Ut,i=new Ut);var a=o||new Ut,s=1/0;if(e.setFromCoplanarPoints(this.a,this.b,this.c),e.projectPoint(r,n),!0===this.containsPoint(n))a.copy(n);else{t[0].set(this.a,this.b),t[1].set(this.b,this.c),t[2].set(this.c,this.a);for(var l=0;l0,a=r[1]&&r[1].length>0,s=e.morphTargets,l=s.length;if(l>0){t=[];for(var u=0;u0){c=[];for(u=0;u0?1:-1,u.push(k.x,k.y,k.z),c.push(y/m),c.push(1-b/g),C+=1}}for(b=0;b0)for(h=0;h0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var e,t,n;for(this.computeFaceNormals(),e=0,t=this.faces.length;e0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,n,i,r;for(n=0,i=this.faces.length;n0&&(e+=t[n].distanceTo(t[n-1])),this.lineDistances[n]=e},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Qn),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new ei),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,n){if(!1!==(e&&e.isGeometry)){var i,r=this.vertices.length,o=this.vertices,a=e.vertices,s=this.faces,l=e.faces,u=this.faceVertexUvs[0],c=e.faceVertexUvs[0],d=this.colors,h=e.colors;void 0===n&&(n=0),void 0!==t&&(i=(new ti).getNormalMatrix(t));for(var p=0,f=a.length;p=0;n--){var f=h[n];for(this.faces.splice(f,1),a=0,s=this.faceVertexUvs.length;a0,g=p.vertexNormals.length>0,v=1!==p.color.r||1!==p.color.g||1!==p.color.b,y=p.vertexColors.length>0,b=0;if(b=M(b,0,0),b=M(b,1,!0),b=M(b,2,!1),b=M(b,3,f),b=M(b,4,m),b=M(b,5,g),b=M(b,6,v),b=M(b,7,y),a.push(b),a.push(p.a,p.b,p.c),a.push(p.materialIndex),f){var _=this.faceVertexUvs[0][r];a.push(T(_[0]),T(_[1]),T(_[2]))}if(m&&a.push(S(p.normal)),g){var x=p.vertexNormals;a.push(S(x[0]),S(x[1]),S(x[2]))}if(v&&a.push(E(p.color)),y){var w=p.vertexColors;a.push(E(w[0]),E(w[1]),E(w[2]))}}function M(e,t,n){return n?e|1<0&&(e.data.colors=u),d.length>0&&(e.data.uvs=[d]),e.data.faces=a,e},clone:function(){return(new Ni).copy(this)},copy:function(e){var t,n,i,r,o,a;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=e.name;var s=e.vertices;for(t=0,n=s.length;t65535?Oi:Ti)(e,1):this.index=e},addAttribute:function(e,t){return!1===(t&&t.isBufferAttribute)&&!1===(t&&t.isInterleavedBufferAttribute)?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void this.addAttribute(e,new xi(arguments[1],arguments[2]))):"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),void this.setIndex(t)):(this.attributes[e]=t,this)},getAttribute:function(e){return this.attributes[e]},removeAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,n){this.groups.push({start:e,count:t,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix:function(e){var t=this.attributes.position;void 0!==t&&(e.applyToBufferAttribute(t),t.needsUpdate=!0);var n=this.attributes.normal;void 0!==n&&((new ti).getNormalMatrix(e).applyToBufferAttribute(n),n.needsUpdate=!0);return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var e;return function(t){return void 0===e&&(e=new Wt),e.makeRotationX(t),this.applyMatrix(e),this}}(),rotateY:function(){var e;return function(t){return void 0===e&&(e=new Wt),e.makeRotationY(t),this.applyMatrix(e),this}}(),rotateZ:function(){var e;return function(t){return void 0===e&&(e=new Wt),e.makeRotationZ(t),this.applyMatrix(e),this}}(),translate:function(){var e;return function(t,n,i){return void 0===e&&(e=new Wt),e.makeTranslation(t,n,i),this.applyMatrix(e),this}}(),scale:function(){var e;return function(t,n,i){return void 0===e&&(e=new Wt),e.makeScale(t,n,i),this.applyMatrix(e),this}}(),lookAt:function(){var e;return function(t){void 0===e&&(e=new gi),e.lookAt(t),e.updateMatrix(),this.applyMatrix(e.matrix)}}(),center:function(){this.computeBoundingBox();var e=this.boundingBox.getCenter().negate();return this.translate(e.x,e.y,e.z),e},setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){var n=new ki(3*t.vertices.length,3),i=new ki(3*t.colors.length,3);if(this.addAttribute("position",n.copyVector3sArray(t.vertices)),this.addAttribute("color",i.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var r=new ki(t.lineDistances.length,1);this.addAttribute("lineDistance",r.copyArray(t.lineDistances))}null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},updateFromObject:function(e){var t,n=e.geometry;if(e.isMesh){var i=n.__directGeometry;if(!0===n.elementsNeedUpdate&&(i=void 0,n.elementsNeedUpdate=!1),void 0===i)return this.fromGeometry(n);i.verticesNeedUpdate=n.verticesNeedUpdate,i.normalsNeedUpdate=n.normalsNeedUpdate,i.colorsNeedUpdate=n.colorsNeedUpdate,i.uvsNeedUpdate=n.uvsNeedUpdate,i.groupsNeedUpdate=n.groupsNeedUpdate,n.verticesNeedUpdate=!1,n.normalsNeedUpdate=!1,n.colorsNeedUpdate=!1,n.uvsNeedUpdate=!1,n.groupsNeedUpdate=!1,n=i}return!0===n.verticesNeedUpdate&&(void 0!==(t=this.attributes.position)&&(t.copyVector3sArray(n.vertices),t.needsUpdate=!0),n.verticesNeedUpdate=!1),!0===n.normalsNeedUpdate&&(void 0!==(t=this.attributes.normal)&&(t.copyVector3sArray(n.normals),t.needsUpdate=!0),n.normalsNeedUpdate=!1),!0===n.colorsNeedUpdate&&(void 0!==(t=this.attributes.color)&&(t.copyColorsArray(n.colors),t.needsUpdate=!0),n.colorsNeedUpdate=!1),n.uvsNeedUpdate&&(void 0!==(t=this.attributes.uv)&&(t.copyVector2sArray(n.uvs),t.needsUpdate=!0),n.uvsNeedUpdate=!1),n.lineDistancesNeedUpdate&&(void 0!==(t=this.attributes.lineDistance)&&(t.copyArray(n.lineDistances),t.needsUpdate=!0),n.lineDistancesNeedUpdate=!1),n.groupsNeedUpdate&&(n.computeGroups(e.geometry),this.groups=n.groups,n.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=(new Ai).fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(3*e.vertices.length);if(this.addAttribute("position",new xi(t,3).copyVector3sArray(e.vertices)),e.normals.length>0){var n=new Float32Array(3*e.normals.length);this.addAttribute("normal",new xi(n,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var i=new Float32Array(3*e.colors.length);this.addAttribute("color",new xi(i,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var r=new Float32Array(2*e.uvs.length);this.addAttribute("uv",new xi(r,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var o=new Float32Array(2*e.uvs2.length);this.addAttribute("uv2",new xi(o,2).copyVector2sArray(e.uvs2))}if(e.indices.length>0){var a=new(Ri(e.indices)>65535?Uint32Array:Uint16Array)(3*e.indices.length);this.setIndex(new xi(a,1).copyIndicesArray(e.indices))}for(var s in this.groups=e.groups,e.morphTargets){for(var l=[],u=e.morphTargets[s],c=0,d=u.length;c0){var f=new ki(4*e.skinIndices.length,4);this.addAttribute("skinIndex",f.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var m=new ki(4*e.skinWeights.length,4);this.addAttribute("skinWeight",m.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Qn);var e=this.attributes.position;void 0!==e?this.boundingBox.setFromBufferAttribute(e):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(){var e=new Qn,t=new Ut;return function(){null===this.boundingSphere&&(this.boundingSphere=new ei);var n=this.attributes.position;if(n){var i=this.boundingSphere.center;e.setFromBufferAttribute(n),e.getCenter(i);for(var r=0,o=0,a=n.count;o0&&(e.data.groups=JSON.parse(JSON.stringify(s)));var l=this.boundingSphere;return null!==l&&(e.data.boundingSphere={center:l.center.toArray(),radius:l.radius}),e},clone:function(){return(new Fi).copy(this)},copy:function(e){var t,n,i;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var r=e.index;null!==r&&this.setIndex(r.clone());var o=e.attributes;for(t in o){var a=o[t];this.addAttribute(t,a.clone())}var s=e.morphAttributes;for(t in s){var l=[],u=s[t];for(n=0,i=u.length;n0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var t=0,n=e.length;tt.far?null:{distance:l,point:f.clone(),object:e}}function v(e,t,n,a,s,l,h,f){i.fromBufferAttribute(a,l),r.fromBufferAttribute(a,h),o.fromBufferAttribute(a,f);var v=g(e,t,n,i,r,o,p);return v&&(s&&(u.fromBufferAttribute(s,l),c.fromBufferAttribute(s,h),d.fromBufferAttribute(s,f),v.uv=m(p,i,r,o,u,c,d)),v.face=new bi(l,h,f,yi.normal(i,r,o)),v.faceIndex=l),v}return function(h,f){var y,b=this.geometry,_=this.material,x=this.matrixWorld;if(void 0!==_&&(null===b.boundingSphere&&b.computeBoundingSphere(),n.copy(b.boundingSphere),n.applyMatrix4(x),!1!==h.ray.intersectsSphere(n)&&(e.getInverse(x),t.copy(h.ray).applyMatrix4(e),null===b.boundingBox||!1!==t.intersectsBox(b.boundingBox))))if(b.isBufferGeometry){var w,M,S,E,T,C=b.index,O=b.attributes.position,k=b.attributes.uv;if(null!==C)for(E=0,T=C.count;E0&&(L=z);for(var B=0,j=F.length;B/g,(function(e,t){var n=kn[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return rr(n)}))}function or(e){return e.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,(function(e,t,n,i){for(var r="",o=parseInt(t);o0?e.gammaFactor:1,x=function(e,t,n){return[(e=e||{}).derivatives||t.envMapCubeUV||t.bumpMap||t.normalMap||t.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(e.fragDepth||t.logarithmicDepthBuffer)&&n.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",e.drawBuffers&&n.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(e.shaderTextureLOD||t.envMap)&&n.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(nr).join("\n")}(o,i,e.extensions),w=function(e){var t=[];for(var n in e){var i=e[n];!1!==i&&t.push("#define "+n+" "+i)}return t.join("\n")}(a),M=r.createProgram();n.isRawShaderMaterial?(p=[w,"\n"].filter(nr).join("\n"),f=[x,w,"\n"].filter(nr).join("\n")):(p=["precision "+i.precision+" float;","precision "+i.precision+" int;","#define SHADER_NAME "+n.__webglShader.name,w,i.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+y,"#define MAX_BONES "+i.maxBones,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+d:"",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.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.vertexColors?"#define USE_COLOR":"",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":"","#define NUM_CLIPPING_PLANES "+i.numClippingPlanes,i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+u:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&e.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#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(nr).join("\n"),f=[x,"precision "+i.precision+" float;","precision "+i.precision+" int;","#define SHADER_NAME "+n.__webglShader.name,w,i.alphaTest?"#define ALPHATEST "+i.alphaTest:"","#define GAMMA_FACTOR "+y,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+c:"",i.envMap?"#define "+d:"",i.envMap?"#define "+h:"",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.specularMap?"#define USE_SPECULARMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.vertexColors?"#define USE_COLOR":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+i.numClippingPlanes,"#define UNION_CLIPPING_PLANES "+(i.numClippingPlanes-i.numClipIntersection),i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+u:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&e.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",i.envMap&&e.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",i.toneMapping!==le?"#define TONE_MAPPING":"",i.toneMapping!==le?kn.tonemapping_pars_fragment:"",i.toneMapping!==le?tr("toneMapping",i.toneMapping):"",i.outputEncoding||i.mapEncoding||i.envMapEncoding||i.emissiveMapEncoding?kn.encodings_pars_fragment:"",i.mapEncoding?er("mapTexelToLinear",i.mapEncoding):"",i.envMapEncoding?er("envMapTexelToLinear",i.envMapEncoding):"",i.emissiveMapEncoding?er("emissiveMapTexelToLinear",i.emissiveMapEncoding):"",i.outputEncoding?(m="linearToOutputTexel",g=i.outputEncoding,v=Qi(g),"vec4 "+m+"( vec4 value ) { return LinearTo"+v[0]+v[1]+"; }"):"",i.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(nr).join("\n")),s=ir(s=rr(s),i),l=ir(l=rr(l),i),n.isShaderMaterial||(s=or(s),l=or(l));var S=p+s,E=f+l,T=Ki(r,r.VERTEX_SHADER,S),C=Ki(r,r.FRAGMENT_SHADER,E);r.attachShader(M,T),r.attachShader(M,C),void 0!==n.index0AttributeName?r.bindAttribLocation(M,0,n.index0AttributeName):!0===i.morphTargets&&r.bindAttribLocation(M,0,"position"),r.linkProgram(M);var O,k,P=r.getProgramInfoLog(M),A=r.getShaderInfoLog(T),R=r.getShaderInfoLog(C),L=!0,I=!0;return!1===r.getProgramParameter(M,r.LINK_STATUS)?(L=!1,console.error("THREE.WebGLProgram: shader error: ",r.getError(),"gl.VALIDATE_STATUS",r.getProgramParameter(M,r.VALIDATE_STATUS),"gl.getProgramInfoLog",P,A,R)):""!==P?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",P):""!==A&&""!==R||(I=!1),I&&(this.diagnostics={runnable:L,material:n,programLog:P,vertexShader:{log:A,prefix:p},fragmentShader:{log:R,prefix:f}}),r.deleteShader(T),r.deleteShader(C),this.getUniforms=function(){return void 0===O&&(O=new Cn(r,M,e)),O},this.getAttributes=function(){return void 0===k&&(k=function(e,t,n){for(var i={},r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES),o=0;o0,shadowMapType:e.shadowMap.type,toneMapping:e.toneMapping,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:n.premultipliedAlpha,alphaTest:n.alphaTest,doubleSided:n.side===M,flipSided:n.side===w,depthPacking:void 0!==n.depthPacking&&n.depthPacking}},this.getProgramCode=function(e,t){var n=[];if(t.shaderID?n.push(t.shaderID):(n.push(e.fragmentShader),n.push(e.vertexShader)),void 0!==e.defines)for(var i in e.defines)n.push(i),n.push(e.defines[i]);for(var o=0;o65535?Oi:Ti)(a,1);return r(f,e.ELEMENT_ARRAY_BUFFER),i.wireframe=f,f},update:function(t){var n=i.get(t);t.geometry.isGeometry&&n.updateFromObject(t);var o=n.index,a=n.attributes;for(var s in null!==o&&r(o,e.ELEMENT_ARRAY_BUFFER),a)r(a[s],e.ARRAY_BUFFER);var l=n.morphAttributes;for(var s in l)for(var u=l[s],c=0,d=u.length;ct||e.height>t){var n=t/Math.max(e.width,e.height),i=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return i.width=Math.floor(e.width*n),i.height=Math.floor(e.height*n),i.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,i.width,i.height),console.warn("THREE.WebGLRenderer: image is too big ("+e.width+"x"+e.height+"). Resized to "+i.width+"x"+i.height,e),i}return e}function c(e){return Ct.isPowerOfTwo(e.width)&&Ct.isPowerOfTwo(e.height)}function d(t){return t===Se||t===Ee||t===Te?e.NEAREST:e.LINEAR}function h(t){var n=t.target;n.removeEventListener("dispose",h),function(t){var n=i.get(t);if(t.image&&n.__image__webglTextureCube)e.deleteTexture(n.__image__webglTextureCube);else{if(void 0===n.__webglInit)return;e.deleteTexture(n.__webglTexture)}i.delete(t)}(n),s.textures--}function p(t){var n=t.target;n.removeEventListener("dispose",p),function(t){var n=i.get(t),r=i.get(t.texture);if(!t)return;void 0!==r.__webglTexture&&e.deleteTexture(r.__webglTexture);t.depthTexture&&t.depthTexture.dispose();if(t.isWebGLRenderTargetCube)for(var o=0;o<6;o++)e.deleteFramebuffer(n.__webglFramebuffer[o]),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[o]);else e.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer);i.delete(t.texture),i.delete(t)}(n),s.textures--}function f(t,a){var d=i.get(t);if(t.version>0&&d.__version!==t.version){var p=t.image;if(void 0===p)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",t);else{if(!1!==p.complete)return void function(t,i,a){void 0===t.__webglInit&&(t.__webglInit=!0,i.addEventListener("dispose",h),t.__webglTexture=e.createTexture(),s.textures++);n.activeTexture(e.TEXTURE0+a),n.bindTexture(e.TEXTURE_2D,t.__webglTexture),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,i.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,i.unpackAlignment);var d=u(i.image,r.maxTextureSize);(function(e){return e.wrapS!==we||e.wrapT!==we||e.minFilter!==Se&&e.minFilter!==Ce})(i)&&!1===c(d)&&(d=function(e){if(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement){var t=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return t.width=Ct.nearestPowerOfTwo(e.width),t.height=Ct.nearestPowerOfTwo(e.height),t.getContext("2d").drawImage(e,0,0,t.width,t.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+e.width+"x"+e.height+"). Resized to "+t.width+"x"+t.height,e),t}return e}(d));var p=c(d),f=o(i.format),g=o(i.type);m(e.TEXTURE_2D,i,p);var v,y=i.mipmaps;if(i.isDepthTexture){var b=e.DEPTH_COMPONENT;if(i.type===Ne){if(!l)throw new Error("Float Depth Texture only supported in WebGL2.0");b=e.DEPTH_COMPONENT32F}else l&&(b=e.DEPTH_COMPONENT16);i.format===Xe&&b===e.DEPTH_COMPONENT&&i.type!==Le&&i.type!==De&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=Le,g=o(i.type)),i.format===Ke&&(b=e.DEPTH_STENCIL,i.type!==Ue&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=Ue,g=o(i.type))),n.texImage2D(e.TEXTURE_2D,0,b,d.width,d.height,0,f,g,null)}else if(i.isDataTexture)if(y.length>0&&p){for(var _=0,x=y.length;_-1?n.compressedTexImage2D(e.TEXTURE_2D,_,f,v.width,v.height,0,v.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(e.TEXTURE_2D,_,f,v.width,v.height,0,f,g,v.data);else if(y.length>0&&p){for(_=0,x=y.length;_1||i.get(a).__currentAnisotropy)&&(e.texParameterf(n,l.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy)}}function g(t,r,a,s){var l=o(r.texture.format),u=o(r.texture.type);n.texImage2D(s,0,l,r.width,r.height,0,l,u,null),e.bindFramebuffer(e.FRAMEBUFFER,t),e.framebufferTexture2D(e.FRAMEBUFFER,a,s,i.get(r.texture).__webglTexture,0),e.bindFramebuffer(e.FRAMEBUFFER,null)}function v(t,n){e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer&&!n.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t)):n.depthBuffer&&n.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t)):e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,n.width,n.height),e.bindRenderbuffer(e.RENDERBUFFER,null)}function y(t){var n=i.get(t),r=!0===t.isWebGLRenderTargetCube;if(t.depthTexture){if(r)throw new Error("target.depthTexture not supported in Cube render targets");!function(t,n){if(n&&n.isWebGLRenderTargetCube)throw new Error("Depth Texture with cube render targets is not supported!");if(e.bindFramebuffer(e.FRAMEBUFFER,t),!n.depthTexture||!n.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");i.get(n.depthTexture).__webglTexture&&n.depthTexture.image.width===n.width&&n.depthTexture.image.height===n.height||(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=!0),f(n.depthTexture,0);var r=i.get(n.depthTexture).__webglTexture;if(n.depthTexture.format===Xe)e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,r,0);else{if(n.depthTexture.format!==Ke)throw new Error("Unknown depthTexture format");e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,r,0)}}(n.__webglFramebuffer,t)}else if(r){n.__webglDepthbuffer=[];for(var o=0;o<6;o++)e.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer[o]),n.__webglDepthbuffer[o]=e.createRenderbuffer(),v(n.__webglDepthbuffer[o],t)}else e.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer),n.__webglDepthbuffer=e.createRenderbuffer(),v(n.__webglDepthbuffer,t);e.bindFramebuffer(e.FRAMEBUFFER,null)}this.setTexture2D=f,this.setTextureCube=function(t,a){var l=i.get(t);if(6===t.image.length)if(t.version>0&&l.__version!==t.version){l.__image__webglTextureCube||(t.addEventListener("dispose",h),l.__image__webglTextureCube=e.createTexture(),s.textures++),n.activeTexture(e.TEXTURE0+a),n.bindTexture(e.TEXTURE_CUBE_MAP,l.__image__webglTextureCube),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t.flipY);for(var d=t&&t.isCompressedTexture,p=t.image[0]&&t.image[0].isDataTexture,f=[],g=0;g<6;g++)f[g]=d||p?p?t.image[g].image:t.image[g]:u(t.image[g],r.maxCubemapSize);var v=c(f[0]),y=o(t.format),b=o(t.type);m(e.TEXTURE_CUBE_MAP,t,v);for(g=0;g<6;g++)if(d)for(var _,x=f[g].mipmaps,w=0,M=x.length;w-1?n.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+g,w,y,_.width,_.height,0,_.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+g,w,y,_.width,_.height,0,y,b,_.data);else p?n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,y,f[g].width,f[g].height,0,y,b,f[g].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,y,y,b,f[g]);t.generateMipmaps&&v&&e.generateMipmap(e.TEXTURE_CUBE_MAP),l.__version=t.version,t.onUpdate&&t.onUpdate(t)}else n.activeTexture(e.TEXTURE0+a),n.bindTexture(e.TEXTURE_CUBE_MAP,l.__image__webglTextureCube)},this.setTextureCubeDynamic=function(t,r){n.activeTexture(e.TEXTURE0+r),n.bindTexture(e.TEXTURE_CUBE_MAP,i.get(t).__webglTexture)},this.setupRenderTarget=function(t){var r=i.get(t),o=i.get(t.texture);t.addEventListener("dispose",p),o.__webglTexture=e.createTexture(),s.textures++;var a=!0===t.isWebGLRenderTargetCube,l=c(t);if(a){r.__webglFramebuffer=[];for(var u=0;u<6;u++)r.__webglFramebuffer[u]=e.createFramebuffer()}else r.__webglFramebuffer=e.createFramebuffer();if(a){n.bindTexture(e.TEXTURE_CUBE_MAP,o.__webglTexture),m(e.TEXTURE_CUBE_MAP,t.texture,l);for(u=0;u<6;u++)g(r.__webglFramebuffer[u],t,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+u);t.texture.generateMipmaps&&l&&e.generateMipmap(e.TEXTURE_CUBE_MAP),n.bindTexture(e.TEXTURE_CUBE_MAP,null)}else n.bindTexture(e.TEXTURE_2D,o.__webglTexture),m(e.TEXTURE_2D,t.texture,l),g(r.__webglFramebuffer,t,e.COLOR_ATTACHMENT0,e.TEXTURE_2D),t.texture.generateMipmaps&&l&&e.generateMipmap(e.TEXTURE_2D),n.bindTexture(e.TEXTURE_2D,null);t.depthBuffer&&y(t)},this.updateRenderTargetMipmap=function(t){var r=t.texture;if(r.generateMipmaps&&c(t)&&r.minFilter!==Se&&r.minFilter!==Ce){var o=t&&t.isWebGLRenderTargetCube?e.TEXTURE_CUBE_MAP:e.TEXTURE_2D,a=i.get(r).__webglTexture;n.bindTexture(o,a),e.generateMipmap(o),n.bindTexture(o,null)}}}function dr(){var e={};return{get:function(t){var n=t.uuid,i=e[n];return void 0===i&&(i={},e[n]=i),i},delete:function(t){delete e[t.uuid]},clear:function(){e={}}}}function hr(e,t,n){var i=new function(){var t=!1,n=new Ft,i=null,r=new Ft;return{setMask:function(n){i===n||t||(e.colorMask(n,n,n,n),i=n)},setLocked:function(e){t=e},setClear:function(t,i,o,a,s){!0===s&&(t*=a,i*=a,o*=a),n.set(t,i,o,a),!1===r.equals(n)&&(e.clearColor(t,i,o,a),r.copy(n))},reset:function(){t=!1,i=null,r.set(0,0,0,1)}}},r=new function(){var t=!1,n=null,i=null,r=null;return{setTest:function(t){t?V(e.DEPTH_TEST):H(e.DEPTH_TEST)},setMask:function(i){n===i||t||(e.depthMask(i),n=i)},setFunc:function(t){if(i!==t){if(t)switch(t){case J:e.depthFunc(e.NEVER);break;case $:e.depthFunc(e.ALWAYS);break;case Q:e.depthFunc(e.LESS);break;case ee:e.depthFunc(e.LEQUAL);break;case te:e.depthFunc(e.EQUAL);break;case ne:e.depthFunc(e.GEQUAL);break;case ie:e.depthFunc(e.GREATER);break;case re:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}else e.depthFunc(e.LEQUAL);i=t}},setLocked:function(e){t=e},setClear:function(t){r!==t&&(e.clearDepth(t),r=t)},reset:function(){t=!1,n=null,i=null,r=null}}},o=new function(){var t=!1,n=null,i=null,r=null,o=null,a=null,s=null,l=null,u=null;return{setTest:function(t){t?V(e.STENCIL_TEST):H(e.STENCIL_TEST)},setMask:function(i){n===i||t||(e.stencilMask(i),n=i)},setFunc:function(t,n,a){i===t&&r===n&&o===a||(e.stencilFunc(t,n,a),i=t,r=n,o=a)},setOp:function(t,n,i){a===t&&s===n&&l===i||(e.stencilOp(t,n,i),a=t,s=n,l=i)},setLocked:function(e){t=e},setClear:function(t){u!==t&&(e.clearStencil(t),u=t)},reset:function(){t=!1,n=null,i=null,r=null,o=null,a=null,s=null,l=null,u=null}}},a=e.getParameter(e.MAX_VERTEX_ATTRIBS),s=new Uint8Array(a),l=new Uint8Array(a),u=new Uint8Array(a),c={},d=null,m=null,g=null,v=null,y=null,b=null,_=null,x=null,w=!1,M=null,S=null,E=null,T=null,C=null,O=null,D=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),N=parseFloat(/^WebGL\ ([0-9])/.exec(e.getParameter(e.VERSION))[1]),F=parseFloat(N)>=1,z=null,B={},j=new Ft,U=new Ft;function W(t,n,i){var r=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(var a=0;a0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var o=void 0!==n.precision?n.precision:"highp",a=r(o);a!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",a,"instead."),o=a);var s=!0===n.logarithmicDepthBuffer&&!!t.get("EXT_frag_depth"),l=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),u=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),c=e.getParameter(e.MAX_TEXTURE_SIZE),d=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),h=e.getParameter(e.MAX_VERTEX_ATTRIBS),p=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),f=e.getParameter(e.MAX_VARYING_VECTORS),m=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),g=u>0,v=!!t.get("OES_texture_float");return{getMaxAnisotropy:function(){if(void 0!==i)return i;var n=t.get("EXT_texture_filter_anisotropic");return i=null!==n?e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:r,precision:o,logarithmicDepthBuffer:s,maxTextures:l,maxVertexTextures:u,maxTextureSize:c,maxCubemapSize:d,maxAttributes:h,maxVertexUniforms:p,maxVaryings:f,maxFragmentUniforms:m,vertexTextures:g,floatFragmentTextures:v,floatVertexTextures:g&&v}}function fr(e){var t={};return{get:function(n){if(void 0!==t[n])return t[n];var i;switch(n){case"WEBGL_depth_texture":i=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":i=e.getExtension("WEBGL_compressed_texture_etc1");break;default:i=e.getExtension(n)}return null===i&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),t[n]=i,i}}}function mr(){var e=this,t=null,n=0,i=!1,r=!1,o=new ni,a=new ti,s={value:null,needsUpdate:!1};function l(){s.value!==t&&(s.value=t,s.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(t,n,i,r){var l=null!==t?t.length:0,u=null;if(0!==l){if(u=s.value,!0!==r||null===u){var c=i+4*l,d=n.matrixWorldInverse;a.getNormalMatrix(d),(null===u||u.length=0&&e.numSupportedMorphTargets++}if(e.morphNormals){e.numSupportedMorphNormals=0;for(c=0;c<_.maxMorphNormals;c++)u["morphNormal"+c]>=0&&e.numSupportedMorphNormals++}var d=i.__webglShader.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(i.numClippingPlanes=se.numPlanes,i.numIntersection=se.numIntersection,d.clippingPlanes=se.uniform),i.fog=t,i.lightsHash=ge.hash,e.lights&&(d.ambientLightColor.value=ge.ambient,d.directionalLights.value=ge.directional,d.spotLights.value=ge.spot,d.rectAreaLights.value=ge.rectArea,d.pointLights.value=ge.point,d.hemisphereLights.value=ge.hemi,d.directionalShadowMap.value=ge.directionalShadowMap,d.directionalShadowMatrix.value=ge.directionalShadowMatrix,d.spotShadowMap.value=ge.spotShadowMap,d.spotShadowMatrix.value=ge.spotShadowMatrix,d.pointShadowMap.value=ge.pointShadowMap,d.pointShadowMatrix.value=ge.pointShadowMatrix);var h=i.program.getUniforms(),p=Cn.seqWithValue(h.seq,d);i.uniformsList=p}(n,t,i),n.needsUpdate=!1);var a,s,l=!1,u=!1,c=!1,d=r.program,h=d.getUniforms(),p=r.__webglShader.uniforms;if(d.id!==x&&(b.useProgram(d.program),x=d.id,l=!0,u=!0,c=!0),n.id!==O&&(O=n.id,u=!0),l||e!==A){if(h.set(b,e,"projectionMatrix"),_e.logarithmicDepthBuffer&&h.setValue(b,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),e!==A&&(A=e,u=!0,c=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.envMap){var f=h.map.cameraPosition;void 0!==f&&f.setValue(b,pe.setFromMatrixPosition(e.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&h.setValue(b,"viewMatrix",e.matrixWorldInverse),h.set(b,_,"toneMappingExposure"),h.set(b,_,"toneMappingWhitePoint")}if(n.skinning){h.setOptional(b,i,"bindMatrix"),h.setOptional(b,i,"bindMatrixInverse");var m=i.skeleton;m&&(_e.floatVertexTextures&&m.useVertexTexture?(h.set(b,m,"boneTexture"),h.set(b,m,"boneTextureWidth"),h.set(b,m,"boneTextureHeight")):h.setOptional(b,m,"boneMatrices"))}return u&&(n.lights&&(s=c,(a=p).ambientLightColor.needsUpdate=s,a.directionalLights.needsUpdate=s,a.pointLights.needsUpdate=s,a.spotLights.needsUpdate=s,a.rectAreaLights.needsUpdate=s,a.hemisphereLights.needsUpdate=s),t&&n.fog&&function(e,t){e.fogColor.value=t.color,t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)}(p,t),(n.isMeshBasicMaterial||n.isMeshLambertMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.isMeshNormalMaterial||n.isMeshDepthMaterial)&&function(e,t){e.opacity.value=t.opacity,e.diffuse.value=t.color,t.emissive&&e.emissive.value.copy(t.emissive).multiplyScalar(t.emissiveIntensity);e.map.value=t.map,e.specularMap.value=t.specularMap,e.alphaMap.value=t.alphaMap,t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity);t.aoMap&&(e.aoMap.value=t.aoMap,e.aoMapIntensity.value=t.aoMapIntensity);var n;t.map?n=t.map:t.specularMap?n=t.specularMap:t.displacementMap?n=t.displacementMap:t.normalMap?n=t.normalMap:t.bumpMap?n=t.bumpMap:t.roughnessMap?n=t.roughnessMap:t.metalnessMap?n=t.metalnessMap:t.alphaMap?n=t.alphaMap:t.emissiveMap&&(n=t.emissiveMap);if(void 0!==n){n.isWebGLRenderTarget&&(n=n.texture);var i=n.offset,r=n.repeat;e.offsetRepeat.value.set(i.x,i.y,r.x,r.y)}e.envMap.value=t.envMap,e.flipEnvMap.value=t.envMap&&t.envMap.isCubeTexture?-1:1,e.reflectivity.value=t.reflectivity,e.refractionRatio.value=t.refractionRatio}(p,n),n.isLineBasicMaterial?zt(p,n):n.isLineDashedMaterial?(zt(p,n),function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(p,n)):n.isPointsMaterial?function(e,t){if(e.diffuse.value=t.color,e.opacity.value=t.opacity,e.size.value=t.size*ne,e.scale.value=.5*te,e.map.value=t.map,null!==t.map){var n=t.map.offset,i=t.map.repeat;e.offsetRepeat.value.set(n.x,n.y,i.x,i.y)}}(p,n):n.isMeshLambertMaterial?function(e,t){t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}(p,n):n.isMeshToonMaterial?function(e,t){Bt(e,t),t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(p,n):n.isMeshPhongMaterial?Bt(p,n):n.isMeshPhysicalMaterial?function(e,t){e.clearCoat.value=t.clearCoat,e.clearCoatRoughness.value=t.clearCoatRoughness,jt(e,t)}(p,n):n.isMeshStandardMaterial?jt(p,n):n.isMeshDepthMaterial?n.displacementMap&&(p.displacementMap.value=n.displacementMap,p.displacementScale.value=n.displacementScale,p.displacementBias.value=n.displacementBias):n.isMeshNormalMaterial&&function(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale);t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale));t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(p,n),void 0!==p.ltcMat&&(p.ltcMat.value=THREE.UniformsLib.LTC_MAT_TEXTURE),void 0!==p.ltcMag&&(p.ltcMag.value=THREE.UniformsLib.LTC_MAG_TEXTURE),Cn.upload(b,r.uniformsList,p,_)),h.set(b,i,"modelViewMatrix"),h.set(b,i,"normalMatrix"),h.setValue(b,"modelMatrix",i.matrixWorld),d}function zt(e,t){e.diffuse.value=t.color,e.opacity.value=t.opacity}function Bt(e,t){e.specular.value=t.specular,e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale)),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function jt(e,t){e.roughness.value=t.roughness,e.metalness.value=t.metalness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap),t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale)),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}function Gt(e){var t;if(e===xe)return b.REPEAT;if(e===we)return b.CLAMP_TO_EDGE;if(e===Me)return b.MIRRORED_REPEAT;if(e===Se)return b.NEAREST;if(e===Ee)return b.NEAREST_MIPMAP_NEAREST;if(e===Te)return b.NEAREST_MIPMAP_LINEAR;if(e===Ce)return b.LINEAR;if(e===Oe)return b.LINEAR_MIPMAP_NEAREST;if(e===ke)return b.LINEAR_MIPMAP_LINEAR;if(e===Pe)return b.UNSIGNED_BYTE;if(e===ze)return b.UNSIGNED_SHORT_4_4_4_4;if(e===Be)return b.UNSIGNED_SHORT_5_5_5_1;if(e===je)return b.UNSIGNED_SHORT_5_6_5;if(e===Ae)return b.BYTE;if(e===Re)return b.SHORT;if(e===Le)return b.UNSIGNED_SHORT;if(e===Ie)return b.INT;if(e===De)return b.UNSIGNED_INT;if(e===Ne)return b.FLOAT;if(e===Fe&&null!==(t=be.get("OES_texture_half_float")))return t.HALF_FLOAT_OES;if(e===We)return b.ALPHA;if(e===Ge)return b.RGB;if(e===Ve)return b.RGBA;if(e===He)return b.LUMINANCE;if(e===Ye)return b.LUMINANCE_ALPHA;if(e===Xe)return b.DEPTH_COMPONENT;if(e===Ke)return b.DEPTH_STENCIL;if(e===D)return b.FUNC_ADD;if(e===N)return b.FUNC_SUBTRACT;if(e===F)return b.FUNC_REVERSE_SUBTRACT;if(e===j)return b.ZERO;if(e===U)return b.ONE;if(e===W)return b.SRC_COLOR;if(e===G)return b.ONE_MINUS_SRC_COLOR;if(e===V)return b.SRC_ALPHA;if(e===H)return b.ONE_MINUS_SRC_ALPHA;if(e===Y)return b.DST_ALPHA;if(e===q)return b.ONE_MINUS_DST_ALPHA;if(e===X)return b.DST_COLOR;if(e===K)return b.ONE_MINUS_DST_COLOR;if(e===Z)return b.SRC_ALPHA_SATURATE;if((e===Ze||e===Je||e===$e||e===Qe)&&null!==(t=be.get("WEBGL_compressed_texture_s3tc"))){if(e===Ze)return t.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===Je)return t.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===$e)return t.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===Qe)return t.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((e===et||e===tt||e===nt||e===it)&&null!==(t=be.get("WEBGL_compressed_texture_pvrtc"))){if(e===et)return t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===tt)return t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===nt)return t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===it)return t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(e===rt&&null!==(t=be.get("WEBGL_compressed_texture_etc1")))return t.COMPRESSED_RGB_ETC1_WEBGL;if((e===z||e===B)&&null!==(t=be.get("EXT_blend_minmax"))){if(e===z)return t.MIN_EXT;if(e===B)return t.MAX_EXT}return e===Ue&&null!==(t=be.get("WEBGL_depth_texture"))?t.UNSIGNED_INT_24_8_WEBGL:0}this.getContext=function(){return b},this.getContextAttributes=function(){return b.getContextAttributes()},this.forceContextLoss=function(){be.get("WEBGL_lose_context").loseContext()},this.getMaxAnisotropy=function(){return _e.getMaxAnisotropy()},this.getPrecision=function(){return _e.precision},this.getPixelRatio=function(){return ne},this.setPixelRatio=function(e){void 0!==e&&(ne=e,this.setSize(oe.z,oe.w,!1))},this.getSize=function(){return{width:ee,height:te}},this.setSize=function(e,n,i){ee=e,te=n,t.width=e*ne,t.height=n*ne,!1!==i&&(t.style.width=e+"px",t.style.height=n+"px"),this.setViewport(0,0,e,n)},this.setViewport=function(e,t,n,i){qe.viewport(oe.set(e,t,n,i))},this.setScissor=function(e,t,n,i){qe.scissor(ie.set(e,t,n,i))},this.setScissorTest=function(e){qe.setScissorTest(re=e)},this.getClearColor=function(){return $},this.setClearColor=function(e,t){$.set(e),Q=void 0!==t?t:1,qe.buffers.color.setClear($.r,$.g,$.b,Q,s)},this.getClearAlpha=function(){return Q},this.setClearAlpha=function(e){Q=e,qe.buffers.color.setClear($.r,$.g,$.b,Q,s)},this.clear=function(e,t,n){var i=0;(void 0===e||e)&&(i|=b.COLOR_BUFFER_BIT),(void 0===t||t)&&(i|=b.DEPTH_BUFFER_BIT),(void 0===n||n)&&(i|=b.STENCIL_BUFFER_BIT),b.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.clearTarget=function(e,t,n,i){this.setRenderTarget(e),this.clear(t,n,i)},this.resetGLState=xt,this.dispose=function(){p=[],f=-1,d=[],h=-1,t.removeEventListener("webglcontextlost",Tt,!1)},this.renderBufferImmediate=function(e,t,n){qe.initAttributes();var i=ot.get(e);e.hasPositions&&!i.position&&(i.position=b.createBuffer()),e.hasNormals&&!i.normal&&(i.normal=b.createBuffer()),e.hasUvs&&!i.uv&&(i.uv=b.createBuffer()),e.hasColors&&!i.color&&(i.color=b.createBuffer());var r=t.getAttributes();if(e.hasPositions&&(b.bindBuffer(b.ARRAY_BUFFER,i.position),b.bufferData(b.ARRAY_BUFFER,e.positionArray,b.DYNAMIC_DRAW),qe.enableAttribute(r.position),b.vertexAttribPointer(r.position,3,b.FLOAT,!1,0,0)),e.hasNormals){if(b.bindBuffer(b.ARRAY_BUFFER,i.normal),!n.isMeshPhongMaterial&&!n.isMeshStandardMaterial&&!n.isMeshNormalMaterial&&n.shading===S)for(var o=0,a=3*e.count;o8&&(c.length=8);var f=n.morphAttributes;for(d=0,h=c.length;d=0){var c=o[l];if(void 0!==c){var d=c.normalized,h=c.itemSize,p=st.getAttributeProperties(c),f=p.__webglBuffer,m=p.type,g=p.bytesPerElement;if(c.isInterleavedBufferAttribute){var v=c.data,y=v.stride,_=c.offset;v&&v.isInstancedInterleavedBuffer?(qe.enableAttributeAndDivisor(u,v.meshPerAttribute,r),void 0===n.maxInstancedCount&&(n.maxInstancedCount=v.meshPerAttribute*v.count)):qe.enableAttribute(u),b.bindBuffer(b.ARRAY_BUFFER,f),b.vertexAttribPointer(u,h,m,d,y*g,(i*y+_)*g)}else c.isInstancedBufferAttribute?(qe.enableAttributeAndDivisor(u,c.meshPerAttribute,r),void 0===n.maxInstancedCount&&(n.maxInstancedCount=c.meshPerAttribute*c.count)):qe.enableAttribute(u),b.bindBuffer(b.ARRAY_BUFFER,f),b.vertexAttribPointer(u,h,m,d,0,i*h*g)}else if(void 0!==s){var x=s[l];if(void 0!==x)switch(x.length){case 2:b.vertexAttrib2fv(u,x);break;case 3:b.vertexAttrib3fv(u,x);break;case 4:b.vertexAttrib4fv(u,x);break;default:b.vertexAttrib1fv(u,x)}}}}qe.disableUnusedAttributes()}(i,a,n),null!==g&&b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,st.getAttributeBuffer(g)));var w=0;null!==g?w=g.count:void 0!==_&&(w=_.count);var M=n.drawRange.start*x,S=n.drawRange.count*x,E=null!==o?o.start*x:0,T=null!==o?o.count*x:1/0,C=Math.max(M,E),O=Math.min(w,M+S,E+T)-1,k=Math.max(0,O-C+1);if(0!==k){if(r.isMesh)if(!0===i.wireframe)qe.setLineWidth(i.wireframeLinewidth*bt()),y.setMode(b.LINES);else switch(r.drawMode){case ft:y.setMode(b.TRIANGLES);break;case mt:y.setMode(b.TRIANGLE_STRIP);break;case gt:y.setMode(b.TRIANGLE_FAN)}else if(r.isLine){var A=i.linewidth;void 0===A&&(A=1),qe.setLineWidth(A*bt()),r.isLineSegments?y.setMode(b.LINES):y.setMode(b.LINE_STRIP)}else r.isPoints&&y.setMode(b.POINTS);n&&n.isInstancedBufferGeometry?n.maxInstancedCount>0&&y.renderInstances(n,C,k):y.render(C,k)}},this.render=function(e,t,n,i){if(void 0===t||!0===t.isCamera){P="",O=-1,A=null,!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),t.matrixWorldInverse.getInverse(t.matrixWorld),he.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),ae.setFromMatrix(he),u.length=0,h=-1,f=-1,v.length=0,y.length=0,ce=this.localClippingEnabled,le=se.init(this.clippingPlanes,ce,t),function e(t,n){if(!1===t.visible)return;if(0!=(t.layers.mask&n.layers.mask))if(t.isLight)u.push(t);else if(t.isSprite)!1!==t.frustumCulled&&!0!==(h=t,de.center.set(0,0,0),de.radius=.7071067811865476,de.applyMatrix4(h.matrixWorld),Lt(de))||v.push(t);else if(t.isLensFlare)y.push(t);else if(t.isImmediateRenderObject)!0===_.sortObjects&&(pe.setFromMatrixPosition(t.matrixWorld),pe.applyMatrix4(he)),Rt(t,null,t.material,pe.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.update(),!1===t.frustumCulled||!0===function(e){var t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere();return de.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),Lt(de)}(t))){var i=t.material;if(!0===i.visible){!0===_.sortObjects&&(pe.setFromMatrixPosition(t.matrixWorld),pe.applyMatrix4(he));var r=st.update(t);if(i.isMultiMaterial)for(var o=r.groups,a=i.materials,s=0,l=o.length;s=_e.maxTextures&&console.warn("WebGLRenderer: trying to use "+e+" texture units while this GPU supports only "+_e.maxTextures),J+=1,e},this.setTexture2D=(Mt=!1,function(e,t){e&&e.isWebGLRenderTarget&&(Mt||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),Mt=!0),e=e.texture),at.setTexture2D(e,t)}),this.setTexture=function(){var e=!1;return function(t,n){e||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),e=!0),at.setTexture2D(t,n)}}(),this.setTextureCube=function(){var e=!1;return function(t,n){t&&t.isWebGLRenderTargetCube&&(e||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),e=!0),t=t.texture),t&&t.isCubeTexture||Array.isArray(t.image)&&6===t.image.length?at.setTextureCube(t,n):at.setTextureCubeDynamic(t,n)}}(),this.getCurrentRenderTarget=function(){return E},this.setRenderTarget=function(e){E=e,e&&void 0===ot.get(e).__webglFramebuffer&&at.setupRenderTarget(e);var t,n=e&&e.isWebGLRenderTargetCube;if(e){var i=ot.get(e);t=n?i.__webglFramebuffer[e.activeCubeFace]:i.__webglFramebuffer,R.copy(e.scissor),L=e.scissorTest,I.copy(e.viewport)}else t=null,R.copy(ie).multiplyScalar(ne),L=re,I.copy(oe).multiplyScalar(ne);if(C!==t&&(b.bindFramebuffer(b.FRAMEBUFFER,t),C=t),qe.scissor(R),qe.setScissorTest(L),qe.viewport(I),n){var r=ot.get(e.texture);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_CUBE_MAP_POSITIVE_X+e.activeCubeFace,r.__webglTexture,e.activeMipMapLevel)}},this.readRenderTargetPixels=function(e,t,n,i,r,o){if(!1!==(e&&e.isWebGLRenderTarget)){var a=ot.get(e).__webglFramebuffer;if(a){var s=!1;a!==C&&(b.bindFramebuffer(b.FRAMEBUFFER,a),s=!0);try{var l=e.texture,u=l.format,c=l.type;if(u!==Ve&&Gt(u)!==b.getParameter(b.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(c===Pe||Gt(c)===b.getParameter(b.IMPLEMENTATION_COLOR_READ_TYPE)||c===Ne&&(be.get("OES_texture_float")||be.get("WEBGL_color_buffer_float"))||c===Fe&&be.get("EXT_color_buffer_half_float")))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");b.checkFramebufferStatus(b.FRAMEBUFFER)===b.FRAMEBUFFER_COMPLETE?t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&b.readPixels(t,n,i,r,Gt(u),Gt(c),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&b.bindFramebuffer(b.FRAMEBUFFER,C)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")}}function vr(e,t){this.name="",this.color=new Pn(e),this.density=void 0!==t?t:25e-5}function yr(e,t,n){this.name="",this.color=new Pn(e),this.near=void 0!==t?t:1,this.far=void 0!==n?n:1e3}function br(){gi.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function _r(e,t,n,i,r){gi.call(this),this.lensFlares=[],this.positionScreen=new Ut,this.customUpdateCallback=void 0,void 0!==e&&this.add(e,t,n,i,r)}function xr(e){Zn.call(this),this.type="SpriteMaterial",this.color=new Pn(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(e)}function wr(e){gi.call(this),this.type="Sprite",this.material=void 0!==e?e:new xr}function Mr(){gi.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function Sr(e,t,n){if(this.useVertexTexture=void 0===n||n,this.identityMatrix=new Wt,e=e||[],this.bones=e.slice(0),this.useVertexTexture){var i=Math.sqrt(4*this.bones.length);i=Ct.nextPowerOfTwo(Math.ceil(i)),i=Math.max(i,4),this.boneTextureWidth=i,this.boneTextureHeight=i,this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new Rn(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,Ve,Ne)}else this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[];for(var r=0,o=this.bones.length;r=e.HAVE_CURRENT_DATA&&(u.needsUpdate=!0)}()}function Ir(e,t,n,i,r,o,a,s,l,u,c,d){Nt.call(this,null,o,a,s,l,u,i,r,c,d),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function Dr(e,t,n,i,r,o,a,s,l){Nt.call(this,e,t,n,i,r,o,a,s,l),this.needsUpdate=!0}function Nr(e,t,n,i,r,o,a,s,l,u){if((u=void 0!==u?u:Xe)!==Xe&&u!==Ke)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&u===Xe&&(n=Le),void 0===n&&u===Ke&&(n=Ue),Nt.call(this,null,i,r,o,a,s,u,n,l),this.image={width:e,height:t},this.magFilter=void 0!==a?a:Se,this.minFilter=void 0!==s?s:Se,this.flipY=!1,this.generateMipmaps=!1}function Fr(e){Fi.call(this),this.type="WireframeGeometry";var t,n,i,r,o,a,s,l,u=[],c=[0,0],d={},h=["a","b","c"];if(e&&e.isGeometry){var p=e.faces;for(t=0,i=p.length;t.9&&a<.1&&(t<.2&&(o[e+0]+=1),n<.2&&(o[e+2]+=1),i<.2&&(o[e+4]+=1))}}()}(),this.addAttribute("position",new ki(r,3)),this.addAttribute("normal",new ki(r.slice(),3)),this.addAttribute("uv",new ki(o,2)),this.normalizeNormals()}function Wr(e,t){Ni.call(this),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Gr(e,t)),this.mergeVertices()}function Gr(e,t){Ur.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Vr(e,t){Ni.call(this),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Hr(e,t)),this.mergeVertices()}function Hr(e,t){Ur.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Yr(e,t){Ni.call(this),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new qr(e,t)),this.mergeVertices()}function qr(e,t){var n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1];Ur.call(this,i,[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,t),this.type="IcosahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Xr(e,t){Ni.call(this),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Kr(e,t)),this.mergeVertices()}function Kr(e,t){var n=(1+Math.sqrt(5))/2,i=1/n,r=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i];Ur.call(this,r,[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t),this.type="DodecahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Zr(e,t,n,i,r,o){Ni.call(this),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r},void 0!==o&&console.warn("THREE.TubeGeometry: taper has been removed.");var a=new Jr(e,t,n,i,r);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals,this.fromBufferGeometry(a),this.mergeVertices()}function Jr(e,t,n,i,r){Fi.call(this),this.type="TubeBufferGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r},t=t||64,n=n||1,i=i||8,r=r||!1;var o=e.computeFrenetFrames(t,r);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;var a,s,l=new Ut,u=new Ut,c=new Ot,d=[],h=[],p=[],f=[];function m(r){var a=e.getPointAt(r/t),c=o.normals[r],p=o.binormals[r];for(s=0;s<=i;s++){var f=s/i*Math.PI*2,m=Math.sin(f),g=-Math.cos(f);u.x=g*c.x+m*p.x,u.y=g*c.y+m*p.y,u.z=g*c.z+m*p.z,u.normalize(),h.push(u.x,u.y,u.z),l.x=a.x+n*u.x,l.y=a.y+n*u.y,l.z=a.z+n*u.z,d.push(l.x,l.y,l.z)}}!function(){for(a=0;athis.scale.x*this.scale.y/4||t.push({distance:Math.sqrt(n),point:this.position,face:null,object:this})}),clone:function(){return new this.constructor(this.material).copy(this)}}),Mr.prototype=Object.assign(Object.create(gi.prototype),{constructor:Mr,copy:function(e){gi.prototype.copy.call(this,e,!1);for(var t=e.levels,n=0,i=t.length;n1){e.setFromMatrixPosition(n.matrixWorld),t.setFromMatrixPosition(this.matrixWorld);var r=e.distanceTo(t);i[0].object.visible=!0;for(var o=1,a=i.length;o=i[o].distance;o++)i[o-1].object.visible=!1,i[o].object.visible=!0;for(;oa))h.applyMatrix4(this.matrixWorld),(M=i.ray.origin.distanceTo(h))i.far||r.push({distance:M,point:d.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}else for(v=0,y=m.length/3-1;va))h.applyMatrix4(this.matrixWorld),(M=i.ray.origin.distanceTo(h))i.far||r.push({distance:M,point:d.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}}else if(s.isGeometry){var x=s.vertices,w=x.length;for(v=0;va))h.applyMatrix4(this.matrixWorld),(M=i.ray.origin.distanceTo(h))i.far||r.push({distance:M,point:d.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),kr.prototype=Object.assign(Object.create(Or.prototype),{constructor:kr,isLineSegments:!0}),Pr.prototype=Object.create(Zn.prototype),Pr.prototype.constructor=Pr,Pr.prototype.isPointsMaterial=!0,Pr.prototype.copy=function(e){return Zn.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this},Ar.prototype=Object.assign(Object.create(gi.prototype),{constructor:Ar,isPoints:!0,raycast:function(){var e=new Wt,t=new oi,n=new ei;return function(i,r){var o=this,a=this.geometry,s=this.matrixWorld,l=i.params.Points.threshold;if(null===a.boundingSphere&&a.computeBoundingSphere(),n.copy(a.boundingSphere),n.applyMatrix4(s),!1!==i.ray.intersectsSphere(n)){e.getInverse(s),t.copy(i.ray).applyMatrix4(e);var u=l/((this.scale.x+this.scale.y+this.scale.z)/3),c=u*u,d=new Ut;if(a.isBufferGeometry){var h=a.index,p=a.attributes.position.array;if(null!==h)for(var f=h.array,m=0,g=f.length;mi.far)return;r.push({distance:u,distanceToRay:Math.sqrt(a),point:l.clone(),index:n,face:null,object:o})}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Rr.prototype=Object.assign(Object.create(gi.prototype),{constructor:Rr}),Lr.prototype=Object.create(Nt.prototype),Lr.prototype.constructor=Lr,Ir.prototype=Object.create(Nt.prototype),Ir.prototype.constructor=Ir,Ir.prototype.isCompressedTexture=!0,Dr.prototype=Object.create(Nt.prototype),Dr.prototype.constructor=Dr,Nr.prototype=Object.create(Nt.prototype),Nr.prototype.constructor=Nr,Nr.prototype.isDepthTexture=!0,Fr.prototype=Object.create(Fi.prototype),Fr.prototype.constructor=Fr,zr.prototype=Object.create(Ni.prototype),zr.prototype.constructor=zr,Br.prototype=Object.create(Fi.prototype),Br.prototype.constructor=Br,jr.prototype=Object.create(Ni.prototype),jr.prototype.constructor=jr,Ur.prototype=Object.create(Fi.prototype),Ur.prototype.constructor=Ur,Wr.prototype=Object.create(Ni.prototype),Wr.prototype.constructor=Wr,Gr.prototype=Object.create(Ur.prototype),Gr.prototype.constructor=Gr,Vr.prototype=Object.create(Ni.prototype),Vr.prototype.constructor=Vr,Hr.prototype=Object.create(Ur.prototype),Hr.prototype.constructor=Hr,Yr.prototype=Object.create(Ni.prototype),Yr.prototype.constructor=Yr,qr.prototype=Object.create(Ur.prototype),qr.prototype.constructor=qr,Xr.prototype=Object.create(Ni.prototype),Xr.prototype.constructor=Xr,Kr.prototype=Object.create(Ur.prototype),Kr.prototype.constructor=Kr,Zr.prototype=Object.create(Ni.prototype),Zr.prototype.constructor=Zr,Jr.prototype=Object.create(Fi.prototype),Jr.prototype.constructor=Jr,$r.prototype=Object.create(Ni.prototype),$r.prototype.constructor=$r,Qr.prototype=Object.create(Fi.prototype),Qr.prototype.constructor=Qr,eo.prototype=Object.create(Ni.prototype),eo.prototype.constructor=eo,to.prototype=Object.create(Fi.prototype),to.prototype.constructor=to;var no={area:function(e){for(var t=e.length,n=0,i=t-1,r=0;r=-Number.EPSILON&&w>=-Number.EPSILON&&x>=-Number.EPSILON))return!1;return!0}return function(t,n){var i=t.length;if(i<3)return null;var r,o,a,s=[],l=[],u=[];if(no.area(t)>0)for(o=0;o2;){if(d--<=0)return console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()"),n?u:s;if(c<=(r=o)&&(r=0),c<=(o=r+1)&&(o=0),c<=(a=o+1)&&(a=0),e(t,r,o,a,c,l)){var h,p,f,m,g;for(h=l[r],p=l[o],f=l[a],s.push([t[h],t[p],t[f]]),u.push([l[r],l[o],l[a]]),m=o,g=o+1;g2&&e[t-1].equals(e[0])&&e.pop()}function i(e,t,n){return e.x!==t.x?e.xNumber.EPSILON){var f;if(h>0){if(p<0||p>h)return[];if((f=u*c-l*d)<0||f>h)return[]}else{if(p>0||p0||fM?[]:y===M?o?[]:[g]:b<=M?[g,v]:[g,x])}function o(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,l=i.x-e.x,u=i.y-e.y,c=r*s-o*a,d=r*u-o*l;if(Math.abs(c)>Number.EPSILON){var h=l*s-u*a;return c>0?d>=0&&h>=0:d>=0||h>=0}return d>0}n(e),t.forEach(n);for(var a,s,l,u,c,d,h={},p=e.concat(),f=0,m=t.length;fr&&(s=0);var l=o(i[e],i[a],i[s],n[t]);if(!l)return!1;var u=n.length-1,c=t-1;c<0&&(c=u);var d=t+1;return d>u&&(d=0),!!(l=o(n[t],n[c],n[d],i[e]))}function s(e,t){var n,o;for(n=0;n0)return!0;return!1}var l=[];function u(e,n){var i,o,a,s;for(i=0;i0)return!0;return!1}for(var c,d,h,p,f,m,g,v,y,b,_=[],x=0,w=t.length;x0;){if(--S<0){console.log("Infinite Loop! Holes left:"+l.length+", Probably Hole outside Shape!");break}for(d=M;d=0)break;_[m]=!0}if(c>=0)break}}return i}(e,t),v=no.triangulate(g,!1);for(a=0,s=v.length;a0)&&f.push(x,w,S),(l!==n-1||u0&&v(!0),t>0&&v(!1)),this.setIndex(u),this.addAttribute("position",new ki(c,3)),this.addAttribute("normal",new ki(d,3)),this.addAttribute("uv",new ki(h,2))}function vo(e,t,n,i,r,o,a){mo.call(this,0,e,t,n,i,r,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:a}}function yo(e,t,n,i,r,o,a){go.call(this,0,e,t,n,i,r,o,a),this.type="ConeBufferGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:a}}function bo(e,t,n,i){Ni.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},this.fromBufferGeometry(new _o(e,t,n,i))}function _o(e,t,n,i){Fi.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},e=e||50,t=void 0!==t?Math.max(3,t):8,n=void 0!==n?n:0,i=void 0!==i?i:2*Math.PI;var r,o,a=[],s=[],l=[],u=[],c=new Ut,d=new Ot;for(s.push(0,0,0),l.push(0,0,1),u.push(.5,.5),o=0,r=3;o<=t;o++,r+=3){var h=n+o/t*i;c.x=e*Math.cos(h),c.y=e*Math.sin(h),s.push(c.x,c.y,c.z),l.push(0,0,1),d.x=(s[r]/e+1)/2,d.y=(s[r+1]/e+1)/2,u.push(d.x,d.y)}for(r=1;r<=t;r++)a.push(r,r+1,0);this.setIndex(a),this.addAttribute("position",new ki(s,3)),this.addAttribute("normal",new ki(l,3)),this.addAttribute("uv",new ki(u,2))}io.prototype=Object.create(Ni.prototype),io.prototype.constructor=io,io.prototype.addShapeList=function(e,t){for(var n=e.length,i=0;iNumber.EPSILON){var h=Math.sqrt(c),p=Math.sqrt(l*l+u*u),f=t.x-s/h,m=t.y+a/h,g=((n.x-u/p-f)*u-(n.y+l/p-m)*l)/(a*u-s*l),v=(i=f+a*g-e.x)*i+(r=m+s*g-e.y)*r;if(v<=2)return new Ot(i,r);o=Math.sqrt(v/2)}else{var y=!1;a>Number.EPSILON?l>Number.EPSILON&&(y=!0):a<-Number.EPSILON?l<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(u)&&(y=!0),y?(i=-s,r=a,o=Math.sqrt(c)):(i=a,r=s,o=Math.sqrt(c/2))}return new Ot(i/o,r/o)}for(var z=[],B=0,j=C.length,U=j-1,W=B+1;B=0;k--){for(A=k/p,R=d*Math.cos(A*Math.PI/2),P=h*Math.sin(A*Math.PI/2),B=0,j=C.length;B=0;){n=B,(i=B-1)<0&&(i=e.length-1);var r=0,o=g+2*p;for(r=0;r0||0===e.search(/^data\:image\/jpeg/);r.format=i?Ge:Ve,r.image=n,r.needsUpdate=!0,void 0!==t&&t(r)}),n,i),r},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}}),Wo.prototype=Object.assign(Object.create(gi.prototype),{constructor:Wo,isLight:!0,copy:function(e){return gi.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},toJSON:function(e){var t=gi.prototype.toJSON.call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}),Go.prototype=Object.assign(Object.create(Wo.prototype),{constructor:Go,isHemisphereLight:!0,copy:function(e){return Wo.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}),Object.assign(Vo.prototype,{copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var e={};return 0!==this.bias&&(e.bias=this.bias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}),Ho.prototype=Object.assign(Object.create(Vo.prototype),{constructor:Ho,isSpotLightShadow:!0,update:function(e){var t=2*Ct.RAD2DEG*e.angle,n=this.mapSize.width/this.mapSize.height,i=e.distance||500,r=this.camera;t===r.fov&&n===r.aspect&&i===r.far||(r.fov=t,r.aspect=n,r.far=i,r.updateProjectionMatrix())}}),Yo.prototype=Object.assign(Object.create(Wo.prototype),{constructor:Yo,isSpotLight:!0,copy:function(e){return Wo.prototype.copy.call(this,e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),qo.prototype=Object.assign(Object.create(Wo.prototype),{constructor:qo,isPointLight:!0,copy:function(e){return Wo.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}),Xo.prototype=Object.assign(Object.create(Vo.prototype),{constructor:Xo}),Ko.prototype=Object.assign(Object.create(Wo.prototype),{constructor:Ko,isDirectionalLight:!0,copy:function(e){return Wo.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),Zo.prototype=Object.assign(Object.create(Wo.prototype),{constructor:Zo,isAmbientLight:!0});var Jo,$o,Qo,ea,ta,na={arraySlice:function(e,t,n){return na.isTypedArray(e)?new e.constructor(e.subarray(t,n)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){for(var t=e.length,n=new Array(t),i=0;i!==t;++i)n[i]=i;return n.sort((function(t,n){return e[t]-e[n]})),n},sortedArray:function(e,t,n){for(var i=e.length,r=new e.constructor(i),o=0,a=0;a!==i;++o)for(var s=n[o]*t,l=0;l!==t;++l)r[a++]=e[s+l];return r},flattenJSON:function(e,t,n,i){for(var r=1,o=e[0];void 0!==o&&void 0===o[i];)o=e[r++];if(void 0!==o){var a=o[i];if(void 0!==a)if(Array.isArray(a))do{void 0!==(a=o[i])&&(t.push(o.time),n.push.apply(n,a)),o=e[r++]}while(void 0!==o);else if(void 0!==a.toArray)do{void 0!==(a=o[i])&&(t.push(o.time),a.toArray(n,n.length)),o=e[r++]}while(void 0!==o);else do{void 0!==(a=o[i])&&(t.push(o.time),n.push(a)),o=e[r++]}while(void 0!==o)}}};function ia(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n}function ra(e,t,n,i){ia.call(this,e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function oa(e,t,n,i){ia.call(this,e,t,n,i)}function aa(e,t,n,i){ia.call(this,e,t,n,i)}function sa(e,t,n,i){if(void 0===e)throw new Error("track name is undefined");if(void 0===t||0===t.length)throw new Error("no keyframes in track named "+e);this.name=e,this.times=na.convertArray(t,this.TimeBufferType),this.values=na.convertArray(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation),this.validate(),this.optimize()}function la(e,t,n,i){sa.call(this,e,t,n,i)}function ua(e,t,n,i){ia.call(this,e,t,n,i)}function ca(e,t,n,i){sa.call(this,e,t,n,i)}function da(e,t,n,i){sa.call(this,e,t,n,i)}function ha(e,t,n,i){sa.call(this,e,t,n,i)}function pa(e,t,n){sa.call(this,e,t,n)}function fa(e,t,n,i){sa.call(this,e,t,n,i)}function ma(e,t,n,i){sa.apply(this,arguments)}function ga(e,t,n){this.name=e,this.tracks=n,this.duration=void 0!==t?t:-1,this.uuid=Ct.generateUUID(),this.duration<0&&this.resetDuration(),this.optimize()}function va(e){this.manager=void 0!==e?e:Do,this.textures={}}function ya(e){this.manager=void 0!==e?e:Do}function ba(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}}function _a(e){"boolean"==typeof e&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),e=void 0),this.manager=void 0!==e?e:Do,this.withCredentials=!1}function xa(e){this.manager=void 0!==e?e:Do,this.texturePath=""}function wa(e,t,n,i,r){var o=.5*(i-t),a=.5*(r-n),s=e*e;return(2*n-2*i+o+a)*(e*s)+(-3*n+3*i-2*o-a)*s+o*e+n}function Ma(e,t,n,i){return function(e,t){var n=1-e;return n*n*t}(e,t)+function(e,t){return 2*(1-e)*e*t}(e,n)+function(e,t){return e*e*t}(e,i)}function Sa(e,t,n,i,r){return function(e,t){var n=1-e;return n*n*n*t}(e,t)+function(e,t){var n=1-e;return 3*n*n*e*t}(e,n)+function(e,t){return 3*(1-e)*e*e*t}(e,i)+function(e,t){return e*e*e*t}(e,r)}function Ea(){}function Ta(e,t){this.v1=e,this.v2=t}function Ca(){this.curves=[],this.autoClose=!1}function Oa(e,t,n,i,r,o,a,s){this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=o,this.aClockwise=a,this.aRotation=s||0}function ka(e){this.points=void 0===e?[]:e}function Pa(e,t,n,i){this.v0=e,this.v1=t,this.v2=n,this.v3=i}function Aa(e,t,n){this.v0=e,this.v1=t,this.v2=n}ia.prototype={constructor:ia,evaluate:function(e){var t=this.parameterPositions,n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{var o;n:{i:if(!(e=r)break e;var s=t[1];e=(r=t[--n-1]))break t}o=n,n=0}for(;n>>1;et;)--o;if(++o,0!==r||o!==i){r>=o&&(r=(o=Math.max(o,1))-1);var a=this.getValueSize();this.times=na.arraySlice(n,r,o),this.values=na.arraySlice(this.values,r*a,o*a)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("invalid value size in track",this),e=!1);var n=this.times,i=this.values,r=n.length;0===r&&(console.error("track is empty",this),e=!1);for(var o=null,a=0;a!==r;a++){var s=n[a];if("number"==typeof s&&isNaN(s)){console.error("time is not a valid number",this,a,s),e=!1;break}if(null!==o&&o>s){console.error("out of order keys",this,a,s,o),e=!1;break}o=s}if(void 0!==i&&na.isTypedArray(i)){a=0;for(var l=i.length;a!==l;++a){var u=i[a];if(isNaN(u)){console.error("value is not a valid number",this,a,u),e=!1;break}}}return e},optimize:function(){for(var e=this.times,t=this.values,n=this.getValueSize(),i=this.getInterpolation()===ct,r=1,o=e.length-1,a=1;a0){e[r]=e[o];for(f=o*n,m=r*n,h=0;h!==n;++h)t[m+h]=t[f+h];++r}return r!==e.length&&(this.times=na.arraySlice(e,0,r),this.values=na.arraySlice(t,0,r*n)),this}},la.prototype=Object.assign(Object.create(Jo),{constructor:la,ValueTypeName:"vector"}),ua.prototype=Object.assign(Object.create(ia.prototype),{constructor:ua,interpolate_:function(e,t,n,i){for(var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=e*a,l=(n-t)/(i-t),u=s+a;s!==u;s+=4)jt.slerpFlat(r,0,o,s-a,o,s,l);return r}}),ca.prototype=Object.assign(Object.create(Jo),{constructor:ca,ValueTypeName:"quaternion",DefaultInterpolation:ut,InterpolantFactoryMethodLinear:function(e){return new ua(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),da.prototype=Object.assign(Object.create(Jo),{constructor:da,ValueTypeName:"number"}),ha.prototype=Object.assign(Object.create(Jo),{constructor:ha,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:lt,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),pa.prototype=Object.assign(Object.create(Jo),{constructor:pa,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:lt,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),fa.prototype=Object.assign(Object.create(Jo),{constructor:fa,ValueTypeName:"color"}),ma.prototype=Jo,Jo.constructor=ma,Object.assign(ma,{parse:function(e){if(void 0===e.type)throw new Error("track type undefined, can not parse");var t=ma._getTrackTypeForValueTypeName(e.type);if(void 0===e.times){var n=[],i=[];na.flattenJSON(e.keys,n,i,"value"),e.times=n,e.values=i}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)},toJSON:function(e){var t,n=e.constructor;if(void 0!==n.toJSON)t=n.toJSON(e);else{t={name:e.name,times:na.convertArray(e.times,Array),values:na.convertArray(e.values,Array)};var i=e.getInterpolation();i!==e.DefaultInterpolation&&(t.interpolation=i)}return t.type=e.ValueTypeName,t},_getTrackTypeForValueTypeName:function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return da;case"vector":case"vector2":case"vector3":case"vector4":return la;case"color":return fa;case"quaternion":return ca;case"bool":case"boolean":return pa;case"string":return ha}throw new Error("Unsupported typeName: "+e)}}),ga.prototype={constructor:ga,resetDuration:function(){for(var e=0,t=0,n=this.tracks.length;t!==n;++t){var i=this.tracks[t];e=Math.max(e,i.times[i.times.length-1])}this.duration=e},trim:function(){for(var e=0;e1){var u=i[d=l[1]];u||(i[d]=u=[]),u.push(s)}}var c=[];for(var d in i)c.push(ga.CreateFromMorphTargetSequence(d,i[d],t,n));return c},parseAnimation:function(e,t){if(!e)return console.error(" no animation in JSONLoader data"),null;for(var n=function(e,t,n,i,r){if(0!==n.length){var o=[],a=[];na.flattenJSON(n,o,a,i),0!==o.length&&r.push(new e(t,o,a))}},i=[],r=e.name||"default",o=e.length||-1,a=e.fps||30,s=e.hierarchy||[],l=0;l1?e.skinWeights[i+1]:0,s=t>2?e.skinWeights[i+2]:0,l=t>3?e.skinWeights[i+3]:0;n.skinWeights.push(new Ft(o,a,s,l))}if(e.skinIndices)for(i=0,r=e.skinIndices.length;i1?e.skinIndices[i+1]:0,d=t>2?e.skinIndices[i+2]:0,h=t>3?e.skinIndices[i+3]:0;n.skinIndices.push(new Ft(u,c,d,h))}n.bones=e.bones,n.bones&&n.bones.length>0&&(n.skinWeights.length!==n.skinIndices.length||n.skinIndices.length!==n.vertices.length)&&console.warn("When skinning, number of vertices ("+n.vertices.length+"), skinIndices ("+n.skinIndices.length+"), and skinWeights ("+n.skinWeights.length+") should match.")}(),function(t){if(void 0!==e.morphTargets)for(var i=0,r=e.morphTargets.length;i0){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');var c=n.faces,d=e.morphColors[0].colors;for(i=0,r=c.length;i0&&(n.animations=t)}(),n.computeFaceNormals(),n.computeBoundingSphere(),void 0===e.materials||0===e.materials.length)return{geometry:n};var r=ba.prototype.initMaterials(e.materials,t,this.crossOrigin);return{geometry:n,materials:r}}}),Object.assign(xa.prototype,{load:function(e,t,n,i){""===this.texturePath&&(this.texturePath=e.substring(0,e.lastIndexOf("/")+1));var r=this;new No(r.manager).load(e,(function(n){var o=null;try{o=JSON.parse(n)}catch(t){return void 0!==i&&i(t),void console.error("THREE:ObjectLoader: Can't parse "+e+".",t.message)}var a=o.metadata;void 0!==a&&void 0!==a.type&&"geometry"!==a.type.toLowerCase()?r.parse(o,t):console.error("THREE.ObjectLoader: Can't load "+e+". Use THREE.JSONLoader instead.")}),n,i)},setTexturePath:function(e){this.texturePath=e},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e,t){var n=this.parseGeometries(e.geometries),i=this.parseImages(e.images,(function(){void 0!==t&&t(a)})),r=this.parseTextures(e.textures,i),o=this.parseMaterials(e.materials,r),a=this.parseObject(e.object,n,o);return e.animations&&(a.animations=this.parseAnimations(e.animations)),void 0!==e.images&&0!==e.images.length||void 0!==t&&t(a),a},parseGeometries:function(e){var t={};if(void 0!==e)for(var n=new _a,i=new ya,r=0,o=e.length;r0){var o=new Bo(new Io(t));o.setCrossOrigin(this.crossOrigin);for(var a=0,s=e.length;a0?new Tr(s,l):new zi(s,l);break;case"LOD":r=new Mr;break;case"Line":r=new Or(o(t.geometry),a(t.material),t.mode);break;case"LineSegments":r=new kr(o(t.geometry),a(t.material));break;case"PointCloud":case"Points":r=new Ar(o(t.geometry),a(t.material));break;case"Sprite":r=new wr(a(t.material));break;case"Group":r=new Rr;break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh type. Instantiates Object3D instead.");default:r=new gi}if(r.uuid=t.uuid,void 0!==t.name&&(r.name=t.name),void 0!==t.matrix?(e.fromArray(t.matrix),e.decompose(r.position,r.quaternion,r.scale)):(void 0!==t.position&&r.position.fromArray(t.position),void 0!==t.rotation&&r.rotation.fromArray(t.rotation),void 0!==t.quaternion&&r.quaternion.fromArray(t.quaternion),void 0!==t.scale&&r.scale.fromArray(t.scale)),void 0!==t.castShadow&&(r.castShadow=t.castShadow),void 0!==t.receiveShadow&&(r.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(r.shadow.bias=t.shadow.bias),void 0!==t.shadow.radius&&(r.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&r.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(r.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(r.visible=t.visible),void 0!==t.userData&&(r.userData=t.userData),void 0!==t.children)for(var u in t.children)r.add(this.parseObject(t.children[u],n,i));if("LOD"===t.type)for(var c=t.levels,d=0;d0)){l=r;break}l=r-1}if(i[r=l]===n)return r/(o-1);var u=i[r];return(r+(n-u)/(i[r+1]-u))/(o-1)},getTangent:function(e){var t=e-1e-4,n=e+1e-4;t<0&&(t=0),n>1&&(n=1);var i=this.getPoint(t);return this.getPoint(n).clone().sub(i).normalize()},getTangentAt:function(e){var t=this.getUtoTmapping(e);return this.getTangent(t)},computeFrenetFrames:function(e,t){var n,i,r,o=new Ut,a=[],s=[],l=[],u=new Ut,c=new Wt;for(n=0;n<=e;n++)i=n/e,a[n]=this.getTangentAt(i),a[n].normalize();s[0]=new Ut,l[0]=new Ut;var d=Number.MAX_VALUE,h=Math.abs(a[0].x),p=Math.abs(a[0].y),f=Math.abs(a[0].z);for(h<=d&&(d=h,o.set(1,0,0)),p<=d&&(d=p,o.set(0,1,0)),f<=d&&o.set(0,0,1),u.crossVectors(a[0],o).normalize(),s[0].crossVectors(a[0],u),l[0].crossVectors(a[0],s[0]),n=1;n<=e;n++)s[n]=s[n-1].clone(),l[n]=l[n-1].clone(),u.crossVectors(a[n-1],a[n]),u.length()>Number.EPSILON&&(u.normalize(),r=Math.acos(Ct.clamp(a[n-1].dot(a[n]),-1,1)),s[n].applyMatrix4(c.makeRotationAxis(u,r))),l[n].crossVectors(a[n],s[n]);if(!0===t)for(r=Math.acos(Ct.clamp(s[0].dot(s[e]),-1,1)),r/=e,a[0].dot(u.crossVectors(s[0],s[e]))>0&&(r=-r),n=1;n<=e;n++)s[n].applyMatrix4(c.makeRotationAxis(a[n],r*n)),l[n].crossVectors(a[n],s[n]);return{tangents:a,normals:s,binormals:l}}},Ta.prototype=Object.create(Ea.prototype),Ta.prototype.constructor=Ta,Ta.prototype.isLineCurve=!0,Ta.prototype.getPoint=function(e){if(1===e)return this.v2.clone();var t=this.v2.clone().sub(this.v1);return t.multiplyScalar(e).add(this.v1),t},Ta.prototype.getPointAt=function(e){return this.getPoint(e)},Ta.prototype.getTangent=function(e){return this.v2.clone().sub(this.v1).normalize()},Ca.prototype=Object.assign(Object.create(Ea.prototype),{constructor:Ca,add:function(e){this.curves.push(e)},closePath:function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new Ta(t,e))},getPoint:function(e){for(var t=e*this.getLength(),n=this.getCurveLengths(),i=0;i=t){var r=n[i]-t,o=this.curves[i],a=o.getLength(),s=0===a?0:1-r/a;return o.getPointAt(s)}i++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,n=0,i=this.curves.length;n1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},createPointsGeometry:function(e){var t=this.getPoints(e);return this.createGeometry(t)},createSpacedPointsGeometry:function(e){var t=this.getSpacedPoints(e);return this.createGeometry(t)},createGeometry:function(e){for(var t=new Ni,n=0,i=e.length;nt;)n-=t;nt.length-2?t.length-1:i+1],l=t[i>t.length-3?t.length-1:i+2];return new Ot(wa(r,o.x,a.x,s.x,l.x),wa(r,o.y,a.y,s.y,l.y))},Pa.prototype=Object.create(Ea.prototype),Pa.prototype.constructor=Pa,Pa.prototype.getPoint=function(e){var t=this.v0,n=this.v1,i=this.v2,r=this.v3;return new Ot(Sa(e,t.x,n.x,i.x,r.x),Sa(e,t.y,n.y,i.y,r.y))},Aa.prototype=Object.create(Ea.prototype),Aa.prototype.constructor=Aa,Aa.prototype.getPoint=function(e){var t=this.v0,n=this.v1,i=this.v2;return new Ot(Ma(e,t.x,n.x,i.x),Ma(e,t.y,n.y,i.y))};var Ra,La=Object.assign(Object.create(Ca.prototype),{fromPoints:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,n=e.length;t0){var u=l.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(l);var c=l.getPoint(1);this.currentPoint.copy(c)}});function Ia(e){Ca.call(this),this.currentPoint=new Ot,e&&this.fromPoints(e)}function Da(){Ia.apply(this,arguments),this.holes=[]}function Na(){this.subPaths=[],this.currentPath=null}function Fa(e){this.data=e}function za(e){this.manager=void 0!==e?e:Do}Ia.prototype=La,La.constructor=Ia,Da.prototype=Object.assign(Object.create(La),{constructor:Da,getPointsHoles:function(e){for(var t=[],n=0,i=this.holes.length;nNumber.EPSILON){if(u<0&&(a=t[o],l=-l,s=t[r],u=-u),e.ys.y)continue;if(e.y===a.y){if(e.x===a.x)return!0}else{var c=u*(e.x-a.x)-l*(e.y-a.y);if(0===c)return!0;if(c<0)continue;i=!i}}else{if(e.y!==a.y)continue;if(s.x<=e.x&&e.x<=a.x||a.x<=e.x&&e.x<=s.x)return!0}}return i}var r=no.isClockWise,o=this.subPaths;if(0===o.length)return[];if(!0===t)return n(o);var a,s,l,u=[];if(1===o.length)return s=o[0],(l=new Da).curves=s.curves,u.push(l),u;var c=!r(o[0].getPoints());c=e?!c:c;var d,h,p=[],f=[],m=[],g=0;f[g]=void 0,m[g]=[];for(var v=0,y=o.length;v1){for(var b=!1,_=[],x=0,w=f.length;x0&&(b||(m=p))}v=0;for(var O=f.length;v0){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e=.5)for(var o=0;o!==r;++o)e[t+o]=e[n+o]},_slerp:function(e,t,n,i,r){jt.slerpFlat(e,t,e,t,e,n,i)},_lerp:function(e,t,n,i,r){for(var o=1-i,a=0;a!==r;++a){var s=t+a;e[s]=e[s]*o+e[n+a]*i}}},cs.prototype={constructor:cs,getValue:function(e,t){this.bind(),this.getValue(e,t)},setValue:function(e,t){this.bind(),this.setValue(e,t)},bind:function(){var e=this.node,t=this.parsedPath,n=t.objectName,i=t.propertyName,r=t.propertyIndex;if(e||(e=cs.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,e){if(n){var o=t.objectIndex;switch(n){case"materials":if(!e.material)return void console.error(" can not bind to material as node does not have a material",this);if(!e.material.materials)return void console.error(" can not bind to material.materials as node.material does not have a materials array",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error(" can not bind to bones as node does not have a skeleton",this);e=e.skeleton.bones;for(var a=0;a=n){var d=n++,h=t[d];i[h.uuid]=c,t[c]=h,i[u]=d,t[d]=l;for(var p=0,f=o;p!==f;++p){var m=r[p],g=m[d],v=m[c];m[c]=g,m[d]=v}}}this.nCachedObjects_=n},uncache:function(e){for(var t=this._objects,n=t.length,i=this.nCachedObjects_,r=this._indicesByUUID,o=this._bindings,a=o.length,s=0,l=arguments.length;s!==l;++s){var u=arguments[s],c=u.uuid,d=r[c];if(void 0!==d)if(delete r[c],d0)for(var l=this._interpolants,u=this._propertyBindings,c=0,d=l.length;c!==d;++c)l[c].evaluate(a),u[c].accumulate(i,s)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var n=this._weightInterpolant;if(null!==n){var i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=t,t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n)t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}return this._effectiveTimeScale=t,t},_updateTime:function(e){var t=this.time+e;if(0===e)return t;var n=this._clip.duration,i=this.loop,r=this._loopCount;if(i===ot){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(t>=n)t=n;else{if(!(t<0))break e;t=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{var o=i===st;if(-1===r&&(e>=0?(r=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),t>=n||t<0){var a=Math.floor(t/n);t-=n*a,r+=Math.abs(a);var s=this.repetitions-r;if(s<0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?n:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(0===s){var l=e<0;this._setEndings(l,!l,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}if(o&&1==(1&r))return this.time=t,n-t}return this.time=t,t},_setEndings:function(e,t,n){var i=this._interpolantSettings;n?(i.endingStart=ht,i.endingEnd=ht):(i.endingStart=e?this.zeroSlopeAtStart?ht:dt:pt,i.endingEnd=t?this.zeroSlopeAtEnd?ht:dt:pt)},_scheduleFading:function(e,t,n){var i=this._mixer,r=i.time,o=this._weightInterpolant;null===o&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);var a=o.parameterPositions,s=o.sampleValues;return a[0]=r,s[0]=t,a[1]=r+e,s[1]=n,this}},ps.prototype={constructor:ps,clipAction:function(e,t){var n=t||this._root,i=n.uuid,r="string"==typeof e?ga.findByName(n,e):e,o=null!==r?r.uuid:e,a=this._actionsByClip[o],s=null;if(void 0!==a){var l=a.actionByRoot[i];if(void 0!==l)return l;s=a.knownActions[0],null===r&&(r=s._clip)}if(null===r)return null;var u=new hs(this,r,t);return this._bindAction(u,s),this._addInactiveAction(u,o,i),u},existingAction:function(e,t){var n=t||this._root,i=n.uuid,r="string"==typeof e?ga.findByName(n,e):e,o=r?r.uuid:e,a=this._actionsByClip[o];return void 0!==a&&a.actionByRoot[i]||null},stopAllAction:function(){var e=this._actions,t=this._nActiveActions,n=this._bindings,i=this._nActiveBindings;this._nActiveActions=0,this._nActiveBindings=0;for(var r=0;r!==t;++r)e[r].reset();for(r=0;r!==i;++r)n[r].useCount=0;return this},update:function(e){e*=this.timeScale;for(var t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),o=this._accuIndex^=1,a=0;a!==n;++a){var s=t[a];s.enabled&&s._update(i,e,r,o)}var l=this._bindings,u=this._nActiveBindings;for(a=0;a!==u;++a)l[a].apply(o);return this},getRoot:function(){return this._root},uncacheClip:function(e){var t=this._actions,n=e.uuid,i=this._actionsByClip,r=i[n];if(void 0!==r){for(var o=r.knownActions,a=0,s=o.length;a!==s;++a){var l=o[a];this._deactivateAction(l);var u=l._cacheIndex,c=t[t.length-1];l._cacheIndex=null,l._byClipCacheIndex=null,c._cacheIndex=u,t[u]=c,t.pop(),this._removeInactiveBindingsForAction(l)}delete i[n]}},uncacheRoot:function(e){var t=e.uuid,n=this._actionsByClip;for(var i in n){var r=n[i].actionByRoot[t];void 0!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}var o=this._bindingsByRootAndName[t];if(void 0!==o)for(var a in o){var s=o[a];s.restoreOriginalState(),this._removeInactiveBinding(s)}},uncacheAction:function(e,t){var n=this.existingAction(e,t);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}},Object.assign(ps.prototype,{_bindAction:function(e,t){var n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,o=e._propertyBindings,a=e._interpolants,s=n.uuid,l=this._bindingsByRootAndName,u=l[s];void 0===u&&(u={},l[s]=u);for(var c=0;c!==r;++c){var d=i[c],h=d.name,p=u[h];if(void 0!==p)o[c]=p;else{if(void 0!==(p=o[c])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,h));continue}var f=t&&t._propertyBindings[c].binding.parsedPath;++(p=new us(cs.create(n,h,f),d.ValueTypeName,d.getValueSize())).referenceCount,this._addInactiveBinding(p,s,h),o[c]=p}a[c].resultBuffer=p.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,n=e._clip.uuid,i=this._actionsByClip[n];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,n,t)}for(var r=e._propertyBindings,o=0,a=r.length;o!==a;++o){var s=r[o];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,n=0,i=t.length;n!==i;++n){var r=t[n];0==--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){var t=e._cacheIndex;return null!==t&&t1)i[l=s[1]]||(i[l]={start:1/0,end:-1/0}),o<(u=i[l]).start&&(u.start=o),o>u.end&&(u.end=o),t||(t=l)}for(var l in i){var u=i[l];this.createAnimation(l,u.start,u.end,e)}this.firstAnimation=t},Ts.prototype.setAnimationDirectionForward=function(e){var t=this.animationsMap[e];t&&(t.direction=1,t.directionBackwards=!1)},Ts.prototype.setAnimationDirectionBackward=function(e){var t=this.animationsMap[e];t&&(t.direction=-1,t.directionBackwards=!0)},Ts.prototype.setAnimationFPS=function(e,t){var n=this.animationsMap[e];n&&(n.fps=t,n.duration=(n.end-n.start)/n.fps)},Ts.prototype.setAnimationDuration=function(e,t){var n=this.animationsMap[e];n&&(n.duration=t,n.fps=(n.end-n.start)/n.duration)},Ts.prototype.setAnimationWeight=function(e,t){var n=this.animationsMap[e];n&&(n.weight=t)},Ts.prototype.setAnimationTime=function(e,t){var n=this.animationsMap[e];n&&(n.time=t)},Ts.prototype.getAnimationTime=function(e){var t=0,n=this.animationsMap[e];return n&&(t=n.time),t},Ts.prototype.getAnimationDuration=function(e){var t=-1,n=this.animationsMap[e];return n&&(t=n.duration),t},Ts.prototype.playAnimation=function(e){var t=this.animationsMap[e];t?(t.time=0,t.active=!0):console.warn("THREE.MorphBlendMesh: animation["+e+"] undefined in .playAnimation()")},Ts.prototype.stopAnimation=function(e){var t=this.animationsMap[e];t&&(t.active=!1)},Ts.prototype.update=function(e){for(var t=0,n=this.animationsList.length;ti.duration||i.time<0)&&(i.direction*=-1,i.time>i.duration&&(i.time=i.duration,i.directionBackwards=!0),i.time<0&&(i.time=0,i.directionBackwards=!1)):(i.time=i.time%i.duration,i.time<0&&(i.time+=i.duration));var o=i.start+Ct.clamp(Math.floor(i.time/r),0,i.length-1),a=i.weight;o!==i.currentFrame&&(this.morphTargetInfluences[i.lastFrame]=0,this.morphTargetInfluences[i.currentFrame]=1*a,this.morphTargetInfluences[o]=0,i.lastFrame=i.currentFrame,i.currentFrame=o);var s=i.time%r/r;i.directionBackwards&&(s=1-s),i.currentFrame!==i.lastFrame?(this.morphTargetInfluences[i.currentFrame]=s*a,this.morphTargetInfluences[i.lastFrame]=(1-s)*a):this.morphTargetInfluences[i.currentFrame]=a}}},Cs.prototype=Object.create(gi.prototype),Cs.prototype.constructor=Cs,Cs.prototype.isImmediateRenderObject=!0,Os.prototype=Object.create(kr.prototype),Os.prototype.constructor=Os,Os.prototype.update=function(){var e=new Ut,t=new Ut,n=new ti;return function(){var i=["a","b","c"];this.object.updateMatrixWorld(!0),n.getNormalMatrix(this.object.matrixWorld);var r=this.object.matrixWorld,o=this.geometry.attributes.position,a=this.object.geometry;if(a&&a.isGeometry)for(var s=a.vertices,l=a.faces,u=0,c=0,d=l.length;c.99999?this.quaternion.set(0,0,0,1):e.y<-.99999?this.quaternion.set(1,0,0,0):(Qa.set(e.z,0,-e.x).normalize(),$a=Math.acos(e.y),this.quaternion.setFromAxisAngle(Qa,$a))}),js.prototype.setLength=function(e,t,n){void 0===t&&(t=.2*e),void 0===n&&(n=.2*t),this.line.scale.set(1,Math.max(0,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()},js.prototype.setColor=function(e){this.line.material.color.copy(e),this.cone.material.color.copy(e)},Us.prototype=Object.create(kr.prototype),Us.prototype.constructor=Us;var Gs=new Ut,Vs=new Ws,Hs=new Ws,Ys=new Ws;function qs(e){this.points=e||[],this.closed=!1}function Xs(e,t,n,i){this.v0=e,this.v1=t,this.v2=n,this.v3=i}function Ks(e,t,n){this.v0=e,this.v1=t,this.v2=n}function Zs(e,t){this.v1=e,this.v2=t}function Js(e,t,n,i,r,o){Oa.call(this,e,t,n,n,i,r,o)}qs.prototype=Object.create(Ea.prototype),qs.prototype.constructor=qs,qs.prototype.getPoint=function(e){var t=this.points,n=t.length;n<2&&console.log("duh, you need at least 2 points");var i,r,o,a,s=(n-(this.closed?0:1))*e,l=Math.floor(s),u=s-l;if(this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/t.length)+1)*t.length:0===u&&l===n-1&&(l=n-2,u=1),this.closed||l>0?i=t[(l-1)%n]:(Gs.subVectors(t[0],t[1]).add(t[0]),i=Gs),r=t[l%n],o=t[(l+1)%n],this.closed||l+20?1:+e}),void 0===Function.prototype.name&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(Object.assign=function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n>=4,n[r]=t[19===r?3&e|8:e]);return n.join("")}}(),clamp:function(e,t,n){return Math.max(t,Math.min(n,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)},lerp:function(e,t,n){return(1-n)*e+n*t},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*Mt.DEG2RAD},radToDeg:function(e){return e*Mt.RAD2DEG},isPowerOfTwo:function(e){return 0==(e&e-1)&&0!==e},nearestPowerOfTwo:function(e){return Math.pow(2,Math.round(Math.log(e)/Math.LN2))},nextPowerOfTwo:function(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e}};function St(e,t){this.x=e||0,this.y=t||0}St.prototype={constructor:St,isVector2:!0,get width(){return this.x},set width(e){this.x=e},get height(){return this.y},set height(e){this.y=e},set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e):(this.x=0,this.y=0),this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:function(e,t){return void 0===r&&(r=new St,o=new St),r.set(e,e),o.set(t,t),this.clamp(r,o)},clampLength:function(e,t){var n=this.length();return this.multiplyScalar(Math.max(e,Math.min(t,n))/n)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length())},angle:function(){var e=Math.atan2(this.y,this.x);return e<0&&(e+=2*Math.PI),e},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},distanceToManhattan:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this},rotateAround:function(e,t){var n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,o=this.y-e.y;return this.x=r*n-o*i+e.x,this.y=r*i+o*n+e.y,this}};var Et,Tt,Ct,Ot,kt,Pt,At=0;function Rt(e,t,n,i,r,o,a,s,l,u){Object.defineProperty(this,"id",{value:At++}),this.uuid=Mt.generateUUID(),this.name="",this.image=void 0!==e?e:Rt.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==t?t:Rt.DEFAULT_MAPPING,this.wrapS=void 0!==n?n:ve,this.wrapT=void 0!==i?i:ve,this.magFilter=void 0!==r?r:Me,this.minFilter=void 0!==o?o:Ee,this.anisotropy=void 0!==l?l:1,this.format=void 0!==a?a:je,this.type=void 0!==s?s:Te,this.offset=new St(0,0),this.repeat=new St(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==u?u:pt,this.version=0,this.onUpdate=null}function Lt(e,t,n,i){this.x=e||0,this.y=t||0,this.z=n||0,this.w=void 0!==i?i:1}function It(e,t,n){this.uuid=Mt.generateUUID(),this.width=e,this.height=t,this.scissor=new Lt(0,0,e,t),this.scissorTest=!1,this.viewport=new Lt(0,0,e,t),void 0===(n=n||{}).minFilter&&(n.minFilter=Me),this.texture=new Rt(void 0,void 0,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0===n.stencilBuffer||n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}function Dt(e,t,n){It.call(this,e,t,n),this.activeCubeFace=0,this.activeMipMapLevel=0}function Nt(e,t,n,i){this._x=e||0,this._y=t||0,this._z=n||0,this._w=void 0!==i?i:1}function Ft(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0}function zt(){this.elements=new Float32Array([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.")}function Bt(e,t,n,i,r,o,a,s,l,u){e=void 0!==e?e:[],t=void 0!==t?t:ce,Rt.call(this,e,t,n,i,r,o,a,s,l,u),this.flipY=!1}Rt.DEFAULT_IMAGE=void 0,Rt.DEFAULT_MAPPING=ue,Rt.prototype={constructor:Rt,isTexture:!0,set needsUpdate(e){!0===e&&this.version++},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){if(void 0!==e.textures[this.uuid])return e.textures[this.uuid];var t={metadata:{version:4.4,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],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var n=this.image;void 0===n.uuid&&(n.uuid=Mt.generateUUID()),void 0===e.images[n.uuid]&&(e.images[n.uuid]={uuid:n.uuid,url:function(e){var t;return void 0!==e.toDataURL?t=e:((t=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")).width=e.width,t.height=e.height,t.getContext("2d").drawImage(e,0,0,e.width,e.height)),t.width>2048||t.height>2048?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}(n)}),t.image=n.uuid}return e.textures[this.uuid]=t,t},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(this.mapping===ue){if(e.multiply(this.repeat),e.add(this.offset),e.x<0||e.x>1)switch(this.wrapS){case ye:e.x=e.x-Math.floor(e.x);break;case ve:e.x=e.x<0?0:1;break;case be:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case ye:e.y=e.y-Math.floor(e.y);break;case ve:e.y=e.y<0?0:1;break;case be:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}this.flipY&&(e.y=1-e.y)}}},Object.assign(Rt.prototype,i.prototype),Lt.prototype={constructor:Lt,isVector4:!0,set:function(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e,this.z*=e,this.w*=e):(this.x=0,this.y=0,this.z=0,this.w=0),this},applyMatrix4:function(e){var t=this.x,n=this.y,i=this.z,r=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i+o[12]*r,this.y=o[1]*t+o[5]*n+o[9]*i+o[13]*r,this.z=o[2]*t+o[6]*n+o[10]*i+o[14]*r,this.w=o[3]*t+o[7]*n+o[11]*i+o[15]*r,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,n,i,r,o=e.elements,a=o[0],s=o[4],l=o[8],u=o[1],c=o[5],d=o[9],h=o[2],p=o[6],f=o[10];if(Math.abs(s-u)<.01&&Math.abs(l-h)<.01&&Math.abs(d-p)<.01){if(Math.abs(s+u)<.1&&Math.abs(l+h)<.1&&Math.abs(d+p)<.1&&Math.abs(a+c+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;var m=(a+1)/2,g=(c+1)/2,y=(f+1)/2,v=(s+u)/4,b=(l+h)/4,_=(d+p)/4;return m>g&&m>y?m<.01?(n=0,i=.707106781,r=.707106781):(i=v/(n=Math.sqrt(m)),r=b/n):g>y?g<.01?(n=.707106781,i=0,r=.707106781):(n=v/(i=Math.sqrt(g)),r=_/i):y<.01?(n=.707106781,i=.707106781,r=0):(n=b/(r=Math.sqrt(y)),i=_/r),this.set(n,i,r,t),this}var x=Math.sqrt((p-d)*(p-d)+(l-h)*(l-h)+(u-s)*(u-s));return Math.abs(x)<.001&&(x=1),this.x=(p-d)/x,this.y=(l-h)/x,this.z=(u-s)/x,this.w=Math.acos((a+c+f-1)/2),this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(){var e,t;return function(n,i){return void 0===e&&(e=new Lt,t=new Lt),e.set(n,n,n,n),t.set(i,i,i,i),this.clamp(e,t)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}},It.prototype={constructor:It,isWebGLRenderTarget:!0,setSize:function(e,t){this.width===e&&this.height===t||(this.width=e,this.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}},Object.assign(It.prototype,i.prototype),Dt.prototype=Object.create(It.prototype),Dt.prototype.constructor=Dt,Dt.prototype.isWebGLRenderTargetCube=!0,Nt.prototype={constructor:Nt,get x(){return this._x},set x(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get w(){return this._w},set w(e){this._w=e,this.onChangeCallback()},set:function(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this.onChangeCallback(),this},setFromEuler:function(e,t){if(!1===(e&&e.isEuler))throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=Math.cos(e._x/2),i=Math.cos(e._y/2),r=Math.cos(e._z/2),o=Math.sin(e._x/2),a=Math.sin(e._y/2),s=Math.sin(e._z/2),l=e.order;return"XYZ"===l?(this._x=o*i*r+n*a*s,this._y=n*a*r-o*i*s,this._z=n*i*s+o*a*r,this._w=n*i*r-o*a*s):"YXZ"===l?(this._x=o*i*r+n*a*s,this._y=n*a*r-o*i*s,this._z=n*i*s-o*a*r,this._w=n*i*r+o*a*s):"ZXY"===l?(this._x=o*i*r-n*a*s,this._y=n*a*r+o*i*s,this._z=n*i*s+o*a*r,this._w=n*i*r-o*a*s):"ZYX"===l?(this._x=o*i*r-n*a*s,this._y=n*a*r+o*i*s,this._z=n*i*s-o*a*r,this._w=n*i*r+o*a*s):"YZX"===l?(this._x=o*i*r+n*a*s,this._y=n*a*r+o*i*s,this._z=n*i*s-o*a*r,this._w=n*i*r-o*a*s):"XZY"===l&&(this._x=o*i*r-n*a*s,this._y=n*a*r-o*i*s,this._z=n*i*s+o*a*r,this._w=n*i*r+o*a*s),!1!==t&&this.onChangeCallback(),this},setFromAxisAngle:function(e,t){var n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this.onChangeCallback(),this},setFromRotationMatrix:function(e){var t,n=e.elements,i=n[0],r=n[4],o=n[8],a=n[1],s=n[5],l=n[9],u=n[2],c=n[6],d=n[10],h=i+s+d;return h>0?(t=.5/Math.sqrt(h+1),this._w=.25/t,this._x=(c-l)*t,this._y=(o-u)*t,this._z=(a-r)*t):i>s&&i>d?(t=2*Math.sqrt(1+i-s-d),this._w=(c-l)/t,this._x=.25*t,this._y=(r+a)/t,this._z=(o+u)/t):s>d?(t=2*Math.sqrt(1+s-i-d),this._w=(o-u)/t,this._x=(r+a)/t,this._y=.25*t,this._z=(l+c)/t):(t=2*Math.sqrt(1+d-i-s),this._w=(a-r)/t,this._x=(o+u)/t,this._y=(l+c)/t,this._z=.25*t),this.onChangeCallback(),this},setFromUnitVectors:function(){var e,t;return function(n,i){return void 0===e&&(e=new Ft),(t=n.dot(i)+1)<1e-6?(t=0,Math.abs(n.x)>Math.abs(n.z)?e.set(-n.y,n.x,0):e.set(0,-n.z,n.y)):e.crossVectors(n,i),this._x=e.x,this._y=e.y,this._z=e.z,this._w=t,this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this.onChangeCallback(),this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var n=e._x,i=e._y,r=e._z,o=e._w,a=t._x,s=t._y,l=t._z,u=t._w;return this._x=n*u+o*a+i*l-r*s,this._y=i*u+o*s+r*a-n*l,this._z=r*u+o*l+n*s-i*a,this._w=o*u-n*a-i*s-r*l,this.onChangeCallback(),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var n=this._x,i=this._y,r=this._z,o=this._w,a=o*e._w+n*e._x+i*e._y+r*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=n,this._y=i,this._z=r,this;var s=Math.sqrt(1-a*a);if(Math.abs(s)<.001)return this._w=.5*(o+this._w),this._x=.5*(n+this._x),this._y=.5*(i+this._y),this._z=.5*(r+this._z),this;var l=Math.atan2(s,a),u=Math.sin((1-t)*l)/s,c=Math.sin(t*l)/s;return this._w=o*u+this._w*c,this._x=n*u+this._x*c,this._y=i*u+this._y*c,this._z=r*u+this._z*c,this.onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}},Object.assign(Nt,{slerp:function(e,t,n,i){return n.copy(e).slerp(t,i)},slerpFlat:function(e,t,n,i,r,o,a){var s=n[i+0],l=n[i+1],u=n[i+2],c=n[i+3],d=r[o+0],h=r[o+1],p=r[o+2],f=r[o+3];if(c!==f||s!==d||l!==h||u!==p){var m=1-a,g=s*d+l*h+u*p+c*f,y=g>=0?1:-1,v=1-g*g;if(v>Number.EPSILON){var b=Math.sqrt(v),_=Math.atan2(b,g*y);m=Math.sin(m*_)/b,a=Math.sin(a*_)/b}var x=a*y;if(s=s*m+d*x,l=l*m+h*x,u=u*m+p*x,c=c*m+f*x,m===1-a){var w=1/Math.sqrt(s*s+l*l+u*u+c*c);s*=w,l*=w,u*=w,c*=w}}e[t]=s,e[t+1]=l,e[t+2]=u,e[t+3]=c}}),Ft.prototype={constructor:Ft,isVector3:!0,set:function(e,t,n){return this.x=e,this.y=t,this.z=n,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e,this.z*=e):(this.x=0,this.y=0,this.z=0),this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(e){return!1===(e&&e.isEuler)&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),void 0===Ct&&(Ct=new Nt),this.applyQuaternion(Ct.setFromEuler(e))},applyAxisAngle:function(){var e;return function(t,n){return void 0===e&&(e=new Nt),this.applyQuaternion(e.setFromAxisAngle(t,n))}}(),applyMatrix3:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this},applyMatrix4:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements;this.x=r[0]*t+r[4]*n+r[8]*i+r[12],this.y=r[1]*t+r[5]*n+r[9]*i+r[13],this.z=r[2]*t+r[6]*n+r[10]*i+r[14];var o=r[3]*t+r[7]*n+r[11]*i+r[15];return this.divideScalar(o)},applyQuaternion:function(e){var t=this.x,n=this.y,i=this.z,r=e.x,o=e.y,a=e.z,s=e.w,l=s*t+o*i-a*n,u=s*n+a*t-r*i,c=s*i+r*n-o*t,d=-r*t-o*n-a*i;return this.x=l*s+d*-r+u*-a-c*-o,this.y=u*s+d*-o+c*-r-l*-a,this.z=c*s+d*-a+l*-o-u*-r,this},project:function(e){return void 0===Tt&&(Tt=new zt),Tt.multiplyMatrices(e.projectionMatrix,Tt.getInverse(e.matrixWorld)),this.applyMatrix4(Tt)},unproject:function(){var e;return function(t){return void 0===e&&(e=new zt),e.multiplyMatrices(t.matrixWorld,e.getInverse(t.projectionMatrix)),this.applyMatrix4(e)}}(),transformDirection:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:function(){var e,t;return function(n,i){return void 0===e&&(e=new Ft,t=new Ft),e.set(n,n,n),t.set(i,i,i),this.clamp(e,t)}}(),clampLength:function(e,t){var n=this.length();return this.multiplyScalar(Math.max(e,Math.min(t,n))/n)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},cross:function(e,t){if(void 0!==t)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t);var n=this.x,i=this.y,r=this.z;return this.x=i*e.z-r*e.y,this.y=r*e.x-n*e.z,this.z=n*e.y-i*e.x,this},crossVectors:function(e,t){var n=e.x,i=e.y,r=e.z,o=t.x,a=t.y,s=t.z;return this.x=i*s-r*a,this.y=r*o-n*s,this.z=n*a-i*o,this},projectOnVector:function(e){var t=e.dot(this)/e.lengthSq();return this.copy(e).multiplyScalar(t)},projectOnPlane:function(e){return void 0===Et&&(Et=new Ft),Et.copy(this).projectOnVector(e),this.sub(Et)},reflect:function(){var e;return function(t){return void 0===e&&(e=new Ft),this.sub(e.copy(t).multiplyScalar(2*this.dot(t)))}}(),angleTo:function(e){var t=this.dot(e)/Math.sqrt(this.lengthSq()*e.lengthSq());return Math.acos(Mt.clamp(t,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i},distanceToManhattan:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){var t=Math.sin(e.phi)*e.radius;return this.x=t*Math.sin(e.theta),this.y=Math.cos(e.phi)*e.radius,this.z=t*Math.cos(e.theta),this},setFromCylindrical:function(e){return this.x=e.radius*Math.sin(e.theta),this.y=e.y,this.z=e.radius*Math.cos(e.theta),this},setFromMatrixPosition:function(e){return this.setFromMatrixColumn(e,3)},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this},setFromMatrixColumn:function(e,t){if("number"==typeof e){console.warn("THREE.Vector3: setFromMatrixColumn now expects ( matrix, index ).");var n=e;e=t,t=n}return this.fromArray(e.elements,4*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}},zt.prototype={constructor:zt,isMatrix4:!0,set:function(e,t,n,i,r,o,a,s,l,u,c,d,h,p,f,m){var g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=r,g[5]=o,g[9]=a,g[13]=s,g[2]=l,g[6]=u,g[10]=c,g[14]=d,g[3]=h,g[7]=p,g[11]=f,g[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new zt).fromArray(this.elements)},copy:function(e){return this.elements.set(e.elements),this},copyPosition:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this},extractBasis:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this},extractRotation:function(){var e;return function(t){void 0===e&&(e=new Ft);var n=this.elements,i=t.elements,r=1/e.setFromMatrixColumn(t,0).length(),o=1/e.setFromMatrixColumn(t,1).length(),a=1/e.setFromMatrixColumn(t,2).length();return n[0]=i[0]*r,n[1]=i[1]*r,n[2]=i[2]*r,n[4]=i[4]*o,n[5]=i[5]*o,n[6]=i[6]*o,n[8]=i[8]*a,n[9]=i[9]*a,n[10]=i[10]*a,this}}(),makeRotationFromEuler:function(e){!1===(e&&e.isEuler)&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,n=e.x,i=e.y,r=e.z,o=Math.cos(n),a=Math.sin(n),s=Math.cos(i),l=Math.sin(i),u=Math.cos(r),c=Math.sin(r);if("XYZ"===e.order){var d=o*u,h=o*c,p=a*u,f=a*c;t[0]=s*u,t[4]=-s*c,t[8]=l,t[1]=h+p*l,t[5]=d-f*l,t[9]=-a*s,t[2]=f-d*l,t[6]=p+h*l,t[10]=o*s}else if("YXZ"===e.order){var m=s*u,g=s*c,y=l*u,v=l*c;t[0]=m+v*a,t[4]=y*a-g,t[8]=o*l,t[1]=o*c,t[5]=o*u,t[9]=-a,t[2]=g*a-y,t[6]=v+m*a,t[10]=o*s}else if("ZXY"===e.order){m=s*u,g=s*c,y=l*u,v=l*c;t[0]=m-v*a,t[4]=-o*c,t[8]=y+g*a,t[1]=g+y*a,t[5]=o*u,t[9]=v-m*a,t[2]=-o*l,t[6]=a,t[10]=o*s}else if("ZYX"===e.order){d=o*u,h=o*c,p=a*u,f=a*c;t[0]=s*u,t[4]=p*l-h,t[8]=d*l+f,t[1]=s*c,t[5]=f*l+d,t[9]=h*l-p,t[2]=-l,t[6]=a*s,t[10]=o*s}else if("YZX"===e.order){var b=o*s,_=o*l,x=a*s,w=a*l;t[0]=s*u,t[4]=w-b*c,t[8]=x*c+_,t[1]=c,t[5]=o*u,t[9]=-a*u,t[2]=-l*u,t[6]=_*c+x,t[10]=b-w*c}else if("XZY"===e.order){b=o*s,_=o*l,x=a*s,w=a*l;t[0]=s*u,t[4]=-c,t[8]=l*u,t[1]=b*c+w,t[5]=o*u,t[9]=_*c-x,t[2]=x*c-_,t[6]=a*u,t[10]=w*c+b}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(e){var t=this.elements,n=e.x,i=e.y,r=e.z,o=e.w,a=n+n,s=i+i,l=r+r,u=n*a,c=n*s,d=n*l,h=i*s,p=i*l,f=r*l,m=o*a,g=o*s,y=o*l;return t[0]=1-(h+f),t[4]=c-y,t[8]=d+g,t[1]=c+y,t[5]=1-(u+f),t[9]=p-m,t[2]=d-g,t[6]=p+m,t[10]=1-(u+h),t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},lookAt:function(e,t,n){void 0===Ot&&(Ot=new Ft,kt=new Ft,Pt=new Ft);var i=this.elements;return Pt.subVectors(e,t).normalize(),0===Pt.lengthSq()&&(Pt.z=1),Ot.crossVectors(n,Pt).normalize(),0===Ot.lengthSq()&&(Pt.z+=1e-4,Ot.crossVectors(n,Pt).normalize()),kt.crossVectors(Pt,Ot),i[0]=Ot.x,i[4]=kt.x,i[8]=Pt.x,i[1]=Ot.y,i[5]=kt.y,i[9]=Pt.y,i[2]=Ot.z,i[6]=kt.z,i[10]=Pt.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,i=t.elements,r=this.elements,o=n[0],a=n[4],s=n[8],l=n[12],u=n[1],c=n[5],d=n[9],h=n[13],p=n[2],f=n[6],m=n[10],g=n[14],y=n[3],v=n[7],b=n[11],_=n[15],x=i[0],w=i[4],M=i[8],S=i[12],E=i[1],T=i[5],C=i[9],O=i[13],k=i[2],P=i[6],A=i[10],R=i[14],L=i[3],I=i[7],D=i[11],N=i[15];return r[0]=o*x+a*E+s*k+l*L,r[4]=o*w+a*T+s*P+l*I,r[8]=o*M+a*C+s*A+l*D,r[12]=o*S+a*O+s*R+l*N,r[1]=u*x+c*E+d*k+h*L,r[5]=u*w+c*T+d*P+h*I,r[9]=u*M+c*C+d*A+h*D,r[13]=u*S+c*O+d*R+h*N,r[2]=p*x+f*E+m*k+g*L,r[6]=p*w+f*T+m*P+g*I,r[10]=p*M+f*C+m*A+g*D,r[14]=p*S+f*O+m*R+g*N,r[3]=y*x+v*E+b*k+_*L,r[7]=y*w+v*T+b*P+_*I,r[11]=y*M+v*C+b*A+_*D,r[15]=y*S+v*O+b*R+_*N,this},multiplyToArray:function(e,t,n){var i=this.elements;return this.multiplyMatrices(e,t),n[0]=i[0],n[1]=i[1],n[2]=i[2],n[3]=i[3],n[4]=i[4],n[5]=i[5],n[6]=i[6],n[7]=i[7],n[8]=i[8],n[9]=i[9],n[10]=i[10],n[11]=i[11],n[12]=i[12],n[13]=i[13],n[14]=i[14],n[15]=i[15],this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},applyToBufferAttribute:function(){var e;return function(t){void 0===e&&(e=new Ft);for(var n=0,i=t.count;n0)return e;var r=t*n,o=Gt[r];if(void 0===o&&(o=new Float32Array(r),Gt[r]=o),0!==t){i.toArray(o,0);for(var a=1,s=0;a!==t;++a)s+=n,e[a].toArray(o,s)}return o}function Yt(e,t){var n=Vt[t];void 0===n&&(n=new Int32Array(t),Vt[t]=n);for(var i=0;i!==t;++i)n[i]=e.allocTextureUnit();return n}function qt(e,t){e.uniform1f(this.addr,t)}function Xt(e,t){e.uniform1i(this.addr,t)}function Kt(e,t){void 0===t.x?e.uniform2fv(this.addr,t):e.uniform2f(this.addr,t.x,t.y)}function Zt(e,t){void 0!==t.x?e.uniform3f(this.addr,t.x,t.y,t.z):void 0!==t.r?e.uniform3f(this.addr,t.r,t.g,t.b):e.uniform3fv(this.addr,t)}function Jt(e,t){void 0===t.x?e.uniform4fv(this.addr,t):e.uniform4f(this.addr,t.x,t.y,t.z,t.w)}function $t(e,t){e.uniformMatrix2fv(this.addr,!1,t.elements||t)}function Qt(e,t){e.uniformMatrix3fv(this.addr,!1,t.elements||t)}function en(e,t){e.uniformMatrix4fv(this.addr,!1,t.elements||t)}function tn(e,t,n){var i=n.allocTextureUnit();e.uniform1i(this.addr,i),n.setTexture2D(t||jt,i)}function nn(e,t,n){var i=n.allocTextureUnit();e.uniform1i(this.addr,i),n.setTextureCube(t||Ut,i)}function rn(e,t){e.uniform2iv(this.addr,t)}function on(e,t){e.uniform3iv(this.addr,t)}function an(e,t){e.uniform4iv(this.addr,t)}function sn(e,t){e.uniform1fv(this.addr,t)}function ln(e,t){e.uniform1iv(this.addr,t)}function un(e,t){e.uniform2fv(this.addr,Ht(t,this.size,2))}function cn(e,t){e.uniform3fv(this.addr,Ht(t,this.size,3))}function dn(e,t){e.uniform4fv(this.addr,Ht(t,this.size,4))}function hn(e,t){e.uniformMatrix2fv(this.addr,!1,Ht(t,this.size,4))}function pn(e,t){e.uniformMatrix3fv(this.addr,!1,Ht(t,this.size,9))}function fn(e,t){e.uniformMatrix4fv(this.addr,!1,Ht(t,this.size,16))}function mn(e,t,n){var i=t.length,r=Yt(n,i);e.uniform1iv(this.addr,r);for(var o=0;o!==i;++o)n.setTexture2D(t[o]||jt,r[o])}function gn(e,t,n){var i=t.length,r=Yt(n,i);e.uniform1iv(this.addr,r);for(var o=0;o!==i;++o)n.setTextureCube(t[o]||Ut,r[o])}function yn(e,t,n){this.id=e,this.addr=n,this.setValue=function(e){switch(e){case 5126:return qt;case 35664:return Kt;case 35665:return Zt;case 35666:return Jt;case 35674:return $t;case 35675:return Qt;case 35676:return en;case 35678:return tn;case 35680:return nn;case 5124:case 35670:return Xt;case 35667:case 35671:return rn;case 35668:case 35672:return on;case 35669:case 35673:return an}}(t.type)}function vn(e,t,n){this.id=e,this.addr=n,this.size=t.size,this.setValue=function(e){switch(e){case 5126:return sn;case 35664:return un;case 35665:return cn;case 35666:return dn;case 35674:return hn;case 35675:return pn;case 35676:return fn;case 35678:return mn;case 35680:return gn;case 5124:case 35670:return ln;case 35667:case 35671:return rn;case 35668:case 35672:return on;case 35669:case 35673:return an}}(t.type)}function bn(e){this.id=e,Wt.call(this)}bn.prototype.setValue=function(e,t){for(var n=this.seq,i=0,r=n.length;i!==r;++i){var o=n[i];o.setValue(e,t[o.id])}};var _n=/([\w\d_]+)(\])?(\[|\.)?/g;function xn(e,t){e.seq.push(t),e.map[t.id]=t}function wn(e,t,n){var i=e.name,r=i.length;for(_n.lastIndex=0;;){var o=_n.exec(i),a=_n.lastIndex,s=o[1],l="]"===o[2],u=o[3];if(l&&(s|=0),void 0===u||"["===u&&a+2===r){xn(n,void 0===u?new yn(s,e,t):new vn(s,e,t));break}var c=n.map[s];void 0===c&&xn(n,c=new bn(s)),n=c}}function Mn(e,t,n){Wt.call(this),this.renderer=n;for(var i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS),r=0;r 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t\t}\n\t\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 ltcTextureCoords( const in GeometricContext geometry, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = (LUT_SIZE - 1.0)/LUT_SIZE;\n\tconst float LUT_BIAS = 0.5/LUT_SIZE;\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 P = geometry.position;\n\tfloat theta = acos( dot( N, V ) );\n\tvec2 uv = vec2(\n\t\tsqrt( saturate( roughness ) ),\n\t\tsaturate( theta / ( 0.5 * PI ) ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nvoid clipQuadToHorizon( inout vec3 L[5], out int n ) {\n\tint config = 0;\n\tif ( L[0].z > 0.0 ) config += 1;\n\tif ( L[1].z > 0.0 ) config += 2;\n\tif ( L[2].z > 0.0 ) config += 4;\n\tif ( L[3].z > 0.0 ) config += 8;\n\tn = 0;\n\tif ( config == 0 ) {\n\t} else if ( config == 1 ) {\n\t\tn = 3;\n\t\tL[1] = -L[1].z * L[0] + L[0].z * L[1];\n\t\tL[2] = -L[3].z * L[0] + L[0].z * L[3];\n\t} else if ( config == 2 ) {\n\t\tn = 3;\n\t\tL[0] = -L[0].z * L[1] + L[1].z * L[0];\n\t\tL[2] = -L[2].z * L[1] + L[1].z * L[2];\n\t} else if ( config == 3 ) {\n\t\tn = 4;\n\t\tL[2] = -L[2].z * L[1] + L[1].z * L[2];\n\t\tL[3] = -L[3].z * L[0] + L[0].z * L[3];\n\t} else if ( config == 4 ) {\n\t\tn = 3;\n\t\tL[0] = -L[3].z * L[2] + L[2].z * L[3];\n\t\tL[1] = -L[1].z * L[2] + L[2].z * L[1];\n\t} else if ( config == 5 ) {\n\t\tn = 0;\n\t} else if ( config == 6 ) {\n\t\tn = 4;\n\t\tL[0] = -L[0].z * L[1] + L[1].z * L[0];\n\t\tL[3] = -L[3].z * L[2] + L[2].z * L[3];\n\t} else if ( config == 7 ) {\n\t\tn = 5;\n\t\tL[4] = -L[3].z * L[0] + L[0].z * L[3];\n\t\tL[3] = -L[3].z * L[2] + L[2].z * L[3];\n\t} else if ( config == 8 ) {\n\t\tn = 3;\n\t\tL[0] = -L[0].z * L[3] + L[3].z * L[0];\n\t\tL[1] = -L[2].z * L[3] + L[3].z * L[2];\n\t\tL[2] = L[3];\n\t} else if ( config == 9 ) {\n\t\tn = 4;\n\t\tL[1] = -L[1].z * L[0] + L[0].z * L[1];\n\t\tL[2] = -L[2].z * L[3] + L[3].z * L[2];\n\t} else if ( config == 10 ) {\n\t\tn = 0;\n\t} else if ( config == 11 ) {\n\t\tn = 5;\n\t\tL[4] = L[3];\n\t\tL[3] = -L[2].z * L[3] + L[3].z * L[2];\n\t\tL[2] = -L[2].z * L[1] + L[1].z * L[2];\n\t} else if ( config == 12 ) {\n\t\tn = 4;\n\t\tL[1] = -L[1].z * L[2] + L[2].z * L[1];\n\t\tL[0] = -L[0].z * L[3] + L[3].z * L[0];\n\t} else if ( config == 13 ) {\n\t\tn = 5;\n\t\tL[4] = L[3];\n\t\tL[3] = L[2];\n\t\tL[2] = -L[1].z * L[2] + L[2].z * L[1];\n\t\tL[1] = -L[1].z * L[0] + L[0].z * L[1];\n\t} else if ( config == 14 ) {\n\t\tn = 5;\n\t\tL[4] = -L[0].z * L[3] + L[3].z * L[0];\n\t\tL[0] = -L[0].z * L[1] + L[1].z * L[0];\n\t} else if ( config == 15 ) {\n\t\tn = 4;\n\t}\n\tif ( n == 3 )\n\t\tL[3] = L[0];\n\tif ( n == 4 )\n\t\tL[4] = L[0];\n}\nfloat integrateLtcBrdfOverRectEdge( vec3 v1, vec3 v2 ) {\n\tfloat cosTheta = dot( v1, v2 );\n\tfloat theta = acos( cosTheta );\n\tfloat res = cross( v1, v2 ).z * ( ( theta > 0.001 ) ? theta / sin( theta ) : 1.0 );\n\treturn res;\n}\nvoid initRectPoints( const in vec3 pos, const in vec3 halfWidth, const in vec3 halfHeight, out vec3 rectPoints[4] ) {\n\trectPoints[0] = pos - halfWidth - halfHeight;\n\trectPoints[1] = pos + halfWidth - halfHeight;\n\trectPoints[2] = pos + halfWidth + halfHeight;\n\trectPoints[3] = pos - halfWidth + halfHeight;\n}\nvec3 integrateLtcBrdfOverRect( const in GeometricContext geometry, const in mat3 brdfMat, const in vec3 rectPoints[4] ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 P = geometry.position;\n\tvec3 T1, T2;\n\tT1 = normalize(V - N * dot( V, N ));\n\tT2 = - cross( N, T1 );\n\tmat3 brdfWrtSurface = brdfMat * transpose( mat3( T1, T2, N ) );\n\tvec3 clippedRect[5];\n\tclippedRect[0] = brdfWrtSurface * ( rectPoints[0] - P );\n\tclippedRect[1] = brdfWrtSurface * ( rectPoints[1] - P );\n\tclippedRect[2] = brdfWrtSurface * ( rectPoints[2] - P );\n\tclippedRect[3] = brdfWrtSurface * ( rectPoints[3] - P );\n\tint n;\n\tclipQuadToHorizon(clippedRect, n);\n\tif ( n == 0 )\n\t\treturn vec3( 0, 0, 0 );\n\tclippedRect[0] = normalize( clippedRect[0] );\n\tclippedRect[1] = normalize( clippedRect[1] );\n\tclippedRect[2] = normalize( clippedRect[2] );\n\tclippedRect[3] = normalize( clippedRect[3] );\n\tclippedRect[4] = normalize( clippedRect[4] );\n\tfloat sum = 0.0;\n\tsum += integrateLtcBrdfOverRectEdge( clippedRect[0], clippedRect[1] );\n\tsum += integrateLtcBrdfOverRectEdge( clippedRect[1], clippedRect[2] );\n\tsum += integrateLtcBrdfOverRectEdge( clippedRect[2], clippedRect[3] );\n\tif (n >= 4)\n\t\tsum += integrateLtcBrdfOverRectEdge( clippedRect[3], clippedRect[4] );\n\tif (n == 5)\n\t\tsum += integrateLtcBrdfOverRectEdge( clippedRect[4], clippedRect[0] );\n\tsum = max( 0.0, sum );\n\tvec3 Lo_i = vec3( sum, sum, sum );\n\treturn Lo_i;\n}\nvec3 Rect_Area_Light_Specular_Reflectance(\n\t\tconst in GeometricContext geometry,\n\t\tconst in vec3 lightPos, const in vec3 lightHalfWidth, const in vec3 lightHalfHeight,\n\t\tconst in float roughness,\n\t\tconst in sampler2D ltcMat, const in sampler2D ltcMag ) {\n\tvec3 rectPoints[4];\n\tinitRectPoints( lightPos, lightHalfWidth, lightHalfHeight, rectPoints );\n\tvec2 uv = ltcTextureCoords( geometry, roughness );\n\tvec4 brdfLtcApproxParams, t;\n\tbrdfLtcApproxParams = texture2D( ltcMat, uv );\n\tt = texture2D( ltcMat, uv );\n\tfloat brdfLtcScalar = texture2D( ltcMag, uv ).a;\n\tmat3 brdfLtcApproxMat = mat3(\n\t\tvec3( 1, 0, t.y ),\n\t\tvec3( 0, t.z, 0 ),\n\t\tvec3( t.w, 0, t.x )\n\t);\n\tvec3 specularReflectance = integrateLtcBrdfOverRect( geometry, brdfLtcApproxMat, rectPoints );\n\tspecularReflectance *= brdfLtcScalar;\n\treturn specularReflectance;\n}\nvec3 Rect_Area_Light_Diffuse_Reflectance(\n\t\tconst in GeometricContext geometry,\n\t\tconst in vec3 lightPos, const in vec3 lightHalfWidth, const in vec3 lightHalfHeight ) {\n\tvec3 rectPoints[4];\n\tinitRectPoints( lightPos, lightHalfWidth, lightHalfHeight, rectPoints );\n\tmat3 diffuseBrdfMat = mat3(1);\n\tvec3 diffuseReflectance = integrateLtcBrdfOverRect( geometry, diffuseBrdfMat, rectPoints );\n\treturn diffuseReflectance;\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = dFdx( surf_pos );\n\t\tvec3 vSigmaY = dFdy( surf_pos );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; ++ i ) {\n\t\tvec4 plane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t\t\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; ++ i ) {\n\t\t\tvec4 plane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t\n\t#endif\n#endif\n",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transpose( const in mat3 v ) {\n\tmat3 tmp;\n\ttmp[0] = vec3(v[0].x, v[1].x, v[2].x);\n\ttmp[1] = vec3(v[0].y, v[1].y, v[2].y);\n\ttmp[2] = vec3(v[0].z, v[1].z, v[2].z);\n\treturn tmp;\n}\n",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n",defaultnormal_vertex:"#ifdef FLIP_SIDED\n\tobjectNormal = -objectNormal;\n#endif\nvec3 transformedNormal = normalMatrix * objectNormal;\n",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",encodings_fragment:" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n\tXp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract(Le);\n\tvResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n\treturn vec4( max(vRGB, 0.0), 1.0 );\n}\n",envmap_fragment:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\tvec3 reflectView = flipNormal * normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif\n",envmap_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif\n",fog_vertex:"\n#ifdef USE_FOG\nfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float fogDepth;\n#endif\n",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif\n",gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif\n",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n",lights_pars:"uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltcMat;\tuniform sampler2D ltcMag;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = saturate( reflectVec.y * 0.5 + 0.5 );\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_BlinnPhong( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 matDiffColor = material.diffuseColor;\n\t\tvec3 matSpecColor = material.specularColor;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = BlinnExponentToGGXRoughness( material.specularShininess );\n\t\tvec3 spec = Rect_Area_Light_Specular_Reflectance(\n\t\t\t\tgeometry,\n\t\t\t\trectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight,\n\t\t\t\troughness,\n\t\t\t\tltcMat, ltcMag );\n\t\tvec3 diff = Rect_Area_Light_Diffuse_Reflectance(\n\t\t\t\tgeometry,\n\t\t\t\trectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight );\n\t\treflectedLight.directSpecular += lightColor * matSpecColor * spec / PI2;\n\t\treflectedLight.directDiffuse += lightColor * matDiffColor * diff / PI2;\n\t}\n#endif\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 matDiffColor = material.diffuseColor;\n\t\tvec3 matSpecColor = material.specularColor;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 spec = Rect_Area_Light_Specular_Reflectance(\n\t\t\t\tgeometry,\n\t\t\t\trectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight,\n\t\t\t\troughness,\n\t\t\t\tltcMat, ltcMag );\n\t\tvec3 diff = Rect_Area_Light_Diffuse_Reflectance(\n\t\t\t\tgeometry,\n\t\t\t\trectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight );\n\t\treflectedLight.directSpecular += lightColor * matSpecColor * spec;\n\t\treflectedLight.directDiffuse += lightColor * matDiffColor * diff;\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n",lights_template:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tvec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n\t#ifndef STANDARD\n\t\tvec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );\n\t#else\n\t\tvec3 clearCoatRadiance = vec3( 0.0 );\n\t#endif\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n",logdepthbuf_fragment:"#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\t#endif\n#endif\n",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n",map_particle_fragment:"#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n#endif\n",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.r;\n#endif\n",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n",normal_flip:"#ifdef DOUBLE_SIDED\n\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n#else\n\tfloat flipNormal = 1.0;\n#endif\n",normal_fragment:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal ) * flipNormal;\n#endif\n#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 1.0 - 2.0 * rgb.xyz;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",project_vertex:"#ifdef USE_SKINNING\n\tvec4 mvPosition = modelViewMatrix * skinned;\n#else\n\tvec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n#endif\ngl_Position = projectionMatrix * mvPosition;\n",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.r;\n#endif\n",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn 1.0;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\tfloat dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif\n",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\n",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureWidth;\n\t\tuniform int boneTextureHeight;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureWidth ) );\n\t\t\tfloat y = floor( j / float( boneTextureWidth ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureWidth );\n\t\t\tfloat dy = 1.0 / float( boneTextureHeight );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\tskinned = bindMatrixInverse * skinned;\n#endif\n",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",tonemapping_pars_fragment:"#define saturate(a) clamp( a, 0.0, 1.0 )\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n",uv_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n#endif\n",uv_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( PHYSICAL ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\t#ifdef USE_SKINNING\n\t\tvec4 worldPosition = modelMatrix * skinned;\n\t#else\n\t\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\t#endif\n#endif\n",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\n#include \nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n",cube_vert:"varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}\n",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",distanceRGBA_frag:"uniform vec3 lightPos;\nvarying vec4 vWorldPosition;\n#include \n#include \n#include \nvoid main () {\n\t#include \n\tgl_FragColor = packDepthToRGBA( length( vWorldPosition.xyz - lightPos.xyz ) / 1000.0 );\n}\n",distanceRGBA_vert:"varying vec4 vWorldPosition;\n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition;\n}\n",equirect_frag:"uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n",equirect_vert:"varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}\n",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}\n",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_ENVMAP\n\t#include \n\t#include \n\t#include \n\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include \n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}\n",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}\n",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}\n",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",shadow_frag:"uniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( 0.0, 0.0, 0.0, opacity * ( 1.0 - getShadowMask() ) );\n}\n",shadow_vert:"#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n}\n"};function Tn(e,t,n){return void 0===t&&void 0===n?this.set(e):this.setRGB(e,t,n)}Tn.prototype={constructor:Tn,isColor:!0,r:1,g:1,b:1,set:function(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setScalar:function(e){return this.r=e,this.g=e,this.b=e,this},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,n){return this.r=e,this.g=t,this.b=n,this},setHSL:function(){function e(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}return function(t,n,i){if(t=Mt.euclideanModulo(t,1),n=Mt.clamp(n,0,1),i=Mt.clamp(i,0,1),0===n)this.r=this.g=this.b=i;else{var r=i<=.5?i*(1+n):i+n-i*n,o=2*i-r;this.r=e(o,r,t+1/3),this.g=e(o,r,t),this.b=e(o,r,t-1/3)}return this}}(),setStyle:function(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var i,r=n[1],o=n[2];switch(r){case"rgb":case"rgba":if(i=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,t(i[5]),this;if(i=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,t(i[5]),this;break;case"hsl":case"hsla":if(i=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o)){var a=parseFloat(i[1])/360,s=parseInt(i[2],10)/100,l=parseInt(i[3],10)/100;return t(i[5]),this.setHSL(a,s,l)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(e)){var u,c=(u=n[1]).length;if(3===c)return this.r=parseInt(u.charAt(0)+u.charAt(0),16)/255,this.g=parseInt(u.charAt(1)+u.charAt(1),16)/255,this.b=parseInt(u.charAt(2)+u.charAt(2),16)/255,this;if(6===c)return this.r=parseInt(u.charAt(0)+u.charAt(1),16)/255,this.g=parseInt(u.charAt(2)+u.charAt(3),16)/255,this.b=parseInt(u.charAt(4)+u.charAt(5),16)/255,this}e&&e.length>0&&(void 0!==(u=Cn[e])?this.setHex(u):console.warn("THREE.Color: Unknown color "+e));return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var n=t>0?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this},convertGammaToLinear:function(){var e=this.r,t=this.g,n=this.b;return this.r=e*e,this.g=t*t,this.b=n*n,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){var t,n,i=e||{h:0,s:0,l:0},r=this.r,o=this.g,a=this.b,s=Math.max(r,o,a),l=Math.min(r,o,a),u=(l+s)/2;if(l===s)t=0,n=0;else{var c=s-l;switch(n=u<=.5?c/(s+l):c/(2-s-l),s){case r:t=(o-a)/c+(o.001&&k.scale>.001&&(x.x=k.x,x.y=k.y,x.z=k.z,b=k.size*k.scale/f.w,_.x=b*g,_.y=b,c.uniform3f(s.screenPosition,x.x,x.y,x.z),c.uniform2f(s.scale,_.x,_.y),c.uniform1f(s.rotation,k.rotation),c.uniform1f(s.opacity,k.opacity),c.uniform3f(s.color,k.color.r,k.color.g,k.color.b),d.setBlending(k.blending,k.blendEquation,k.blendSrc,k.blendDst),e.setTexture2D(k.texture,1),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0))}}}d.enable(c.CULL_FACE),d.enable(c.DEPTH_TEST),d.setDepthWrite(!0),e.resetGLState()}}}function Ln(e,t){var n,i,r,o,a,s,l=e.context,u=e.state,c=new Ft,d=new Nt,h=new Ft;function p(){var t=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),u=new Uint16Array([0,1,2,0,2,3]);n=l.createBuffer(),i=l.createBuffer(),l.bindBuffer(l.ARRAY_BUFFER,n),l.bufferData(l.ARRAY_BUFFER,t,l.STATIC_DRAW),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,i),l.bufferData(l.ELEMENT_ARRAY_BUFFER,u,l.STATIC_DRAW),r=function(){var t=l.createProgram(),n=l.createShader(l.VERTEX_SHADER),i=l.createShader(l.FRAGMENT_SHADER);return l.shaderSource(n,["precision "+e.getPrecision()+" float;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uvOffset + uv * uvScale;","vec2 alignedPosition = position * scale;","vec2 rotatedPosition;","rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","vec4 finalPosition;","finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","finalPosition.xy += rotatedPosition;","finalPosition = projectionMatrix * finalPosition;","gl_Position = finalPosition;","}"].join("\n")),l.shaderSource(i,["precision "+e.getPrecision()+" float;","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","void main() {","vec4 texture = texture2D( map, vUV );","if ( texture.a < alphaTest ) discard;","gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","if ( fogType > 0 ) {","float depth = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = 0.0;","if ( fogType == 1 ) {","fogFactor = smoothstep( fogNear, fogFar, depth );","} else {","const float LOG2 = 1.442695;","fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );","fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","}","gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );","}","}"].join("\n")),l.compileShader(n),l.compileShader(i),l.attachShader(t,n),l.attachShader(t,i),l.linkProgram(t),t}(),o={position:l.getAttribLocation(r,"position"),uv:l.getAttribLocation(r,"uv")},a={uvOffset:l.getUniformLocation(r,"uvOffset"),uvScale:l.getUniformLocation(r,"uvScale"),rotation:l.getUniformLocation(r,"rotation"),scale:l.getUniformLocation(r,"scale"),color:l.getUniformLocation(r,"color"),map:l.getUniformLocation(r,"map"),opacity:l.getUniformLocation(r,"opacity"),modelViewMatrix:l.getUniformLocation(r,"modelViewMatrix"),projectionMatrix:l.getUniformLocation(r,"projectionMatrix"),fogType:l.getUniformLocation(r,"fogType"),fogDensity:l.getUniformLocation(r,"fogDensity"),fogNear:l.getUniformLocation(r,"fogNear"),fogFar:l.getUniformLocation(r,"fogFar"),fogColor:l.getUniformLocation(r,"fogColor"),alphaTest:l.getUniformLocation(r,"alphaTest")};var c=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");c.width=8,c.height=8;var d=c.getContext("2d");d.fillStyle="white",d.fillRect(0,0,8,8),(s=new Rt(c)).needsUpdate=!0}function f(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:t.id-e.id}this.render=function(m,g){if(0!==t.length){void 0===r&&p(),l.useProgram(r),u.initAttributes(),u.enableAttribute(o.position),u.enableAttribute(o.uv),u.disableUnusedAttributes(),u.disable(l.CULL_FACE),u.enable(l.BLEND),l.bindBuffer(l.ARRAY_BUFFER,n),l.vertexAttribPointer(o.position,2,l.FLOAT,!1,16,0),l.vertexAttribPointer(o.uv,2,l.FLOAT,!1,16,8),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,i),l.uniformMatrix4fv(a.projectionMatrix,!1,g.projectionMatrix.elements),u.activeTexture(l.TEXTURE0),l.uniform1i(a.map,0);var y=0,v=0,b=m.fog;b?(l.uniform3f(a.fogColor,b.color.r,b.color.g,b.color.b),b.isFog?(l.uniform1f(a.fogNear,b.near),l.uniform1f(a.fogFar,b.far),l.uniform1i(a.fogType,1),y=1,v=1):b.isFogExp2&&(l.uniform1f(a.fogDensity,b.density),l.uniform1i(a.fogType,2),y=2,v=2)):(l.uniform1i(a.fogType,0),y=0,v=0);for(var _=0,x=t.length;_this.max.x||e.ythis.max.y)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){return(t||new St).set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)},clampPoint:function(e,t){return(t||new St).copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new St;return function(t){return e.copy(t).clamp(this.min,this.max).sub(t).length()}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}};var In,Dn,Nn,Fn,zn,Bn,jn,Un,Wn,Gn,Vn,Hn=0;function Yn(){Object.defineProperty(this,"id",{value:Hn++}),this.uuid=Mt.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=T,this.side=y,this.shading=x,this.vertexColors=w,this.opacity=1,this.transparent=!1,this.blendSrc=j,this.blendDst=U,this.blendEquation=A,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=Z,this.depthTest=!0,this.depthWrite=!0,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.alphaTest=0,this.premultipliedAlpha=!1,this.overdraw=0,this.visible=!0,this._needsUpdate=!0}function qn(e){Yn.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.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,void 0!==e&&(void 0!==e.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))}function Xn(e){Yn.call(this),this.type="MeshDepthMaterial",this.depthPacking=xt,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.lights=!1,this.setValues(e)}function Kn(e,t){this.min=void 0!==e?e:new Ft(1/0,1/0,1/0),this.max=void 0!==t?t:new Ft(-1/0,-1/0,-1/0)}function Zn(e,t){this.center=void 0!==e?e:new Ft,this.radius=void 0!==t?t:0}function Jn(){this.elements=new Float32Array([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.")}function $n(e,t){this.normal=void 0!==e?e:new Ft(1,0,0),this.constant=void 0!==t?t:0}function Qn(e,t,n,i,r,o){this.planes=[void 0!==e?e:new $n,void 0!==t?t:new $n,void 0!==n?n:new $n,void 0!==i?i:new $n,void 0!==r?r:new $n,void 0!==o?o:new $n]}function ei(e,t,n,i){var r=e.context,o=e.state,a=new Qn,s=new zt,l=t.shadows,u=new St,c=new St(i.maxTextureSize,i.maxTextureSize),d=new Ft,h=new Ft,p=[],f=1,g=2,_=1+(f|g),x=new Array(_),w=new Array(_),M={},S=[new Ft(1,0,0),new Ft(-1,0,0),new Ft(0,0,1),new Ft(0,0,-1),new Ft(0,1,0),new Ft(0,-1,0)],E=[new Ft(0,1,0),new Ft(0,1,0),new Ft(0,1,0),new Ft(0,1,0),new Ft(0,0,1),new Ft(0,0,-1)],T=[new Lt,new Lt,new Lt,new Lt,new Lt,new Lt],C=new Xn;C.depthPacking=wt,C.clipping=!0;for(var O=Pn.distanceRGBA,k=Sn.clone(O.uniforms),P=0;P!==_;++P){var A=0!=(P&f),R=0!=(P&g),L=C.clone();L.morphTargets=A,L.skinning=R,x[P]=L;var I=new qn({defines:{USE_SHADOWMAP:""},uniforms:k,vertexShader:O.vertexShader,fragmentShader:O.fragmentShader,morphTargets:A,skinning:R,clipping:!0});w[P]=I}var D=this;function N(t,n,i,r){var o=t.geometry,a=null,s=x,l=t.customDepthMaterial;if(i&&(s=w,l=t.customDistanceMaterial),l)a=l;else{var u=!1;n.morphTargets&&(o&&o.isBufferGeometry?u=o.morphAttributes&&o.morphAttributes.position&&o.morphAttributes.position.length>0:o&&o.isGeometry&&(u=o.morphTargets&&o.morphTargets.length>0));var c=t.isSkinnedMesh&&n.skinning,d=0;u&&(d|=f),c&&(d|=g),a=s[d]}if(e.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length){var h=a.uuid,p=n.uuid,m=M[h];void 0===m&&(m={},M[h]=m);var _=m[p];void 0===_&&(_=a.clone(),m[p]=_),a=_}a.visible=n.visible,a.wireframe=n.wireframe;var S=n.side;return D.renderSingleSided&&S==b&&(S=y),D.renderReverseSided&&(S===y?S=v:S===v&&(S=y)),a.side=S,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,i&&void 0!==a.uniforms.lightPos&&a.uniforms.lightPos.value.copy(r),a}function F(e,t,n){if(!1!==e.visible){if(0!=(e.layers.mask&t.layers.mask)&&(e.isMesh||e.isLine||e.isPoints))if(e.castShadow&&(!1===e.frustumCulled||!0===a.intersectsObject(e)))!0===e.material.visible&&(e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),p.push(e));for(var i=e.children,r=0,o=i.length;r0&&(n.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),n.skinning=this.skinning,n.morphTargets=this.morphTargets,t){var r=i(e.textures),o=i(e.images);r.length>0&&(n.textures=r),o.length>0&&(n.images=o)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.lights=e.lights,this.blending=e.blending,this.side=e.side,this.shading=e.shading,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.overdraw=e.overdraw,this.visible=e.visible,this.clipShadows=e.clipShadows,this.clipIntersection=e.clipIntersection;var t=e.clippingPlanes,n=null;if(null!==t){var i=t.length;n=new Array(i);for(var r=0;r!==i;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}},Object.assign(Yn.prototype,i.prototype),qn.prototype=Object.create(Yn.prototype),qn.prototype.constructor=qn,qn.prototype.isShaderMaterial=!0,qn.prototype.copy=function(e){return Yn.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Sn.clone(e.uniforms),this.defines=e.defines,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=e.extensions,this},qn.prototype.toJSON=function(e){var t=Yn.prototype.toJSON.call(this,e);return t.uniforms=this.uniforms,t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t},Xn.prototype=Object.create(Yn.prototype),Xn.prototype.constructor=Xn,Xn.prototype.isMeshDepthMaterial=!0,Xn.prototype.copy=function(e){return Yn.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},Kn.prototype={constructor:Kn,isBox3:!0,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){for(var t=1/0,n=1/0,i=1/0,r=-1/0,o=-1/0,a=-1/0,s=0,l=e.length;sr&&(r=u),c>o&&(o=c),d>a&&(a=d)}return this.min.set(t,n,i),this.max.set(r,o,a),this},setFromBufferAttribute:function(e){for(var t=1/0,n=1/0,i=1/0,r=-1/0,o=-1/0,a=-1/0,s=0,l=e.count;sr&&(r=u),c>o&&(o=c),d>a&&(a=d)}return this.min.set(t,n,i),this.max.set(r,o,a),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){return(t||new Ft).set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)},intersectsSphere:function(e){return void 0===Dn&&(Dn=new Ft),this.clampPoint(e.center,Dn),Dn.distanceToSquared(e.center)<=e.radius*e.radius},intersectsPlane:function(e){var t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=e.constant&&n>=e.constant},clampPoint:function(e,t){return(t||new Ft).copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new Ft;return function(t){return e.copy(t).clamp(this.min,this.max).sub(t).length()}}(),getBoundingSphere:function(){var e=new Ft;return function(t){var n=t||new Zn;return this.getCenter(n.center),n.radius=.5*this.getSize(e).length(),n}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:(In=[new Ft,new Ft,new Ft,new Ft,new Ft,new Ft,new Ft,new Ft],function(e){return this.isEmpty()?this:(In[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),In[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),In[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),In[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),In[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),In[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),In[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),In[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(In),this)}),translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},Zn.prototype={constructor:Zn,set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(e,t){void 0===Nn&&(Nn=new Kn);var n=this.center;void 0!==t?n.copy(t):Nn.setFromPoints(e).getCenter(n);for(var i=0,r=0,o=e.length;rthis.radius*this.radius&&(i.sub(this.center).normalize(),i.multiplyScalar(this.radius).add(this.center)),i},getBoundingBox:function(e){var t=e||new Kn;return t.set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}},Jn.prototype={constructor:Jn,isMatrix3:!0,set:function(e,t,n,i,r,o,a,s,l){var u=this.elements;return u[0]=e,u[1]=i,u[2]=a,u[3]=t,u[4]=r,u[5]=s,u[6]=n,u[7]=o,u[8]=l,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(e){var t=e.elements;return this.set(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8]),this},setFromMatrix4:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},applyToBufferAttribute:function(){var e;return function(t){void 0===e&&(e=new Ft);for(var n=0,i=t.count;n1?void 0:i.copy(r).multiplyScalar(a).add(t.start)}}(),intersectsLine:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return(e||new Ft).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var e=new Ft,t=new Jn;return function(n,i){var r=this.coplanarPoint(e).applyMatrix4(n),o=i||t.getNormalMatrix(n),a=this.normal.applyMatrix3(o).normalize();return this.constant=-r.dot(a),this}}(),translate:function(e){return this.constant=this.constant-e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}},Qn.prototype={constructor:Qn,set:function(e,t,n,i,r,o){var a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(i),a[4].copy(r),a[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this},setFromMatrix:function(e){var t=this.planes,n=e.elements,i=n[0],r=n[1],o=n[2],a=n[3],s=n[4],l=n[5],u=n[6],c=n[7],d=n[8],h=n[9],p=n[10],f=n[11],m=n[12],g=n[13],y=n[14],v=n[15];return t[0].setComponents(a-i,c-s,f-d,v-m).normalize(),t[1].setComponents(a+i,c+s,f+d,v+m).normalize(),t[2].setComponents(a+r,c+l,f+h,v+g).normalize(),t[3].setComponents(a-r,c-l,f-h,v-g).normalize(),t[4].setComponents(a-o,c-u,f-p,v-y).normalize(),t[5].setComponents(a+o,c+u,f+p,v+y).normalize(),this},intersectsObject:(Bn=new Zn,function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),Bn.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Bn)}),intersectsSprite:function(){var e=new Zn;return function(t){return e.center.set(0,0,0),e.radius=.7071067811865476,e.applyMatrix4(t.matrixWorld),this.intersectsSphere(e)}}(),intersectsSphere:function(e){for(var t=this.planes,n=e.center,i=-e.radius,r=0;r<6;r++){if(t[r].distanceToPoint(n)0?e.min.x:e.max.x,zn.x=i.normal.x>0?e.max.x:e.min.x,Fn.y=i.normal.y>0?e.min.y:e.max.y,zn.y=i.normal.y>0?e.max.y:e.min.y,Fn.z=i.normal.z>0?e.min.z:e.max.z,zn.z=i.normal.z>0?e.max.z:e.min.z;var r=i.distanceToPoint(Fn),o=i.distanceToPoint(zn);if(r<0&&o<0)return!1}return!0}),containsPoint:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}},ti.prototype={constructor:ti,set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return(t||new Ft).copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:function(){var e=new Ft;return function(t){return this.origin.copy(this.at(t,e)),this}}(),closestPointToPoint:function(e,t){var n=t||new Ft;n.subVectors(e,this.origin);var i=n.dot(this.direction);return i<0?n.copy(this.origin):n.copy(this.direction).multiplyScalar(i).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(){var e=new Ft;return function(t){var n=e.subVectors(t,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(t):(e.copy(this.direction).multiplyScalar(n).add(this.origin),e.distanceToSquared(t))}}(),distanceSqToSegment:(Un=new Ft,Wn=new Ft,Gn=new Ft,function(e,t,n,i){Un.copy(e).add(t).multiplyScalar(.5),Wn.copy(t).sub(e).normalize(),Gn.copy(this.origin).sub(Un);var r,o,a,s,l=.5*e.distanceTo(t),u=-this.direction.dot(Wn),c=Gn.dot(this.direction),d=-Gn.dot(Wn),h=Gn.lengthSq(),p=Math.abs(1-u*u);if(p>0)if(o=u*c-d,s=l*p,(r=u*d-c)>=0)if(o>=-s)if(o<=s){var f=1/p;a=(r*=f)*(r+u*(o*=f)+2*c)+o*(u*r+o+2*d)+h}else o=l,a=-(r=Math.max(0,-(u*o+c)))*r+o*(o+2*d)+h;else o=-l,a=-(r=Math.max(0,-(u*o+c)))*r+o*(o+2*d)+h;else o<=-s?a=-(r=Math.max(0,-(-u*l+c)))*r+(o=r>0?-l:Math.min(Math.max(-l,-d),l))*(o+2*d)+h:o<=s?(r=0,a=(o=Math.min(Math.max(-l,-d),l))*(o+2*d)+h):a=-(r=Math.max(0,-(u*l+c)))*r+(o=r>0?l:Math.min(Math.max(-l,-d),l))*(o+2*d)+h;else o=u>0?-l:l,a=-(r=Math.max(0,-(u*o+c)))*r+o*(o+2*d)+h;return n&&n.copy(this.direction).multiplyScalar(r).add(this.origin),i&&i.copy(Wn).multiplyScalar(o).add(Un),a}),intersectSphere:function(){var e=new Ft;return function(t,n){e.subVectors(t.center,this.origin);var i=e.dot(this.direction),r=e.dot(e)-i*i,o=t.radius*t.radius;if(r>o)return null;var a=Math.sqrt(o-r),s=i-a,l=i+a;return s<0&&l<0?null:s<0?this.at(l,n):this.at(s,n)}}(),intersectsSphere:function(e){return this.distanceToPoint(e.center)<=e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null},intersectPlane:function(e,t){var n=this.distanceToPlane(e);return null===n?null:this.at(n,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0},intersectBox:function(e,t){var n,i,r,o,a,s,l=1/this.direction.x,u=1/this.direction.y,c=1/this.direction.z,d=this.origin;return l>=0?(n=(e.min.x-d.x)*l,i=(e.max.x-d.x)*l):(n=(e.max.x-d.x)*l,i=(e.min.x-d.x)*l),u>=0?(r=(e.min.y-d.y)*u,o=(e.max.y-d.y)*u):(r=(e.max.y-d.y)*u,o=(e.min.y-d.y)*u),n>o||r>i?null:((r>n||n!=n)&&(n=r),(o=0?(a=(e.min.z-d.z)*c,s=(e.max.z-d.z)*c):(a=(e.max.z-d.z)*c,s=(e.min.z-d.z)*c),n>s||a>i?null:((a>n||n!=n)&&(n=a),(s=0?n:i,t)))},intersectsBox:(jn=new Ft,function(e){return null!==this.intersectBox(e,jn)}),intersectTriangle:function(){var e=new Ft,t=new Ft,n=new Ft,i=new Ft;return function(r,o,a,s,l){t.subVectors(o,r),n.subVectors(a,r),i.crossVectors(t,n);var u,c=this.direction.dot(i);if(c>0){if(s)return null;u=1}else{if(!(c<0))return null;u=-1,c=-c}e.subVectors(this.origin,r);var d=u*this.direction.dot(n.crossVectors(e,n));if(d<0)return null;var h=u*this.direction.dot(t.cross(e));if(h<0)return null;if(d+h>c)return null;var p=-u*e.dot(i);return p<0?null:this.at(p/c,l)}}(),applyMatrix4:function(e){return this.direction.add(this.origin).applyMatrix4(e),this.origin.applyMatrix4(e),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}},ni.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],ni.DefaultOrder="XYZ",ni.prototype={constructor:ni,isEuler:!0,get x(){return this._x},set x(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get order(){return this._order},set order(e){this._order=e,this.onChangeCallback()},set:function(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._order=i||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this.onChangeCallback(),this},setFromRotationMatrix:function(e,t,n){var i=Mt.clamp,r=e.elements,o=r[0],a=r[4],s=r[8],l=r[1],u=r[5],c=r[9],d=r[2],h=r[6],p=r[10];return"XYZ"===(t=t||this._order)?(this._y=Math.asin(i(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-c,p),this._z=Math.atan2(-a,o)):(this._x=Math.atan2(h,u),this._z=0)):"YXZ"===t?(this._x=Math.asin(-i(c,-1,1)),Math.abs(c)<.99999?(this._y=Math.atan2(s,p),this._z=Math.atan2(l,u)):(this._y=Math.atan2(-d,o),this._z=0)):"ZXY"===t?(this._x=Math.asin(i(h,-1,1)),Math.abs(h)<.99999?(this._y=Math.atan2(-d,p),this._z=Math.atan2(-a,u)):(this._y=0,this._z=Math.atan2(l,o))):"ZYX"===t?(this._y=Math.asin(-i(d,-1,1)),Math.abs(d)<.99999?(this._x=Math.atan2(h,p),this._z=Math.atan2(l,o)):(this._x=0,this._z=Math.atan2(-a,u))):"YZX"===t?(this._z=Math.asin(i(l,-1,1)),Math.abs(l)<.99999?(this._x=Math.atan2(-c,u),this._y=Math.atan2(-d,o)):(this._x=0,this._y=Math.atan2(s,p))):"XZY"===t?(this._z=Math.asin(-i(a,-1,1)),Math.abs(a)<.99999?(this._x=Math.atan2(h,u),this._y=Math.atan2(s,o)):(this._x=Math.atan2(-c,p),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+t),this._order=t,!1!==n&&this.onChangeCallback(),this},setFromQuaternion:function(){var e;return function(t,n,i){return void 0===e&&(e=new zt),e.makeRotationFromQuaternion(t),this.setFromRotationMatrix(e,n,i)}}(),setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:(Vn=new Nt,function(e){return Vn.setFromEuler(this),this.setFromQuaternion(Vn,e)}),equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new Ft(this._x,this._y,this._z)},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}},ii.prototype={constructor:ii,set:function(e){this.mask=1<n&&(n=e[t]);return n}hi.DefaultUp=new Ft(0,1,0),hi.DefaultMatrixAutoUpdate=!0,hi.prototype={constructor:hi,isObject3D:!0,applyMatrix:function(e){this.matrix.multiplyMatrices(e,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:(si=new Nt,function(e,t){return si.setFromAxisAngle(e,t),this.quaternion.multiply(si),this}),rotateX:function(){var e=new Ft(1,0,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateY:function(){var e=new Ft(0,1,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateZ:function(){var e=new Ft(0,0,1);return function(t){return this.rotateOnAxis(e,t)}}(),translateOnAxis:function(){var e=new Ft;return function(t,n){return e.copy(t).applyQuaternion(this.quaternion),this.position.add(e.multiplyScalar(n)),this}}(),translateX:function(){var e=new Ft(1,0,0);return function(t){return this.translateOnAxis(e,t)}}(),translateY:function(){var e=new Ft(0,1,0);return function(t){return this.translateOnAxis(e,t)}}(),translateZ:function(){var e=new Ft(0,0,1);return function(t){return this.translateOnAxis(e,t)}}(),localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:(ai=new zt,function(e){return e.applyMatrix4(ai.getInverse(this.matrixWorld))}),lookAt:function(){var e=new zt;return function(t){e.lookAt(t,this.position,this.up),this.quaternion.setFromRotationMatrix(e)}}(),add:function(e){if(arguments.length>1){for(var t=0;t1)for(var t=0;t0){i.children=[];for(var r=0;r0&&(n.geometries=o),a.length>0&&(n.materials=a),s.length>0&&(n.textures=s),l.length>0&&(n.images=l)}return n.object=i,n;function u(e){var t=[];for(var n in e){var i=e[n];delete i.metadata,t.push(i)}return t}},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(var n=0;n0?r.multiplyScalar(1/Math.sqrt(o)):r.set(0,0,0)}),fi.barycoordFromPoint=function(){var e=new Ft,t=new Ft,n=new Ft;return function(i,r,o,a,s){e.subVectors(a,r),t.subVectors(o,r),n.subVectors(i,r);var l=e.dot(e),u=e.dot(t),c=e.dot(n),d=t.dot(t),h=t.dot(n),p=l*d-u*u,f=s||new Ft;if(0===p)return f.set(-2,-1,-1);var m=1/p,g=(d*c-u*h)*m,y=(l*h-u*c)*m;return f.set(1-g-y,y,g)}}(),fi.containsPoint=function(){var e=new Ft;return function(t,n,i,r){var o=fi.barycoordFromPoint(t,n,i,r,e);return o.x>=0&&o.y>=0&&o.x+o.y<=1}}(),fi.prototype={constructor:fi,set:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this},setFromPointsAndIndices:function(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},area:function(){var e=new Ft,t=new Ft;return function(){return e.subVectors(this.c,this.b),t.subVectors(this.a,this.b),.5*e.cross(t).length()}}(),midpoint:function(e){return(e||new Ft).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(e){return fi.normal(this.a,this.b,this.c,e)},plane:function(e){return(e||new $n).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(e,t){return fi.barycoordFromPoint(e,this.a,this.b,this.c,t)},containsPoint:function(e){return fi.containsPoint(e,this.a,this.b,this.c)},closestPointToPoint:function(){var e,t,n,i;return function(r,o){void 0===e&&(e=new $n,t=[new pi,new pi,new pi],n=new Ft,i=new Ft);var a=o||new Ft,s=1/0;if(e.setFromCoplanarPoints(this.a,this.b,this.c),e.projectPoint(r,n),!0===this.containsPoint(n))a.copy(n);else{t[0].set(this.a,this.b),t[1].set(this.b,this.c),t[2].set(this.c,this.a);for(var l=0;l0,a=r[1]&&r[1].length>0,s=e.morphTargets,l=s.length;if(l>0){t=[];for(var u=0;u0){c=[];for(u=0;u0?1:-1,u.push(k.x,k.y,k.z),c.push(v/m),c.push(1-b/g),C+=1}}for(b=0;b0)for(h=0;h0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var e,t,n;for(this.computeFaceNormals(),e=0,t=this.faces.length;e0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,n,i,r;for(n=0,i=this.faces.length;n0&&(e+=t[n].distanceTo(t[n-1])),this.lineDistances[n]=e},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Kn),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new Zn),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,n){if(!1!==(e&&e.isGeometry)){var i,r=this.vertices.length,o=this.vertices,a=e.vertices,s=this.faces,l=e.faces,u=this.faceVertexUvs[0],c=e.faceVertexUvs[0],d=this.colors,h=e.colors;void 0===n&&(n=0),void 0!==t&&(i=(new Jn).getNormalMatrix(t));for(var p=0,f=a.length;p=0;n--){var f=h[n];for(this.faces.splice(f,1),a=0,s=this.faceVertexUvs.length;a0,g=p.vertexNormals.length>0,y=1!==p.color.r||1!==p.color.g||1!==p.color.b,v=p.vertexColors.length>0,b=0;if(b=M(b,0,0),b=M(b,1,!0),b=M(b,2,!1),b=M(b,3,f),b=M(b,4,m),b=M(b,5,g),b=M(b,6,y),b=M(b,7,v),a.push(b),a.push(p.a,p.b,p.c),a.push(p.materialIndex),f){var _=this.faceVertexUvs[0][r];a.push(T(_[0]),T(_[1]),T(_[2]))}if(m&&a.push(S(p.normal)),g){var x=p.vertexNormals;a.push(S(x[0]),S(x[1]),S(x[2]))}if(y&&a.push(E(p.color)),v){var w=p.vertexColors;a.push(E(w[0]),E(w[1]),E(w[2]))}}function M(e,t,n){return n?e|1<0&&(e.data.colors=u),d.length>0&&(e.data.uvs=[d]),e.data.faces=a,e},clone:function(){return(new Ri).copy(this)},copy:function(e){var t,n,i,r,o,a;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=e.name;var s=e.vertices;for(t=0,n=s.length;t65535?Si:wi)(e,1):this.index=e},addAttribute:function(e,t){return!1===(t&&t.isBufferAttribute)&&!1===(t&&t.isInterleavedBufferAttribute)?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void this.addAttribute(e,new yi(arguments[1],arguments[2]))):"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),void this.setIndex(t)):(this.attributes[e]=t,this)},getAttribute:function(e){return this.attributes[e]},removeAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,n){this.groups.push({start:e,count:t,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix:function(e){var t=this.attributes.position;void 0!==t&&(e.applyToBufferAttribute(t),t.needsUpdate=!0);var n=this.attributes.normal;void 0!==n&&((new Jn).getNormalMatrix(e).applyToBufferAttribute(n),n.needsUpdate=!0);return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var e;return function(t){return void 0===e&&(e=new zt),e.makeRotationX(t),this.applyMatrix(e),this}}(),rotateY:function(){var e;return function(t){return void 0===e&&(e=new zt),e.makeRotationY(t),this.applyMatrix(e),this}}(),rotateZ:function(){var e;return function(t){return void 0===e&&(e=new zt),e.makeRotationZ(t),this.applyMatrix(e),this}}(),translate:function(){var e;return function(t,n,i){return void 0===e&&(e=new zt),e.makeTranslation(t,n,i),this.applyMatrix(e),this}}(),scale:function(){var e;return function(t,n,i){return void 0===e&&(e=new zt),e.makeScale(t,n,i),this.applyMatrix(e),this}}(),lookAt:function(){var e;return function(t){void 0===e&&(e=new hi),e.lookAt(t),e.updateMatrix(),this.applyMatrix(e.matrix)}}(),center:function(){this.computeBoundingBox();var e=this.boundingBox.getCenter().negate();return this.translate(e.x,e.y,e.z),e},setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){var n=new Ei(3*t.vertices.length,3),i=new Ei(3*t.colors.length,3);if(this.addAttribute("position",n.copyVector3sArray(t.vertices)),this.addAttribute("color",i.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var r=new Ei(t.lineDistances.length,1);this.addAttribute("lineDistance",r.copyArray(t.lineDistances))}null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},updateFromObject:function(e){var t,n=e.geometry;if(e.isMesh){var i=n.__directGeometry;if(!0===n.elementsNeedUpdate&&(i=void 0,n.elementsNeedUpdate=!1),void 0===i)return this.fromGeometry(n);i.verticesNeedUpdate=n.verticesNeedUpdate,i.normalsNeedUpdate=n.normalsNeedUpdate,i.colorsNeedUpdate=n.colorsNeedUpdate,i.uvsNeedUpdate=n.uvsNeedUpdate,i.groupsNeedUpdate=n.groupsNeedUpdate,n.verticesNeedUpdate=!1,n.normalsNeedUpdate=!1,n.colorsNeedUpdate=!1,n.uvsNeedUpdate=!1,n.groupsNeedUpdate=!1,n=i}return!0===n.verticesNeedUpdate&&(void 0!==(t=this.attributes.position)&&(t.copyVector3sArray(n.vertices),t.needsUpdate=!0),n.verticesNeedUpdate=!1),!0===n.normalsNeedUpdate&&(void 0!==(t=this.attributes.normal)&&(t.copyVector3sArray(n.normals),t.needsUpdate=!0),n.normalsNeedUpdate=!1),!0===n.colorsNeedUpdate&&(void 0!==(t=this.attributes.color)&&(t.copyColorsArray(n.colors),t.needsUpdate=!0),n.colorsNeedUpdate=!1),n.uvsNeedUpdate&&(void 0!==(t=this.attributes.uv)&&(t.copyVector2sArray(n.uvs),t.needsUpdate=!0),n.uvsNeedUpdate=!1),n.lineDistancesNeedUpdate&&(void 0!==(t=this.attributes.lineDistance)&&(t.copyArray(n.lineDistances),t.needsUpdate=!0),n.lineDistancesNeedUpdate=!1),n.groupsNeedUpdate&&(n.computeGroups(e.geometry),this.groups=n.groups,n.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=(new Ci).fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(3*e.vertices.length);if(this.addAttribute("position",new yi(t,3).copyVector3sArray(e.vertices)),e.normals.length>0){var n=new Float32Array(3*e.normals.length);this.addAttribute("normal",new yi(n,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var i=new Float32Array(3*e.colors.length);this.addAttribute("color",new yi(i,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var r=new Float32Array(2*e.uvs.length);this.addAttribute("uv",new yi(r,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var o=new Float32Array(2*e.uvs2.length);this.addAttribute("uv2",new yi(o,2).copyVector2sArray(e.uvs2))}if(e.indices.length>0){var a=new(Oi(e.indices)>65535?Uint32Array:Uint16Array)(3*e.indices.length);this.setIndex(new yi(a,1).copyIndicesArray(e.indices))}for(var s in this.groups=e.groups,e.morphTargets){for(var l=[],u=e.morphTargets[s],c=0,d=u.length;c0){var f=new Ei(4*e.skinIndices.length,4);this.addAttribute("skinIndex",f.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var m=new Ei(4*e.skinWeights.length,4);this.addAttribute("skinWeight",m.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Kn);var e=this.attributes.position;void 0!==e?this.boundingBox.setFromBufferAttribute(e):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(){var e=new Kn,t=new Ft;return function(){null===this.boundingSphere&&(this.boundingSphere=new Zn);var n=this.attributes.position;if(n){var i=this.boundingSphere.center;e.setFromBufferAttribute(n),e.getCenter(i);for(var r=0,o=0,a=n.count;o0&&(e.data.groups=JSON.parse(JSON.stringify(s)));var l=this.boundingSphere;return null!==l&&(e.data.boundingSphere={center:l.center.toArray(),radius:l.radius}),e},clone:function(){return(new Li).copy(this)},copy:function(e){var t,n,i;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var r=e.index;null!==r&&this.setIndex(r.clone());var o=e.attributes;for(t in o){var a=o[t];this.addAttribute(t,a.clone())}var s=e.morphAttributes;for(t in s){var l=[],u=s[t];for(n=0,i=u.length;n0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var t=0,n=e.length;tt.far?null:{distance:l,point:f.clone(),object:e}}function y(e,t,n,a,s,l,h,f){i.fromBufferAttribute(a,l),r.fromBufferAttribute(a,h),o.fromBufferAttribute(a,f);var y=g(e,t,n,i,r,o,p);return y&&(s&&(u.fromBufferAttribute(s,l),c.fromBufferAttribute(s,h),d.fromBufferAttribute(s,f),y.uv=m(p,i,r,o,u,c,d)),y.face=new mi(l,h,f,fi.normal(i,r,o)),y.faceIndex=l),y}return function(h,f){var v,b=this.geometry,_=this.material,x=this.matrixWorld;if(void 0!==_&&(null===b.boundingSphere&&b.computeBoundingSphere(),n.copy(b.boundingSphere),n.applyMatrix4(x),!1!==h.ray.intersectsSphere(n)&&(e.getInverse(x),t.copy(h.ray).applyMatrix4(e),null===b.boundingBox||!1!==t.intersectsBox(b.boundingBox))))if(b.isBufferGeometry){var w,M,S,E,T,C=b.index,O=b.attributes.position,k=b.attributes.uv;if(null!==C)for(E=0,T=C.count;E0&&(L=z);for(var B=0,j=F.length;B/g,(function(e,t){var n=En[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return er(n)}))}function tr(e){return e.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,(function(e,t,n,i){for(var r="",o=parseInt(t);o0?e.gammaFactor:1,x=function(e,t,n){return[(e=e||{}).derivatives||t.envMapCubeUV||t.bumpMap||t.normalMap||t.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(e.fragDepth||t.logarithmicDepthBuffer)&&n.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",e.drawBuffers&&n.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(e.shaderTextureLOD||t.envMap)&&n.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter($i).join("\n")}(o,i,e.extensions),w=function(e){var t=[];for(var n in e){var i=e[n];!1!==i&&t.push("#define "+n+" "+i)}return t.join("\n")}(a),M=r.createProgram();n.isRawShaderMaterial?(p=[w,"\n"].filter($i).join("\n"),f=[x,w,"\n"].filter($i).join("\n")):(p=["precision "+i.precision+" float;","precision "+i.precision+" int;","#define SHADER_NAME "+n.__webglShader.name,w,i.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+_,"#define MAX_BONES "+i.maxBones,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+d:"",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.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.vertexColors?"#define USE_COLOR":"",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":"","#define NUM_CLIPPING_PLANES "+i.numClippingPlanes,i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+u:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&e.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#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($i).join("\n"),f=[x,"precision "+i.precision+" float;","precision "+i.precision+" int;","#define SHADER_NAME "+n.__webglShader.name,w,i.alphaTest?"#define ALPHATEST "+i.alphaTest:"","#define GAMMA_FACTOR "+_,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+c:"",i.envMap?"#define "+d:"",i.envMap?"#define "+h:"",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.specularMap?"#define USE_SPECULARMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.vertexColors?"#define USE_COLOR":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+i.numClippingPlanes,"#define UNION_CLIPPING_PLANES "+(i.numClippingPlanes-i.numClipIntersection),i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+u:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&e.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",i.envMap&&e.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",i.toneMapping!==re?"#define TONE_MAPPING":"",i.toneMapping!==re?En.tonemapping_pars_fragment:"",i.toneMapping!==re?Ji("toneMapping",i.toneMapping):"",i.outputEncoding||i.mapEncoding||i.envMapEncoding||i.emissiveMapEncoding?En.encodings_pars_fragment:"",i.mapEncoding?Zi("mapTexelToLinear",i.mapEncoding):"",i.envMapEncoding?Zi("envMapTexelToLinear",i.envMapEncoding):"",i.emissiveMapEncoding?Zi("emissiveMapTexelToLinear",i.emissiveMapEncoding):"",i.outputEncoding?(y="linearToOutputTexel",v=i.outputEncoding,b=Ki(v),"vec4 "+y+"( vec4 value ) { return LinearTo"+b[0]+b[1]+"; }"):"",i.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter($i).join("\n")),s=Qi(s=er(s),i),l=Qi(l=er(l),i),n.isShaderMaterial||(s=tr(s),l=tr(l));var S=p+s,E=f+l,T=Hi(r,r.VERTEX_SHADER,S),C=Hi(r,r.FRAGMENT_SHADER,E);r.attachShader(M,T),r.attachShader(M,C),void 0!==n.index0AttributeName?r.bindAttribLocation(M,0,n.index0AttributeName):!0===i.morphTargets&&r.bindAttribLocation(M,0,"position"),r.linkProgram(M);var O,k,P=r.getProgramInfoLog(M),A=r.getShaderInfoLog(T),R=r.getShaderInfoLog(C),L=!0,I=!0;return!1===r.getProgramParameter(M,r.LINK_STATUS)?(L=!1,console.error("THREE.WebGLProgram: shader error: ",r.getError(),"gl.VALIDATE_STATUS",r.getProgramParameter(M,r.VALIDATE_STATUS),"gl.getProgramInfoLog",P,A,R)):""!==P?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",P):""!==A&&""!==R||(I=!1),I&&(this.diagnostics={runnable:L,material:n,programLog:P,vertexShader:{log:A,prefix:p},fragmentShader:{log:R,prefix:f}}),r.deleteShader(T),r.deleteShader(C),this.getUniforms=function(){return void 0===O&&(O=new Mn(r,M,e)),O},this.getAttributes=function(){return void 0===k&&(k=function(e,t,n){for(var i={},r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES),o=0;o0,shadowMapType:e.shadowMap.type,toneMapping:e.toneMapping,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:n.premultipliedAlpha,alphaTest:n.alphaTest,doubleSided:n.side===b,flipSided:n.side===v,depthPacking:void 0!==n.depthPacking&&n.depthPacking}},this.getProgramCode=function(e,t){var n=[];if(t.shaderID?n.push(t.shaderID):(n.push(e.fragmentShader),n.push(e.vertexShader)),void 0!==e.defines)for(var i in e.defines)n.push(i),n.push(e.defines[i]);for(var o=0;o65535?Si:wi)(a,1);return r(f,e.ELEMENT_ARRAY_BUFFER),i.wireframe=f,f},update:function(t){var n=i.get(t);t.geometry.isGeometry&&n.updateFromObject(t);var o=n.index,a=n.attributes;for(var s in null!==o&&r(o,e.ELEMENT_ARRAY_BUFFER),a)r(a[s],e.ARRAY_BUFFER);var l=n.morphAttributes;for(var s in l)for(var u=l[s],c=0,d=u.length;ct||e.height>t){var n=t/Math.max(e.width,e.height),i=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return i.width=Math.floor(e.width*n),i.height=Math.floor(e.height*n),i.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,i.width,i.height),console.warn("THREE.WebGLRenderer: image is too big ("+e.width+"x"+e.height+"). Resized to "+i.width+"x"+i.height,e),i}return e}function c(e){return Mt.isPowerOfTwo(e.width)&&Mt.isPowerOfTwo(e.height)}function d(t){return t===_e||t===xe||t===we?e.NEAREST:e.LINEAR}function h(t){var n=t.target;n.removeEventListener("dispose",h),function(t){var n=i.get(t);if(t.image&&n.__image__webglTextureCube)e.deleteTexture(n.__image__webglTextureCube);else{if(void 0===n.__webglInit)return;e.deleteTexture(n.__webglTexture)}i.delete(t)}(n),s.textures--}function p(t){var n=t.target;n.removeEventListener("dispose",p),function(t){var n=i.get(t),r=i.get(t.texture);if(!t)return;void 0!==r.__webglTexture&&e.deleteTexture(r.__webglTexture);t.depthTexture&&t.depthTexture.dispose();if(t.isWebGLRenderTargetCube)for(var o=0;o<6;o++)e.deleteFramebuffer(n.__webglFramebuffer[o]),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[o]);else e.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer);i.delete(t.texture),i.delete(t)}(n),s.textures--}function f(t,a){var d=i.get(t);if(t.version>0&&d.__version!==t.version){var p=t.image;if(void 0===p)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",t);else{if(!1!==p.complete)return void function(t,i,a){void 0===t.__webglInit&&(t.__webglInit=!0,i.addEventListener("dispose",h),t.__webglTexture=e.createTexture(),s.textures++);n.activeTexture(e.TEXTURE0+a),n.bindTexture(e.TEXTURE_2D,t.__webglTexture),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,i.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,i.unpackAlignment);var d=u(i.image,r.maxTextureSize);(function(e){return e.wrapS!==ve||e.wrapT!==ve||e.minFilter!==_e&&e.minFilter!==Me})(i)&&!1===c(d)&&(d=function(e){if(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement){var t=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return t.width=Mt.nearestPowerOfTwo(e.width),t.height=Mt.nearestPowerOfTwo(e.height),t.getContext("2d").drawImage(e,0,0,t.width,t.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+e.width+"x"+e.height+"). Resized to "+t.width+"x"+t.height,e),t}return e}(d));var p=c(d),f=o(i.format),g=o(i.type);m(e.TEXTURE_2D,i,p);var y,v=i.mipmaps;if(i.isDepthTexture){var b=e.DEPTH_COMPONENT;if(i.type===Re){if(!l)throw new Error("Float Depth Texture only supported in WebGL2.0");b=e.DEPTH_COMPONENT32F}else l&&(b=e.DEPTH_COMPONENT16);i.format===Ve&&b===e.DEPTH_COMPONENT&&i.type!==ke&&i.type!==Ae&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=ke,g=o(i.type)),i.format===He&&(b=e.DEPTH_STENCIL,i.type!==Fe&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=Fe,g=o(i.type))),n.texImage2D(e.TEXTURE_2D,0,b,d.width,d.height,0,f,g,null)}else if(i.isDataTexture)if(v.length>0&&p){for(var _=0,x=v.length;_-1?n.compressedTexImage2D(e.TEXTURE_2D,_,f,y.width,y.height,0,y.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(e.TEXTURE_2D,_,f,y.width,y.height,0,f,g,y.data);else if(v.length>0&&p){for(_=0,x=v.length;_1||i.get(a).__currentAnisotropy)&&(e.texParameterf(n,l.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy)}}function g(t,r,a,s){var l=o(r.texture.format),u=o(r.texture.type);n.texImage2D(s,0,l,r.width,r.height,0,l,u,null),e.bindFramebuffer(e.FRAMEBUFFER,t),e.framebufferTexture2D(e.FRAMEBUFFER,a,s,i.get(r.texture).__webglTexture,0),e.bindFramebuffer(e.FRAMEBUFFER,null)}function y(t,n){e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer&&!n.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t)):n.depthBuffer&&n.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t)):e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,n.width,n.height),e.bindRenderbuffer(e.RENDERBUFFER,null)}function v(t){var n=i.get(t),r=!0===t.isWebGLRenderTargetCube;if(t.depthTexture){if(r)throw new Error("target.depthTexture not supported in Cube render targets");!function(t,n){if(n&&n.isWebGLRenderTargetCube)throw new Error("Depth Texture with cube render targets is not supported!");if(e.bindFramebuffer(e.FRAMEBUFFER,t),!n.depthTexture||!n.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");i.get(n.depthTexture).__webglTexture&&n.depthTexture.image.width===n.width&&n.depthTexture.image.height===n.height||(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=!0),f(n.depthTexture,0);var r=i.get(n.depthTexture).__webglTexture;if(n.depthTexture.format===Ve)e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,r,0);else{if(n.depthTexture.format!==He)throw new Error("Unknown depthTexture format");e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,r,0)}}(n.__webglFramebuffer,t)}else if(r){n.__webglDepthbuffer=[];for(var o=0;o<6;o++)e.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer[o]),n.__webglDepthbuffer[o]=e.createRenderbuffer(),y(n.__webglDepthbuffer[o],t)}else e.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer),n.__webglDepthbuffer=e.createRenderbuffer(),y(n.__webglDepthbuffer,t);e.bindFramebuffer(e.FRAMEBUFFER,null)}this.setTexture2D=f,this.setTextureCube=function(t,a){var l=i.get(t);if(6===t.image.length)if(t.version>0&&l.__version!==t.version){l.__image__webglTextureCube||(t.addEventListener("dispose",h),l.__image__webglTextureCube=e.createTexture(),s.textures++),n.activeTexture(e.TEXTURE0+a),n.bindTexture(e.TEXTURE_CUBE_MAP,l.__image__webglTextureCube),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t.flipY);for(var d=t&&t.isCompressedTexture,p=t.image[0]&&t.image[0].isDataTexture,f=[],g=0;g<6;g++)f[g]=d||p?p?t.image[g].image:t.image[g]:u(t.image[g],r.maxCubemapSize);var y=c(f[0]),v=o(t.format),b=o(t.type);m(e.TEXTURE_CUBE_MAP,t,y);for(g=0;g<6;g++)if(d)for(var _,x=f[g].mipmaps,w=0,M=x.length;w-1?n.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+g,w,v,_.width,_.height,0,_.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+g,w,v,_.width,_.height,0,v,b,_.data);else p?n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,v,f[g].width,f[g].height,0,v,b,f[g].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,v,v,b,f[g]);t.generateMipmaps&&y&&e.generateMipmap(e.TEXTURE_CUBE_MAP),l.__version=t.version,t.onUpdate&&t.onUpdate(t)}else n.activeTexture(e.TEXTURE0+a),n.bindTexture(e.TEXTURE_CUBE_MAP,l.__image__webglTextureCube)},this.setTextureCubeDynamic=function(t,r){n.activeTexture(e.TEXTURE0+r),n.bindTexture(e.TEXTURE_CUBE_MAP,i.get(t).__webglTexture)},this.setupRenderTarget=function(t){var r=i.get(t),o=i.get(t.texture);t.addEventListener("dispose",p),o.__webglTexture=e.createTexture(),s.textures++;var a=!0===t.isWebGLRenderTargetCube,l=c(t);if(a){r.__webglFramebuffer=[];for(var u=0;u<6;u++)r.__webglFramebuffer[u]=e.createFramebuffer()}else r.__webglFramebuffer=e.createFramebuffer();if(a){n.bindTexture(e.TEXTURE_CUBE_MAP,o.__webglTexture),m(e.TEXTURE_CUBE_MAP,t.texture,l);for(u=0;u<6;u++)g(r.__webglFramebuffer[u],t,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+u);t.texture.generateMipmaps&&l&&e.generateMipmap(e.TEXTURE_CUBE_MAP),n.bindTexture(e.TEXTURE_CUBE_MAP,null)}else n.bindTexture(e.TEXTURE_2D,o.__webglTexture),m(e.TEXTURE_2D,t.texture,l),g(r.__webglFramebuffer,t,e.COLOR_ATTACHMENT0,e.TEXTURE_2D),t.texture.generateMipmaps&&l&&e.generateMipmap(e.TEXTURE_2D),n.bindTexture(e.TEXTURE_2D,null);t.depthBuffer&&v(t)},this.updateRenderTargetMipmap=function(t){var r=t.texture;if(r.generateMipmaps&&c(t)&&r.minFilter!==_e&&r.minFilter!==Me){var o=t&&t.isWebGLRenderTargetCube?e.TEXTURE_CUBE_MAP:e.TEXTURE_2D,a=i.get(r).__webglTexture;n.bindTexture(o,a),e.generateMipmap(o),n.bindTexture(o,null)}}}function sr(){var e={};return{get:function(t){var n=t.uuid,i=e[n];return void 0===i&&(i={},e[n]=i),i},delete:function(t){delete e[t.uuid]},clear:function(){e={}}}}function lr(e,t,n){var i=new function(){var t=!1,n=new Lt,i=null,r=new Lt;return{setMask:function(n){i===n||t||(e.colorMask(n,n,n,n),i=n)},setLocked:function(e){t=e},setClear:function(t,i,o,a,s){!0===s&&(t*=a,i*=a,o*=a),n.set(t,i,o,a),!1===r.equals(n)&&(e.clearColor(t,i,o,a),r.copy(n))},reset:function(){t=!1,i=null,r.set(0,0,0,1)}}},r=new function(){var t=!1,n=null,i=null,r=null;return{setTest:function(t){t?V(e.DEPTH_TEST):H(e.DEPTH_TEST)},setMask:function(i){n===i||t||(e.depthMask(i),n=i)},setFunc:function(t){if(i!==t){if(t)switch(t){case q:e.depthFunc(e.NEVER);break;case X:e.depthFunc(e.ALWAYS);break;case K:e.depthFunc(e.LESS);break;case Z:e.depthFunc(e.LEQUAL);break;case J:e.depthFunc(e.EQUAL);break;case $:e.depthFunc(e.GEQUAL);break;case Q:e.depthFunc(e.GREATER);break;case ee:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}else e.depthFunc(e.LEQUAL);i=t}},setLocked:function(e){t=e},setClear:function(t){r!==t&&(e.clearDepth(t),r=t)},reset:function(){t=!1,n=null,i=null,r=null}}},o=new function(){var t=!1,n=null,i=null,r=null,o=null,a=null,s=null,l=null,u=null;return{setTest:function(t){t?V(e.STENCIL_TEST):H(e.STENCIL_TEST)},setMask:function(i){n===i||t||(e.stencilMask(i),n=i)},setFunc:function(t,n,a){i===t&&r===n&&o===a||(e.stencilFunc(t,n,a),i=t,r=n,o=a)},setOp:function(t,n,i){a===t&&s===n&&l===i||(e.stencilOp(t,n,i),a=t,s=n,l=i)},setLocked:function(e){t=e},setClear:function(t){u!==t&&(e.clearStencil(t),u=t)},reset:function(){t=!1,n=null,i=null,r=null,o=null,a=null,s=null,l=null,u=null}}},a=e.getParameter(e.MAX_VERTEX_ATTRIBS),s=new Uint8Array(a),d=new Uint8Array(a),h=new Uint8Array(a),p={},f=null,m=null,g=null,y=null,v=null,b=null,_=null,x=null,w=!1,M=null,S=null,A=null,R=null,L=null,I=null,D=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),N=parseFloat(/^WebGL\ ([0-9])/.exec(e.getParameter(e.VERSION))[1]),F=parseFloat(N)>=1,z=null,B={},j=new Lt,U=new Lt;function W(t,n,i){var r=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(var a=0;a0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var o=void 0!==n.precision?n.precision:"highp",a=r(o);a!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",a,"instead."),o=a);var s=!0===n.logarithmicDepthBuffer&&!!t.get("EXT_frag_depth"),l=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),u=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),c=e.getParameter(e.MAX_TEXTURE_SIZE),d=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),h=e.getParameter(e.MAX_VERTEX_ATTRIBS),p=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),f=e.getParameter(e.MAX_VARYING_VECTORS),m=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),g=u>0,y=!!t.get("OES_texture_float");return{getMaxAnisotropy:function(){if(void 0!==i)return i;var n=t.get("EXT_texture_filter_anisotropic");return i=null!==n?e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:r,precision:o,logarithmicDepthBuffer:s,maxTextures:l,maxVertexTextures:u,maxTextureSize:c,maxCubemapSize:d,maxAttributes:h,maxVertexUniforms:p,maxVaryings:f,maxFragmentUniforms:m,vertexTextures:g,floatFragmentTextures:y,floatVertexTextures:g&&y}}function cr(e){var t={};return{get:function(n){if(void 0!==t[n])return t[n];var i;switch(n){case"WEBGL_depth_texture":i=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":i=e.getExtension("WEBGL_compressed_texture_etc1");break;default:i=e.getExtension(n)}return null===i&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),t[n]=i,i}}}function dr(){var e=this,t=null,n=0,i=!1,r=!1,o=new $n,a=new Jn,s={value:null,needsUpdate:!1};function l(){s.value!==t&&(s.value=t,s.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(t,n,i,r){var l=null!==t?t.length:0,u=null;if(0!==l){if(u=s.value,!0!==r||null===u){var c=i+4*l,d=n.matrixWorldInverse;a.getNormalMatrix(d),(null===u||u.length=0&&e.numSupportedMorphTargets++}if(e.morphNormals){e.numSupportedMorphNormals=0;for(c=0;c=0&&e.numSupportedMorphNormals++}var d=i.__webglShader.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(i.numClippingPlanes=le.numPlanes,i.numIntersection=le.numIntersection,d.clippingPlanes=le.uniform),i.fog=t,i.lightsHash=ge.hash,e.lights&&(d.ambientLightColor.value=ge.ambient,d.directionalLights.value=ge.directional,d.spotLights.value=ge.spot,d.rectAreaLights.value=ge.rectArea,d.pointLights.value=ge.point,d.hemisphereLights.value=ge.hemi,d.directionalShadowMap.value=ge.directionalShadowMap,d.directionalShadowMatrix.value=ge.directionalShadowMatrix,d.spotShadowMap.value=ge.spotShadowMap,d.spotShadowMatrix.value=ge.spotShadowMatrix,d.pointShadowMap.value=ge.pointShadowMap,d.pointShadowMatrix.value=ge.pointShadowMatrix);var h=i.program.getUniforms(),p=Mn.seqWithValue(h.seq,d);i.uniformsList=p}(n,t,i),n.needsUpdate=!1);var a,s,l=!1,u=!1,c=!1,d=r.program,h=d.getUniforms(),p=r.__webglShader.uniforms;if(d.id!==T&&(M.useProgram(d.program),T=d.id,l=!0,u=!0,c=!0),n.id!==k&&(k=n.id,u=!0),l||e!==q){if(h.set(M,e,"projectionMatrix"),it.logarithmicDepthBuffer&&h.setValue(M,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),e!==q&&(q=e,u=!0,c=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.envMap){var f=h.map.cameraPosition;void 0!==f&&f.setValue(M,pe.setFromMatrixPosition(e.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&h.setValue(M,"viewMatrix",e.matrixWorldInverse),h.set(M,S,"toneMappingExposure"),h.set(M,S,"toneMappingWhitePoint")}if(n.skinning){h.setOptional(M,i,"bindMatrix"),h.setOptional(M,i,"bindMatrixInverse");var m=i.skeleton;m&&(it.floatVertexTextures&&m.useVertexTexture?(h.set(M,m,"boneTexture"),h.set(M,m,"boneTextureWidth"),h.set(M,m,"boneTextureHeight")):h.setOptional(M,m,"boneMatrices"))}return u&&(n.lights&&(s=c,(a=p).ambientLightColor.needsUpdate=s,a.directionalLights.needsUpdate=s,a.pointLights.needsUpdate=s,a.spotLights.needsUpdate=s,a.rectAreaLights.needsUpdate=s,a.hemisphereLights.needsUpdate=s),t&&n.fog&&function(e,t){e.fogColor.value=t.color,t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)}(p,t),(n.isMeshBasicMaterial||n.isMeshLambertMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.isMeshNormalMaterial||n.isMeshDepthMaterial)&&function(e,t){e.opacity.value=t.opacity,e.diffuse.value=t.color,t.emissive&&e.emissive.value.copy(t.emissive).multiplyScalar(t.emissiveIntensity);e.map.value=t.map,e.specularMap.value=t.specularMap,e.alphaMap.value=t.alphaMap,t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity);t.aoMap&&(e.aoMap.value=t.aoMap,e.aoMapIntensity.value=t.aoMapIntensity);var n;t.map?n=t.map:t.specularMap?n=t.specularMap:t.displacementMap?n=t.displacementMap:t.normalMap?n=t.normalMap:t.bumpMap?n=t.bumpMap:t.roughnessMap?n=t.roughnessMap:t.metalnessMap?n=t.metalnessMap:t.alphaMap?n=t.alphaMap:t.emissiveMap&&(n=t.emissiveMap);if(void 0!==n){n.isWebGLRenderTarget&&(n=n.texture);var i=n.offset,r=n.repeat;e.offsetRepeat.value.set(i.x,i.y,r.x,r.y)}e.envMap.value=t.envMap,e.flipEnvMap.value=t.envMap&&t.envMap.isCubeTexture?-1:1,e.reflectivity.value=t.reflectivity,e.refractionRatio.value=t.refractionRatio}(p,n),n.isLineBasicMaterial?jt(p,n):n.isLineDashedMaterial?(jt(p,n),function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(p,n)):n.isPointsMaterial?function(e,t){if(e.diffuse.value=t.color,e.opacity.value=t.opacity,e.size.value=t.size*ne,e.scale.value=.5*te,e.map.value=t.map,null!==t.map){var n=t.map.offset,i=t.map.repeat;e.offsetRepeat.value.set(n.x,n.y,i.x,i.y)}}(p,n):n.isMeshLambertMaterial?function(e,t){t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}(p,n):n.isMeshToonMaterial?function(e,t){Ut(e,t),t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(p,n):n.isMeshPhongMaterial?Ut(p,n):n.isMeshPhysicalMaterial?function(e,t){e.clearCoat.value=t.clearCoat,e.clearCoatRoughness.value=t.clearCoatRoughness,Wt(e,t)}(p,n):n.isMeshStandardMaterial?Wt(p,n):n.isMeshDepthMaterial?n.displacementMap&&(p.displacementMap.value=n.displacementMap,p.displacementScale.value=n.displacementScale,p.displacementBias.value=n.displacementBias):n.isMeshNormalMaterial&&function(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale);t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale));t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(p,n),void 0!==p.ltcMat&&(p.ltcMat.value=THREE.UniformsLib.LTC_MAT_TEXTURE),void 0!==p.ltcMag&&(p.ltcMag.value=THREE.UniformsLib.LTC_MAG_TEXTURE),Mn.upload(M,r.uniformsList,p,S)),h.set(M,i,"modelViewMatrix"),h.set(M,i,"normalMatrix"),h.setValue(M,"modelMatrix",i.matrixWorld),d}function jt(e,t){e.diffuse.value=t.color,e.opacity.value=t.opacity}function Ut(e,t){e.specular.value=t.specular,e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale)),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function Wt(e,t){e.roughness.value=t.roughness,e.metalness.value=t.metalness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap),t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale)),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}function Gt(e){var t;if(e===ye)return M.REPEAT;if(e===ve)return M.CLAMP_TO_EDGE;if(e===be)return M.MIRRORED_REPEAT;if(e===_e)return M.NEAREST;if(e===xe)return M.NEAREST_MIPMAP_NEAREST;if(e===we)return M.NEAREST_MIPMAP_LINEAR;if(e===Me)return M.LINEAR;if(e===Se)return M.LINEAR_MIPMAP_NEAREST;if(e===Ee)return M.LINEAR_MIPMAP_LINEAR;if(e===Te)return M.UNSIGNED_BYTE;if(e===Ie)return M.UNSIGNED_SHORT_4_4_4_4;if(e===De)return M.UNSIGNED_SHORT_5_5_5_1;if(e===Ne)return M.UNSIGNED_SHORT_5_6_5;if(e===Ce)return M.BYTE;if(e===Oe)return M.SHORT;if(e===ke)return M.UNSIGNED_SHORT;if(e===Pe)return M.INT;if(e===Ae)return M.UNSIGNED_INT;if(e===Re)return M.FLOAT;if(e===Le&&null!==(t=nt.get("OES_texture_half_float")))return t.HALF_FLOAT_OES;if(e===ze)return M.ALPHA;if(e===Be)return M.RGB;if(e===je)return M.RGBA;if(e===Ue)return M.LUMINANCE;if(e===We)return M.LUMINANCE_ALPHA;if(e===Ve)return M.DEPTH_COMPONENT;if(e===He)return M.DEPTH_STENCIL;if(e===A)return M.FUNC_ADD;if(e===R)return M.FUNC_SUBTRACT;if(e===L)return M.FUNC_REVERSE_SUBTRACT;if(e===N)return M.ZERO;if(e===F)return M.ONE;if(e===z)return M.SRC_COLOR;if(e===B)return M.ONE_MINUS_SRC_COLOR;if(e===j)return M.SRC_ALPHA;if(e===U)return M.ONE_MINUS_SRC_ALPHA;if(e===W)return M.DST_ALPHA;if(e===G)return M.ONE_MINUS_DST_ALPHA;if(e===V)return M.DST_COLOR;if(e===H)return M.ONE_MINUS_DST_COLOR;if(e===Y)return M.SRC_ALPHA_SATURATE;if((e===Ye||e===qe||e===Xe||e===Ke)&&null!==(t=nt.get("WEBGL_compressed_texture_s3tc"))){if(e===Ye)return t.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===qe)return t.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===Xe)return t.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===Ke)return t.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((e===Ze||e===Je||e===$e||e===Qe)&&null!==(t=nt.get("WEBGL_compressed_texture_pvrtc"))){if(e===Ze)return t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===Je)return t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===$e)return t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===Qe)return t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(e===et&&null!==(t=nt.get("WEBGL_compressed_texture_etc1")))return t.COMPRESSED_RGB_ETC1_WEBGL;if((e===I||e===D)&&null!==(t=nt.get("EXT_blend_minmax"))){if(e===I)return t.MIN_EXT;if(e===D)return t.MAX_EXT}return e===Fe&&null!==(t=nt.get("WEBGL_depth_texture"))?t.UNSIGNED_INT_24_8_WEBGL:0}this.getContext=function(){return M},this.getContextAttributes=function(){return M.getContextAttributes()},this.forceContextLoss=function(){nt.get("WEBGL_lose_context").loseContext()},this.getMaxAnisotropy=function(){return it.getMaxAnisotropy()},this.getPrecision=function(){return it.precision},this.getPixelRatio=function(){return ne},this.setPixelRatio=function(e){void 0!==e&&(ne=e,this.setSize(ae.z,ae.w,!1))},this.getSize=function(){return{width:ee,height:te}},this.setSize=function(e,n,i){ee=e,te=n,t.width=e*ne,t.height=n*ne,!1!==i&&(t.style.width=e+"px",t.style.height=n+"px"),this.setViewport(0,0,e,n)},this.setViewport=function(e,t,n,i){rt.viewport(ae.set(e,t,n,i))},this.setScissor=function(e,t,n,i){rt.scissor(ie.set(e,t,n,i))},this.setScissorTest=function(e){rt.setScissorTest(re=e)},this.getClearColor=function(){return $},this.setClearColor=function(e,t){$.set(e),Q=void 0!==t?t:1,rt.buffers.color.setClear($.r,$.g,$.b,Q,l)},this.getClearAlpha=function(){return Q},this.setClearAlpha=function(e){Q=e,rt.buffers.color.setClear($.r,$.g,$.b,Q,l)},this.clear=function(e,t,n){var i=0;(void 0===e||e)&&(i|=M.COLOR_BUFFER_BIT),(void 0===t||t)&&(i|=M.DEPTH_BUFFER_BIT),(void 0===n||n)&&(i|=M.STENCIL_BUFFER_BIT),M.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.clearTarget=function(e,t,n,i){this.setRenderTarget(e),this.clear(t,n,i)},this.resetGLState=xt,this.dispose=function(){f=[],m=-1,d=[],p=-1,t.removeEventListener("webglcontextlost",Tt,!1)},this.renderBufferImmediate=function(e,t,n){rt.initAttributes();var i=ot.get(e);e.hasPositions&&!i.position&&(i.position=M.createBuffer()),e.hasNormals&&!i.normal&&(i.normal=M.createBuffer()),e.hasUvs&&!i.uv&&(i.uv=M.createBuffer()),e.hasColors&&!i.color&&(i.color=M.createBuffer());var r=t.getAttributes();if(e.hasPositions&&(M.bindBuffer(M.ARRAY_BUFFER,i.position),M.bufferData(M.ARRAY_BUFFER,e.positionArray,M.DYNAMIC_DRAW),rt.enableAttribute(r.position),M.vertexAttribPointer(r.position,3,M.FLOAT,!1,0,0)),e.hasNormals){if(M.bindBuffer(M.ARRAY_BUFFER,i.normal),!n.isMeshPhongMaterial&&!n.isMeshStandardMaterial&&!n.isMeshNormalMaterial&&n.shading===_)for(var o=0,a=3*e.count;o8&&(c.length=8);var f=n.morphAttributes;for(d=0,h=c.length;d=0){var c=o[l];if(void 0!==c){var d=c.normalized,h=c.itemSize,p=st.getAttributeProperties(c),f=p.__webglBuffer,m=p.type,g=p.bytesPerElement;if(c.isInterleavedBufferAttribute){var y=c.data,v=y.stride,b=c.offset;y&&y.isInstancedInterleavedBuffer?(rt.enableAttributeAndDivisor(u,y.meshPerAttribute,r),void 0===n.maxInstancedCount&&(n.maxInstancedCount=y.meshPerAttribute*y.count)):rt.enableAttribute(u),M.bindBuffer(M.ARRAY_BUFFER,f),M.vertexAttribPointer(u,h,m,d,v*g,(i*v+b)*g)}else c.isInstancedBufferAttribute?(rt.enableAttributeAndDivisor(u,c.meshPerAttribute,r),void 0===n.maxInstancedCount&&(n.maxInstancedCount=c.meshPerAttribute*c.count)):rt.enableAttribute(u),M.bindBuffer(M.ARRAY_BUFFER,f),M.vertexAttribPointer(u,h,m,d,0,i*h*g)}else if(void 0!==s){var _=s[l];if(void 0!==_)switch(_.length){case 2:M.vertexAttrib2fv(u,_);break;case 3:M.vertexAttrib3fv(u,_);break;case 4:M.vertexAttrib4fv(u,_);break;default:M.vertexAttrib1fv(u,_)}}}}rt.disableUnusedAttributes()}(i,a,n),null!==m&&M.bindBuffer(M.ELEMENT_ARRAY_BUFFER,st.getAttributeBuffer(m)));var x=0;null!==m?x=m.count:void 0!==b&&(x=b.count);var w=n.drawRange.start*_,S=n.drawRange.count*_,E=null!==o?o.start*_:0,T=null!==o?o.count*_:1/0,C=Math.max(w,E),O=Math.min(x,w+S,E+T)-1,k=Math.max(0,O-C+1);if(0!==k){if(r.isMesh)if(!0===i.wireframe)rt.setLineWidth(i.wireframeLinewidth*bt()),v.setMode(M.LINES);else switch(r.drawMode){case ct:v.setMode(M.TRIANGLES);break;case dt:v.setMode(M.TRIANGLE_STRIP);break;case ht:v.setMode(M.TRIANGLE_FAN)}else if(r.isLine){var A=i.linewidth;void 0===A&&(A=1),rt.setLineWidth(A*bt()),r.isLineSegments?v.setMode(M.LINES):v.setMode(M.LINE_STRIP)}else r.isPoints&&v.setMode(M.POINTS);n&&n.isInstancedBufferGeometry?n.maxInstancedCount>0&&v.renderInstances(n,C,k):v.render(C,k)}},this.render=function(e,t,n,i){if(void 0===t||!0===t.isCamera){P="",k=-1,q=null,!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),t.matrixWorldInverse.getInverse(t.matrixWorld),he.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),se.setFromMatrix(he),c.length=0,p=-1,m=-1,y.length=0,x.length=0,ce=this.localClippingEnabled,ue=le.init(this.clippingPlanes,ce,t),function e(t,n){if(!1===t.visible)return;var i=0!=(t.layers.mask&n.layers.mask);if(i)if(t.isLight)c.push(t);else if(t.isSprite)!1!==t.frustumCulled&&!0!==(p=t,de.center.set(0,0,0),de.radius=.7071067811865476,de.applyMatrix4(p.matrixWorld),It(de))||y.push(t);else if(t.isLensFlare)x.push(t);else if(t.isImmediateRenderObject)!0===S.sortObjects&&(pe.setFromMatrixPosition(t.matrixWorld),pe.applyMatrix4(he)),Rt(t,null,t.material,pe.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.update(),!1===t.frustumCulled||!0===function(e){var t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere();return de.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),It(de)}(t))){var r=t.material;if(!0===r.visible){!0===S.sortObjects&&(pe.setFromMatrixPosition(t.matrixWorld),pe.applyMatrix4(he));var o=st.update(t);if(r.isMultiMaterial)for(var a=o.groups,s=r.materials,l=0,u=a.length;l=it.maxTextures&&console.warn("WebGLRenderer: trying to use "+e+" texture units while this GPU supports only "+it.maxTextures),J+=1,e},this.setTexture2D=(Mt=!1,function(e,t){e&&e.isWebGLRenderTarget&&(Mt||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),Mt=!0),e=e.texture),at.setTexture2D(e,t)}),this.setTexture=function(){var e=!1;return function(t,n){e||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),e=!0),at.setTexture2D(t,n)}}(),this.setTextureCube=function(){var e=!1;return function(t,n){t&&t.isWebGLRenderTargetCube&&(e||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),e=!0),t=t.texture),t&&t.isCubeTexture||Array.isArray(t.image)&&6===t.image.length?at.setTextureCube(t,n):at.setTextureCubeDynamic(t,n)}}(),this.getCurrentRenderTarget=function(){return C},this.setRenderTarget=function(e){C=e,e&&void 0===ot.get(e).__webglFramebuffer&&at.setupRenderTarget(e);var t,n=e&&e.isWebGLRenderTargetCube;if(e){var i=ot.get(e);t=n?i.__webglFramebuffer[e.activeCubeFace]:i.__webglFramebuffer,X.copy(e.scissor),K=e.scissorTest,Z.copy(e.viewport)}else t=null,X.copy(ie).multiplyScalar(ne),K=re,Z.copy(ae).multiplyScalar(ne);if(O!==t&&(M.bindFramebuffer(M.FRAMEBUFFER,t),O=t),rt.scissor(X),rt.setScissorTest(K),rt.viewport(Z),n){var r=ot.get(e.texture);M.framebufferTexture2D(M.FRAMEBUFFER,M.COLOR_ATTACHMENT0,M.TEXTURE_CUBE_MAP_POSITIVE_X+e.activeCubeFace,r.__webglTexture,e.activeMipMapLevel)}},this.readRenderTargetPixels=function(e,t,n,i,r,o){if(!1!==(e&&e.isWebGLRenderTarget)){var a=ot.get(e).__webglFramebuffer;if(a){var s=!1;a!==O&&(M.bindFramebuffer(M.FRAMEBUFFER,a),s=!0);try{var l=e.texture,u=l.format,c=l.type;if(u!==je&&Gt(u)!==M.getParameter(M.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(c===Te||Gt(c)===M.getParameter(M.IMPLEMENTATION_COLOR_READ_TYPE)||c===Re&&(nt.get("OES_texture_float")||nt.get("WEBGL_color_buffer_float"))||c===Le&&nt.get("EXT_color_buffer_half_float")))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");M.checkFramebufferStatus(M.FRAMEBUFFER)===M.FRAMEBUFFER_COMPLETE?t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&M.readPixels(t,n,i,r,Gt(u),Gt(c),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&M.bindFramebuffer(M.FRAMEBUFFER,O)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")}}function pr(e,t){this.name="",this.color=new Tn(e),this.density=void 0!==t?t:25e-5}function fr(e,t,n){this.name="",this.color=new Tn(e),this.near=void 0!==t?t:1,this.far=void 0!==n?n:1e3}function mr(){hi.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function gr(e,t,n,i,r){hi.call(this),this.lensFlares=[],this.positionScreen=new Ft,this.customUpdateCallback=void 0,void 0!==e&&this.add(e,t,n,i,r)}function yr(e){Yn.call(this),this.type="SpriteMaterial",this.color=new Tn(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(e)}function vr(e){hi.call(this),this.type="Sprite",this.material=void 0!==e?e:new yr}function br(){hi.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function _r(e,t,n){if(this.useVertexTexture=void 0===n||n,this.identityMatrix=new zt,e=e||[],this.bones=e.slice(0),this.useVertexTexture){var i=Math.sqrt(4*this.bones.length);i=Mt.nextPowerOfTwo(Math.ceil(i)),i=Math.max(i,4),this.boneTextureWidth=i,this.boneTextureHeight=i,this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new On(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,je,Re)}else this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[];for(var r=0,o=this.bones.length;r=e.HAVE_CURRENT_DATA&&(u.needsUpdate=!0)}()}function Pr(e,t,n,i,r,o,a,s,l,u,c,d){Rt.call(this,null,o,a,s,l,u,i,r,c,d),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function Ar(e,t,n,i,r,o,a,s,l){Rt.call(this,e,t,n,i,r,o,a,s,l),this.needsUpdate=!0}function Rr(e,t,n,i,r,o,a,s,l,u){if((u=void 0!==u?u:Ve)!==Ve&&u!==He)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&u===Ve&&(n=ke),void 0===n&&u===He&&(n=Fe),Rt.call(this,null,i,r,o,a,s,u,n,l),this.image={width:e,height:t},this.magFilter=void 0!==a?a:_e,this.minFilter=void 0!==s?s:_e,this.flipY=!1,this.generateMipmaps=!1}function Lr(e){Li.call(this),this.type="WireframeGeometry";var t,n,i,r,o,a,s,l,u=[],c=[0,0],d={},h=["a","b","c"];if(e&&e.isGeometry){var p=e.faces;for(t=0,i=p.length;t.9&&a<.1&&(t<.2&&(o[e+0]+=1),n<.2&&(o[e+2]+=1),i<.2&&(o[e+4]+=1))}}()}(),this.addAttribute("position",new Ei(r,3)),this.addAttribute("normal",new Ei(r.slice(),3)),this.addAttribute("uv",new Ei(o,2)),this.normalizeNormals()}function zr(e,t){Ri.call(this),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Br(e,t)),this.mergeVertices()}function Br(e,t){Fr.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronBufferGeometry",this.parameters={radius:e,detail:t}}function jr(e,t){Ri.call(this),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Ur(e,t)),this.mergeVertices()}function Ur(e,t){Fr.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Wr(e,t){Ri.call(this),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Gr(e,t)),this.mergeVertices()}function Gr(e,t){var n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1];Fr.call(this,i,[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,t),this.type="IcosahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Vr(e,t){Ri.call(this),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Hr(e,t)),this.mergeVertices()}function Hr(e,t){var n=(1+Math.sqrt(5))/2,i=1/n,r=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i];Fr.call(this,r,[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t),this.type="DodecahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Yr(e,t,n,i,r,o){Ri.call(this),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r},void 0!==o&&console.warn("THREE.TubeGeometry: taper has been removed.");var a=new qr(e,t,n,i,r);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals,this.fromBufferGeometry(a),this.mergeVertices()}function qr(e,t,n,i,r){Li.call(this),this.type="TubeBufferGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r},t=t||64,n=n||1,i=i||8,r=r||!1;var o=e.computeFrenetFrames(t,r);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;var a,s,l=new Ft,u=new Ft,c=new St,d=[],h=[],p=[],f=[];function m(r){var a=e.getPointAt(r/t),c=o.normals[r],p=o.binormals[r];for(s=0;s<=i;s++){var f=s/i*Math.PI*2,m=Math.sin(f),g=-Math.cos(f);u.x=g*c.x+m*p.x,u.y=g*c.y+m*p.y,u.z=g*c.z+m*p.z,u.normalize(),h.push(u.x,u.y,u.z),l.x=a.x+n*u.x,l.y=a.y+n*u.y,l.z=a.z+n*u.z,d.push(l.x,l.y,l.z)}}!function(){for(a=0;athis.scale.x*this.scale.y/4||t.push({distance:Math.sqrt(n),point:this.position,face:null,object:this})}),clone:function(){return new this.constructor(this.material).copy(this)}}),br.prototype=Object.assign(Object.create(hi.prototype),{constructor:br,copy:function(e){hi.prototype.copy.call(this,e,!1);for(var t=e.levels,n=0,i=t.length;n1){e.setFromMatrixPosition(n.matrixWorld),t.setFromMatrixPosition(this.matrixWorld);var r=e.distanceTo(t);i[0].object.visible=!0;for(var o=1,a=i.length;o=i[o].distance;o++)i[o-1].object.visible=!1,i[o].object.visible=!0;for(;oa))h.applyMatrix4(this.matrixWorld),(M=i.ray.origin.distanceTo(h))i.far||r.push({distance:M,point:d.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}else for(y=0,v=m.length/3-1;ya))h.applyMatrix4(this.matrixWorld),(M=i.ray.origin.distanceTo(h))i.far||r.push({distance:M,point:d.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}else if(s.isGeometry){var x=s.vertices,w=x.length;for(y=0;ya))h.applyMatrix4(this.matrixWorld),(M=i.ray.origin.distanceTo(h))i.far||r.push({distance:M,point:d.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Er.prototype=Object.assign(Object.create(Sr.prototype),{constructor:Er,isLineSegments:!0}),Tr.prototype=Object.create(Yn.prototype),Tr.prototype.constructor=Tr,Tr.prototype.isPointsMaterial=!0,Tr.prototype.copy=function(e){return Yn.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this},Cr.prototype=Object.assign(Object.create(hi.prototype),{constructor:Cr,isPoints:!0,raycast:function(){var e=new zt,t=new ti,n=new Zn;return function(i,r){var o=this,a=this.geometry,s=this.matrixWorld,l=i.params.Points.threshold;if(null===a.boundingSphere&&a.computeBoundingSphere(),n.copy(a.boundingSphere),n.applyMatrix4(s),!1!==i.ray.intersectsSphere(n)){e.getInverse(s),t.copy(i.ray).applyMatrix4(e);var u=l/((this.scale.x+this.scale.y+this.scale.z)/3),c=u*u,d=new Ft;if(a.isBufferGeometry){var h=a.index,p=a.attributes.position.array;if(null!==h)for(var f=h.array,m=0,g=f.length;mi.far)return;r.push({distance:u,distanceToRay:Math.sqrt(a),point:l.clone(),index:n,face:null,object:o})}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Or.prototype=Object.assign(Object.create(hi.prototype),{constructor:Or}),kr.prototype=Object.create(Rt.prototype),kr.prototype.constructor=kr,Pr.prototype=Object.create(Rt.prototype),Pr.prototype.constructor=Pr,Pr.prototype.isCompressedTexture=!0,Ar.prototype=Object.create(Rt.prototype),Ar.prototype.constructor=Ar,Rr.prototype=Object.create(Rt.prototype),Rr.prototype.constructor=Rr,Rr.prototype.isDepthTexture=!0,Lr.prototype=Object.create(Li.prototype),Lr.prototype.constructor=Lr,Ir.prototype=Object.create(Ri.prototype),Ir.prototype.constructor=Ir,Dr.prototype=Object.create(Li.prototype),Dr.prototype.constructor=Dr,Nr.prototype=Object.create(Ri.prototype),Nr.prototype.constructor=Nr,Fr.prototype=Object.create(Li.prototype),Fr.prototype.constructor=Fr,zr.prototype=Object.create(Ri.prototype),zr.prototype.constructor=zr,Br.prototype=Object.create(Fr.prototype),Br.prototype.constructor=Br,jr.prototype=Object.create(Ri.prototype),jr.prototype.constructor=jr,Ur.prototype=Object.create(Fr.prototype),Ur.prototype.constructor=Ur,Wr.prototype=Object.create(Ri.prototype),Wr.prototype.constructor=Wr,Gr.prototype=Object.create(Fr.prototype),Gr.prototype.constructor=Gr,Vr.prototype=Object.create(Ri.prototype),Vr.prototype.constructor=Vr,Hr.prototype=Object.create(Fr.prototype),Hr.prototype.constructor=Hr,Yr.prototype=Object.create(Ri.prototype),Yr.prototype.constructor=Yr,qr.prototype=Object.create(Li.prototype),qr.prototype.constructor=qr,Xr.prototype=Object.create(Ri.prototype),Xr.prototype.constructor=Xr,Kr.prototype=Object.create(Li.prototype),Kr.prototype.constructor=Kr,Zr.prototype=Object.create(Ri.prototype),Zr.prototype.constructor=Zr,Jr.prototype=Object.create(Li.prototype),Jr.prototype.constructor=Jr;var $r={area:function(e){for(var t=e.length,n=0,i=t-1,r=0;r=-Number.EPSILON&&w>=-Number.EPSILON&&x>=-Number.EPSILON))return!1;return!0}return function(t,n){var i=t.length;if(i<3)return null;var r,o,a,s=[],l=[],u=[];if($r.area(t)>0)for(o=0;o2;){if(d--<=0)return console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()"),n?u:s;if(c<=(r=o)&&(r=0),c<=(o=r+1)&&(o=0),c<=(a=o+1)&&(a=0),e(t,r,o,a,c,l)){var h,p,f,m,g;for(h=l[r],p=l[o],f=l[a],s.push([t[h],t[p],t[f]]),u.push([l[r],l[o],l[a]]),m=o,g=o+1;g2&&e[t-1].equals(e[0])&&e.pop()}function i(e,t,n){return e.x!==t.x?e.xNumber.EPSILON){var f;if(h>0){if(p<0||p>h)return[];if((f=u*c-l*d)<0||f>h)return[]}else{if(p>0||p0||fM?[]:v===M?o?[]:[g]:b<=M?[g,y]:[g,x])}function o(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,l=i.x-e.x,u=i.y-e.y,c=r*s-o*a,d=r*u-o*l;if(Math.abs(c)>Number.EPSILON){var h=l*s-u*a;return c>0?d>=0&&h>=0:d>=0||h>=0}return d>0}n(e),t.forEach(n);for(var a,s,l,u,c,d,h={},p=e.concat(),f=0,m=t.length;fr&&(s=0);var l=o(i[e],i[a],i[s],n[t]);if(!l)return!1;var u=n.length-1,c=t-1;c<0&&(c=u);var d=t+1;return d>u&&(d=0),!!(l=o(n[t],n[c],n[d],i[e]))}function s(e,t){var n,o;for(n=0;n0)return!0;return!1}var l=[];function u(e,n){var i,o,a,s;for(i=0;i0)return!0;return!1}for(var c,d,h,p,f,m,g,y,v,b,_=[],x=0,w=t.length;x0;){if(--S<0){console.log("Infinite Loop! Holes left:"+l.length+", Probably Hole outside Shape!");break}for(d=M;d=0)break;_[m]=!0}if(c>=0)break}}return i}(e,t),y=$r.triangulate(g,!1);for(a=0,s=y.length;a0)&&f.push(x,w,S),(l!==n-1||u0&&y(!0),t>0&&y(!1)),this.setIndex(u),this.addAttribute("position",new Ei(c,3)),this.addAttribute("normal",new Ei(d,3)),this.addAttribute("uv",new Ei(h,2))}function po(e,t,n,i,r,o,a){co.call(this,0,e,t,n,i,r,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:a}}function fo(e,t,n,i,r,o,a){ho.call(this,0,e,t,n,i,r,o,a),this.type="ConeBufferGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:a}}function mo(e,t,n,i){Ri.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},this.fromBufferGeometry(new go(e,t,n,i))}function go(e,t,n,i){Li.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},e=e||50,t=void 0!==t?Math.max(3,t):8,n=void 0!==n?n:0,i=void 0!==i?i:2*Math.PI;var r,o,a=[],s=[],l=[],u=[],c=new Ft,d=new St;for(s.push(0,0,0),l.push(0,0,1),u.push(.5,.5),o=0,r=3;o<=t;o++,r+=3){var h=n+o/t*i;c.x=e*Math.cos(h),c.y=e*Math.sin(h),s.push(c.x,c.y,c.z),l.push(0,0,1),d.x=(s[r]/e+1)/2,d.y=(s[r+1]/e+1)/2,u.push(d.x,d.y)}for(r=1;r<=t;r++)a.push(r,r+1,0);this.setIndex(a),this.addAttribute("position",new Ei(s,3)),this.addAttribute("normal",new Ei(l,3)),this.addAttribute("uv",new Ei(u,2))}Qr.prototype=Object.create(Ri.prototype),Qr.prototype.constructor=Qr,Qr.prototype.addShapeList=function(e,t){for(var n=e.length,i=0;iNumber.EPSILON){var h=Math.sqrt(c),p=Math.sqrt(l*l+u*u),f=t.x-s/h,m=t.y+a/h,g=((n.x-u/p-f)*u-(n.y+l/p-m)*l)/(a*u-s*l),y=(i=f+a*g-e.x)*i+(r=m+s*g-e.y)*r;if(y<=2)return new St(i,r);o=Math.sqrt(y/2)}else{var v=!1;a>Number.EPSILON?l>Number.EPSILON&&(v=!0):a<-Number.EPSILON?l<-Number.EPSILON&&(v=!0):Math.sign(s)===Math.sign(u)&&(v=!0),v?(i=-s,r=a,o=Math.sqrt(c)):(i=a,r=s,o=Math.sqrt(c/2))}return new St(i/o,r/o)}for(var z=[],B=0,j=C.length,U=j-1,W=B+1;B=0;k--){for(A=k/p,R=d*Math.cos(A*Math.PI/2),P=h*Math.sin(A*Math.PI/2),B=0,j=C.length;B=0;){n=B,(i=B-1)<0&&(i=e.length-1);var r=0,o=g+2*p;for(r=0;r0||0===e.search(/^data\:image\/jpeg/);r.format=i?Be:je,r.image=n,r.needsUpdate=!0,void 0!==t&&t(r)}),n,i),r},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}}),zo.prototype=Object.assign(Object.create(hi.prototype),{constructor:zo,isLight:!0,copy:function(e){return hi.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},toJSON:function(e){var t=hi.prototype.toJSON.call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}),Bo.prototype=Object.assign(Object.create(zo.prototype),{constructor:Bo,isHemisphereLight:!0,copy:function(e){return zo.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}),Object.assign(jo.prototype,{copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var e={};return 0!==this.bias&&(e.bias=this.bias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}),Uo.prototype=Object.assign(Object.create(jo.prototype),{constructor:Uo,isSpotLightShadow:!0,update:function(e){var t=2*Mt.RAD2DEG*e.angle,n=this.mapSize.width/this.mapSize.height,i=e.distance||500,r=this.camera;t===r.fov&&n===r.aspect&&i===r.far||(r.fov=t,r.aspect=n,r.far=i,r.updateProjectionMatrix())}}),Wo.prototype=Object.assign(Object.create(zo.prototype),{constructor:Wo,isSpotLight:!0,copy:function(e){return zo.prototype.copy.call(this,e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),Go.prototype=Object.assign(Object.create(zo.prototype),{constructor:Go,isPointLight:!0,copy:function(e){return zo.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}),Vo.prototype=Object.assign(Object.create(jo.prototype),{constructor:Vo}),Ho.prototype=Object.assign(Object.create(zo.prototype),{constructor:Ho,isDirectionalLight:!0,copy:function(e){return zo.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),Yo.prototype=Object.assign(Object.create(zo.prototype),{constructor:Yo,isAmbientLight:!0});var qo,Xo,Ko,Zo,Jo,$o={arraySlice:function(e,t,n){return $o.isTypedArray(e)?new e.constructor(e.subarray(t,n)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){for(var t=e.length,n=new Array(t),i=0;i!==t;++i)n[i]=i;return n.sort((function(t,n){return e[t]-e[n]})),n},sortedArray:function(e,t,n){for(var i=e.length,r=new e.constructor(i),o=0,a=0;a!==i;++o)for(var s=n[o]*t,l=0;l!==t;++l)r[a++]=e[s+l];return r},flattenJSON:function(e,t,n,i){for(var r=1,o=e[0];void 0!==o&&void 0===o[i];)o=e[r++];if(void 0!==o){var a=o[i];if(void 0!==a)if(Array.isArray(a))do{void 0!==(a=o[i])&&(t.push(o.time),n.push.apply(n,a)),o=e[r++]}while(void 0!==o);else if(void 0!==a.toArray)do{void 0!==(a=o[i])&&(t.push(o.time),a.toArray(n,n.length)),o=e[r++]}while(void 0!==o);else do{void 0!==(a=o[i])&&(t.push(o.time),n.push(a)),o=e[r++]}while(void 0!==o)}}};function Qo(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n}function ea(e,t,n,i){Qo.call(this,e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function ta(e,t,n,i){Qo.call(this,e,t,n,i)}function na(e,t,n,i){Qo.call(this,e,t,n,i)}function ia(e,t,n,i){if(void 0===e)throw new Error("track name is undefined");if(void 0===t||0===t.length)throw new Error("no keyframes in track named "+e);this.name=e,this.times=$o.convertArray(t,this.TimeBufferType),this.values=$o.convertArray(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation),this.validate(),this.optimize()}function ra(e,t,n,i){ia.call(this,e,t,n,i)}function oa(e,t,n,i){Qo.call(this,e,t,n,i)}function aa(e,t,n,i){ia.call(this,e,t,n,i)}function sa(e,t,n,i){ia.call(this,e,t,n,i)}function la(e,t,n,i){ia.call(this,e,t,n,i)}function ua(e,t,n){ia.call(this,e,t,n)}function ca(e,t,n,i){ia.call(this,e,t,n,i)}function da(e,t,n,i){ia.apply(this,arguments)}function ha(e,t,n){this.name=e,this.tracks=n,this.duration=void 0!==t?t:-1,this.uuid=Mt.generateUUID(),this.duration<0&&this.resetDuration(),this.optimize()}function pa(e){this.manager=void 0!==e?e:Ao,this.textures={}}function fa(e){this.manager=void 0!==e?e:Ao}function ma(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}}function ga(e){"boolean"==typeof e&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),e=void 0),this.manager=void 0!==e?e:Ao,this.withCredentials=!1}function ya(e){this.manager=void 0!==e?e:Ao,this.texturePath=""}function va(e,t,n,i,r){var o=.5*(i-t),a=.5*(r-n),s=e*e;return(2*n-2*i+o+a)*(e*s)+(-3*n+3*i-2*o-a)*s+o*e+n}function ba(e,t,n,i){return function(e,t){var n=1-e;return n*n*t}(e,t)+function(e,t){return 2*(1-e)*e*t}(e,n)+function(e,t){return e*e*t}(e,i)}function _a(e,t,n,i,r){return function(e,t){var n=1-e;return n*n*n*t}(e,t)+function(e,t){var n=1-e;return 3*n*n*e*t}(e,n)+function(e,t){return 3*(1-e)*e*e*t}(e,i)+function(e,t){return e*e*e*t}(e,r)}function xa(){}function wa(e,t){this.v1=e,this.v2=t}function Ma(){this.curves=[],this.autoClose=!1}function Sa(e,t,n,i,r,o,a,s){this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=o,this.aClockwise=a,this.aRotation=s||0}function Ea(e){this.points=void 0===e?[]:e}function Ta(e,t,n,i){this.v0=e,this.v1=t,this.v2=n,this.v3=i}function Ca(e,t,n){this.v0=e,this.v1=t,this.v2=n}Qo.prototype={constructor:Qo,evaluate:function(e){var t=this.parameterPositions,n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{var o;n:{i:if(!(e=r)break e;var s=t[1];e=(r=t[--n-1]))break t}o=n,n=0}for(;n>>1;et;)--o;if(++o,0!==r||o!==i){r>=o&&(r=(o=Math.max(o,1))-1);var a=this.getValueSize();this.times=$o.arraySlice(n,r,o),this.values=$o.arraySlice(this.values,r*a,o*a)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("invalid value size in track",this),e=!1);var n=this.times,i=this.values,r=n.length;0===r&&(console.error("track is empty",this),e=!1);for(var o=null,a=0;a!==r;a++){var s=n[a];if("number"==typeof s&&isNaN(s)){console.error("time is not a valid number",this,a,s),e=!1;break}if(null!==o&&o>s){console.error("out of order keys",this,a,s,o),e=!1;break}o=s}if(void 0!==i&&$o.isTypedArray(i)){a=0;for(var l=i.length;a!==l;++a){var u=i[a];if(isNaN(u)){console.error("value is not a valid number",this,a,u),e=!1;break}}}return e},optimize:function(){for(var e=this.times,t=this.values,n=this.getValueSize(),i=this.getInterpolation()===at,r=1,o=e.length-1,a=1;a0){e[r]=e[o];for(f=o*n,m=r*n,h=0;h!==n;++h)t[m+h]=t[f+h];++r}return r!==e.length&&(this.times=$o.arraySlice(e,0,r),this.values=$o.arraySlice(t,0,r*n)),this}},ra.prototype=Object.assign(Object.create(qo),{constructor:ra,ValueTypeName:"vector"}),oa.prototype=Object.assign(Object.create(Qo.prototype),{constructor:oa,interpolate_:function(e,t,n,i){for(var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=e*a,l=(n-t)/(i-t),u=s+a;s!==u;s+=4)Nt.slerpFlat(r,0,o,s-a,o,s,l);return r}}),aa.prototype=Object.assign(Object.create(qo),{constructor:aa,ValueTypeName:"quaternion",DefaultInterpolation:ot,InterpolantFactoryMethodLinear:function(e){return new oa(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),sa.prototype=Object.assign(Object.create(qo),{constructor:sa,ValueTypeName:"number"}),la.prototype=Object.assign(Object.create(qo),{constructor:la,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:rt,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),ua.prototype=Object.assign(Object.create(qo),{constructor:ua,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:rt,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),ca.prototype=Object.assign(Object.create(qo),{constructor:ca,ValueTypeName:"color"}),da.prototype=qo,qo.constructor=da,Object.assign(da,{parse:function(e){if(void 0===e.type)throw new Error("track type undefined, can not parse");var t=da._getTrackTypeForValueTypeName(e.type);if(void 0===e.times){var n=[],i=[];$o.flattenJSON(e.keys,n,i,"value"),e.times=n,e.values=i}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)},toJSON:function(e){var t,n=e.constructor;if(void 0!==n.toJSON)t=n.toJSON(e);else{t={name:e.name,times:$o.convertArray(e.times,Array),values:$o.convertArray(e.values,Array)};var i=e.getInterpolation();i!==e.DefaultInterpolation&&(t.interpolation=i)}return t.type=e.ValueTypeName,t},_getTrackTypeForValueTypeName:function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return sa;case"vector":case"vector2":case"vector3":case"vector4":return ra;case"color":return ca;case"quaternion":return aa;case"bool":case"boolean":return ua;case"string":return la}throw new Error("Unsupported typeName: "+e)}}),ha.prototype={constructor:ha,resetDuration:function(){for(var e=0,t=0,n=this.tracks.length;t!==n;++t){var i=this.tracks[t];e=Math.max(e,i.times[i.times.length-1])}this.duration=e},trim:function(){for(var e=0;e1){var u=i[d=l[1]];u||(i[d]=u=[]),u.push(s)}}var c=[];for(var d in i)c.push(ha.CreateFromMorphTargetSequence(d,i[d],t,n));return c},parseAnimation:function(e,t){if(!e)return console.error(" no animation in JSONLoader data"),null;for(var n=function(e,t,n,i,r){if(0!==n.length){var o=[],a=[];$o.flattenJSON(n,o,a,i),0!==o.length&&r.push(new e(t,o,a))}},i=[],r=e.name||"default",o=e.length||-1,a=e.fps||30,s=e.hierarchy||[],l=0;l1?e.skinWeights[i+1]:0,s=t>2?e.skinWeights[i+2]:0,l=t>3?e.skinWeights[i+3]:0;n.skinWeights.push(new Lt(o,a,s,l))}if(e.skinIndices)for(i=0,r=e.skinIndices.length;i1?e.skinIndices[i+1]:0,d=t>2?e.skinIndices[i+2]:0,h=t>3?e.skinIndices[i+3]:0;n.skinIndices.push(new Lt(u,c,d,h))}n.bones=e.bones,n.bones&&n.bones.length>0&&(n.skinWeights.length!==n.skinIndices.length||n.skinIndices.length!==n.vertices.length)&&console.warn("When skinning, number of vertices ("+n.vertices.length+"), skinIndices ("+n.skinIndices.length+"), and skinWeights ("+n.skinWeights.length+") should match.")}(),function(t){if(void 0!==e.morphTargets)for(var i=0,r=e.morphTargets.length;i0){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');var c=n.faces,d=e.morphColors[0].colors;for(i=0,r=c.length;i0&&(n.animations=t)}(),n.computeFaceNormals(),n.computeBoundingSphere(),void 0===e.materials||0===e.materials.length)return{geometry:n};var r=ma.prototype.initMaterials(e.materials,t,this.crossOrigin);return{geometry:n,materials:r}}}),Object.assign(ya.prototype,{load:function(e,t,n,i){""===this.texturePath&&(this.texturePath=e.substring(0,e.lastIndexOf("/")+1));var r=this;new Ro(r.manager).load(e,(function(n){var o=null;try{o=JSON.parse(n)}catch(t){return void 0!==i&&i(t),void console.error("THREE:ObjectLoader: Can't parse "+e+".",t.message)}var a=o.metadata;void 0!==a&&void 0!==a.type&&"geometry"!==a.type.toLowerCase()?r.parse(o,t):console.error("THREE.ObjectLoader: Can't load "+e+". Use THREE.JSONLoader instead.")}),n,i)},setTexturePath:function(e){this.texturePath=e},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e,t){var n=this.parseGeometries(e.geometries),i=this.parseImages(e.images,(function(){void 0!==t&&t(a)})),r=this.parseTextures(e.textures,i),o=this.parseMaterials(e.materials,r),a=this.parseObject(e.object,n,o);return e.animations&&(a.animations=this.parseAnimations(e.animations)),void 0!==e.images&&0!==e.images.length||void 0!==t&&t(a),a},parseGeometries:function(e){var t={};if(void 0!==e)for(var n=new ga,i=new fa,r=0,o=e.length;r0){var o=new Do(new Po(t));o.setCrossOrigin(this.crossOrigin);for(var a=0,s=e.length;a0?new wr(s,l):new Ii(s,l);break;case"LOD":r=new br;break;case"Line":r=new Sr(o(t.geometry),a(t.material),t.mode);break;case"LineSegments":r=new Er(o(t.geometry),a(t.material));break;case"PointCloud":case"Points":r=new Cr(o(t.geometry),a(t.material));break;case"Sprite":r=new vr(a(t.material));break;case"Group":r=new Or;break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh type. Instantiates Object3D instead.");default:r=new hi}if(r.uuid=t.uuid,void 0!==t.name&&(r.name=t.name),void 0!==t.matrix?(e.fromArray(t.matrix),e.decompose(r.position,r.quaternion,r.scale)):(void 0!==t.position&&r.position.fromArray(t.position),void 0!==t.rotation&&r.rotation.fromArray(t.rotation),void 0!==t.quaternion&&r.quaternion.fromArray(t.quaternion),void 0!==t.scale&&r.scale.fromArray(t.scale)),void 0!==t.castShadow&&(r.castShadow=t.castShadow),void 0!==t.receiveShadow&&(r.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(r.shadow.bias=t.shadow.bias),void 0!==t.shadow.radius&&(r.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&r.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(r.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(r.visible=t.visible),void 0!==t.userData&&(r.userData=t.userData),void 0!==t.children)for(var u in t.children)r.add(this.parseObject(t.children[u],n,i));if("LOD"===t.type)for(var c=t.levels,d=0;d0)){l=r;break}l=r-1}if(i[r=l]===n)return r/(o-1);var u=i[r];return(r+(n-u)/(i[r+1]-u))/(o-1)},getTangent:function(e){var t=e-1e-4,n=e+1e-4;t<0&&(t=0),n>1&&(n=1);var i=this.getPoint(t);return this.getPoint(n).clone().sub(i).normalize()},getTangentAt:function(e){var t=this.getUtoTmapping(e);return this.getTangent(t)},computeFrenetFrames:function(e,t){var n,i,r,o=new Ft,a=[],s=[],l=[],u=new Ft,c=new zt;for(n=0;n<=e;n++)i=n/e,a[n]=this.getTangentAt(i),a[n].normalize();s[0]=new Ft,l[0]=new Ft;var d=Number.MAX_VALUE,h=Math.abs(a[0].x),p=Math.abs(a[0].y),f=Math.abs(a[0].z);for(h<=d&&(d=h,o.set(1,0,0)),p<=d&&(d=p,o.set(0,1,0)),f<=d&&o.set(0,0,1),u.crossVectors(a[0],o).normalize(),s[0].crossVectors(a[0],u),l[0].crossVectors(a[0],s[0]),n=1;n<=e;n++)s[n]=s[n-1].clone(),l[n]=l[n-1].clone(),u.crossVectors(a[n-1],a[n]),u.length()>Number.EPSILON&&(u.normalize(),r=Math.acos(Mt.clamp(a[n-1].dot(a[n]),-1,1)),s[n].applyMatrix4(c.makeRotationAxis(u,r))),l[n].crossVectors(a[n],s[n]);if(!0===t)for(r=Math.acos(Mt.clamp(s[0].dot(s[e]),-1,1)),r/=e,a[0].dot(u.crossVectors(s[0],s[e]))>0&&(r=-r),n=1;n<=e;n++)s[n].applyMatrix4(c.makeRotationAxis(a[n],r*n)),l[n].crossVectors(a[n],s[n]);return{tangents:a,normals:s,binormals:l}}},wa.prototype=Object.create(xa.prototype),wa.prototype.constructor=wa,wa.prototype.isLineCurve=!0,wa.prototype.getPoint=function(e){if(1===e)return this.v2.clone();var t=this.v2.clone().sub(this.v1);return t.multiplyScalar(e).add(this.v1),t},wa.prototype.getPointAt=function(e){return this.getPoint(e)},wa.prototype.getTangent=function(e){return this.v2.clone().sub(this.v1).normalize()},Ma.prototype=Object.assign(Object.create(xa.prototype),{constructor:Ma,add:function(e){this.curves.push(e)},closePath:function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new wa(t,e))},getPoint:function(e){for(var t=e*this.getLength(),n=this.getCurveLengths(),i=0;i=t){var r=n[i]-t,o=this.curves[i],a=o.getLength(),s=0===a?0:1-r/a;return o.getPointAt(s)}i++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,n=0,i=this.curves.length;n1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},createPointsGeometry:function(e){var t=this.getPoints(e);return this.createGeometry(t)},createSpacedPointsGeometry:function(e){var t=this.getSpacedPoints(e);return this.createGeometry(t)},createGeometry:function(e){for(var t=new Ri,n=0,i=e.length;nt;)n-=t;nt.length-2?t.length-1:i+1],l=t[i>t.length-3?t.length-1:i+2];return new St(va(r,o.x,a.x,s.x,l.x),va(r,o.y,a.y,s.y,l.y))},Ta.prototype=Object.create(xa.prototype),Ta.prototype.constructor=Ta,Ta.prototype.getPoint=function(e){var t=this.v0,n=this.v1,i=this.v2,r=this.v3;return new St(_a(e,t.x,n.x,i.x,r.x),_a(e,t.y,n.y,i.y,r.y))},Ca.prototype=Object.create(xa.prototype),Ca.prototype.constructor=Ca,Ca.prototype.getPoint=function(e){var t=this.v0,n=this.v1,i=this.v2;return new St(ba(e,t.x,n.x,i.x),ba(e,t.y,n.y,i.y))};var Oa,ka=Object.assign(Object.create(Ma.prototype),{fromPoints:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,n=e.length;t0){var u=l.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(l);var c=l.getPoint(1);this.currentPoint.copy(c)}});function Pa(e){Ma.call(this),this.currentPoint=new St,e&&this.fromPoints(e)}function Aa(){Pa.apply(this,arguments),this.holes=[]}function Ra(){this.subPaths=[],this.currentPath=null}function La(e){this.data=e}function Ia(e){this.manager=void 0!==e?e:Ao}Pa.prototype=ka,ka.constructor=Pa,Aa.prototype=Object.assign(Object.create(ka),{constructor:Aa,getPointsHoles:function(e){for(var t=[],n=0,i=this.holes.length;nNumber.EPSILON){if(u<0&&(a=t[o],l=-l,s=t[r],u=-u),e.ys.y)continue;if(e.y===a.y){if(e.x===a.x)return!0}else{var c=u*(e.x-a.x)-l*(e.y-a.y);if(0===c)return!0;if(c<0)continue;i=!i}}else{if(e.y!==a.y)continue;if(s.x<=e.x&&e.x<=a.x||a.x<=e.x&&e.x<=s.x)return!0}}return i}var r=$r.isClockWise,o=this.subPaths;if(0===o.length)return[];if(!0===t)return n(o);var a,s,l,u=[];if(1===o.length)return s=o[0],(l=new Aa).curves=s.curves,u.push(l),u;var c=!r(o[0].getPoints());c=e?!c:c;var d,h,p=[],f=[],m=[],g=0;f[g]=void 0,m[g]=[];for(var y=0,v=o.length;y1){for(var b=!1,_=[],x=0,w=f.length;x0&&(b||(m=p))}y=0;for(var O=f.length;y0){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e=.5)for(var o=0;o!==r;++o)e[t+o]=e[n+o]},_slerp:function(e,t,n,i,r){Nt.slerpFlat(e,t,e,t,e,n,i)},_lerp:function(e,t,n,i,r){for(var o=1-i,a=0;a!==r;++a){var s=t+a;e[s]=e[s]*o+e[n+a]*i}}},as.prototype={constructor:as,getValue:function(e,t){this.bind(),this.getValue(e,t)},setValue:function(e,t){this.bind(),this.setValue(e,t)},bind:function(){var e=this.node,t=this.parsedPath,n=t.objectName,i=t.propertyName,r=t.propertyIndex;if(e||(e=as.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,e){if(n){var o=t.objectIndex;switch(n){case"materials":if(!e.material)return void console.error(" can not bind to material as node does not have a material",this);if(!e.material.materials)return void console.error(" can not bind to material.materials as node.material does not have a materials array",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error(" can not bind to bones as node does not have a skeleton",this);e=e.skeleton.bones;for(var a=0;a=n){var d=n++,h=t[d];i[h.uuid]=c,t[c]=h,i[u]=d,t[d]=l;for(var p=0,f=o;p!==f;++p){var m=r[p],g=m[d],y=m[c];m[c]=g,m[d]=y}}}this.nCachedObjects_=n},uncache:function(e){for(var t=this._objects,n=t.length,i=this.nCachedObjects_,r=this._indicesByUUID,o=this._bindings,a=o.length,s=0,l=arguments.length;s!==l;++s){var u=arguments[s],c=u.uuid,d=r[c];if(void 0!==d)if(delete r[c],d0)for(var l=this._interpolants,u=this._propertyBindings,c=0,d=l.length;c!==d;++c)l[c].evaluate(a),u[c].accumulate(i,s)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var n=this._weightInterpolant;if(null!==n){var i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=t,t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n)t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}return this._effectiveTimeScale=t,t},_updateTime:function(e){var t=this.time+e;if(0===e)return t;var n=this._clip.duration,i=this.loop,r=this._loopCount;if(i===tt){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(t>=n)t=n;else{if(!(t<0))break e;t=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{var o=i===it;if(-1===r&&(e>=0?(r=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),t>=n||t<0){var a=Math.floor(t/n);t-=n*a,r+=Math.abs(a);var s=this.repetitions-r;if(s<0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?n:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(0===s){var l=e<0;this._setEndings(l,!l,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}if(o&&1==(1&r))return this.time=t,n-t}return this.time=t,t},_setEndings:function(e,t,n){var i=this._interpolantSettings;n?(i.endingStart=lt,i.endingEnd=lt):(i.endingStart=e?this.zeroSlopeAtStart?lt:st:ut,i.endingEnd=t?this.zeroSlopeAtEnd?lt:st:ut)},_scheduleFading:function(e,t,n){var i=this._mixer,r=i.time,o=this._weightInterpolant;null===o&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);var a=o.parameterPositions,s=o.sampleValues;return a[0]=r,s[0]=t,a[1]=r+e,s[1]=n,this}},us.prototype={constructor:us,clipAction:function(e,t){var n=t||this._root,i=n.uuid,r="string"==typeof e?ha.findByName(n,e):e,o=null!==r?r.uuid:e,a=this._actionsByClip[o],s=null;if(void 0!==a){var l=a.actionByRoot[i];if(void 0!==l)return l;s=a.knownActions[0],null===r&&(r=s._clip)}if(null===r)return null;var u=new ls(this,r,t);return this._bindAction(u,s),this._addInactiveAction(u,o,i),u},existingAction:function(e,t){var n=t||this._root,i=n.uuid,r="string"==typeof e?ha.findByName(n,e):e,o=r?r.uuid:e,a=this._actionsByClip[o];return void 0!==a&&a.actionByRoot[i]||null},stopAllAction:function(){var e=this._actions,t=this._nActiveActions,n=this._bindings,i=this._nActiveBindings;this._nActiveActions=0,this._nActiveBindings=0;for(var r=0;r!==t;++r)e[r].reset();for(r=0;r!==i;++r)n[r].useCount=0;return this},update:function(e){e*=this.timeScale;for(var t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),o=this._accuIndex^=1,a=0;a!==n;++a){var s=t[a];s.enabled&&s._update(i,e,r,o)}var l=this._bindings,u=this._nActiveBindings;for(a=0;a!==u;++a)l[a].apply(o);return this},getRoot:function(){return this._root},uncacheClip:function(e){var t=this._actions,n=e.uuid,i=this._actionsByClip,r=i[n];if(void 0!==r){for(var o=r.knownActions,a=0,s=o.length;a!==s;++a){var l=o[a];this._deactivateAction(l);var u=l._cacheIndex,c=t[t.length-1];l._cacheIndex=null,l._byClipCacheIndex=null,c._cacheIndex=u,t[u]=c,t.pop(),this._removeInactiveBindingsForAction(l)}delete i[n]}},uncacheRoot:function(e){var t=e.uuid,n=this._actionsByClip;for(var i in n){var r=n[i].actionByRoot[t];void 0!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}var o=this._bindingsByRootAndName[t];if(void 0!==o)for(var a in o){var s=o[a];s.restoreOriginalState(),this._removeInactiveBinding(s)}},uncacheAction:function(e,t){var n=this.existingAction(e,t);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}},Object.assign(us.prototype,{_bindAction:function(e,t){var n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,o=e._propertyBindings,a=e._interpolants,s=n.uuid,l=this._bindingsByRootAndName,u=l[s];void 0===u&&(u={},l[s]=u);for(var c=0;c!==r;++c){var d=i[c],h=d.name,p=u[h];if(void 0!==p)o[c]=p;else{if(void 0!==(p=o[c])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,h));continue}var f=t&&t._propertyBindings[c].binding.parsedPath;++(p=new os(as.create(n,h,f),d.ValueTypeName,d.getValueSize())).referenceCount,this._addInactiveBinding(p,s,h),o[c]=p}a[c].resultBuffer=p.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,n=e._clip.uuid,i=this._actionsByClip[n];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,n,t)}for(var r=e._propertyBindings,o=0,a=r.length;o!==a;++o){var s=r[o];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,n=0,i=t.length;n!==i;++n){var r=t[n];0==--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){var t=e._cacheIndex;return null!==t&&t1)i[l=s[1]]||(i[l]={start:1/0,end:-1/0}),o<(u=i[l]).start&&(u.start=o),o>u.end&&(u.end=o),t||(t=l)}for(var l in i){var u=i[l];this.createAnimation(l,u.start,u.end,e)}this.firstAnimation=t},ws.prototype.setAnimationDirectionForward=function(e){var t=this.animationsMap[e];t&&(t.direction=1,t.directionBackwards=!1)},ws.prototype.setAnimationDirectionBackward=function(e){var t=this.animationsMap[e];t&&(t.direction=-1,t.directionBackwards=!0)},ws.prototype.setAnimationFPS=function(e,t){var n=this.animationsMap[e];n&&(n.fps=t,n.duration=(n.end-n.start)/n.fps)},ws.prototype.setAnimationDuration=function(e,t){var n=this.animationsMap[e];n&&(n.duration=t,n.fps=(n.end-n.start)/n.duration)},ws.prototype.setAnimationWeight=function(e,t){var n=this.animationsMap[e];n&&(n.weight=t)},ws.prototype.setAnimationTime=function(e,t){var n=this.animationsMap[e];n&&(n.time=t)},ws.prototype.getAnimationTime=function(e){var t=0,n=this.animationsMap[e];return n&&(t=n.time),t},ws.prototype.getAnimationDuration=function(e){var t=-1,n=this.animationsMap[e];return n&&(t=n.duration),t},ws.prototype.playAnimation=function(e){var t=this.animationsMap[e];t?(t.time=0,t.active=!0):console.warn("THREE.MorphBlendMesh: animation["+e+"] undefined in .playAnimation()")},ws.prototype.stopAnimation=function(e){var t=this.animationsMap[e];t&&(t.active=!1)},ws.prototype.update=function(e){for(var t=0,n=this.animationsList.length;ti.duration||i.time<0)&&(i.direction*=-1,i.time>i.duration&&(i.time=i.duration,i.directionBackwards=!0),i.time<0&&(i.time=0,i.directionBackwards=!1)):(i.time=i.time%i.duration,i.time<0&&(i.time+=i.duration));var o=i.start+Mt.clamp(Math.floor(i.time/r),0,i.length-1),a=i.weight;o!==i.currentFrame&&(this.morphTargetInfluences[i.lastFrame]=0,this.morphTargetInfluences[i.currentFrame]=1*a,this.morphTargetInfluences[o]=0,i.lastFrame=i.currentFrame,i.currentFrame=o);var s=i.time%r/r;i.directionBackwards&&(s=1-s),i.currentFrame!==i.lastFrame?(this.morphTargetInfluences[i.currentFrame]=s*a,this.morphTargetInfluences[i.lastFrame]=(1-s)*a):this.morphTargetInfluences[i.currentFrame]=a}}},Ms.prototype=Object.create(hi.prototype),Ms.prototype.constructor=Ms,Ms.prototype.isImmediateRenderObject=!0,Ss.prototype=Object.create(Er.prototype),Ss.prototype.constructor=Ss,Ss.prototype.update=function(){var e=new Ft,t=new Ft,n=new Jn;return function(){var i=["a","b","c"];this.object.updateMatrixWorld(!0),n.getNormalMatrix(this.object.matrixWorld);var r=this.object.matrixWorld,o=this.geometry.attributes.position,a=this.object.geometry;if(a&&a.isGeometry)for(var s=a.vertices,l=a.faces,u=0,c=0,d=l.length;c.99999?this.quaternion.set(0,0,0,1):e.y<-.99999?this.quaternion.set(1,0,0,0):(Ka.set(e.z,0,-e.x).normalize(),Xa=Math.acos(e.y),this.quaternion.setFromAxisAngle(Ka,Xa))}),Ns.prototype.setLength=function(e,t,n){void 0===t&&(t=.2*e),void 0===n&&(n=.2*t),this.line.scale.set(1,Math.max(0,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()},Ns.prototype.setColor=function(e){this.line.material.color.copy(e),this.cone.material.color.copy(e)},Fs.prototype=Object.create(Er.prototype),Fs.prototype.constructor=Fs;var Bs=new Ft,js=new zs,Us=new zs,Ws=new zs;function Gs(e){this.points=e||[],this.closed=!1}function Vs(e,t,n,i){this.v0=e,this.v1=t,this.v2=n,this.v3=i}function Hs(e,t,n){this.v0=e,this.v1=t,this.v2=n}function Ys(e,t){this.v1=e,this.v2=t}function qs(e,t,n,i,r,o){Sa.call(this,e,t,n,n,i,r,o)}Gs.prototype=Object.create(xa.prototype),Gs.prototype.constructor=Gs,Gs.prototype.getPoint=function(e){var t=this.points,n=t.length;n<2&&console.log("duh, you need at least 2 points");var i,r,o,a,s=(n-(this.closed?0:1))*e,l=Math.floor(s),u=s-l;if(this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/t.length)+1)*t.length:0===u&&l===n-1&&(l=n-2,u=1),this.closed||l>0?i=t[(l-1)%n]:(Bs.subVectors(t[0],t[1]).add(t[0]),i=Bs),r=t[l%n],o=t[(l+1)%n],this.closed||l+2 @@ -26,27 +26,12 @@ var i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__p * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */(function(){var o="Expected a function",a="__lodash_placeholder__",s=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],l="[object Arguments]",u="[object Array]",c="[object Boolean]",d="[object Date]",h="[object Error]",p="[object Function]",f="[object GeneratorFunction]",m="[object Map]",g="[object Number]",v="[object Object]",y="[object RegExp]",b="[object Set]",_="[object String]",x="[object Symbol]",w="[object WeakMap]",M="[object ArrayBuffer]",S="[object DataView]",E="[object Float32Array]",T="[object Float64Array]",C="[object Int8Array]",O="[object Int16Array]",k="[object Int32Array]",P="[object Uint8Array]",A="[object Uint16Array]",R="[object Uint32Array]",L=/\b__p \+= '';/g,I=/\b(__p \+=) '' \+/g,D=/(__e\(.*?\)|\b__t\)) \+\n'';/g,N=/&(?:amp|lt|gt|quot|#39);/g,F=/[&<>"']/g,z=RegExp(N.source),B=RegExp(F.source),j=/<%-([\s\S]+?)%>/g,U=/<%([\s\S]+?)%>/g,W=/<%=([\s\S]+?)%>/g,G=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,V=/^\w*$/,H=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Y=/[\\^$.*+?()[\]{}|]/g,q=RegExp(Y.source),X=/^\s+|\s+$/g,K=/^\s+/,Z=/\s+$/,J=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,$=/\{\n\/\* \[wrapped with (.+)\] \*/,Q=/,? & /,ee=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,te=/\\(\\)?/g,ne=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ie=/\w*$/,re=/^[-+]0x[0-9a-f]+$/i,oe=/^0b[01]+$/i,ae=/^\[object .+?Constructor\]$/,se=/^0o[0-7]+$/i,le=/^(?:0|[1-9]\d*)$/,ue=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ce=/($^)/,de=/['\n\r\u2028\u2029\\]/g,he="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",pe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",fe="[\\ud800-\\udfff]",me="["+pe+"]",ge="["+he+"]",ve="\\d+",ye="[\\u2700-\\u27bf]",be="[a-z\\xdf-\\xf6\\xf8-\\xff]",_e="[^\\ud800-\\udfff"+pe+ve+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",xe="\\ud83c[\\udffb-\\udfff]",we="[^\\ud800-\\udfff]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Se="[\\ud800-\\udbff][\\udc00-\\udfff]",Ee="[A-Z\\xc0-\\xd6\\xd8-\\xde]",Te="(?:"+be+"|"+_e+")",Ce="(?:"+Ee+"|"+_e+")",Oe="(?:"+ge+"|"+xe+")"+"?",ke="[\\ufe0e\\ufe0f]?"+Oe+("(?:\\u200d(?:"+[we,Me,Se].join("|")+")[\\ufe0e\\ufe0f]?"+Oe+")*"),Pe="(?:"+[ye,Me,Se].join("|")+")"+ke,Ae="(?:"+[we+ge+"?",ge,Me,Se,fe].join("|")+")",Re=RegExp("['’]","g"),Le=RegExp(ge,"g"),Ie=RegExp(xe+"(?="+xe+")|"+Ae+ke,"g"),De=RegExp([Ee+"?"+be+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[me,Ee,"$"].join("|")+")",Ce+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[me,Ee+Te,"$"].join("|")+")",Ee+"?"+Te+"+(?:['’](?:d|ll|m|re|s|t|ve))?",Ee+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ve,Pe].join("|"),"g"),Ne=RegExp("[\\u200d\\ud800-\\udfff"+he+"\\ufe0e\\ufe0f]"),Fe=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ze=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Be=-1,je={};je[E]=je[T]=je[C]=je[O]=je[k]=je[P]=je["[object Uint8ClampedArray]"]=je[A]=je[R]=!0,je[l]=je[u]=je[M]=je[c]=je[S]=je[d]=je[h]=je[p]=je[m]=je[g]=je[v]=je[y]=je[b]=je[_]=je[w]=!1;var Ue={};Ue[l]=Ue[u]=Ue[M]=Ue[S]=Ue[c]=Ue[d]=Ue[E]=Ue[T]=Ue[C]=Ue[O]=Ue[k]=Ue[m]=Ue[g]=Ue[v]=Ue[y]=Ue[b]=Ue[_]=Ue[x]=Ue[P]=Ue["[object Uint8ClampedArray]"]=Ue[A]=Ue[R]=!0,Ue[h]=Ue[p]=Ue[w]=!1;var We={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ge=parseFloat,Ve=parseInt,He="object"==typeof e&&e&&e.Object===Object&&e,Ye="object"==typeof self&&self&&self.Object===Object&&self,qe=He||Ye||Function("return this")(),Xe=t&&!t.nodeType&&t,Ke=Xe&&"object"==typeof i&&i&&!i.nodeType&&i,Ze=Ke&&Ke.exports===Xe,Je=Ze&&He.process,$e=function(){try{var e=Ke&&Ke.require&&Ke.require("util").types;return e||Je&&Je.binding&&Je.binding("util")}catch(e){}}(),Qe=$e&&$e.isArrayBuffer,et=$e&&$e.isDate,tt=$e&&$e.isMap,nt=$e&&$e.isRegExp,it=$e&&$e.isSet,rt=$e&&$e.isTypedArray;function ot(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function at(e,t,n,i){for(var r=-1,o=null==e?0:e.length;++r-1}function ht(e,t,n){for(var i=-1,r=null==e?0:e.length;++i-1;);return n}function It(e,t){for(var n=e.length;n--&&xt(t,e[n],0)>-1;);return n}function Dt(e,t){for(var n=e.length,i=0;n--;)e[n]===t&&++i;return i}var Nt=Tt({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Ft=Tt({"&":"&","<":"<",">":">",'"':""","'":"'"});function zt(e){return"\\"+We[e]}function Bt(e){return Ne.test(e)}function jt(e){var t=-1,n=Array(e.size);return e.forEach((function(e,i){n[++t]=[i,e]})),n}function Ut(e,t){return function(n){return e(t(n))}}function Wt(e,t){for(var n=-1,i=e.length,r=0,o=[];++n",""":'"',"'":"'"});var Xt=function e(t){var n,i=(t=null==t?qe:Xt.defaults(qe.Object(),t,Xt.pick(qe,ze))).Array,r=t.Date,he=t.Error,pe=t.Function,fe=t.Math,me=t.Object,ge=t.RegExp,ve=t.String,ye=t.TypeError,be=i.prototype,_e=pe.prototype,xe=me.prototype,we=t["__core-js_shared__"],Me=_e.toString,Se=xe.hasOwnProperty,Ee=0,Te=(n=/[^.]+$/.exec(we&&we.keys&&we.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Ce=xe.toString,Oe=Me.call(me),ke=qe._,Pe=ge("^"+Me.call(Se).replace(Y,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ae=Ze?t.Buffer:void 0,Ie=t.Symbol,Ne=t.Uint8Array,We=Ae?Ae.allocUnsafe:void 0,He=Ut(me.getPrototypeOf,me),Ye=me.create,Xe=xe.propertyIsEnumerable,Ke=be.splice,Je=Ie?Ie.isConcatSpreadable:void 0,$e=Ie?Ie.iterator:void 0,yt=Ie?Ie.toStringTag:void 0,Tt=function(){try{var e=Qr(me,"defineProperty");return e({},"",{}),e}catch(e){}}(),Kt=t.clearTimeout!==qe.clearTimeout&&t.clearTimeout,Zt=r&&r.now!==qe.Date.now&&r.now,Jt=t.setTimeout!==qe.setTimeout&&t.setTimeout,$t=fe.ceil,Qt=fe.floor,en=me.getOwnPropertySymbols,tn=Ae?Ae.isBuffer:void 0,nn=t.isFinite,rn=be.join,on=Ut(me.keys,me),an=fe.max,sn=fe.min,ln=r.now,un=t.parseInt,cn=fe.random,dn=be.reverse,hn=Qr(t,"DataView"),pn=Qr(t,"Map"),fn=Qr(t,"Promise"),mn=Qr(t,"Set"),gn=Qr(t,"WeakMap"),vn=Qr(me,"create"),yn=gn&&new gn,bn={},_n=Co(hn),xn=Co(pn),wn=Co(fn),Mn=Co(mn),Sn=Co(gn),En=Ie?Ie.prototype:void 0,Tn=En?En.valueOf:void 0,Cn=En?En.toString:void 0;function On(e){if(Va(e)&&!La(e)&&!(e instanceof Rn)){if(e instanceof An)return e;if(Se.call(e,"__wrapped__"))return Oo(e)}return new An(e)}var kn=function(){function e(){}return function(t){if(!Ga(t))return{};if(Ye)return Ye(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function Pn(){}function An(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}function Rn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function Ln(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function Zn(e,t,n,i,r,o){var a,s=1&t,u=2&t,h=4&t;if(n&&(a=r?n(e,i,r,o):n(e)),void 0!==a)return a;if(!Ga(e))return e;var w=La(e);if(w){if(a=function(e){var t=e.length,n=new e.constructor(t);t&&"string"==typeof e[0]&&Se.call(e,"index")&&(n.index=e.index,n.input=e.input);return n}(e),!s)return vr(e,a)}else{var L=no(e),I=L==p||L==f;if(Fa(e))return dr(e,s);if(L==v||L==l||I&&!r){if(a=u||I?{}:ro(e),!s)return u?function(e,t){return yr(e,to(e),t)}(e,function(e,t){return e&&yr(t,xs(t),e)}(a,e)):function(e,t){return yr(e,eo(e),t)}(e,Yn(a,e))}else{if(!Ue[L])return r?e:{};a=function(e,t,n){var i=e.constructor;switch(t){case M:return hr(e);case c:case d:return new i(+e);case S:return function(e,t){var n=t?hr(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case E:case T:case C:case O:case k:case P:case"[object Uint8ClampedArray]":case A:case R:return pr(e,n);case m:return new i;case g:case _:return new i(e);case y:return function(e){var t=new e.constructor(e.source,ie.exec(e));return t.lastIndex=e.lastIndex,t}(e);case b:return new i;case x:return r=e,Tn?me(Tn.call(r)):{}}var r}(e,L,s)}}o||(o=new Fn);var D=o.get(e);if(D)return D;o.set(e,a),Ka(e)?e.forEach((function(i){a.add(Zn(i,t,n,i,e,o))})):Ha(e)&&e.forEach((function(i,r){a.set(r,Zn(i,t,n,r,e,o))}));var N=w?void 0:(h?u?Yr:Hr:u?xs:_s)(e);return st(N||e,(function(i,r){N&&(i=e[r=i]),Gn(a,r,Zn(i,t,n,r,e,o))})),a}function Jn(e,t,n){var i=n.length;if(null==e)return!i;for(e=me(e);i--;){var r=n[i],o=t[r],a=e[r];if(void 0===a&&!(r in e)||!o(a))return!1}return!0}function $n(e,t,n){if("function"!=typeof e)throw new ye(o);return _o((function(){e.apply(void 0,n)}),t)}function Qn(e,t,n,i){var r=-1,o=dt,a=!0,s=e.length,l=[],u=t.length;if(!s)return l;n&&(t=pt(t,Pt(n))),i?(o=ht,a=!1):t.length>=200&&(o=Rt,a=!1,t=new Nn(t));e:for(;++r-1},In.prototype.set=function(e,t){var n=this.__data__,i=Vn(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this},Dn.prototype.clear=function(){this.size=0,this.__data__={hash:new Ln,map:new(pn||In),string:new Ln}},Dn.prototype.delete=function(e){var t=Jr(this,e).delete(e);return this.size-=t?1:0,t},Dn.prototype.get=function(e){return Jr(this,e).get(e)},Dn.prototype.has=function(e){return Jr(this,e).has(e)},Dn.prototype.set=function(e,t){var n=Jr(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this},Nn.prototype.add=Nn.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Nn.prototype.has=function(e){return this.__data__.has(e)},Fn.prototype.clear=function(){this.__data__=new In,this.size=0},Fn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Fn.prototype.get=function(e){return this.__data__.get(e)},Fn.prototype.has=function(e){return this.__data__.has(e)},Fn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof In){var i=n.__data__;if(!pn||i.length<199)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new Dn(i)}return n.set(e,t),this.size=n.size,this};var ei=xr(li),ti=xr(ui,!0);function ni(e,t){var n=!0;return ei(e,(function(e,i,r){return n=!!t(e,i,r)})),n}function ii(e,t,n){for(var i=-1,r=e.length;++i0&&n(s)?t>1?oi(s,t-1,n,i,r):ft(r,s):i||(r[r.length]=s)}return r}var ai=wr(),si=wr(!0);function li(e,t){return e&&ai(e,t,_s)}function ui(e,t){return e&&si(e,t,_s)}function ci(e,t){return ct(t,(function(t){return ja(e[t])}))}function di(e,t){for(var n=0,i=(t=sr(t,e)).length;null!=e&&nt}function mi(e,t){return null!=e&&Se.call(e,t)}function gi(e,t){return null!=e&&t in me(e)}function vi(e,t,n){for(var r=n?ht:dt,o=e[0].length,a=e.length,s=a,l=i(a),u=1/0,c=[];s--;){var d=e[s];s&&t&&(d=pt(d,Pt(t))),u=sn(d.length,u),l[s]=!n&&(t||o>=120&&d.length>=120)?new Nn(s&&d):void 0}d=e[0];var h=-1,p=l[0];e:for(;++h=s)return l;var u=n[i];return l*("desc"==u?-1:1)}}return e.index-t.index}(e,t,n)}))}function Li(e,t,n){for(var i=-1,r=t.length,o={};++i-1;)s!==e&&Ke.call(s,l,1),Ke.call(e,l,1);return e}function Di(e,t){for(var n=e?t.length:0,i=n-1;n--;){var r=t[n];if(n==i||r!==o){var o=r;ao(r)?Ke.call(e,r,1):Qi(e,r)}}return e}function Ni(e,t){return e+Qt(cn()*(t-e+1))}function Fi(e,t){var n="";if(!e||t<1||t>9007199254740991)return n;do{t%2&&(n+=e),(t=Qt(t/2))&&(e+=e)}while(t);return n}function zi(e,t){return xo(mo(e,t,Ys),e+"")}function Bi(e){return Bn(ks(e))}function ji(e,t){var n=ks(e);return So(n,Kn(t,0,n.length))}function Ui(e,t,n,i){if(!Ga(e))return e;for(var r=-1,o=(t=sr(t,e)).length,a=o-1,s=e;null!=s&&++ro?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=i(o);++r>>1,a=e[o];null!==a&&!Ja(a)&&(n?a<=t:a=200){var u=t?null:Fr(e);if(u)return Gt(u);a=!1,r=Rt,l=new Nn}else l=t?[]:s;e:for(;++i=i?e:Hi(e,t,n)}var cr=Kt||function(e){return qe.clearTimeout(e)};function dr(e,t){if(t)return e.slice();var n=e.length,i=We?We(n):new e.constructor(n);return e.copy(i),i}function hr(e){var t=new e.constructor(e.byteLength);return new Ne(t).set(new Ne(e)),t}function pr(e,t){var n=t?hr(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function fr(e,t){if(e!==t){var n=void 0!==e,i=null===e,r=e==e,o=Ja(e),a=void 0!==t,s=null===t,l=t==t,u=Ja(t);if(!s&&!u&&!o&&e>t||o&&a&&l&&!s&&!u||i&&a&&l||!n&&l||!r)return 1;if(!i&&!o&&!u&&e1?n[r-1]:void 0,a=r>2?n[2]:void 0;for(o=e.length>3&&"function"==typeof o?(r--,o):void 0,a&&so(n[0],n[1],a)&&(o=r<3?void 0:o,r=1),t=me(t);++i-1?r[o?t[a]:a]:void 0}}function Cr(e){return Vr((function(t){var n=t.length,i=n,r=An.prototype.thru;for(e&&t.reverse();i--;){var a=t[i];if("function"!=typeof a)throw new ye(o);if(r&&!s&&"wrapper"==Xr(a))var s=new An([],!0)}for(i=s?i:n;++i1&&b.reverse(),d&&us))return!1;var u=o.get(e);if(u&&o.get(t))return u==t;var c=-1,d=!0,h=2&n?new Nn:void 0;for(o.set(e,t),o.set(t,e);++c-1&&e%1==0&&e1?"& ":"")+t[i],t=t.join(n>2?", ":" "),e.replace(J,"{\n/* [wrapped with "+t+"] */\n")}(i,function(e,t){return st(s,(function(n){var i="_."+n[0];t&n[1]&&!dt(e,i)&&e.push(i)})),e.sort()}(function(e){var t=e.match($);return t?t[1].split(Q):[]}(i),n)))}function Mo(e){var t=0,n=0;return function(){var i=ln(),r=16-(i-n);if(n=i,r>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function So(e,t){var n=-1,i=e.length,r=i-1;for(t=void 0===t?i:t;++n1?e[t-1]:void 0;return n="function"==typeof n?(e.pop(),n):void 0,Xo(e,n)}));function ta(e){var t=On(e);return t.__chain__=!0,t}function na(e,t){return t(e)}var ia=Vr((function(e){var t=e.length,n=t?e[0]:0,i=this.__wrapped__,r=function(t){return Xn(t,e)};return!(t>1||this.__actions__.length)&&i instanceof Rn&&ao(n)?((i=i.slice(n,+n+(t?1:0))).__actions__.push({func:na,args:[r],thisArg:void 0}),new An(i,this.__chain__).thru((function(e){return t&&!e.length&&e.push(void 0),e}))):this.thru(r)}));var ra=br((function(e,t,n){Se.call(e,n)?++e[n]:qn(e,n,1)}));var oa=Tr(Ro),aa=Tr(Lo);function sa(e,t){return(La(e)?st:ei)(e,Zr(t,3))}function la(e,t){return(La(e)?lt:ti)(e,Zr(t,3))}var ua=br((function(e,t,n){Se.call(e,n)?e[n].push(t):qn(e,n,[t])}));var ca=zi((function(e,t,n){var r=-1,o="function"==typeof t,a=Da(e)?i(e.length):[];return ei(e,(function(e){a[++r]=o?ot(t,e,n):yi(e,t,n)})),a})),da=br((function(e,t,n){qn(e,n,t)}));function ha(e,t){return(La(e)?pt:Ci)(e,Zr(t,3))}var pa=br((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]}));var fa=zi((function(e,t){if(null==e)return[];var n=t.length;return n>1&&so(e,t[0],t[1])?t=[]:n>2&&so(t[0],t[1],t[2])&&(t=[t[0]]),Ri(e,oi(t,1),[])})),ma=Zt||function(){return qe.Date.now()};function ga(e,t,n){return t=n?void 0:t,Br(e,128,void 0,void 0,void 0,void 0,t=e&&null==t?e.length:t)}function va(e,t){var n;if("function"!=typeof t)throw new ye(o);return e=is(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=void 0),n}}var ya=zi((function(e,t,n){var i=1;if(n.length){var r=Wt(n,Kr(ya));i|=32}return Br(e,i,t,n,r)})),ba=zi((function(e,t,n){var i=3;if(n.length){var r=Wt(n,Kr(ba));i|=32}return Br(t,i,e,n,r)}));function _a(e,t,n){var i,r,a,s,l,u,c=0,d=!1,h=!1,p=!0;if("function"!=typeof e)throw new ye(o);function f(t){var n=i,o=r;return i=r=void 0,c=t,s=e.apply(o,n)}function m(e){return c=e,l=_o(v,t),d?f(e):s}function g(e){var n=e-u;return void 0===u||n>=t||n<0||h&&e-c>=a}function v(){var e=ma();if(g(e))return y(e);l=_o(v,function(e){var n=t-(e-u);return h?sn(n,a-(e-c)):n}(e))}function y(e){return l=void 0,p&&i?f(e):(i=r=void 0,s)}function b(){var e=ma(),n=g(e);if(i=arguments,r=this,u=e,n){if(void 0===l)return m(u);if(h)return cr(l),l=_o(v,t),f(u)}return void 0===l&&(l=_o(v,t)),s}return t=os(t)||0,Ga(n)&&(d=!!n.leading,a=(h="maxWait"in n)?an(os(n.maxWait)||0,t):a,p="trailing"in n?!!n.trailing:p),b.cancel=function(){void 0!==l&&cr(l),c=0,i=u=r=l=void 0},b.flush=function(){return void 0===l?s:y(ma())},b}var xa=zi((function(e,t){return $n(e,1,t)})),wa=zi((function(e,t,n){return $n(e,os(t)||0,n)}));function Ma(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new ye(o);var n=function(){var i=arguments,r=t?t.apply(this,i):i[0],o=n.cache;if(o.has(r))return o.get(r);var a=e.apply(this,i);return n.cache=o.set(r,a)||o,a};return n.cache=new(Ma.Cache||Dn),n}function Sa(e){if("function"!=typeof e)throw new ye(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Ma.Cache=Dn;var Ea=lr((function(e,t){var n=(t=1==t.length&&La(t[0])?pt(t[0],Pt(Zr())):pt(oi(t,1),Pt(Zr()))).length;return zi((function(i){for(var r=-1,o=sn(i.length,n);++r=t})),Ra=bi(function(){return arguments}())?bi:function(e){return Va(e)&&Se.call(e,"callee")&&!Xe.call(e,"callee")},La=i.isArray,Ia=Qe?Pt(Qe):function(e){return Va(e)&&pi(e)==M};function Da(e){return null!=e&&Wa(e.length)&&!ja(e)}function Na(e){return Va(e)&&Da(e)}var Fa=tn||ol,za=et?Pt(et):function(e){return Va(e)&&pi(e)==d};function Ba(e){if(!Va(e))return!1;var t=pi(e);return t==h||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!qa(e)}function ja(e){if(!Ga(e))return!1;var t=pi(e);return t==p||t==f||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Ua(e){return"number"==typeof e&&e==is(e)}function Wa(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function Ga(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Va(e){return null!=e&&"object"==typeof e}var Ha=tt?Pt(tt):function(e){return Va(e)&&no(e)==m};function Ya(e){return"number"==typeof e||Va(e)&&pi(e)==g}function qa(e){if(!Va(e)||pi(e)!=v)return!1;var t=He(e);if(null===t)return!0;var n=Se.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Me.call(n)==Oe}var Xa=nt?Pt(nt):function(e){return Va(e)&&pi(e)==y};var Ka=it?Pt(it):function(e){return Va(e)&&no(e)==b};function Za(e){return"string"==typeof e||!La(e)&&Va(e)&&pi(e)==_}function Ja(e){return"symbol"==typeof e||Va(e)&&pi(e)==x}var $a=rt?Pt(rt):function(e){return Va(e)&&Wa(e.length)&&!!je[pi(e)]};var Qa=Ir(Ti),es=Ir((function(e,t){return e<=t}));function ts(e){if(!e)return[];if(Da(e))return Za(e)?Yt(e):vr(e);if($e&&e[$e])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[$e]());var t=no(e);return(t==m?jt:t==b?Gt:ks)(e)}function ns(e){return e?(e=os(e))===1/0||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function is(e){var t=ns(e),n=t%1;return t==t?n?t-n:t:0}function rs(e){return e?Kn(is(e),0,4294967295):0}function os(e){if("number"==typeof e)return e;if(Ja(e))return NaN;if(Ga(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Ga(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(X,"");var n=oe.test(e);return n||se.test(e)?Ve(e.slice(2),n?2:8):re.test(e)?NaN:+e}function as(e){return yr(e,xs(e))}function ss(e){return null==e?"":Ji(e)}var ls=_r((function(e,t){if(ho(t)||Da(t))yr(t,_s(t),e);else for(var n in t)Se.call(t,n)&&Gn(e,n,t[n])})),us=_r((function(e,t){yr(t,xs(t),e)})),cs=_r((function(e,t,n,i){yr(t,xs(t),e,i)})),ds=_r((function(e,t,n,i){yr(t,_s(t),e,i)})),hs=Vr(Xn);var ps=zi((function(e,t){e=me(e);var n=-1,i=t.length,r=i>2?t[2]:void 0;for(r&&so(t[0],t[1],r)&&(i=1);++n1),t})),yr(e,Yr(e),n),i&&(n=Zn(n,7,Wr));for(var r=t.length;r--;)Qi(n,t[r]);return n}));var Es=Vr((function(e,t){return null==e?{}:function(e,t){return Li(e,t,(function(t,n){return gs(e,n)}))}(e,t)}));function Ts(e,t){if(null==e)return{};var n=pt(Yr(e),(function(e){return[e]}));return t=Zr(t),Li(e,n,(function(e,n){return t(e,n[0])}))}var Cs=zr(_s),Os=zr(xs);function ks(e){return null==e?[]:At(e,_s(e))}var Ps=Sr((function(e,t,n){return t=t.toLowerCase(),e+(n?As(t):t)}));function As(e){return Bs(ss(e).toLowerCase())}function Rs(e){return(e=ss(e))&&e.replace(ue,Nt).replace(Le,"")}var Ls=Sr((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),Is=Sr((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Ds=Mr("toLowerCase");var Ns=Sr((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}));var Fs=Sr((function(e,t,n){return e+(n?" ":"")+Bs(t)}));var zs=Sr((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Bs=Mr("toUpperCase");function js(e,t,n){return e=ss(e),void 0===(t=n?void 0:t)?function(e){return Fe.test(e)}(e)?function(e){return e.match(De)||[]}(e):function(e){return e.match(ee)||[]}(e):e.match(t)||[]}var Us=zi((function(e,t){try{return ot(e,void 0,t)}catch(e){return Ba(e)?e:new he(e)}})),Ws=Vr((function(e,t){return st(t,(function(t){t=To(t),qn(e,t,ya(e[t],e))})),e}));function Gs(e){return function(){return e}}var Vs=Cr(),Hs=Cr(!0);function Ys(e){return e}function qs(e){return Mi("function"==typeof e?e:Zn(e,1))}var Xs=zi((function(e,t){return function(n){return yi(n,e,t)}})),Ks=zi((function(e,t){return function(n){return yi(e,n,t)}}));function Zs(e,t,n){var i=_s(t),r=ci(t,i);null!=n||Ga(t)&&(r.length||!i.length)||(n=t,t=e,e=this,r=ci(t,_s(t)));var o=!(Ga(n)&&"chain"in n&&!n.chain),a=ja(e);return st(r,(function(n){var i=t[n];e[n]=i,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__),r=n.__actions__=vr(this.__actions__);return r.push({func:i,args:arguments,thisArg:e}),n.__chain__=t,n}return i.apply(e,ft([this.value()],arguments))})})),e}function Js(){}var $s=Ar(pt),Qs=Ar(ut),el=Ar(vt);function tl(e){return lo(e)?Et(To(e)):function(e){return function(t){return di(t,e)}}(e)}var nl=Lr(),il=Lr(!0);function rl(){return[]}function ol(){return!1}var al=Pr((function(e,t){return e+t}),0),sl=Nr("ceil"),ll=Pr((function(e,t){return e/t}),1),ul=Nr("floor");var cl,dl=Pr((function(e,t){return e*t}),1),hl=Nr("round"),pl=Pr((function(e,t){return e-t}),0);return On.after=function(e,t){if("function"!=typeof t)throw new ye(o);return e=is(e),function(){if(--e<1)return t.apply(this,arguments)}},On.ary=ga,On.assign=ls,On.assignIn=us,On.assignInWith=cs,On.assignWith=ds,On.at=hs,On.before=va,On.bind=ya,On.bindAll=Ws,On.bindKey=ba,On.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return La(e)?e:[e]},On.chain=ta,On.chunk=function(e,t,n){t=(n?so(e,t,n):void 0===t)?1:an(is(t),0);var r=null==e?0:e.length;if(!r||t<1)return[];for(var o=0,a=0,s=i($t(r/t));or?0:r+n),(i=void 0===i||i>r?r:is(i))<0&&(i+=r),i=n>i?0:rs(i);n>>0)?(e=ss(e))&&("string"==typeof t||null!=t&&!Xa(t))&&!(t=Ji(t))&&Bt(e)?ur(Yt(e),0,n):e.split(t,n):[]},On.spread=function(e,t){if("function"!=typeof e)throw new ye(o);return t=null==t?0:an(is(t),0),zi((function(n){var i=n[t],r=ur(n,0,t);return i&&ft(r,i),ot(e,this,r)}))},On.tail=function(e){var t=null==e?0:e.length;return t?Hi(e,1,t):[]},On.take=function(e,t,n){return e&&e.length?Hi(e,0,(t=n||void 0===t?1:is(t))<0?0:t):[]},On.takeRight=function(e,t,n){var i=null==e?0:e.length;return i?Hi(e,(t=i-(t=n||void 0===t?1:is(t)))<0?0:t,i):[]},On.takeRightWhile=function(e,t){return e&&e.length?tr(e,Zr(t,3),!1,!0):[]},On.takeWhile=function(e,t){return e&&e.length?tr(e,Zr(t,3)):[]},On.tap=function(e,t){return t(e),e},On.throttle=function(e,t,n){var i=!0,r=!0;if("function"!=typeof e)throw new ye(o);return Ga(n)&&(i="leading"in n?!!n.leading:i,r="trailing"in n?!!n.trailing:r),_a(e,t,{leading:i,maxWait:t,trailing:r})},On.thru=na,On.toArray=ts,On.toPairs=Cs,On.toPairsIn=Os,On.toPath=function(e){return La(e)?pt(e,To):Ja(e)?[e]:vr(Eo(ss(e)))},On.toPlainObject=as,On.transform=function(e,t,n){var i=La(e),r=i||Fa(e)||$a(e);if(t=Zr(t,4),null==n){var o=e&&e.constructor;n=r?i?new o:[]:Ga(e)&&ja(o)?kn(He(e)):{}}return(r?st:li)(e,(function(e,i,r){return t(n,e,i,r)})),n},On.unary=function(e){return ga(e,1)},On.union=Vo,On.unionBy=Ho,On.unionWith=Yo,On.uniq=function(e){return e&&e.length?$i(e):[]},On.uniqBy=function(e,t){return e&&e.length?$i(e,Zr(t,2)):[]},On.uniqWith=function(e,t){return t="function"==typeof t?t:void 0,e&&e.length?$i(e,void 0,t):[]},On.unset=function(e,t){return null==e||Qi(e,t)},On.unzip=qo,On.unzipWith=Xo,On.update=function(e,t,n){return null==e?e:er(e,t,ar(n))},On.updateWith=function(e,t,n,i){return i="function"==typeof i?i:void 0,null==e?e:er(e,t,ar(n),i)},On.values=ks,On.valuesIn=function(e){return null==e?[]:At(e,xs(e))},On.without=Ko,On.words=js,On.wrap=function(e,t){return Ta(ar(t),e)},On.xor=Zo,On.xorBy=Jo,On.xorWith=$o,On.zip=Qo,On.zipObject=function(e,t){return rr(e||[],t||[],Gn)},On.zipObjectDeep=function(e,t){return rr(e||[],t||[],Ui)},On.zipWith=ea,On.entries=Cs,On.entriesIn=Os,On.extend=us,On.extendWith=cs,Zs(On,On),On.add=al,On.attempt=Us,On.camelCase=Ps,On.capitalize=As,On.ceil=sl,On.clamp=function(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=os(n))==n?n:0),void 0!==t&&(t=(t=os(t))==t?t:0),Kn(os(e),t,n)},On.clone=function(e){return Zn(e,4)},On.cloneDeep=function(e){return Zn(e,5)},On.cloneDeepWith=function(e,t){return Zn(e,5,t="function"==typeof t?t:void 0)},On.cloneWith=function(e,t){return Zn(e,4,t="function"==typeof t?t:void 0)},On.conformsTo=function(e,t){return null==t||Jn(e,t,_s(t))},On.deburr=Rs,On.defaultTo=function(e,t){return null==e||e!=e?t:e},On.divide=ll,On.endsWith=function(e,t,n){e=ss(e),t=Ji(t);var i=e.length,r=n=void 0===n?i:Kn(is(n),0,i);return(n-=t.length)>=0&&e.slice(n,r)==t},On.eq=ka,On.escape=function(e){return(e=ss(e))&&B.test(e)?e.replace(F,Ft):e},On.escapeRegExp=function(e){return(e=ss(e))&&q.test(e)?e.replace(Y,"\\$&"):e},On.every=function(e,t,n){var i=La(e)?ut:ni;return n&&so(e,t,n)&&(t=void 0),i(e,Zr(t,3))},On.find=oa,On.findIndex=Ro,On.findKey=function(e,t){return bt(e,Zr(t,3),li)},On.findLast=aa,On.findLastIndex=Lo,On.findLastKey=function(e,t){return bt(e,Zr(t,3),ui)},On.floor=ul,On.forEach=sa,On.forEachRight=la,On.forIn=function(e,t){return null==e?e:ai(e,Zr(t,3),xs)},On.forInRight=function(e,t){return null==e?e:si(e,Zr(t,3),xs)},On.forOwn=function(e,t){return e&&li(e,Zr(t,3))},On.forOwnRight=function(e,t){return e&&ui(e,Zr(t,3))},On.get=ms,On.gt=Pa,On.gte=Aa,On.has=function(e,t){return null!=e&&io(e,t,mi)},On.hasIn=gs,On.head=Do,On.identity=Ys,On.includes=function(e,t,n,i){e=Da(e)?e:ks(e),n=n&&!i?is(n):0;var r=e.length;return n<0&&(n=an(r+n,0)),Za(e)?n<=r&&e.indexOf(t,n)>-1:!!r&&xt(e,t,n)>-1},On.indexOf=function(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var r=null==n?0:is(n);return r<0&&(r=an(i+r,0)),xt(e,t,r)},On.inRange=function(e,t,n){return t=ns(t),void 0===n?(n=t,t=0):n=ns(n),function(e,t,n){return e>=sn(t,n)&&e=-9007199254740991&&e<=9007199254740991},On.isSet=Ka,On.isString=Za,On.isSymbol=Ja,On.isTypedArray=$a,On.isUndefined=function(e){return void 0===e},On.isWeakMap=function(e){return Va(e)&&no(e)==w},On.isWeakSet=function(e){return Va(e)&&"[object WeakSet]"==pi(e)},On.join=function(e,t){return null==e?"":rn.call(e,t)},On.kebabCase=Ls,On.last=Bo,On.lastIndexOf=function(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var r=i;return void 0!==n&&(r=(r=is(n))<0?an(i+r,0):sn(r,i-1)),t==t?function(e,t,n){for(var i=n+1;i--;)if(e[i]===t)return i;return i}(e,t,r):_t(e,Mt,r,!0)},On.lowerCase=Is,On.lowerFirst=Ds,On.lt=Qa,On.lte=es,On.max=function(e){return e&&e.length?ii(e,Ys,fi):void 0},On.maxBy=function(e,t){return e&&e.length?ii(e,Zr(t,2),fi):void 0},On.mean=function(e){return St(e,Ys)},On.meanBy=function(e,t){return St(e,Zr(t,2))},On.min=function(e){return e&&e.length?ii(e,Ys,Ti):void 0},On.minBy=function(e,t){return e&&e.length?ii(e,Zr(t,2),Ti):void 0},On.stubArray=rl,On.stubFalse=ol,On.stubObject=function(){return{}},On.stubString=function(){return""},On.stubTrue=function(){return!0},On.multiply=dl,On.nth=function(e,t){return e&&e.length?Ai(e,is(t)):void 0},On.noConflict=function(){return qe._===this&&(qe._=ke),this},On.noop=Js,On.now=ma,On.pad=function(e,t,n){e=ss(e);var i=(t=is(t))?Ht(e):0;if(!t||i>=t)return e;var r=(t-i)/2;return Rr(Qt(r),n)+e+Rr($t(r),n)},On.padEnd=function(e,t,n){e=ss(e);var i=(t=is(t))?Ht(e):0;return t&&it){var i=e;e=t,t=i}if(n||e%1||t%1){var r=cn();return sn(e+r*(t-e+Ge("1e-"+((r+"").length-1))),t)}return Ni(e,t)},On.reduce=function(e,t,n){var i=La(e)?mt:Ct,r=arguments.length<3;return i(e,Zr(t,4),n,r,ei)},On.reduceRight=function(e,t,n){var i=La(e)?gt:Ct,r=arguments.length<3;return i(e,Zr(t,4),n,r,ti)},On.repeat=function(e,t,n){return t=(n?so(e,t,n):void 0===t)?1:is(t),Fi(ss(e),t)},On.replace=function(){var e=arguments,t=ss(e[0]);return e.length<3?t:t.replace(e[1],e[2])},On.result=function(e,t,n){var i=-1,r=(t=sr(t,e)).length;for(r||(r=1,e=void 0);++i9007199254740991)return[];var n=4294967295,i=sn(e,4294967295);e-=4294967295;for(var r=kt(i,t=Zr(t));++n=o)return e;var s=n-Ht(i);if(s<1)return i;var l=a?ur(a,0,s).join(""):e.slice(0,s);if(void 0===r)return l+i;if(a&&(s+=l.length-s),Xa(r)){if(e.slice(s).search(r)){var u,c=l;for(r.global||(r=ge(r.source,ss(ie.exec(r))+"g")),r.lastIndex=0;u=r.exec(c);)var d=u.index;l=l.slice(0,void 0===d?s:d)}}else if(e.indexOf(Ji(r),s)!=s){var h=l.lastIndexOf(r);h>-1&&(l=l.slice(0,h))}return l+i},On.unescape=function(e){return(e=ss(e))&&z.test(e)?e.replace(N,qt):e},On.uniqueId=function(e){var t=++Ee;return ss(e)+t},On.upperCase=zs,On.upperFirst=Bs,On.each=sa,On.eachRight=la,On.first=Do,Zs(On,(cl={},li(On,(function(e,t){Se.call(On.prototype,t)||(cl[t]=e)})),cl),{chain:!1}),On.VERSION="4.17.15",st(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){On[e].placeholder=On})),st(["drop","take"],(function(e,t){Rn.prototype[e]=function(n){n=void 0===n?1:an(is(n),0);var i=this.__filtered__&&!t?new Rn(this):this.clone();return i.__filtered__?i.__takeCount__=sn(n,i.__takeCount__):i.__views__.push({size:sn(n,4294967295),type:e+(i.__dir__<0?"Right":"")}),i},Rn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),st(["filter","map","takeWhile"],(function(e,t){var n=t+1,i=1==n||3==n;Rn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:Zr(e,3),type:n}),t.__filtered__=t.__filtered__||i,t}})),st(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Rn.prototype[e]=function(){return this[n](1).value()[0]}})),st(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Rn.prototype[e]=function(){return this.__filtered__?new Rn(this):this[n](1)}})),Rn.prototype.compact=function(){return this.filter(Ys)},Rn.prototype.find=function(e){return this.filter(e).head()},Rn.prototype.findLast=function(e){return this.reverse().find(e)},Rn.prototype.invokeMap=zi((function(e,t){return"function"==typeof e?new Rn(this):this.map((function(n){return yi(n,e,t)}))})),Rn.prototype.reject=function(e){return this.filter(Sa(Zr(e)))},Rn.prototype.slice=function(e,t){e=is(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Rn(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),void 0!==t&&(n=(t=is(t))<0?n.dropRight(-t):n.take(t-e)),n)},Rn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Rn.prototype.toArray=function(){return this.take(4294967295)},li(Rn.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),r=On[i?"take"+("last"==t?"Right":""):t],o=i||/^find/.test(t);r&&(On.prototype[t]=function(){var t=this.__wrapped__,a=i?[1]:arguments,s=t instanceof Rn,l=a[0],u=s||La(t),c=function(e){var t=r.apply(On,ft([e],a));return i&&d?t[0]:t};u&&n&&"function"==typeof l&&1!=l.length&&(s=u=!1);var d=this.__chain__,h=!!this.__actions__.length,p=o&&!d,f=s&&!h;if(!o&&u){t=f?t:new Rn(this);var m=e.apply(t,a);return m.__actions__.push({func:na,args:[c],thisArg:void 0}),new An(m,d)}return p&&f?e.apply(this,a):(m=this.thru(c),p?i?m.value()[0]:m.value():m)})})),st(["pop","push","shift","sort","splice","unshift"],(function(e){var t=be[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",i=/^(?:pop|shift)$/.test(e);On.prototype[e]=function(){var e=arguments;if(i&&!this.__chain__){var r=this.value();return t.apply(La(r)?r:[],e)}return this[n]((function(n){return t.apply(La(n)?n:[],e)}))}})),li(Rn.prototype,(function(e,t){var n=On[t];if(n){var i=n.name+"";Se.call(bn,i)||(bn[i]=[]),bn[i].push({name:t,func:n})}})),bn[Or(void 0,2).name]=[{name:"wrapper",func:void 0}],Rn.prototype.clone=function(){var e=new Rn(this.__wrapped__);return e.__actions__=vr(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=vr(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=vr(this.__views__),e},Rn.prototype.reverse=function(){if(this.__filtered__){var e=new Rn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Rn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=La(e),i=t<0,r=n?e.length:0,o=function(e,t,n){var i=-1,r=n.length;for(;++i=this.__values__.length;return{done:e,value:e?void 0:this.__values__[this.__index__++]}},On.prototype.plant=function(e){for(var t,n=this;n instanceof Pn;){var i=Oo(n);i.__index__=0,i.__values__=void 0,t?r.__wrapped__=i:t=i;var r=i;n=n.__wrapped__}return r.__wrapped__=e,t},On.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Rn){var t=e;return this.__actions__.length&&(t=new Rn(this)),(t=t.reverse()).__actions__.push({func:na,args:[Go],thisArg:void 0}),new An(t,this.__chain__)}return this.thru(Go)},On.prototype.toJSON=On.prototype.valueOf=On.prototype.value=function(){return nr(this.__wrapped__,this.__actions__)},On.prototype.first=On.prototype.head,$e&&(On.prototype[$e]=function(){return this}),On}();qe._=Xt,void 0===(r=function(){return Xt}.call(t,n,t,i))||(i.exports=r)}).call(this)}).call(this,n(47),n(74)(e))},function(e,t,n){e.exports={default:n(189),__esModule:!0}},function(e,t,n){e.exports={default:n(191),__esModule:!0}},function(e,t,n){"use strict";var i,r,o=e.exports=n(30),a=n(156);o.codegen=n(412),o.fetch=n(413),o.path=n(414),o.fs=o.inquire("fs"),o.toArray=function(e){if(e){for(var t=Object.keys(e),n=new Array(t.length),i=0;i3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=new i.MeshBasicMaterial({map:c.load(e),transparent:!0,depthWrite:!1}),l=new i.Mesh(new i.PlaneGeometry(t,n),s);return l.material.side=i.DoubleSide,l.position.set(r,o,a),l.overdraw=!0,l},t.drawDashedLineFromPoints=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16711680,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:4,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1,l=!(arguments.length>7&&void 0!==arguments[7])||arguments[7],u=new i.Path,c=u.createGeometry(e);c.computeLineDistances();var h=new i.LineDashedMaterial({color:t,dashSize:r,linewidth:n,gapSize:o,transparent:!0,opacity:s}),p=new i.Line(c,h);d(p,a),p.matrixAutoUpdate=l,l||p.updateMatrix();return p},t.drawCircle=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:32,r=new i.CircleGeometry(e,n),o=new i.Mesh(r,t);return o},t.drawEllipse=function(e,t,n){var r=new i.Shape;r.absellipse(0,0,e,t,0,2*Math.PI,!1,0);var o=new i.ShapeBufferGeometry(r);return new i.Mesh(o,n)},t.drawThickBandFromPoints=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:16777215,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=l(e.map((function(e){return[e.x,e.y]}))),s=new i.ShaderMaterial(u({side:i.DoubleSide,diffuse:n,thickness:t,opacity:r,transparent:!0})),c=new i.Mesh(a,s);return d(c,o),c},t.drawSegmentsFromPoints=h,t.drawBox=function(e,t,n){var r=new i.CubeGeometry(e.x,e.y,e.z),o=new i.MeshBasicMaterial({color:t}),a=new i.Mesh(r,o),s=new i.BoxHelper(a);return s.material.linewidth=n,s},t.drawDashedBox=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.01,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.02,a=new i.CubeGeometry(e.x,e.y,e.z);a=new i.EdgesGeometry(a),(a=(new i.Geometry).fromBufferGeometry(a)).computeLineDistances();var s=new i.LineDashedMaterial({color:t,linewidth:n,dashSize:r,gapSize:o}),l=new i.LineSegments(a,s);return l},t.drawArrow=function(e,t,n,r,o){var a=new i.Vector3(0,e,0),s=new i.Vector3(0,0,0),l=new i.Vector3(r/2,e-n,0),u=new i.Vector3(-r/2,e-n,0);return h([s,a,l,a,u],o,t,1)},t.getShapeGeometryFromPoints=p,t.drawShapeFromPoints=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new i.MeshBasicMaterial({color:16711680}),n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=p(e,n),s=new i.Mesh(a,t);d(s,r),s.matrixAutoUpdate=o,!1===o&&s.updateMatrix();return s},t.disposeMeshGroup=function(e){if(!e)return;e.traverse((function(e){void 0!==e.geometry&&(e.geometry.dispose(),e.material.dispose())}))},t.disposeMesh=function(e){if(!e)return;e.geometry.dispose(),e.material.dispose()};var i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(11)),r=a(n(224)),o=a(n(233));function a(e){return e&&e.__esModule?e:{default:e}}var s=n(14),l=(0,r.default)(i),u=(0,o.default)(i),c=new i.TextureLoader;function d(e,t){if(t){var n=.04*t;e.position.z+=n}}function h(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16711680,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=arguments.length>5&&void 0!==arguments[5]&&arguments[5],s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1,l=new i.Path,u=l.createGeometry(e),c=new i.LineBasicMaterial({color:t,linewidth:n,transparent:a,opacity:s}),h=new i.Line(u,c);return d(h,r),h.matrixAutoUpdate=o,!1===o&&h.updateMatrix(),h}function p(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=new i.Shape;if(t){n.moveTo(e[0].x,e[0].y);for(var r=1;r2&&void 0!==arguments[2]&&arguments[2];this.coordinates.isInitialized()&&!n||this.coordinates.initialize(e,t)}},{key:"updateDimension",value:function(e,t){e=e||(this.camera.aspect=e/t,this.camera.updateProjectionMatrix(),this.renderer.setSize(e,t),this.dimension.width=e,this.dimension.height=t)}},{key:"enableOrbitControls",value:function(e){var t=this.adc.mesh.position;this.camera.position.set(t.x,t.y,50),"FLU"===this.coordinates.systemName?this.camera.up.set(1,0,0):this.camera.up.set(0,0,1);var n=new o.Vector3(t.x,t.y,0);this.camera.lookAt(n),this.controls.target0=n.clone(),this.controls.position0=this.camera.position.clone(),this.controls.zoom0=this.camera.zoom,this.controls.minDistance=4,this.controls.maxDistance=4e3,this.controls.minPolarAngle=0,this.controls.maxPolarAngle=Math.PI/2,this.controls.enabled=!0,this.controls.enableRotate=e,this.controls.reset()}},{key:"adjustCamera",value:function(e,t){if(!this.routingEditor.isInEditingMode()){switch(this.camera.fov=PARAMETERS.camera[t].fov,this.camera.near=PARAMETERS.camera[t].near,this.camera.far=PARAMETERS.camera[t].far,t){case"Default":var n=this.viewDistance*Math.cos(e.rotation.y)*Math.cos(this.viewAngle),i=this.viewDistance*Math.sin(e.rotation.y)*Math.cos(this.viewAngle),r=this.viewDistance*Math.sin(this.viewAngle);this.camera.position.x=e.position.x-n,this.camera.position.y=e.position.y-i,this.camera.position.z=e.position.z+r,this.camera.up.set(0,0,1),this.camera.lookAt({x:e.position.x+n,y:e.position.y+i,z:0}),this.controls.enabled=!1;break;case"Near":n=.5*this.viewDistance*Math.cos(e.rotation.y)*Math.cos(this.viewAngle),i=.5*this.viewDistance*Math.sin(e.rotation.y)*Math.cos(this.viewAngle),r=.5*this.viewDistance*Math.sin(this.viewAngle),this.camera.position.x=e.position.x-n,this.camera.position.y=e.position.y-i,this.camera.position.z=e.position.z+r,this.camera.up.set(0,0,1),this.camera.lookAt({x:e.position.x+n,y:e.position.y+i,z:0}),this.controls.enabled=!1;break;case"Overhead":i=.5*this.viewDistance*Math.sin(e.rotation.y)*Math.cos(this.viewAngle),r=2*this.viewDistance*Math.sin(this.viewAngle),this.camera.position.x=e.position.x,this.camera.position.y=e.position.y+i,this.camera.position.z=2*(e.position.z+r),"FLU"===this.coordinates.systemName?this.camera.up.set(1,0,0):this.camera.up.set(0,1,0),this.camera.lookAt({x:e.position.x,y:e.position.y+i,z:0}),this.controls.enabled=!1;break;case"Map":this.controls.enabled||this.enableOrbitControls(!0);break;case"CameraView":var o=this.cameraData.get(),a=o.position,s=o.rotation,l=this.coordinates.applyOffset(a),u=l.x,c=l.y,d=l.z;this.camera.position.set(u,c,d),this.camera.rotation.set(s.x+Math.PI,-s.y,-s.z),this.controls.enabled=!1;var h=document.getElementById("camera-image");h&&this.cameraData.imageSrcData&&(h.src=this.cameraData.imageSrcData)}this.camera.updateProjectionMatrix()}}},{key:"enableRouteEditing",value:function(){this.enableOrbitControls(!1),this.routingEditor.enableEditingMode(this.camera,this.adc),document.getElementById(this.canvasId).addEventListener("mousedown",this.onMouseDownHandler,!1)}},{key:"disableRouteEditing",value:function(){this.routingEditor.disableEditingMode(this.scene);var e=document.getElementById(this.canvasId);e&&e.removeEventListener("mousedown",this.onMouseDownHandler,!1)}},{key:"addDefaultEndPoint",value:function(e){for(var t=0;t1&&void 0!==arguments[1]&&arguments[1];t&&this.map.removeAllElements(this.scene),this.map.appendMapData(e,this.coordinates,this.scene)}},{key:"updatePointCloud",value:function(e){this.coordinates.isInitialized()&&this.adc.mesh&&this.pointCloud.update(e,this.adc.mesh)}},{key:"updateMapIndex",value:function(e,t,n){this.routingEditor.isInEditingMode()&&PARAMETERS.routingEditor.radiusOfMapRequest!==n||this.map.updateIndex(e,t,this.scene)}},{key:"isMobileDevice",value:function(){return navigator.userAgent.match(/Android/i)||navigator.userAgent.match(/webOS/i)||navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/iPod/i)}},{key:"getGeolocation",value:function(e){if(this.coordinates.isInitialized()){var t=e.currentTarget.getBoundingClientRect(),n=new o.Vector3((e.clientX-t.left)/this.dimension.width*2-1,-(e.clientY-t.top)/this.dimension.height*2+1,0);n.unproject(this.camera);var i=n.sub(this.camera.position).normalize(),r=-this.camera.position.z/i.z,a=this.camera.position.clone().add(i.multiplyScalar(r));return this.coordinates.applyOffset(a,!0)}}},{key:"getMouseOverLanes",value:function(e){var t=e.currentTarget.getBoundingClientRect(),n=new o.Vector3((e.clientX-t.left)/this.dimension.width*2-1,-(e.clientY-t.top)/this.dimension.height*2+1,0),i=new o.Raycaster;i.setFromCamera(n,this.camera);var r=this.map.data.lane.reduce((function(e,t){return e.concat(t.drewObjects)}),[]);return i.intersectObjects(r).map((function(e){return e.object.name}))}}]),e}());t.default=S},function(e,t,n){"use strict";(function(e){var i=t;function r(e,t,n){for(var i=Object.keys(t),r=0;r0)},i.Buffer=function(){try{var e=i.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),i._Buffer_from=null,i._Buffer_allocUnsafe=null,i.newBuffer=function(e){return"number"==typeof e?i.Buffer?i._Buffer_allocUnsafe(e):new i.Array(e):i.Buffer?i._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},i.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,i.Long=i.global.dcodeIO&&i.global.dcodeIO.Long||i.global.Long||i.inquire("long"),i.key2Re=/^true|false|0|1$/,i.key32Re=/^-?(?:0|[1-9][0-9]*)$/,i.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,i.longToHash=function(e){return e?i.LongBits.from(e).toHash():i.LongBits.zeroHash},i.longFromHash=function(e,t){var n=i.LongBits.fromHash(e);return i.Long?i.Long.fromBits(n.lo,n.hi,t):n.toNumber(Boolean(t))},i.merge=r,i.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},i.newError=o,i.ProtocolError=o("ProtocolError"),i.oneOfGetter=function(e){for(var t={},n=0;n-1;--n)if(1===t[e[n]]&&void 0!==this[e[n]]&&null!==this[e[n]])return e[n]}},i.oneOfSetter=function(e){return function(t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:0;if(e.constructor===Array&&e.length>0)for(;t1&&void 0!==arguments[1]&&arguments[1],n=new Date(e),i=n.getHours(),r=n.getMinutes(),o=n.getSeconds(),a=(i=i<10?"0"+i:i)+":"+(r=r<10?"0"+r:r)+":"+(o=o<10?"0"+o:o);if(t){var s=n.getMilliseconds();s<10?s="00"+s:s<100&&(s="0"+s),a+=":"+s}return a},t.calculateLaneMarkerPoints=function(e,t){if(!e||!t)return[];for(var n=e.positionX,i=e.positionY,r=e.heading,a=t.c0Position,s=t.c1HeadingAngle,l=t.c2Curvature,u=t.c3CurvatureDerivative,c=t.viewRange,d=[u,l,s,a],h=[],p=0;p=t.length?{value:void 0,done:!0}:(e=i(t,n),this._i+=e.length,{value:e,done:!1})}))},function(e,t){e.exports={}},function(e,t,n){e.exports={default:n(241),__esModule:!0}},function(e,t,n){"use strict";e.exports=o,o.className="ReflectionObject";var i,r=n(17);function o(e,t){if(!r.isString(e))throw TypeError("name must be a string");if(t&&!r.isObject(t))throw TypeError("options must be an object");this.options=t,this.name=e,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(o.prototype,{root:{get:function(){for(var e=this;null!==e.parent;)e=e.parent;return e}},fullName:{get:function(){for(var e=[this.name],t=this.parent;t;)e.unshift(t.name),t=t.parent;return e.join(".")}}}),o.prototype.toJSON=function(){throw Error()},o.prototype.onAdd=function(e){this.parent&&this.parent!==e&&this.parent.remove(this),this.parent=e,this.resolved=!1;var t=e.root;t instanceof i&&t._handleAdd(this)},o.prototype.onRemove=function(e){var t=e.root;t instanceof i&&t._handleRemove(this),this.parent=null,this.resolved=!1},o.prototype.resolve=function(){return this.resolved||this.root instanceof i&&(this.resolved=!0),this},o.prototype.getOption=function(e){if(this.options)return this.options[e]},o.prototype.setOption=function(e,t,n){return n&&this.options&&void 0!==this.options[e]||((this.options||(this.options={}))[e]=t),this},o.prototype.setOptions=function(e,t){if(e)for(var n=Object.keys(e),i=0;ib;b++)if((g=t?y(a(f=e[b])[0],f[1]):y(e[b]))===u||g===c)return g}else for(m=v.call(e);!(f=m.next()).done;)if((g=r(m,y,f.value,t))===u||g===c)return g}).BREAK=u,t.RETURN=c},function(e,t,n){"use strict";e.exports=function(){return new Worker(n.p+"worker.bundle.js")}},function(e,t,n){"use strict";e.exports=c;var i=n(45);((c.prototype=Object.create(i.prototype)).constructor=c).className="Namespace";var r,o,a,s=n(46),l=n(17);function u(e,t){if(e&&e.length){for(var n={},i=0;i=t)return!0;return!1},c.isReservedName=function(e,t){if(e)for(var n=0;n0;){var i=e.shift();if(n.nested&&n.nested[i]){if(!((n=n.nested[i])instanceof c))throw Error("path conflicts with non-namespace objects")}else n.add(n=new c(i))}return t&&n.addJSON(t),n},c.prototype.resolveAll=function(){for(var e=this.nestedArray,t=0;t-1)return i}else if(i instanceof c&&(i=i.lookup(e.slice(1),t,!0)))return i}else for(var r=0;r=0&&c.splice(t,1)}function g(e){var t=document.createElement("style");return e.attrs.type="text/css",v(t,e.attrs),f(e,t),t}function v(e,t){Object.keys(t).forEach((function(n){e.setAttribute(n,t[n])}))}function y(e,t){var n,i,r,o;if(t.transform&&e.css){if(!(o=t.transform(e.css)))return function(){};e.css=o}if(t.singleton){var a=u++;n=l||(l=g(t)),i=x.bind(null,n,a,!1),r=x.bind(null,n,a,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(e){var t=document.createElement("link");return e.attrs.type="text/css",e.attrs.rel="stylesheet",v(t,e.attrs),f(e,t),t}(t),i=M.bind(null,n,t),r=function(){m(n),n.href&&URL.revokeObjectURL(n.href)}):(n=g(t),i=w.bind(null,n),r=function(){m(n)});return i(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;i(e=t)}else r()}}e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(t=t||{}).attrs="object"==typeof t.attrs?t.attrs:{},t.singleton||(t.singleton=a()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var n=p(e,t);return h(n,t),function(e){for(var i=[],r=0;r0?r(i(e),9007199254740991):0}},function(e,t){var n=0,i=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+i).toString(36))}},function(e,t,n){var i=n(65)("meta"),r=n(22),o=n(38),a=n(24).f,s=0,l=Object.isExtensible||function(){return!0},u=!n(37)((function(){return l(Object.preventExtensions({}))})),c=function(e){a(e,i,{value:{i:"O"+ ++s,w:{}}})},d=e.exports={KEY:i,NEED:!1,fastKey:function(e,t){if(!r(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!o(e,i)){if(!l(e))return"F";if(!t)return"E";c(e)}return e[i].i},getWeak:function(e,t){if(!o(e,i)){if(!l(e))return!0;if(!t)return!1;c(e)}return e[i].w},onFreeze:function(e){return u&&d.NEED&&l(e)&&!o(e,i)&&c(e),e}}},function(e,t,n){var i=n(26),r=n(117),o=n(84),a=n(82)("IE_PROTO"),s=function(){},l=function(){var e,t=n(75)("iframe"),i=o.length;for(t.style.display="none",n(118).appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("