无关风月
2025-01-14 1ebda3975a267f73e0d00f577ab5c18d17931309
补充
9个文件已修改
7个文件已添加
4685 ■■■■■ 已修改文件
DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/GDFalconUtil.java 50 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/GDMapGeocodingUtil.java 37 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/TraceTrack.java 93 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/taxi/SearchHttpAK.java 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/taxi/TOrderTaxiController.java 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TOrderPositionBaiDu.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/GDMapGeocodingUtil.java 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ManagementOKTravel/guns-admin/src/main/webapp/WEB-INF/view/common/_container.html 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ManagementOKTravel/guns-admin/src/main/webapp/WEB-INF/view/system/tOrderTaxi/tOrderTaxi_edit.html 58 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ManagementOKTravel/guns-admin/src/main/webapp/WEB-INF/view/system/tOrderTaxi/tOrderTaxi_trajectory.html 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ManagementOKTravel/guns-admin/src/main/webapp/static/js/track1.js 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ManagementOKTravel/guns-admin/src/main/webapp/static/js/track2.js 3856 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ManagementOKTravel/guns-admin/src/main/webapp/static/js/track3.js 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ManagementOKTravel/guns-admin/src/main/webapp/static/modular/system/tOrderTaxi/tOrderTaxi_info.js 217 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/GDMapGeocodingUtil.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/TraceTrack.java 99 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/GDFalconUtil.java
@@ -3,6 +3,7 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.aliyun.oss.ServiceException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
@@ -23,7 +24,7 @@
@Component
public class GDFalconUtil implements ApplicationRunner {
    private String key = "5053ca611c0106e01a665ce7ab84ff26";
    private String key = "94fb3bba5b141c701cbdcab72fe9d9cf";
    @Autowired
    private RestTemplate restTemplate;
@@ -42,7 +43,7 @@
     */
    @Override
    public void run(ApplicationArguments args) throws Exception {
//        this.init();
        this.init();
    }
@@ -50,17 +51,17 @@
    /**
     * 初始化创建服务
     */
//    public void init(){
//        if(serverId == null){
//            JSONArray jsonArray = this.selectServer();
//            if(null == jsonArray){
//                serverId = this.createServer("server");
//            }else{
//                serverId = jsonArray.getJSONObject(0).getString("sid");
//            }
//        }
//
//    }
    public void init(){
        if(serverId == null){
            JSONArray jsonArray = this.selectServer();
            if(null == jsonArray){
                serverId = this.createServer("server");
            }else{
                serverId = jsonArray.getJSONObject(0).getString("sid");
            }
        }
    }
    /**
@@ -146,7 +147,7 @@
     * @return
     */
    public String selectTerminal(String name){
        String url = "https://tsapi.amap.com/v1/track/terminal/list?key=" + key + "&name=" + name;
        String url = "https://tsapi.amap.com/v1/track/terminal/list?key=" + key + "&sid=" + serverId + "&name=" + name;
        String forObject = restTemplate.getForObject(url, String.class);
        JSONObject jsonObject = JSON.parseObject(forObject);
        if(jsonObject.getIntValue("errcode") == 10000){
@@ -218,6 +219,27 @@
        }
    }
    /**
     * 查询轨迹
     * @param tid       终端id
     */
    public String selectTrack(String tid, String trid,Integer page){
        String url = "https://tsapi.amap.com/v1/track/terminal/trsearch?key=" + key + "&sid=" + serverId + "&tid=" + tid + "&trid=" + trid + "&page=" + page + "&pagesize=" + 999;
//        String url = "https://tsapi.amap.com/v1/track/terminal/trsearch?key=" + key + "&sid=" + serverId + "&tid=" + tid + "&starttime=1708410190000" + "&endtime=1708419641315";
        //将请求头部和参数合成一个请求
        String s = restTemplate.getForObject(url , String.class);
        JSONObject jsonObject = JSON.parseObject(s);
        if(jsonObject.getIntValue("errcode") == 10000){
            return jsonObject.getString("data");
        }
        System.err.println(jsonObject.getString("errmsg"));
        if(jsonObject.getIntValue("errcode") != 10000){
            throw new ServiceException(jsonObject.getString("errmsg"));
        }
        return null;
    }
//
//    public Map<String, Object> queryTrsearch(){
DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/GDMapGeocodingUtil.java
@@ -20,7 +20,7 @@
@Component
public class GDMapGeocodingUtil {
    private String key = "3491db7ed190e5e4757fcb838e012130";
    private String key = "WQhfsluNzEeUHUxoH4jc4JiCQOXw4Mnx";
    @Autowired
    private RestTemplate restTemplate;
@@ -31,6 +31,7 @@
    /**
     * 将行政区域名称转化为坐标
     *
     * @param province
     * @param city
     * @param county
@@ -77,25 +78,42 @@
    }
    public Map<String, Object> geocoding(String address) {
        Map<String, Object> map = new HashMap<>();
        String url = "https://api.map.baidu.com/geocoding/v3/?address"+ address+"&output=json&ak=" +key+"&ret_coordtype="+"bd09ll";
        String forObject = restTemplate.getForObject(url, String.class);
        JSONObject jsonObject = JSON.parseObject(forObject);
        String status = jsonObject.getString("status");
        List<String> list = new ArrayList<>();
        if (status.equals("0")) {
            JSONObject result = jsonObject.getJSONObject("result");
            JSONObject location = result.getJSONObject("location");
            String lng = location.getString("lng");
            String lat = location.getString("lat");
            list.add(lat + "," + lng);
        }
        map.put("status", 0);
        map.put("data", list);
        return map;
    }
    /**
     * 根据经纬度获取行政区域信息
     *
     * @param lon
     * @param lan
     * @return
     * @throws Exception
     */
    public Map<String, String> geocode(String lon, String lan) throws Exception{
        String url = "https://restapi.amap.com/v3/geocode/regeo?key=" + key + "&location=" + lon + "," + lan;
        String url = "https://api.map.baidu.com/reverse_geocoding/v3/?ak=" + key + "&output=json&coordtype=bd09ll" + "&location=" + lan + "," + lon;
        String forObject = restTemplate.getForObject(url, String.class);
        JSONObject jsonObject = JSON.parseObject(forObject);
        Map<String, String> map = new HashMap<>();
//        gdInterfaceService.saveData("https://restapi.amap.com/v3/geocode/regeo", "经纬度转行政区域");
        if(jsonObject.getString("status").equals("1")){
            JSONObject regeocode = jsonObject.getJSONObject("regeocode");
            JSONObject addressComponent = regeocode.getJSONObject("addressComponent");
            String address = regeocode.getString("formatted_address");
        if (jsonObject.getString("status").equals("0")) {
            JSONObject result = jsonObject.getJSONObject("result");
            JSONObject addressComponent = result.getJSONObject("addressComponent");
            String address = result.getString("formatted_address");
            map.put("address", address);
            String code = addressComponent.getString("adcode");
            String province = addressComponent.getString("province");
@@ -111,3 +129,4 @@
        return map;
    }
}
DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/TraceTrack.java
New file
@@ -0,0 +1,93 @@
package com.stylefeng.guns.modular.system.util;// 检测到您当前的ak设置了IP白名单校验
// 您的IP白名单中的IP非公网IP,请设置为公网IP,否则将请求失败:
// 请在IP地址为0.0.0.0/0 外网IP的计算发起请求,否则将请求失败
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.util.TreeMap;
import java.util.Map;
public class TraceTrack {
    public static String Host = "https://yingyan.baidu.com";
    public static String URI = "/api/v3/entity/add";
    public static String AK = "X5auNNRi1fQDKoBdwCmRzOjbYcydAsaA";
    public static void main(String[] args) throws Exception {
        // 请求参数
        String entity_name = "entity_1";
        String entity_desc = "zhangsan";
        // POST请求,此处使用TreeMap,默认按key排序
        Map params = new TreeMap<String, String>();
                params.put("ak", AK);
        params.put("service_id", "您的SERVICE");
        params.put("entity_name", "entity_1");
        params.put("entity_desc", "zhangsan");
        String URL = Host + URI;
        TraceTrack ta = new TraceTrack();
        ta.requestPost(URL, params);
    }
    /** 发送POST请求 */
    public void requestPost(String strUrl, Map<String, String> param) throws Exception {
        if (strUrl == null || strUrl.length() <= 0 || param == null || param.size() <= 0) {
            return;
        }
        // 构造x-www-form-urlencoded格式的字符串
        StringBuffer queryString = new StringBuffer();
        for (Map.Entry<?, ?> pair : param.entrySet()) {
            queryString.append(pair.getKey() + "=");
            queryString.append(URLEncoder.encode((String) pair.getValue(), "UTF-8") + "&");
        }
        if (queryString.length() > 0) {
          queryString.deleteCharAt(queryString.length() - 1);
        }
        String result = "";
        try {
          URL url = new URL(strUrl);
          HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
          urlConnection.setRequestMethod("POST");
          //设置连接的超时值为3000毫秒,超时将抛出SocketTimeoutException异常
          urlConnection.setConnectTimeout(3000);
          //设置读取的超时值为3000毫秒,超时将抛出SocketTimeoutException异常
          urlConnection.setReadTimeout(3000);
          //将url连接用于输出,这样才能使用getOutputStream()。getOutputStream()返回的输出流用于传输数据
          urlConnection.setDoOutput(true);
          //设置Content-Type
          urlConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
          //getOutputStream()返回的输出流,用于写入参数数据。
          OutputStream outputStream = urlConnection.getOutputStream();
          outputStream.write(queryString.toString().getBytes());
          outputStream.flush();
          outputStream.close();
          //此时将调用接口方法。getInputStream()返回的输入流可以读取返回的数据。
          InputStreamReader isr = new InputStreamReader(urlConnection.getInputStream());
          BufferedReader reader = new BufferedReader(isr);
          StringBuffer buffer = new StringBuffer();
          String line;
          while ((line = reader.readLine()) != null) {
              buffer.append(line);
          }
          reader.close();
          isr.close();
          System.out.println("返回的内容: " + buffer.toString());
      } catch (IOException e) {
          e.printStackTrace();
      }
  }
}
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/taxi/SearchHttpAK.java
New file
@@ -0,0 +1,81 @@
package com.stylefeng.guns.modular.system.controller.taxi; /**
  * 默认:
  */
import org.springframework.stereotype.Component;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.util.LinkedHashMap;
import java.util.Map;
@Component
public class SearchHttpAK {
    public static String URL = "https://yingyan.baidu.com/api/v3/track/gettrack?";
    public static String AK = "WQhfsluNzEeUHUxoH4jc4JiCQOXw4Mnx";
//    public static void main(String[] args) throws Exception {
//
//        SearchHttpAK ta = new SearchHttpAK();
//
//        Map params = new LinkedHashMap<String, String>();
//        params.put("ak", AK);
//        params.put("entity_name", "entity_1");
//        params.put("service_id", "241187");
//        long unixTimestamp = System.currentTimeMillis() / 1000L;
//        System.out.println("Current Unix Timestamp: " + unixTimestamp);
//
//        params.put("start_time", unixTimestamp+"");
//        params.put("end_time", unixTimestamp+"");
//        ta.requestGetAK(URL, params);
//    }
    /**
     * 默认ak
     * 选择了ak,使用IP白名单校验:
     * 根据您选择的AK以为您生成调用代码
     * 检测到您当前的ak设置了IP白名单校验
     * 您的IP白名单中的IP非公网IP,请设置为公网IP,否则将请求失败
     * 请在IP地址为xxxxxxx的计算发起请求,否则将请求失败
     */
    public String requestGetAK(String strUrl, Map<String, String> param) throws Exception {
        if (strUrl == null || strUrl.length() <= 0 || param == null || param.size() <= 0) {
            return "";
        }
        StringBuffer queryString = new StringBuffer();
        queryString.append(strUrl);
        for (Map.Entry<?, ?> pair : param.entrySet()) {
            queryString.append(pair.getKey() + "=");
            queryString.append(URLEncoder.encode((String) pair.getValue(),
                    "UTF-8") + "&");
        }
        if (queryString.length() > 0) {
            queryString.deleteCharAt(queryString.length() - 1);
        }
        java.net.URL url = new URL(queryString.toString());
        System.out.println(queryString.toString());
        URLConnection httpConnection = (HttpURLConnection) url.openConnection();
        httpConnection.connect();
        InputStreamReader isr = new InputStreamReader(httpConnection.getInputStream());
        BufferedReader reader = new BufferedReader(isr);
        StringBuffer buffer = new StringBuffer();
        String line;
        while ((line = reader.readLine()) != null) {
            buffer.append(line);
        }
        reader.close();
        isr.close();
        System.out.println("AK: " + buffer.toString());
        return buffer.toString();
    }
}
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/taxi/TOrderTaxiController.java
@@ -202,29 +202,27 @@
     * @param orderDetailId
     * @return
     */
    public static String URL = "https://yingyan.baidu.com/api/v3/track/gettrack?";
    public static String AK = "WQhfsluNzEeUHUxoH4jc4JiCQOXw4Mnx";
    @ResponseBody
    @RequestMapping(value = "/getOrderTrack", method = RequestMethod.POST)
    public ResultUtil getOrderTrack(String orderDetailId){
        if(ToolUtil.isNotEmpty(orderDetailId)){
            try {
//                List<TOrderPosition> list = tOrderPositionService.selectList(new EntityWrapper<TOrderPosition>().eq("orderType", 2).eq("orderId", orderDetailId).orderBy("insertTime"));
                /*if(list.size() == 0){
                    return ResultUtil.error("该订单没有运行轨迹");
                }*/
                //将数据存储到文件中
                File file = new File(filePath + orderDetailId + "_2.txt");
                if(!file.exists()){
                    return ResultUtil.success(new ArrayList<>());
                }
                //读取文件(字符流)
                BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(file),"UTF-8"));
                //循环取出数据
                String str = null;
                StringBuffer sb = new StringBuffer();
                while ((str = in.readLine()) != null) {
                    sb.append(str);
                }
                List<TOrderPosition> list = JSONArray.parseArray(sb.toString(), TOrderPosition.class);
                TOrderTaxi tOrderTaxi = tOrderTaxiService.selectById(orderDetailId);
                TDriver tDriver = driverService.selectById(tOrderTaxi.getDriverId());
                SearchHttpAK ta = new SearchHttpAK();
                Map params = new LinkedHashMap<String, String>();
                params.put("ak", AK);
                params.put("entity_name", tDriver.getPhone());
                params.put("service_id", "241187");
                long start = tOrderTaxi.getStartServiceTime().getTime() / 1000L;
                long end = tOrderTaxi.getEndServiceTime().getTime() / 1000L;
                params.put("start_time", start+"");
                params.put("end_time", end+"");
                String s = ta.requestGetAK(URL, params);
                List<TOrderPositionBaiDu> list = JSONArray.parseArray(s.toString(), TOrderPositionBaiDu.class);
                resultUtil = ResultUtil.success(list);
            }catch (Exception e){
                e.printStackTrace();
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TOrderPositionBaiDu.java
New file
@@ -0,0 +1,40 @@
package com.stylefeng.guns.modular.system.model;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
 * <p>
 * 订单坐标信息表
 * </p>
 *
 * @author 吕雪
 * @since 2020-06-08
 */
@Data
public class TOrderPositionBaiDu {
    private Integer driverId;
    /**
     * 经度
     */
    private String longitude;
    /**
     * 纬度
     */
    private String latitude;
}
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/GDMapGeocodingUtil.java
@@ -45,21 +45,18 @@
            return map;
        }
        String url = "https://restapi.amap.com/v3/geocode/geo?key=" + key + "&output=JSON";
        String url = "https://api.map.baidu.com/geocoding/v3/"+"?output=json&ak=" +key+"&ret_coordtype="+"bd09ll";
        url += "&address=" + (ToolUtil.isNotEmpty(province) ? province : "") + (ToolUtil.isNotEmpty(city) ? city : "") + (ToolUtil.isNotEmpty(county) ? county : "") + address;
        String forObject = restTemplate.getForObject(url, String.class);
        JSONObject jsonObject = JSON.parseObject(forObject);
        String status = jsonObject.getString("status");
        List<String> list = new ArrayList<>();
        gdInterfaceService.saveData("https://restapi.amap.com/v3/geocode/geo", "行政区域转经纬度");
        if(status.equals("1")){
            JSONArray geocodes = jsonObject.getJSONArray("geocodes");
            for(int i = 0; i < geocodes.size(); i++){
                String location = geocodes.getJSONObject(i).getString("location");
                list.add(location);
            }
        if(status.equals("0")){
            JSONObject result = jsonObject.getJSONObject("result");
            JSONObject location = result.getJSONObject("location");
            String lng = location.getString("lng");
            String lat = location.getString("lat");
            list.add(lat+","+lng);
        }
        map.put("status", 0);
        map.put("data", list);
@@ -70,20 +67,17 @@
    public Map<String, Object> geocoding(String address){
        Map<String, Object> map = new HashMap<>();
        String url = "https://restapi.amap.com/v3/geocode/geo?key=" + key + "&output=JSON&address=" + address;
        String url = "https://api.map.baidu.com/geocoding/v3/?address"+ address+"&output=json&ak=" +key+"&ret_coordtype="+"bd09ll";
        String forObject = restTemplate.getForObject(url, String.class);
        JSONObject jsonObject = JSON.parseObject(forObject);
        String status = jsonObject.getString("status");
        List<String> list = new ArrayList<>();
        gdInterfaceService.saveData("https://restapi.amap.com/v3/geocode/geo", "行政区域转经纬度");
        if(status.equals("1")){
            JSONArray geocodes = jsonObject.getJSONArray("geocodes");
            for(int i = 0; i < geocodes.size(); i++){
                String location = geocodes.getJSONObject(i).getString("location");
                list.add(location);
            }
        if(status.equals("0")){
            JSONObject result = jsonObject.getJSONObject("result");
            JSONObject location = result.getJSONObject("location");
            String lng = location.getString("lng");
            String lat = location.getString("lat");
            list.add(lat+","+lng);
        }
        map.put("status", 0);
        map.put("data", list);
@@ -100,17 +94,17 @@
     * @throws Exception
     */
    public Map<String, String> geocode(String lon, String lan) throws Exception{
        String url = "https://restapi.amap.com/v3/geocode/regeo?key=" + key + "&location=" + lon + "," + lan;
        String url = "https://api.map.baidu.com/reverse_geocoding/v3/?ak=" + key + "&output=json&coordtype=bd09ll" + "&location=" + lan + "," + lon;
        String forObject = restTemplate.getForObject(url, String.class);
        JSONObject jsonObject = JSON.parseObject(forObject);
        Map<String, String> map = new HashMap<>();
        gdInterfaceService.saveData("https://restapi.amap.com/v3/geocode/regeo", "经纬度转行政区域");
        gdInterfaceService.saveData("https://api.map.baidu.com/reverse_geocoding", "经纬度转行政区域");
        if(jsonObject.getString("status").equals("1")){
            JSONObject regeocode = jsonObject.getJSONObject("regeocode");
            JSONObject addressComponent = regeocode.getJSONObject("addressComponent");
            String address = regeocode.getString("formatted_address");
        if (jsonObject.getString("status").equals("0")) {
            JSONObject result = jsonObject.getJSONObject("result");
            JSONObject addressComponent = result.getJSONObject("addressComponent");
            String address = result.getString("formatted_address");
            map.put("address", address);
            String code = addressComponent.getString("adcode");
            String province = addressComponent.getString("province");
ManagementOKTravel/guns-admin/src/main/webapp/WEB-INF/view/common/_container.html
@@ -6,8 +6,14 @@
    <meta name="renderer" content="webkit"/><!-- 让360浏览器默认选择webkit内核 -->
    <!--地图-->
    <script src="https://webapi.amap.com/maps?v=1.4.8&key=e17d799b2506d05faf7f88320a266803"></script>
<!--    <script type="text/javascript" src="https://api.map.baidu.com/api?v=1.0&ak=3mHKIXMArjgIkgADzOlTYp4XssNSNkwr"></script>-->
<!--    <script type="text/javascript" src="https://api.map.baidu.com/api?v=1.0&ak=3mHKIXMArjgIkgADzOlTYp4XssNSNkwr"></script>-->
    <!--    <script src="https://webapi.amap.com/maps?v=1.4.8&key=e17d799b2506d05faf7f88320a266803"></script>-->
    <!--<script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=IRKL4FLGKZUFr6T3gFk3t9X6kKarKu1K"></script>-->
<!--    <script src="https://api.map.baidu.com/api?v=3.0&ak=3mHKIXMArjgIkgADzOlTYp4XssNSNkwr"></script>-->
<!--    <script src="https://api.map.baidu.com/api?v=1.0&ak=3mHKIXMArjgIkgADzOlTYp4XssNSNkwr"></script>-->
<!--    <script src="${ctxPath}/static/js/track1.js"></script>-->
    <!-- 全局css -->
    <link rel="shortcut icon" href="${ctxPath}/static/img/logo.jpg">
ManagementOKTravel/guns-admin/src/main/webapp/WEB-INF/view/system/tOrderTaxi/tOrderTaxi_edit.html
@@ -1,17 +1,49 @@
@layout("/common/_container.html"){
<style type="text/css">
    html, body, #container {
    body,
    html {
        width: 100%;
        height: 100%;
        margin: 0;
    }
    #allmap {
        height: 100%;
        width: 100%;
    }
    .input-card .btn{
        margin-right: 1.2rem;
        width: 9rem;
    ul li {
        list-style: none;
    }
    .input-card .btn:last-child{
        margin-right: 0;
    .btn-wrap {
        z-index: 999;
        position: fixed;
        bottom: 3.5rem;
        margin-left: 3rem;
        padding: 1rem 1rem;
        border-radius: .25rem;
        background-color: #fff;
        box-shadow: 0 2px 6px 0 rgba(27, 142, 236, 0.5);
    }
    .btn {
        width: 75px;
        height: 30px;
        float: left;
        background-color: #fff;
        color: rgba(27, 142, 236, 1);
        font-size: 14px;
        border: 1px solid rgba(27, 142, 236, 1);
        border-radius: 5px;
        margin: 0 5px;
        text-align: center;
        line-height: 30px;
    }
    .btn:hover {
        background-color: rgba(27, 142, 236, 0.8);
        color: #fff;
    }
</style>
<div class="ibox float-e-margins">
@@ -76,7 +108,7 @@
            </div>
            <div class="row">
                <div class="col-sm-10">
                    <div class="form-horizontal" id="container" style="margin-left: 50px;width: 100%; height: 500px;"></div>
                    <div class="form-horizontal" id="allmap" style="margin-left: 50px;width: 100%; height: 500px;"></div>
                    <div class="input-card" style="margin-left: 50px;">
                        <h4>轨迹回放控制</h4>
                        <div class="input-item">
@@ -93,13 +125,13 @@
            </div>
        </div>
    </div>
</div>
<script src="https://a.amap.com/jsapi_demos/static/demo-center/js/demoutils.js"></script>
<!--<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=3mHKIXMArjgIkgADzOlTYp4XssNSNkwr"></script>-->
<script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=3mHKIXMArjgIkgADzOlTYp4XssNSNkwr&s=1"></script>
<script src="https://cache.amap.com/lbs/static/addToolbar.js"></script>
<script type="text/javascript" src="//api.map.baidu.com/api?type=webgl&v=1.0&ak=t5pcBZB5G4D11G9MzHq8Kik7jqzlTrAL"></script>
<script src="${ctxPath}/static/js/track1.js"></script>
<script src="${ctxPath}/static/js/track2.js"></script>
<script src="${ctxPath}/static/js/track3.js"></script>
<script type="text/javascript" src="//mapopen-pub-jsapi.bj.bcebos.com/jsapiGlgeo/track.js"></script>
<script src="${ctxPath}/static/modular/system/tOrderTaxi/tOrderTaxi_info.js"></script>
@}
ManagementOKTravel/guns-admin/src/main/webapp/WEB-INF/view/system/tOrderTaxi/tOrderTaxi_trajectory.html
@@ -23,9 +23,9 @@
                    <h2 class="h3Class" style="font-weight: 700;">线路轨迹</h2>
                </div>
            </div>
            <div class="row" style="margin-top: 30px;">
            <div class="row">
                <div class="col-sm-10">
                    <div class="form-horizontal" id="container" style="margin-left: 50px;width: 100%; height: 500px;"></div>
                    <div class="form-horizontal" id="allmap" style="margin-left: 50px;width: 100%; height: 500px;"></div>
                    <div class="input-card" style="margin-left: 50px;">
                        <h4>轨迹回放控制</h4>
                        <div class="input-item">
@@ -40,13 +40,13 @@
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="https://a.amap.com/jsapi_demos/static/demo-center/js/demoutils.js"></script>
<script src="https://webapi.amap.com/maps?v=1.4.8&key=e17d799b2506d05faf7f88320a266803"></script>
<script src="https://cache.amap.com/lbs/static/addToolbar.js"></script>
</div>
<script type="text/javascript" src="//api.map.baidu.com/api?type=webgl&v=1.0&ak=t5pcBZB5G4D11G9MzHq8Kik7jqzlTrAL"></script>
<script src="${ctxPath}/static/js/track1.js"></script>
<script src="${ctxPath}/static/js/track2.js"></script>
<script src="${ctxPath}/static/js/track3.js"></script>
<script type="text/javascript" src="//mapopen-pub-jsapi.bj.bcebos.com/jsapiGlgeo/track.js"></script>
<script src="${ctxPath}/static/modular/system/tOrderTaxi/tOrderTaxi_info.js"></script>
@}
ManagementOKTravel/guns-admin/src/main/webapp/static/js/track1.js
New file
@@ -0,0 +1,2 @@
// threejs.org/license
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).THREE={})}(this,(function(t){"use strict";var e=function(t){var e,n=Object.prototype,r=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,n){return t[e]=n}}function c(t,e,n,r){var i=e&&e.prototype instanceof v?e:v,a=Object.create(i.prototype),o=new L(r||[]);return a._invoke=function(t,e,n){var r=h;return function(i,a){if(r===p)throw new Error("Generator is already running");if(r===f){if("throw"===i)throw a;return C()}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var s=T(o,n);if(s){if(s===m)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===h)throw r=f,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=p;var l=u(t,e,n);if("normal"===l.type){if(r=n.done?f:d,l.arg===m)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(r=f,n.method="throw",n.arg=l.arg)}}}(t,n,o),a}function u(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var h="suspendedStart",d="suspendedYield",p="executing",f="completed",m={};function v(){}function g(){}function y(){}var x={};x[a]=function(){return this};var _=Object.getPrototypeOf,b=_&&_(_(R([])));b&&b!==n&&r.call(b,a)&&(x=b);var w=y.prototype=v.prototype=Object.create(x);function M(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function S(t,e){function n(i,a,o,s){var l=u(t[i],t,a);if("throw"!==l.type){var c=l.arg,h=c.value;return h&&"object"==typeof h&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,o,s)}),(function(t){n("throw",t,o,s)})):e.resolve(h).then((function(t){c.value=t,o(c)}),(function(t){return n("throw",t,o,s)}))}s(l.arg)}var i;this._invoke=function(t,r){function a(){return new e((function(e,i){n(t,r,e,i)}))}return i=i?i.then(a,a):a()}}function T(t,n){var r=t.iterator[n.method];if(r===e){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method))return m;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var i=u(r,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,m;var a=i.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function A(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function R(t){if(t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}return{next:C}}function C(){return{value:e,done:!0}}return g.prototype=w.constructor=y,y.constructor=g,g.displayName=l(y,s,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,l(t,s,"GeneratorFunction")),t.prototype=Object.create(w),t},t.awrap=function(t){return{__await:t}},M(S.prototype),S.prototype[o]=function(){return this},t.AsyncIterator=S,t.async=function(e,n,r,i,a){void 0===a&&(a=Promise);var o=new S(c(e,n,r,i),a);return t.isGeneratorFunction(n)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},M(w),l(w,s,"Generator"),w[a]=function(){return this},w.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=R,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(A),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return s.type="throw",s.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var l=r.call(o,"catchLoc"),c=r.call(o,"finallyLoc");if(l&&c){if(this.prev<o.catchLoc)return i(o.catchLoc,!0);if(this.prev<o.finallyLoc)return i(o.finallyLoc)}else if(l){if(this.prev<o.catchLoc)return i(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return i(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=t,o.arg=e,a?(this.method="next",this.next=a.finallyLoc,m):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),A(n),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;A(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:R(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),m}},t}("object"==typeof module?module.exports:{});try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}var n="126",r=100,i=300,a=301,o=302,s=303,l=304,c=306,u=307,h=1e3,d=1001,p=1002,f=1003,m=1004,v=1005,g=1006,y=1007,x=1008,_=1009,b=1012,w=1014,M=1015,S=1016,T=1020,E=1022,A=1023,L=1026,R=1027,C=33776,P=33777,D=33778,I=33779,N=35840,B=35841,O=35842,z=35843,F=37492,H=37496,G=2300,U=2301,k=2302,V=2400,W=2401,j=2402,q=2500,X=2501,Y=3e3,Z=3001,J=3007,Q=3002,K=3004,$=3005,tt=3006,et=7680,nt=35044,rt=35048,it="300 es";function at(t,e,n,r,i,a,o){try{var s=t[a](o),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function ot(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function st(t,e,n){return e&&ot(t.prototype,e),n&&ot(t,n),t}function lt(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,ct(t,e)}function ct(t,e){return(ct=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function ut(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ht(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function dt(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return ht(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ht(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=t[Symbol.iterator]()).next.bind(n)}function pt(){}Object.assign(pt.prototype,{addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)},removeEventListener:function(t,e){if(void 0!==this._listeners){var n=this._listeners[t];if(void 0!==n){var r=n.indexOf(e);-1!==r&&n.splice(r,1)}}},dispatchEvent:function(t){if(void 0!==this._listeners){var e=this._listeners[t.type];if(void 0!==e){t.target=this;for(var n=e.slice(0),r=0,i=n.length;r<i;r++)n[r].call(this,t)}}}});for(var ft=[],mt=0;mt<256;mt++)ft[mt]=(mt<16?"0":"")+mt.toString(16);var vt=1234567,gt={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,n=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return(ft[255&t]+ft[t>>8&255]+ft[t>>16&255]+ft[t>>24&255]+"-"+ft[255&e]+ft[e>>8&255]+"-"+ft[e>>16&15|64]+ft[e>>24&255]+"-"+ft[63&n|128]+ft[n>>8&255]+"-"+ft[n>>16&255]+ft[n>>24&255]+ft[255&r]+ft[r>>8&255]+ft[r>>16&255]+ft[r>>24&255]).toUpperCase()},clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)},lerp:function(t,e,n){return(1-n)*t+n*e},damp:function(t,e,n,r){return gt.lerp(t,e,1-Math.exp(-n*r))},pingpong:function(t,e){return void 0===e&&(e=1),e-Math.abs(gt.euclideanModulo(t,2*e)-e)},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){return void 0!==t&&(vt=t%2147483647),((vt=16807*vt%2147483647)-1)/2147483646},degToRad:function(t){return t*gt.DEG2RAD},radToDeg:function(t){return t*gt.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},setQuaternionFromProperEuler:function(t,e,n,r,i){var a=Math.cos,o=Math.sin,s=a(n/2),l=o(n/2),c=a((e+r)/2),u=o((e+r)/2),h=a((e-r)/2),d=o((e-r)/2),p=a((r-e)/2),f=o((r-e)/2);switch(i){case"XYX":t.set(s*u,l*h,l*d,s*c);break;case"YZY":t.set(l*d,s*u,l*h,s*c);break;case"ZXZ":t.set(l*h,l*d,s*u,s*c);break;case"XZX":t.set(s*u,l*f,l*p,s*c);break;case"YXY":t.set(l*p,s*u,l*f,s*c);break;case"ZYZ":t.set(l*f,l*p,s*u,s*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}},yt=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}var e=t.prototype;return e.set=function(t,e){return this.x=t,this.y=e,this},e.setScalar=function(t){return this.x=t,this.y=t,this},e.setX=function(t){return this.x=t,this},e.setY=function(t){return this.y=t,this},e.setComponent=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this},e.getComponent=function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},e.clone=function(){return new this.constructor(this.x,this.y)},e.copy=function(t){return this.x=t.x,this.y=t.y,this},e.add=function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},e.addScalar=function(t){return this.x+=t,this.y+=t,this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},e.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},e.sub=function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},e.subScalar=function(t){return this.x-=t,this.y-=t,this},e.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},e.multiply=function(t){return this.x*=t.x,this.y*=t.y,this},e.multiplyScalar=function(t){return this.x*=t,this.y*=t,this},e.divide=function(t){return this.x/=t.x,this.y/=t.y,this},e.divideScalar=function(t){return this.multiplyScalar(1/t)},e.applyMatrix3=function(t){var e=this.x,n=this.y,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6],this.y=r[1]*e+r[4]*n+r[7],this},e.min=function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},e.max=function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},e.clamp=function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},e.clampScalar=function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this},e.clampLength=function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},e.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},e.negate=function(){return this.x=-this.x,this.y=-this.y,this},e.dot=function(t){return this.x*t.x+this.y*t.y},e.cross=function(t){return this.x*t.y-this.y*t.x},e.lengthSq=function(){return this.x*this.x+this.y*this.y},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e.manhattanLength=function(){return Math.abs(this.x)+Math.abs(this.y)},e.normalize=function(){return this.divideScalar(this.length()||1)},e.angle=function(){var t=Math.atan2(-this.y,-this.x)+Math.PI;return t},e.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},e.distanceToSquared=function(t){var e=this.x-t.x,n=this.y-t.y;return e*e+n*n},e.manhattanDistanceTo=function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},e.setLength=function(t){return this.normalize().multiplyScalar(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},e.lerpVectors=function(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this},e.equals=function(t){return t.x===this.x&&t.y===this.y},e.fromArray=function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},e.toArray=function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},e.fromBufferAttribute=function(t,e,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this},e.rotateAround=function(t,e){var n=Math.cos(e),r=Math.sin(e),i=this.x-t.x,a=this.y-t.y;return this.x=i*n-a*r+t.x,this.y=i*r+a*n+t.y,this},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this},st(t,[{key:"width",get:function(){return this.x},set:function(t){this.x=t}},{key:"height",get:function(){return this.y},set:function(t){this.y=t}}]),t}();yt.prototype.isVector2=!0;var xt,_t=function(){function t(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}var e=t.prototype;return e.set=function(t,e,n,r,i,a,o,s,l){var c=this.elements;return c[0]=t,c[1]=r,c[2]=o,c[3]=e,c[4]=i,c[5]=s,c[6]=n,c[7]=a,c[8]=l,this},e.identity=function(){return this.set(1,0,0,0,1,0,0,0,1),this},e.copy=function(t){var e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this},e.extractBasis=function(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this},e.setFromMatrix4=function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},e.multiply=function(t){return this.multiplyMatrices(this,t)},e.premultiply=function(t){return this.multiplyMatrices(t,this)},e.multiplyMatrices=function(t,e){var n=t.elements,r=e.elements,i=this.elements,a=n[0],o=n[3],s=n[6],l=n[1],c=n[4],u=n[7],h=n[2],d=n[5],p=n[8],f=r[0],m=r[3],v=r[6],g=r[1],y=r[4],x=r[7],_=r[2],b=r[5],w=r[8];return i[0]=a*f+o*g+s*_,i[3]=a*m+o*y+s*b,i[6]=a*v+o*x+s*w,i[1]=l*f+c*g+u*_,i[4]=l*m+c*y+u*b,i[7]=l*v+c*x+u*w,i[2]=h*f+d*g+p*_,i[5]=h*m+d*y+p*b,i[8]=h*v+d*x+p*w,this},e.multiplyScalar=function(t){var e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this},e.determinant=function(){var t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],l=t[7],c=t[8];return e*a*c-e*o*l-n*i*c+n*o*s+r*i*l-r*a*s},e.invert=function(){var t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],l=t[7],c=t[8],u=c*a-o*l,h=o*s-c*i,d=l*i-a*s,p=e*u+n*h+r*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);var f=1/p;return t[0]=u*f,t[1]=(r*l-c*n)*f,t[2]=(o*n-r*a)*f,t[3]=h*f,t[4]=(c*e-r*s)*f,t[5]=(r*i-o*e)*f,t[6]=d*f,t[7]=(n*s-l*e)*f,t[8]=(a*e-n*i)*f,this},e.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},e.getNormalMatrix=function(t){return this.setFromMatrix4(t).invert().transpose()},e.transposeIntoArray=function(t){var e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this},e.setUvTransform=function(t,e,n,r,i,a,o){var s=Math.cos(i),l=Math.sin(i);return this.set(n*s,n*l,-n*(s*a+l*o)+a+t,-r*l,r*s,-r*(-l*a+s*o)+o+e,0,0,1),this},e.scale=function(t,e){var n=this.elements;return n[0]*=t,n[3]*=t,n[6]*=t,n[1]*=e,n[4]*=e,n[7]*=e,this},e.rotate=function(t){var e=Math.cos(t),n=Math.sin(t),r=this.elements,i=r[0],a=r[3],o=r[6],s=r[1],l=r[4],c=r[7];return r[0]=e*i+n*s,r[3]=e*a+n*l,r[6]=e*o+n*c,r[1]=-n*i+e*s,r[4]=-n*a+e*l,r[7]=-n*o+e*c,this},e.translate=function(t,e){var n=this.elements;return n[0]+=t*n[2],n[3]+=t*n[5],n[6]+=t*n[8],n[1]+=e*n[2],n[4]+=e*n[5],n[7]+=e*n[8],this},e.equals=function(t){for(var e=this.elements,n=t.elements,r=0;r<9;r++)if(e[r]!==n[r])return!1;return!0},e.fromArray=function(t,e){void 0===e&&(e=0);for(var n=0;n<9;n++)this.elements[n]=t[n+e];return this},e.toArray=function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t},e.clone=function(){return(new this.constructor).fromArray(this.elements)},t}();_t.prototype.isMatrix3=!0;var bt={getDataURL:function(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;var e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===xt&&(xt=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),xt.width=t.width,xt.height=t.height;var n=xt.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=xt}return e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}},wt=0,Mt=function(t){function e(n,r,i,a,o,s,l,c,u,h){var p;return void 0===n&&(n=e.DEFAULT_IMAGE),void 0===r&&(r=e.DEFAULT_MAPPING),void 0===i&&(i=d),void 0===a&&(a=d),void 0===o&&(o=g),void 0===s&&(s=x),void 0===l&&(l=A),void 0===c&&(c=_),void 0===u&&(u=1),void 0===h&&(h=Y),p=t.call(this)||this,Object.defineProperty(ut(p),"id",{value:wt++}),p.uuid=gt.generateUUID(),p.name="",p.image=n,p.mipmaps=[],p.mapping=r,p.wrapS=i,p.wrapT=a,p.magFilter=o,p.minFilter=s,p.anisotropy=u,p.format=l,p.internalFormat=null,p.type=c,p.offset=new yt(0,0),p.repeat=new yt(1,1),p.center=new yt(0,0),p.rotation=0,p.matrixAutoUpdate=!0,p.matrix=new _t,p.generateMipmaps=!0,p.premultiplyAlpha=!1,p.flipY=!0,p.unpackAlignment=4,p.encoding=h,p.version=0,p.onUpdate=null,p}lt(e,t);var n=e.prototype;return n.updateMatrix=function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},n.clone=function(){return(new this.constructor).copy(this)},n.copy=function(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},n.toJSON=function(t){var e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];var n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){var r=this.image;if(void 0===r.uuid&&(r.uuid=gt.generateUUID()),!e&&void 0===t.images[r.uuid]){var i;if(Array.isArray(r)){i=[];for(var a=0,o=r.length;a<o;a++)r[a].isDataTexture?i.push(St(r[a].image)):i.push(St(r[a]))}else i=St(r);t.images[r.uuid]={uuid:r.uuid,url:i}}n.image=r.uuid}return e||(t.textures[this.uuid]=n),n},n.dispose=function(){this.dispatchEvent({type:"dispose"})},n.transformUv=function(t){if(this.mapping!==i)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case h:t.x=t.x-Math.floor(t.x);break;case d:t.x=t.x<0?0:1;break;case p:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case h:t.y=t.y-Math.floor(t.y);break;case d:t.y=t.y<0?0:1;break;case p:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t},st(e,[{key:"needsUpdate",set:function(t){!0===t&&this.version++}}]),e}(pt);function St(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?bt.getDataURL(t):t.data?{data:Array.prototype.slice.call(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}Mt.DEFAULT_IMAGE=void 0,Mt.DEFAULT_MAPPING=i,Mt.prototype.isTexture=!0;var Tt=function(){function t(t,e,n,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=0),void 0===r&&(r=1),this.x=t,this.y=e,this.z=n,this.w=r}var e=t.prototype;return e.set=function(t,e,n,r){return this.x=t,this.y=e,this.z=n,this.w=r,this},e.setScalar=function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},e.setX=function(t){return this.x=t,this},e.setY=function(t){return this.y=t,this},e.setZ=function(t){return this.z=t,this},e.setW=function(t){return this.w=t,this},e.setComponent=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this},e.getComponent=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}},e.clone=function(){return new this.constructor(this.x,this.y,this.z,this.w)},e.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},e.add=function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},e.addScalar=function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},e.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},e.sub=function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},e.subScalar=function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},e.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},e.multiply=function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this},e.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},e.applyMatrix4=function(t){var e=this.x,n=this.y,r=this.z,i=this.w,a=t.elements;return this.x=a[0]*e+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*e+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*e+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*e+a[7]*n+a[11]*r+a[15]*i,this},e.divideScalar=function(t){return this.multiplyScalar(1/t)},e.setAxisAngleFromQuaternion=function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},e.setAxisAngleFromRotationMatrix=function(t){var e,n,r,i,a=.01,o=.1,s=t.elements,l=s[0],c=s[4],u=s[8],h=s[1],d=s[5],p=s[9],f=s[2],m=s[6],v=s[10];if(Math.abs(c-h)<a&&Math.abs(u-f)<a&&Math.abs(p-m)<a){if(Math.abs(c+h)<o&&Math.abs(u+f)<o&&Math.abs(p+m)<o&&Math.abs(l+d+v-3)<o)return this.set(1,0,0,0),this;e=Math.PI;var g=(l+1)/2,y=(d+1)/2,x=(v+1)/2,_=(c+h)/4,b=(u+f)/4,w=(p+m)/4;return g>y&&g>x?g<a?(n=0,r=.707106781,i=.707106781):(r=_/(n=Math.sqrt(g)),i=b/n):y>x?y<a?(n=.707106781,r=0,i=.707106781):(n=_/(r=Math.sqrt(y)),i=w/r):x<a?(n=.707106781,r=.707106781,i=0):(n=b/(i=Math.sqrt(x)),r=w/i),this.set(n,r,i,e),this}var M=Math.sqrt((m-p)*(m-p)+(u-f)*(u-f)+(h-c)*(h-c));return Math.abs(M)<.001&&(M=1),this.x=(m-p)/M,this.y=(u-f)/M,this.z=(h-c)/M,this.w=Math.acos((l+d+v-1)/2),this},e.min=function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},e.max=function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},e.clamp=function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this},e.clampScalar=function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this},e.clampLength=function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))},e.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},e.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},e.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},e.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},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},e.lengthSq=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.manhattanLength=function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},e.normalize=function(){return this.divideScalar(this.length()||1)},e.setLength=function(t){return this.normalize().multiplyScalar(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},e.lerpVectors=function(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},e.fromArray=function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},e.toArray=function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},e.fromBufferAttribute=function(t,e,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this},st(t,[{key:"width",get:function(){return this.z},set:function(t){this.z=t}},{key:"height",get:function(){return this.w},set:function(t){this.w=t}}]),t}();Tt.prototype.isVector4=!0;var Et=function(t){function e(e,n,r){var i;return(i=t.call(this)||this).width=e,i.height=n,i.depth=1,i.scissor=new Tt(0,0,e,n),i.scissorTest=!1,i.viewport=new Tt(0,0,e,n),r=r||{},i.texture=new Mt(void 0,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.encoding),i.texture.image={},i.texture.image.width=e,i.texture.image.height=n,i.texture.image.depth=1,i.texture.generateMipmaps=void 0!==r.generateMipmaps&&r.generateMipmaps,i.texture.minFilter=void 0!==r.minFilter?r.minFilter:g,i.depthBuffer=void 0===r.depthBuffer||r.depthBuffer,i.stencilBuffer=void 0!==r.stencilBuffer&&r.stencilBuffer,i.depthTexture=void 0!==r.depthTexture?r.depthTexture:null,i}lt(e,t);var n=e.prototype;return n.setTexture=function(t){t.image={width:this.width,height:this.height,depth:this.depth},this.texture=t},n.setSize=function(t,e,n){void 0===n&&(n=1),this.width===t&&this.height===e&&this.depth===n||(this.width=t,this.height=e,this.depth=n,this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},n.clone=function(){return(new this.constructor).copy(this)},n.copy=function(t){return this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this},n.dispose=function(){this.dispatchEvent({type:"dispose"})},e}(pt);Et.prototype.isWebGLRenderTarget=!0;var At=function(t){function e(e,n,r){var i;return(i=t.call(this,e,n,r)||this).samples=4,i}return lt(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.samples=e.samples,this},e}(Et);At.prototype.isWebGLMultisampleRenderTarget=!0;var Lt=function(){function t(t,e,n,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=0),void 0===r&&(r=1),this._x=t,this._y=e,this._z=n,this._w=r}t.slerp=function(t,e,n,r){return n.copy(t).slerp(e,r)},t.slerpFlat=function(t,e,n,r,i,a,o){var s=n[r+0],l=n[r+1],c=n[r+2],u=n[r+3],h=i[a+0],d=i[a+1],p=i[a+2],f=i[a+3];if(0===o)return t[e+0]=s,t[e+1]=l,t[e+2]=c,void(t[e+3]=u);if(1===o)return t[e+0]=h,t[e+1]=d,t[e+2]=p,void(t[e+3]=f);if(u!==f||s!==h||l!==d||c!==p){var m=1-o,v=s*h+l*d+c*p+u*f,g=v>=0?1:-1,y=1-v*v;if(y>Number.EPSILON){var x=Math.sqrt(y),_=Math.atan2(x,v*g);m=Math.sin(m*_)/x,o=Math.sin(o*_)/x}var b=o*g;if(s=s*m+h*b,l=l*m+d*b,c=c*m+p*b,u=u*m+f*b,m===1-o){var w=1/Math.sqrt(s*s+l*l+c*c+u*u);s*=w,l*=w,c*=w,u*=w}}t[e]=s,t[e+1]=l,t[e+2]=c,t[e+3]=u},t.multiplyQuaternionsFlat=function(t,e,n,r,i,a){var o=n[r],s=n[r+1],l=n[r+2],c=n[r+3],u=i[a],h=i[a+1],d=i[a+2],p=i[a+3];return t[e]=o*p+c*u+s*d-l*h,t[e+1]=s*p+c*h+l*u-o*d,t[e+2]=l*p+c*d+o*h-s*u,t[e+3]=c*p-o*u-s*h-l*d,t};var e=t.prototype;return e.set=function(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._w=r,this._onChangeCallback(),this},e.clone=function(){return new this.constructor(this._x,this._y,this._z,this._w)},e.copy=function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this},e.setFromEuler=function(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=t._x,r=t._y,i=t._z,a=t._order,o=Math.cos,s=Math.sin,l=o(n/2),c=o(r/2),u=o(i/2),h=s(n/2),d=s(r/2),p=s(i/2);switch(a){case"XYZ":this._x=h*c*u+l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u-h*d*p;break;case"YXZ":this._x=h*c*u+l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u+h*d*p;break;case"ZXY":this._x=h*c*u-l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u-h*d*p;break;case"ZYX":this._x=h*c*u-l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u+h*d*p;break;case"YZX":this._x=h*c*u+l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u-h*d*p;break;case"XZY":this._x=h*c*u-l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u+h*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==e&&this._onChangeCallback(),this},e.setFromAxisAngle=function(t,e){var n=e/2,r=Math.sin(n);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(n),this._onChangeCallback(),this},e.setFromRotationMatrix=function(t){var e=t.elements,n=e[0],r=e[4],i=e[8],a=e[1],o=e[5],s=e[9],l=e[2],c=e[6],u=e[10],h=n+o+u;if(h>0){var d=.5/Math.sqrt(h+1);this._w=.25/d,this._x=(c-s)*d,this._y=(i-l)*d,this._z=(a-r)*d}else if(n>o&&n>u){var p=2*Math.sqrt(1+n-o-u);this._w=(c-s)/p,this._x=.25*p,this._y=(r+a)/p,this._z=(i+l)/p}else if(o>u){var f=2*Math.sqrt(1+o-n-u);this._w=(i-l)/f,this._x=(r+a)/f,this._y=.25*f,this._z=(s+c)/f}else{var m=2*Math.sqrt(1+u-n-o);this._w=(a-r)/m,this._x=(i+l)/m,this._y=(s+c)/m,this._z=.25*m}return this._onChangeCallback(),this},e.setFromUnitVectors=function(t,e){var n=t.dot(e)+1;return n<1e-6?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()},e.angleTo=function(t){return 2*Math.acos(Math.abs(gt.clamp(this.dot(t),-1,1)))},e.rotateTowards=function(t,e){var n=this.angleTo(t);if(0===n)return this;var r=Math.min(1,e/n);return this.slerp(t,r),this},e.identity=function(){return this.set(0,0,0,1)},e.invert=function(){return this.conjugate()},e.conjugate=function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},e.dot=function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},e.lengthSq=function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},e.length=function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},e.normalize=function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this},e.multiply=function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},e.premultiply=function(t){return this.multiplyQuaternions(t,this)},e.multiplyQuaternions=function(t,e){var n=t._x,r=t._y,i=t._z,a=t._w,o=e._x,s=e._y,l=e._z,c=e._w;return this._x=n*c+a*o+r*l-i*s,this._y=r*c+a*s+i*o-n*l,this._z=i*c+a*l+n*s-r*o,this._w=a*c-n*o-r*s-i*l,this._onChangeCallback(),this},e.slerp=function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var n=this._x,r=this._y,i=this._z,a=this._w,o=a*t._w+n*t._x+r*t._y+i*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=a,this._x=n,this._y=r,this._z=i,this;var s=1-o*o;if(s<=Number.EPSILON){var l=1-e;return this._w=l*a+e*this._w,this._x=l*n+e*this._x,this._y=l*r+e*this._y,this._z=l*i+e*this._z,this.normalize(),this._onChangeCallback(),this}var c=Math.sqrt(s),u=Math.atan2(c,o),h=Math.sin((1-e)*u)/c,d=Math.sin(e*u)/c;return this._w=a*h+this._w*d,this._x=n*h+this._x*d,this._y=r*h+this._y*d,this._z=i*h+this._z*d,this._onChangeCallback(),this},e.equals=function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},e.fromArray=function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this},e.toArray=function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},e.fromBufferAttribute=function(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this},e._onChange=function(t){return this._onChangeCallback=t,this},e._onChangeCallback=function(){},st(t,[{key:"x",get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()}},{key:"w",get:function(){return this._w},set:function(t){this._w=t,this._onChangeCallback()}}]),t}();Lt.prototype.isQuaternion=!0;var Rt=function(){function t(t,e,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=0),this.x=t,this.y=e,this.z=n}var e=t.prototype;return e.set=function(t,e,n){return void 0===n&&(n=this.z),this.x=t,this.y=e,this.z=n,this},e.setScalar=function(t){return this.x=t,this.y=t,this.z=t,this},e.setX=function(t){return this.x=t,this},e.setY=function(t){return this.y=t,this},e.setZ=function(t){return this.z=t,this},e.setComponent=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this},e.getComponent=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},e.clone=function(){return new this.constructor(this.x,this.y,this.z)},e.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},e.add=function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},e.addScalar=function(t){return this.x+=t,this.y+=t,this.z+=t,this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},e.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},e.sub=function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},e.subScalar=function(t){return this.x-=t,this.y-=t,this.z-=t,this},e.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},e.multiply=function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},e.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this},e.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},e.applyEuler=function(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Pt.setFromEuler(t))},e.applyAxisAngle=function(t,e){return this.applyQuaternion(Pt.setFromAxisAngle(t,e))},e.applyMatrix3=function(t){var e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6]*r,this.y=i[1]*e+i[4]*n+i[7]*r,this.z=i[2]*e+i[5]*n+i[8]*r,this},e.applyNormalMatrix=function(t){return this.applyMatrix3(t).normalize()},e.applyMatrix4=function(t){var e=this.x,n=this.y,r=this.z,i=t.elements,a=1/(i[3]*e+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*e+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*e+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*e+i[6]*n+i[10]*r+i[14])*a,this},e.applyQuaternion=function(t){var e=this.x,n=this.y,r=this.z,i=t.x,a=t.y,o=t.z,s=t.w,l=s*e+a*r-o*n,c=s*n+o*e-i*r,u=s*r+i*n-a*e,h=-i*e-a*n-o*r;return this.x=l*s+h*-i+c*-o-u*-a,this.y=c*s+h*-a+u*-i-l*-o,this.z=u*s+h*-o+l*-a-c*-i,this},e.project=function(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)},e.unproject=function(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)},e.transformDirection=function(t){var e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[4]*n+i[8]*r,this.y=i[1]*e+i[5]*n+i[9]*r,this.z=i[2]*e+i[6]*n+i[10]*r,this.normalize()},e.divide=function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},e.divideScalar=function(t){return this.multiplyScalar(1/t)},e.min=function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},e.max=function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},e.clamp=function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},e.clampScalar=function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this},e.clampLength=function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},e.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},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},e.lengthSq=function(){return this.x*this.x+this.y*this.y+this.z*this.z},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},e.manhattanLength=function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},e.normalize=function(){return this.divideScalar(this.length()||1)},e.setLength=function(t){return this.normalize().multiplyScalar(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},e.lerpVectors=function(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this},e.cross=function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)},e.crossVectors=function(t,e){var n=t.x,r=t.y,i=t.z,a=e.x,o=e.y,s=e.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this},e.projectOnVector=function(t){var e=t.lengthSq();if(0===e)return this.set(0,0,0);var n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)},e.projectOnPlane=function(t){return Ct.copy(this).projectOnVector(t),this.sub(Ct)},e.reflect=function(t){return this.sub(Ct.copy(t).multiplyScalar(2*this.dot(t)))},e.angleTo=function(t){var e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;var n=this.dot(t)/e;return Math.acos(gt.clamp(n,-1,1))},e.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},e.distanceToSquared=function(t){var e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return e*e+n*n+r*r},e.manhattanDistanceTo=function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},e.setFromSpherical=function(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)},e.setFromSphericalCoords=function(t,e,n){var r=Math.sin(e)*t;return this.x=r*Math.sin(n),this.y=Math.cos(e)*t,this.z=r*Math.cos(n),this},e.setFromCylindrical=function(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)},e.setFromCylindricalCoords=function(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this},e.setFromMatrixPosition=function(t){var e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this},e.setFromMatrixScale=function(t){var e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=r,this},e.setFromMatrixColumn=function(t,e){return this.fromArray(t.elements,4*e)},e.setFromMatrix3Column=function(t,e){return this.fromArray(t.elements,3*e)},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},e.fromArray=function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},e.toArray=function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},e.fromBufferAttribute=function(t,e,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},t}();Rt.prototype.isVector3=!0;var Ct=new Rt,Pt=new Lt,Dt=function(){function t(t,e){void 0===t&&(t=new Rt(1/0,1/0,1/0)),void 0===e&&(e=new Rt(-1/0,-1/0,-1/0)),this.min=t,this.max=e}var e=t.prototype;return e.set=function(t,e){return this.min.copy(t),this.max.copy(e),this},e.setFromArray=function(t){for(var e=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,l=t.length;s<l;s+=3){var c=t[s],u=t[s+1],h=t[s+2];c<e&&(e=c),u<n&&(n=u),h<r&&(r=h),c>i&&(i=c),u>a&&(a=u),h>o&&(o=h)}return this.min.set(e,n,r),this.max.set(i,a,o),this},e.setFromBufferAttribute=function(t){for(var e=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,l=t.count;s<l;s++){var c=t.getX(s),u=t.getY(s),h=t.getZ(s);c<e&&(e=c),u<n&&(n=u),h<r&&(r=h),c>i&&(i=c),u>a&&(a=u),h>o&&(o=h)}return this.min.set(e,n,r),this.max.set(i,a,o),this},e.setFromPoints=function(t){this.makeEmpty();for(var e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this},e.setFromCenterAndSize=function(t,e){var n=Nt.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this},e.setFromObject=function(t){return this.makeEmpty(),this.expandByObject(t)},e.clone=function(){return(new this.constructor).copy(this)},e.copy=function(t){return this.min.copy(t.min),this.max.copy(t.max),this},e.makeEmpty=function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},e.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},e.getCenter=function(t){return void 0===t&&(console.warn("THREE.Box3: .getCenter() target is now required"),t=new Rt),this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},e.getSize=function(t){return void 0===t&&(console.warn("THREE.Box3: .getSize() target is now required"),t=new Rt),this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)},e.expandByPoint=function(t){return this.min.min(t),this.max.max(t),this},e.expandByVector=function(t){return this.min.sub(t),this.max.add(t),this},e.expandByScalar=function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},e.expandByObject=function(t){t.updateWorldMatrix(!1,!1);var e=t.geometry;void 0!==e&&(null===e.boundingBox&&e.computeBoundingBox(),Bt.copy(e.boundingBox),Bt.applyMatrix4(t.matrixWorld),this.union(Bt));for(var n=t.children,r=0,i=n.length;r<i;r++)this.expandByObject(n[r]);return this},e.containsPoint=function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},e.containsBox=function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},e.getParameter=function(t,e){return void 0===e&&(console.warn("THREE.Box3: .getParameter() target is now required"),e=new Rt),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},e.intersectsBox=function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},e.intersectsSphere=function(t){return this.clampPoint(t.center,Nt),Nt.distanceToSquared(t.center)<=t.radius*t.radius},e.intersectsPlane=function(t){var e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant},e.intersectsTriangle=function(t){if(this.isEmpty())return!1;this.getCenter(kt),Vt.subVectors(this.max,kt),Ot.subVectors(t.a,kt),zt.subVectors(t.b,kt),Ft.subVectors(t.c,kt),Ht.subVectors(zt,Ot),Gt.subVectors(Ft,zt),Ut.subVectors(Ot,Ft);var e=[0,-Ht.z,Ht.y,0,-Gt.z,Gt.y,0,-Ut.z,Ut.y,Ht.z,0,-Ht.x,Gt.z,0,-Gt.x,Ut.z,0,-Ut.x,-Ht.y,Ht.x,0,-Gt.y,Gt.x,0,-Ut.y,Ut.x,0];return!!qt(e,Ot,zt,Ft,Vt)&&(!!qt(e=[1,0,0,0,1,0,0,0,1],Ot,zt,Ft,Vt)&&(Wt.crossVectors(Ht,Gt),qt(e=[Wt.x,Wt.y,Wt.z],Ot,zt,Ft,Vt)))},e.clampPoint=function(t,e){return void 0===e&&(console.warn("THREE.Box3: .clampPoint() target is now required"),e=new Rt),e.copy(t).clamp(this.min,this.max)},e.distanceToPoint=function(t){return Nt.copy(t).clamp(this.min,this.max).sub(t).length()},e.getBoundingSphere=function(t){return void 0===t&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(t.center),t.radius=.5*this.getSize(Nt).length(),t},e.intersect=function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},e.union=function(t){return this.min.min(t.min),this.max.max(t.max),this},e.applyMatrix4=function(t){return this.isEmpty()||(It[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),It[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),It[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),It[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),It[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),It[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),It[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),It[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(It)),this},e.translate=function(t){return this.min.add(t),this.max.add(t),this},e.equals=function(t){return t.min.equals(this.min)&&t.max.equals(this.max)},t}();Dt.prototype.isBox3=!0;var It=[new Rt,new Rt,new Rt,new Rt,new Rt,new Rt,new Rt,new Rt],Nt=new Rt,Bt=new Dt,Ot=new Rt,zt=new Rt,Ft=new Rt,Ht=new Rt,Gt=new Rt,Ut=new Rt,kt=new Rt,Vt=new Rt,Wt=new Rt,jt=new Rt;function qt(t,e,n,r,i){for(var a=0,o=t.length-3;a<=o;a+=3){jt.fromArray(t,a);var s=i.x*Math.abs(jt.x)+i.y*Math.abs(jt.y)+i.z*Math.abs(jt.z),l=e.dot(jt),c=n.dot(jt),u=r.dot(jt);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>s)return!1}return!0}var Xt=new Dt,Yt=function(){function t(t,e){void 0===t&&(t=new Rt),void 0===e&&(e=-1),this.center=t,this.radius=e}var e=t.prototype;return e.set=function(t,e){return this.center.copy(t),this.radius=e,this},e.setFromPoints=function(t,e){var n=this.center;void 0!==e?n.copy(e):Xt.setFromPoints(t).getCenter(n);for(var r=0,i=0,a=t.length;i<a;i++)r=Math.max(r,n.distanceToSquared(t[i]));return this.radius=Math.sqrt(r),this},e.copy=function(t){return this.center.copy(t.center),this.radius=t.radius,this},e.isEmpty=function(){return this.radius<0},e.makeEmpty=function(){return this.center.set(0,0,0),this.radius=-1,this},e.containsPoint=function(t){return t.distanceToSquared(this.center)<=this.radius*this.radius},e.distanceToPoint=function(t){return t.distanceTo(this.center)-this.radius},e.intersectsSphere=function(t){var e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e},e.intersectsBox=function(t){return t.intersectsSphere(this)},e.intersectsPlane=function(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius},e.clampPoint=function(t,e){var n=this.center.distanceToSquared(t);return void 0===e&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),e=new Rt),e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e},e.getBoundingBox=function(t){return void 0===t&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),t=new Dt),this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)},e.applyMatrix4=function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},e.translate=function(t){return this.center.add(t),this},e.equals=function(t){return t.center.equals(this.center)&&t.radius===this.radius},e.clone=function(){return(new this.constructor).copy(this)},t}(),Zt=new Rt,Jt=new Rt,Qt=new Rt,Kt=new Rt,$t=new Rt,te=new Rt,ee=new Rt,ne=function(){function t(t,e){void 0===t&&(t=new Rt),void 0===e&&(e=new Rt(0,0,-1)),this.origin=t,this.direction=e}var e=t.prototype;return e.set=function(t,e){return this.origin.copy(t),this.direction.copy(e),this},e.copy=function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},e.at=function(t,e){return void 0===e&&(console.warn("THREE.Ray: .at() target is now required"),e=new Rt),e.copy(this.direction).multiplyScalar(t).add(this.origin)},e.lookAt=function(t){return this.direction.copy(t).sub(this.origin).normalize(),this},e.recast=function(t){return this.origin.copy(this.at(t,Zt)),this},e.closestPointToPoint=function(t,e){void 0===e&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),e=new Rt),e.subVectors(t,this.origin);var n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(n).add(this.origin)},e.distanceToPoint=function(t){return Math.sqrt(this.distanceSqToPoint(t))},e.distanceSqToPoint=function(t){var e=Zt.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Zt.copy(this.direction).multiplyScalar(e).add(this.origin),Zt.distanceToSquared(t))},e.distanceSqToSegment=function(t,e,n,r){Jt.copy(t).add(e).multiplyScalar(.5),Qt.copy(e).sub(t).normalize(),Kt.copy(this.origin).sub(Jt);var i,a,o,s,l=.5*t.distanceTo(e),c=-this.direction.dot(Qt),u=Kt.dot(this.direction),h=-Kt.dot(Qt),d=Kt.lengthSq(),p=Math.abs(1-c*c);if(p>0)if(a=c*u-h,s=l*p,(i=c*h-u)>=0)if(a>=-s)if(a<=s){var f=1/p;o=(i*=f)*(i+c*(a*=f)+2*u)+a*(c*i+a+2*h)+d}else a=l,o=-(i=Math.max(0,-(c*a+u)))*i+a*(a+2*h)+d;else a=-l,o=-(i=Math.max(0,-(c*a+u)))*i+a*(a+2*h)+d;else a<=-s?o=-(i=Math.max(0,-(-c*l+u)))*i+(a=i>0?-l:Math.min(Math.max(-l,-h),l))*(a+2*h)+d:a<=s?(i=0,o=(a=Math.min(Math.max(-l,-h),l))*(a+2*h)+d):o=-(i=Math.max(0,-(c*l+u)))*i+(a=i>0?l:Math.min(Math.max(-l,-h),l))*(a+2*h)+d;else a=c>0?-l:l,o=-(i=Math.max(0,-(c*a+u)))*i+a*(a+2*h)+d;return n&&n.copy(this.direction).multiplyScalar(i).add(this.origin),r&&r.copy(Qt).multiplyScalar(a).add(Jt),o},e.intersectSphere=function(t,e){Zt.subVectors(t.center,this.origin);var n=Zt.dot(this.direction),r=Zt.dot(Zt)-n*n,i=t.radius*t.radius;if(r>i)return null;var a=Math.sqrt(i-r),o=n-a,s=n+a;return o<0&&s<0?null:o<0?this.at(s,e):this.at(o,e)},e.intersectsSphere=function(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius},e.distanceToPlane=function(t){var e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null},e.intersectPlane=function(t,e){var n=this.distanceToPlane(t);return null===n?null:this.at(n,e)},e.intersectsPlane=function(t){var e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0},e.intersectBox=function(t,e){var n,r,i,a,o,s,l=1/this.direction.x,c=1/this.direction.y,u=1/this.direction.z,h=this.origin;return l>=0?(n=(t.min.x-h.x)*l,r=(t.max.x-h.x)*l):(n=(t.max.x-h.x)*l,r=(t.min.x-h.x)*l),c>=0?(i=(t.min.y-h.y)*c,a=(t.max.y-h.y)*c):(i=(t.max.y-h.y)*c,a=(t.min.y-h.y)*c),n>a||i>r?null:((i>n||n!=n)&&(n=i),(a<r||r!=r)&&(r=a),u>=0?(o=(t.min.z-h.z)*u,s=(t.max.z-h.z)*u):(o=(t.max.z-h.z)*u,s=(t.min.z-h.z)*u),n>s||o>r?null:((o>n||n!=n)&&(n=o),(s<r||r!=r)&&(r=s),r<0?null:this.at(n>=0?n:r,e)))},e.intersectsBox=function(t){return null!==this.intersectBox(t,Zt)},e.intersectTriangle=function(t,e,n,r,i){$t.subVectors(e,t),te.subVectors(n,t),ee.crossVectors($t,te);var a,o=this.direction.dot(ee);if(o>0){if(r)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}Kt.subVectors(this.origin,t);var s=a*this.direction.dot(te.crossVectors(Kt,te));if(s<0)return null;var l=a*this.direction.dot($t.cross(Kt));if(l<0)return null;if(s+l>o)return null;var c=-a*Kt.dot(ee);return c<0?null:this.at(c/o,i)},e.applyMatrix4=function(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this},e.equals=function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)},e.clone=function(){return(new this.constructor).copy(this)},t}(),re=function(){function t(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}var e=t.prototype;return e.set=function(t,e,n,r,i,a,o,s,l,c,u,h,d,p,f,m){var v=this.elements;return v[0]=t,v[4]=e,v[8]=n,v[12]=r,v[1]=i,v[5]=a,v[9]=o,v[13]=s,v[2]=l,v[6]=c,v[10]=u,v[14]=h,v[3]=d,v[7]=p,v[11]=f,v[15]=m,this},e.identity=function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},e.clone=function(){return(new t).fromArray(this.elements)},e.copy=function(t){var e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this},e.copyPosition=function(t){var e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this},e.setFromMatrix3=function(t){var e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this},e.extractBasis=function(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},e.makeBasis=function(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this},e.extractRotation=function(t){var e=this.elements,n=t.elements,r=1/ie.setFromMatrixColumn(t,0).length(),i=1/ie.setFromMatrixColumn(t,1).length(),a=1/ie.setFromMatrixColumn(t,2).length();return e[0]=n[0]*r,e[1]=n[1]*r,e[2]=n[2]*r,e[3]=0,e[4]=n[4]*i,e[5]=n[5]*i,e[6]=n[6]*i,e[7]=0,e[8]=n[8]*a,e[9]=n[9]*a,e[10]=n[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},e.makeRotationFromEuler=function(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,n=t.x,r=t.y,i=t.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),l=Math.sin(r),c=Math.cos(i),u=Math.sin(i);if("XYZ"===t.order){var h=a*c,d=a*u,p=o*c,f=o*u;e[0]=s*c,e[4]=-s*u,e[8]=l,e[1]=d+p*l,e[5]=h-f*l,e[9]=-o*s,e[2]=f-h*l,e[6]=p+d*l,e[10]=a*s}else if("YXZ"===t.order){var m=s*c,v=s*u,g=l*c,y=l*u;e[0]=m+y*o,e[4]=g*o-v,e[8]=a*l,e[1]=a*u,e[5]=a*c,e[9]=-o,e[2]=v*o-g,e[6]=y+m*o,e[10]=a*s}else if("ZXY"===t.order){var x=s*c,_=s*u,b=l*c,w=l*u;e[0]=x-w*o,e[4]=-a*u,e[8]=b+_*o,e[1]=_+b*o,e[5]=a*c,e[9]=w-x*o,e[2]=-a*l,e[6]=o,e[10]=a*s}else if("ZYX"===t.order){var M=a*c,S=a*u,T=o*c,E=o*u;e[0]=s*c,e[4]=T*l-S,e[8]=M*l+E,e[1]=s*u,e[5]=E*l+M,e[9]=S*l-T,e[2]=-l,e[6]=o*s,e[10]=a*s}else if("YZX"===t.order){var A=a*s,L=a*l,R=o*s,C=o*l;e[0]=s*c,e[4]=C-A*u,e[8]=R*u+L,e[1]=u,e[5]=a*c,e[9]=-o*c,e[2]=-l*c,e[6]=L*u+R,e[10]=A-C*u}else if("XZY"===t.order){var P=a*s,D=a*l,I=o*s,N=o*l;e[0]=s*c,e[4]=-u,e[8]=l*c,e[1]=P*u+N,e[5]=a*c,e[9]=D*u-I,e[2]=I*u-D,e[6]=o*c,e[10]=N*u+P}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},e.makeRotationFromQuaternion=function(t){return this.compose(oe,t,se)},e.lookAt=function(t,e,n){var r=this.elements;return ue.subVectors(t,e),0===ue.lengthSq()&&(ue.z=1),ue.normalize(),le.crossVectors(n,ue),0===le.lengthSq()&&(1===Math.abs(n.z)?ue.x+=1e-4:ue.z+=1e-4,ue.normalize(),le.crossVectors(n,ue)),le.normalize(),ce.crossVectors(ue,le),r[0]=le.x,r[4]=ce.x,r[8]=ue.x,r[1]=le.y,r[5]=ce.y,r[9]=ue.y,r[2]=le.z,r[6]=ce.z,r[10]=ue.z,this},e.multiply=function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},e.premultiply=function(t){return this.multiplyMatrices(t,this)},e.multiplyMatrices=function(t,e){var n=t.elements,r=e.elements,i=this.elements,a=n[0],o=n[4],s=n[8],l=n[12],c=n[1],u=n[5],h=n[9],d=n[13],p=n[2],f=n[6],m=n[10],v=n[14],g=n[3],y=n[7],x=n[11],_=n[15],b=r[0],w=r[4],M=r[8],S=r[12],T=r[1],E=r[5],A=r[9],L=r[13],R=r[2],C=r[6],P=r[10],D=r[14],I=r[3],N=r[7],B=r[11],O=r[15];return i[0]=a*b+o*T+s*R+l*I,i[4]=a*w+o*E+s*C+l*N,i[8]=a*M+o*A+s*P+l*B,i[12]=a*S+o*L+s*D+l*O,i[1]=c*b+u*T+h*R+d*I,i[5]=c*w+u*E+h*C+d*N,i[9]=c*M+u*A+h*P+d*B,i[13]=c*S+u*L+h*D+d*O,i[2]=p*b+f*T+m*R+v*I,i[6]=p*w+f*E+m*C+v*N,i[10]=p*M+f*A+m*P+v*B,i[14]=p*S+f*L+m*D+v*O,i[3]=g*b+y*T+x*R+_*I,i[7]=g*w+y*E+x*C+_*N,i[11]=g*M+y*A+x*P+_*B,i[15]=g*S+y*L+x*D+_*O,this},e.multiplyScalar=function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},e.determinant=function(){var t=this.elements,e=t[0],n=t[4],r=t[8],i=t[12],a=t[1],o=t[5],s=t[9],l=t[13],c=t[2],u=t[6],h=t[10],d=t[14];return t[3]*(+i*s*u-r*l*u-i*o*h+n*l*h+r*o*d-n*s*d)+t[7]*(+e*s*d-e*l*h+i*a*h-r*a*d+r*l*c-i*s*c)+t[11]*(+e*l*u-e*o*d-i*a*u+n*a*d+i*o*c-n*l*c)+t[15]*(-r*o*c-e*s*u+e*o*h+r*a*u-n*a*h+n*s*c)},e.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},e.setPosition=function(t,e,n){var r=this.elements;return t.isVector3?(r[12]=t.x,r[13]=t.y,r[14]=t.z):(r[12]=t,r[13]=e,r[14]=n),this},e.invert=function(){var t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],l=t[7],c=t[8],u=t[9],h=t[10],d=t[11],p=t[12],f=t[13],m=t[14],v=t[15],g=u*m*l-f*h*l+f*s*d-o*m*d-u*s*v+o*h*v,y=p*h*l-c*m*l-p*s*d+a*m*d+c*s*v-a*h*v,x=c*f*l-p*u*l+p*o*d-a*f*d-c*o*v+a*u*v,_=p*u*s-c*f*s-p*o*h+a*f*h+c*o*m-a*u*m,b=e*g+n*y+r*x+i*_;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var w=1/b;return t[0]=g*w,t[1]=(f*h*i-u*m*i-f*r*d+n*m*d+u*r*v-n*h*v)*w,t[2]=(o*m*i-f*s*i+f*r*l-n*m*l-o*r*v+n*s*v)*w,t[3]=(u*s*i-o*h*i-u*r*l+n*h*l+o*r*d-n*s*d)*w,t[4]=y*w,t[5]=(c*m*i-p*h*i+p*r*d-e*m*d-c*r*v+e*h*v)*w,t[6]=(p*s*i-a*m*i-p*r*l+e*m*l+a*r*v-e*s*v)*w,t[7]=(a*h*i-c*s*i+c*r*l-e*h*l-a*r*d+e*s*d)*w,t[8]=x*w,t[9]=(p*u*i-c*f*i-p*n*d+e*f*d+c*n*v-e*u*v)*w,t[10]=(a*f*i-p*o*i+p*n*l-e*f*l-a*n*v+e*o*v)*w,t[11]=(c*o*i-a*u*i-c*n*l+e*u*l+a*n*d-e*o*d)*w,t[12]=_*w,t[13]=(c*f*r-p*u*r+p*n*h-e*f*h-c*n*m+e*u*m)*w,t[14]=(p*o*r-a*f*r-p*n*s+e*f*s+a*n*m-e*o*m)*w,t[15]=(a*u*r-c*o*r+c*n*s-e*u*s-a*n*h+e*o*h)*w,this},e.scale=function(t){var e=this.elements,n=t.x,r=t.y,i=t.z;return e[0]*=n,e[4]*=r,e[8]*=i,e[1]*=n,e[5]*=r,e[9]*=i,e[2]*=n,e[6]*=r,e[10]*=i,e[3]*=n,e[7]*=r,e[11]*=i,this},e.getMaxScaleOnAxis=function(){var t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],r=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,r))},e.makeTranslation=function(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this},e.makeRotationX=function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this},e.makeRotationY=function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this},e.makeRotationZ=function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this},e.makeRotationAxis=function(t,e){var n=Math.cos(e),r=Math.sin(e),i=1-n,a=t.x,o=t.y,s=t.z,l=i*a,c=i*o;return this.set(l*a+n,l*o-r*s,l*s+r*o,0,l*o+r*s,c*o+n,c*s-r*a,0,l*s-r*o,c*s+r*a,i*s*s+n,0,0,0,0,1),this},e.makeScale=function(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this},e.makeShear=function(t,e,n){return this.set(1,e,n,0,t,1,n,0,t,e,1,0,0,0,0,1),this},e.compose=function(t,e,n){var r=this.elements,i=e._x,a=e._y,o=e._z,s=e._w,l=i+i,c=a+a,u=o+o,h=i*l,d=i*c,p=i*u,f=a*c,m=a*u,v=o*u,g=s*l,y=s*c,x=s*u,_=n.x,b=n.y,w=n.z;return r[0]=(1-(f+v))*_,r[1]=(d+x)*_,r[2]=(p-y)*_,r[3]=0,r[4]=(d-x)*b,r[5]=(1-(h+v))*b,r[6]=(m+g)*b,r[7]=0,r[8]=(p+y)*w,r[9]=(m-g)*w,r[10]=(1-(h+f))*w,r[11]=0,r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=1,this},e.decompose=function(t,e,n){var r=this.elements,i=ie.set(r[0],r[1],r[2]).length(),a=ie.set(r[4],r[5],r[6]).length(),o=ie.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),t.x=r[12],t.y=r[13],t.z=r[14],ae.copy(this);var s=1/i,l=1/a,c=1/o;return ae.elements[0]*=s,ae.elements[1]*=s,ae.elements[2]*=s,ae.elements[4]*=l,ae.elements[5]*=l,ae.elements[6]*=l,ae.elements[8]*=c,ae.elements[9]*=c,ae.elements[10]*=c,e.setFromRotationMatrix(ae),n.x=i,n.y=a,n.z=o,this},e.makePerspective=function(t,e,n,r,i,a){void 0===a&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var o=this.elements,s=2*i/(e-t),l=2*i/(n-r),c=(e+t)/(e-t),u=(n+r)/(n-r),h=-(a+i)/(a-i),d=-2*a*i/(a-i);return o[0]=s,o[4]=0,o[8]=c,o[12]=0,o[1]=0,o[5]=l,o[9]=u,o[13]=0,o[2]=0,o[6]=0,o[10]=h,o[14]=d,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},e.makeOrthographic=function(t,e,n,r,i,a){var o=this.elements,s=1/(e-t),l=1/(n-r),c=1/(a-i),u=(e+t)*s,h=(n+r)*l,d=(a+i)*c;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-u,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-h,o[2]=0,o[6]=0,o[10]=-2*c,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},e.equals=function(t){for(var e=this.elements,n=t.elements,r=0;r<16;r++)if(e[r]!==n[r])return!1;return!0},e.fromArray=function(t,e){void 0===e&&(e=0);for(var n=0;n<16;n++)this.elements[n]=t[n+e];return this},e.toArray=function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t},t}();re.prototype.isMatrix4=!0;var ie=new Rt,ae=new re,oe=new Rt(0,0,0),se=new Rt(1,1,1),le=new Rt,ce=new Rt,ue=new Rt,he=new re,de=new Lt,pe=function(){function t(e,n,r,i){void 0===e&&(e=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===i&&(i=t.DefaultOrder),this._x=e,this._y=n,this._z=r,this._order=i}var e=t.prototype;return e.set=function(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._order=r||this._order,this._onChangeCallback(),this},e.clone=function(){return new this.constructor(this._x,this._y,this._z,this._order)},e.copy=function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this},e.setFromRotationMatrix=function(t,e,n){var r=gt.clamp,i=t.elements,a=i[0],o=i[4],s=i[8],l=i[1],c=i[5],u=i[9],h=i[2],d=i[6],p=i[10];switch(e=e||this._order){case"XYZ":this._y=Math.asin(r(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-r(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(s,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,a),this._z=0);break;case"ZXY":this._x=Math.asin(r(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,p),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,a));break;case"ZYX":this._y=Math.asin(-r(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(l,a)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(r(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,a)):(this._x=0,this._y=Math.atan2(s,p));break;case"XZY":this._z=Math.asin(-r(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-u,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!1!==n&&this._onChangeCallback(),this},e.setFromQuaternion=function(t,e,n){return he.makeRotationFromQuaternion(t),this.setFromRotationMatrix(he,e,n)},e.setFromVector3=function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},e.reorder=function(t){return de.setFromEuler(this),this.setFromQuaternion(de,t)},e.equals=function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},e.fromArray=function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this},e.toArray=function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},e.toVector3=function(t){return t?t.set(this._x,this._y,this._z):new Rt(this._x,this._y,this._z)},e._onChange=function(t){return this._onChangeCallback=t,this},e._onChangeCallback=function(){},st(t,[{key:"x",get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()}},{key:"order",get:function(){return this._order},set:function(t){this._order=t,this._onChangeCallback()}}]),t}();pe.prototype.isEuler=!0,pe.DefaultOrder="XYZ",pe.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];var fe=function(){function t(){this.mask=1}var e=t.prototype;return e.set=function(t){this.mask=1<<t|0},e.enable=function(t){this.mask|=1<<t|0},e.enableAll=function(){this.mask=-1},e.toggle=function(t){this.mask^=1<<t|0},e.disable=function(t){this.mask&=~(1<<t|0)},e.disableAll=function(){this.mask=0},e.test=function(t){return 0!=(this.mask&t.mask)},t}(),me=0,ve=new Rt,ge=new Lt,ye=new re,xe=new Rt,_e=new Rt,be=new Rt,we=new Lt,Me=new Rt(1,0,0),Se=new Rt(0,1,0),Te=new Rt(0,0,1),Ee={type:"added"},Ae={type:"removed"};function Le(){Object.defineProperty(this,"id",{value:me++}),this.uuid=gt.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Le.DefaultUp.clone();var t=new Rt,e=new pe,n=new Lt,r=new Rt(1,1,1);e._onChange((function(){n.setFromEuler(e,!1)})),n._onChange((function(){e.setFromQuaternion(n,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new re},normalMatrix:{value:new _t}}),this.matrix=new re,this.matrixWorld=new re,this.matrixAutoUpdate=Le.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new fe,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}Le.DefaultUp=new Rt(0,1,0),Le.DefaultMatrixAutoUpdate=!0,Le.prototype=Object.assign(Object.create(pt.prototype),{constructor:Le,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix4:function(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(t){return this.quaternion.premultiply(t),this},setRotationFromAxisAngle:function(t,e){this.quaternion.setFromAxisAngle(t,e)},setRotationFromEuler:function(t){this.quaternion.setFromEuler(t,!0)},setRotationFromMatrix:function(t){this.quaternion.setFromRotationMatrix(t)},setRotationFromQuaternion:function(t){this.quaternion.copy(t)},rotateOnAxis:function(t,e){return ge.setFromAxisAngle(t,e),this.quaternion.multiply(ge),this},rotateOnWorldAxis:function(t,e){return ge.setFromAxisAngle(t,e),this.quaternion.premultiply(ge),this},rotateX:function(t){return this.rotateOnAxis(Me,t)},rotateY:function(t){return this.rotateOnAxis(Se,t)},rotateZ:function(t){return this.rotateOnAxis(Te,t)},translateOnAxis:function(t,e){return ve.copy(t).applyQuaternion(this.quaternion),this.position.add(ve.multiplyScalar(e)),this},translateX:function(t){return this.translateOnAxis(Me,t)},translateY:function(t){return this.translateOnAxis(Se,t)},translateZ:function(t){return this.translateOnAxis(Te,t)},localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:function(t){return t.applyMatrix4(ye.copy(this.matrixWorld).invert())},lookAt:function(t,e,n){t.isVector3?xe.copy(t):xe.set(t,e,n);var r=this.parent;this.updateWorldMatrix(!0,!1),_e.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?ye.lookAt(_e,xe,this.up):ye.lookAt(xe,_e,this.up),this.quaternion.setFromRotationMatrix(ye),r&&(ye.extractRotation(r.matrixWorld),ge.setFromRotationMatrix(ye),this.quaternion.premultiply(ge.invert()))},add:function(t){if(arguments.length>1){for(var e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(Ee)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)},remove:function(t){if(arguments.length>1){for(var e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}var n=this.children.indexOf(t);return-1!==n&&(t.parent=null,this.children.splice(n,1),t.dispatchEvent(Ae)),this},clear:function(){for(var t=0;t<this.children.length;t++){var e=this.children[t];e.parent=null,e.dispatchEvent(Ae)}return this.children.length=0,this},attach:function(t){return this.updateWorldMatrix(!0,!1),ye.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),ye.multiply(t.parent.matrixWorld)),t.applyMatrix4(ye),this.add(t),t.updateWorldMatrix(!1,!0),this},getObjectById:function(t){return this.getObjectByProperty("id",t)},getObjectByName:function(t){return this.getObjectByProperty("name",t)},getObjectByProperty:function(t,e){if(this[t]===e)return this;for(var n=0,r=this.children.length;n<r;n++){var i=this.children[n].getObjectByProperty(t,e);if(void 0!==i)return i}},getWorldPosition:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),t=new Rt),this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),t=new Lt),this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_e,t,be),t},getWorldScale:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),t=new Rt),this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_e,we,t),t},getWorldDirection:function(t){void 0===t&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),t=new Rt),this.updateWorldMatrix(!0,!1);var e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()},raycast:function(){},traverse:function(t){t(this);for(var e=this.children,n=0,r=e.length;n<r;n++)e[n].traverse(t)},traverseVisible:function(t){if(!1!==this.visible){t(this);for(var e=this.children,n=0,r=e.length;n<r;n++)e[n].traverseVisible(t)}},traverseAncestors:function(t){var e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);for(var e=this.children,n=0,r=e.length;n<r;n++)e[n].updateMatrixWorld(t)},updateWorldMatrix:function(t,e){var n=this.parent;if(!0===t&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===e)for(var r=this.children,i=0,a=r.length;i<a;i++)r[i].updateWorldMatrix(!1,!0)},toJSON:function(t){var e=void 0===t||"string"==typeof t,n={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var r={};function i(e,n){return void 0===e[n.uuid]&&(e[n.uuid]=n.toJSON(t)),n.uuid}if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),!0===this.castShadow&&(r.castShadow=!0),!0===this.receiveShadow&&(r.receiveShadow=!0),!1===this.visible&&(r.visible=!1),!1===this.frustumCulled&&(r.frustumCulled=!1),0!==this.renderOrder&&(r.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON()),this.isMesh||this.isLine||this.isPoints){r.geometry=i(t.geometries,this.geometry);var a=this.geometry.parameters;if(void 0!==a&&void 0!==a.shapes){var o=a.shapes;if(Array.isArray(o))for(var s=0,l=o.length;s<l;s++){var c=o[s];i(t.shapes,c)}else i(t.shapes,o)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(i(t.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){for(var u=[],h=0,d=this.material.length;h<d;h++)u.push(i(t.materials,this.material[h]));r.material=u}else r.material=i(t.materials,this.material);if(this.children.length>0){r.children=[];for(var p=0;p<this.children.length;p++)r.children.push(this.children[p].toJSON(t).object)}if(this.animations.length>0){r.animations=[];for(var f=0;f<this.animations.length;f++){var m=this.animations[f];r.animations.push(i(t.animations,m))}}if(e){var v=M(t.geometries),g=M(t.materials),y=M(t.textures),x=M(t.images),_=M(t.shapes),b=M(t.skeletons),w=M(t.animations);v.length>0&&(n.geometries=v),g.length>0&&(n.materials=g),y.length>0&&(n.textures=y),x.length>0&&(n.images=x),_.length>0&&(n.shapes=_),b.length>0&&(n.skeletons=b),w.length>0&&(n.animations=w)}return n.object=r,n;function M(t){var e=[];for(var n in t){var r=t[n];delete r.metadata,e.push(r)}return e}},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(var n=0;n<t.children.length;n++){var r=t.children[n];this.add(r.clone())}return this}});var Re=new Rt,Ce=new Rt,Pe=new _t,De=function(){function t(t,e){void 0===t&&(t=new Rt(1,0,0)),void 0===e&&(e=0),this.normal=t,this.constant=e}var e=t.prototype;return e.set=function(t,e){return this.normal.copy(t),this.constant=e,this},e.setComponents=function(t,e,n,r){return this.normal.set(t,e,n),this.constant=r,this},e.setFromNormalAndCoplanarPoint=function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},e.setFromCoplanarPoints=function(t,e,n){var r=Re.subVectors(n,e).cross(Ce.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(r,t),this},e.copy=function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},e.normalize=function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},e.negate=function(){return this.constant*=-1,this.normal.negate(),this},e.distanceToPoint=function(t){return this.normal.dot(t)+this.constant},e.distanceToSphere=function(t){return this.distanceToPoint(t.center)-t.radius},e.projectPoint=function(t,e){return void 0===e&&(console.warn("THREE.Plane: .projectPoint() target is now required"),e=new Rt),e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)},e.intersectLine=function(t,e){void 0===e&&(console.warn("THREE.Plane: .intersectLine() target is now required"),e=new Rt);var n=t.delta(Re),r=this.normal.dot(n);if(0===r)return 0===this.distanceToPoint(t.start)?e.copy(t.start):void 0;var i=-(t.start.dot(this.normal)+this.constant)/r;return i<0||i>1?void 0:e.copy(n).multiplyScalar(i).add(t.start)},e.intersectsLine=function(t){var e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0},e.intersectsBox=function(t){return t.intersectsPlane(this)},e.intersectsSphere=function(t){return t.intersectsPlane(this)},e.coplanarPoint=function(t){return void 0===t&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),t=new Rt),t.copy(this.normal).multiplyScalar(-this.constant)},e.applyMatrix4=function(t,e){var n=e||Pe.getNormalMatrix(t),r=this.coplanarPoint(Re).applyMatrix4(t),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this},e.translate=function(t){return this.constant-=t.dot(this.normal),this},e.equals=function(t){return t.normal.equals(this.normal)&&t.constant===this.constant},e.clone=function(){return(new this.constructor).copy(this)},t}();De.prototype.isPlane=!0;var Ie=new Rt,Ne=new Rt,Be=new Rt,Oe=new Rt,ze=new Rt,Fe=new Rt,He=new Rt,Ge=new Rt,Ue=new Rt,ke=new Rt,Ve=function(){function t(t,e,n){void 0===t&&(t=new Rt),void 0===e&&(e=new Rt),void 0===n&&(n=new Rt),this.a=t,this.b=e,this.c=n}t.getNormal=function(t,e,n,r){void 0===r&&(console.warn("THREE.Triangle: .getNormal() target is now required"),r=new Rt),r.subVectors(n,e),Ie.subVectors(t,e),r.cross(Ie);var i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)},t.getBarycoord=function(t,e,n,r,i){Ie.subVectors(r,e),Ne.subVectors(n,e),Be.subVectors(t,e);var a=Ie.dot(Ie),o=Ie.dot(Ne),s=Ie.dot(Be),l=Ne.dot(Ne),c=Ne.dot(Be),u=a*l-o*o;if(void 0===i&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),i=new Rt),0===u)return i.set(-2,-1,-1);var h=1/u,d=(l*s-o*c)*h,p=(a*c-o*s)*h;return i.set(1-d-p,p,d)},t.containsPoint=function(t,e,n,r){return this.getBarycoord(t,e,n,r,Oe),Oe.x>=0&&Oe.y>=0&&Oe.x+Oe.y<=1},t.getUV=function(t,e,n,r,i,a,o,s){return this.getBarycoord(t,e,n,r,Oe),s.set(0,0),s.addScaledVector(i,Oe.x),s.addScaledVector(a,Oe.y),s.addScaledVector(o,Oe.z),s},t.isFrontFacing=function(t,e,n,r){return Ie.subVectors(n,e),Ne.subVectors(t,e),Ie.cross(Ne).dot(r)<0};var e=t.prototype;return e.set=function(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this},e.setFromPointsAndIndices=function(t,e,n,r){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[r]),this},e.clone=function(){return(new this.constructor).copy(this)},e.copy=function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},e.getArea=function(){return Ie.subVectors(this.c,this.b),Ne.subVectors(this.a,this.b),.5*Ie.cross(Ne).length()},e.getMidpoint=function(t){return void 0===t&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),t=new Rt),t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},e.getNormal=function(e){return t.getNormal(this.a,this.b,this.c,e)},e.getPlane=function(t){return void 0===t&&(console.warn("THREE.Triangle: .getPlane() target is now required"),t=new De),t.setFromCoplanarPoints(this.a,this.b,this.c)},e.getBarycoord=function(e,n){return t.getBarycoord(e,this.a,this.b,this.c,n)},e.getUV=function(e,n,r,i,a){return t.getUV(e,this.a,this.b,this.c,n,r,i,a)},e.containsPoint=function(e){return t.containsPoint(e,this.a,this.b,this.c)},e.isFrontFacing=function(e){return t.isFrontFacing(this.a,this.b,this.c,e)},e.intersectsBox=function(t){return t.intersectsTriangle(this)},e.closestPointToPoint=function(t,e){void 0===e&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),e=new Rt);var n,r,i=this.a,a=this.b,o=this.c;ze.subVectors(a,i),Fe.subVectors(o,i),Ge.subVectors(t,i);var s=ze.dot(Ge),l=Fe.dot(Ge);if(s<=0&&l<=0)return e.copy(i);Ue.subVectors(t,a);var c=ze.dot(Ue),u=Fe.dot(Ue);if(c>=0&&u<=c)return e.copy(a);var h=s*u-c*l;if(h<=0&&s>=0&&c<=0)return n=s/(s-c),e.copy(i).addScaledVector(ze,n);ke.subVectors(t,o);var d=ze.dot(ke),p=Fe.dot(ke);if(p>=0&&d<=p)return e.copy(o);var f=d*l-s*p;if(f<=0&&l>=0&&p<=0)return r=l/(l-p),e.copy(i).addScaledVector(Fe,r);var m=c*p-d*u;if(m<=0&&u-c>=0&&d-p>=0)return He.subVectors(o,a),r=(u-c)/(u-c+(d-p)),e.copy(a).addScaledVector(He,r);var v=1/(m+f+h);return n=f*v,r=h*v,e.copy(i).addScaledVector(ze,n).addScaledVector(Fe,r)},e.equals=function(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)},t}(),We=0;function je(){Object.defineProperty(this,"id",{value:We++}),this.uuid=gt.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=r,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=et,this.stencilZFail=et,this.stencilZPass=et,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}je.prototype=Object.assign(Object.create(pt.prototype),{constructor:je,isMaterial:!0,onBeforeCompile:function(){},customProgramCacheKey:function(){return this.onBeforeCompile.toString()},setValues:function(t){if(void 0!==t)for(var e in t){var n=t[e];if(void 0!==n)if("shading"!==e){var r=this[e];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[e]=n:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}else console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===n;else console.warn("THREE.Material: '"+e+"' parameter is undefined.")}},toJSON:function(t){var e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});var n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function r(t){var e=[];for(var n in t){var r=t[n];delete r.metadata,e.push(r)}return e}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(n.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,n.reflectivity=this.reflectivity,n.refractionRatio=this.refractionRatio,void 0!==this.combine&&(n.combine=this.combine),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),0!==this.side&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.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),!0===this.morphTargets&&(n.morphTargets=!0),!0===this.morphNormals&&(n.morphNormals=!0),!0===this.skinning&&(n.skinning=!0),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),e){var i=r(t.textures),a=r(t.images);i.length>0&&(n.textures=i),a.length>0&&(n.images=a)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;var e=t.clippingPlanes,n=null;if(null!==e){var r=e.length;n=new Array(r);for(var i=0;i!==r;++i)n[i]=e[i].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(je.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}});var qe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Xe={h:0,s:0,l:0},Ye={h:0,s:0,l:0};function Ze(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}function Je(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Qe(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}var Ke=function(){function t(t,e,n){return void 0===e&&void 0===n?this.set(t):this.setRGB(t,e,n)}var e=t.prototype;return e.set=function(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},e.setScalar=function(t){return this.r=t,this.g=t,this.b=t,this},e.setHex=function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},e.setRGB=function(t,e,n){return this.r=t,this.g=e,this.b=n,this},e.setHSL=function(t,e,n){if(t=gt.euclideanModulo(t,1),e=gt.clamp(e,0,1),n=gt.clamp(n,0,1),0===e)this.r=this.g=this.b=n;else{var r=n<=.5?n*(1+e):n+e-n*e,i=2*n-r;this.r=Ze(i,r,t+1/3),this.g=Ze(i,r,t),this.b=Ze(i,r,t-1/3)}return this},e.setStyle=function(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){var r,i=n[1],a=n[2];switch(i){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,e(r[4]),this;if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,e(r[4]),this;break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a)){var o=parseFloat(r[1])/360,s=parseInt(r[2],10)/100,l=parseInt(r[3],10)/100;return e(r[4]),this.setHSL(o,s,l)}}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(t)){var c=n[1],u=c.length;if(3===u)return this.r=parseInt(c.charAt(0)+c.charAt(0),16)/255,this.g=parseInt(c.charAt(1)+c.charAt(1),16)/255,this.b=parseInt(c.charAt(2)+c.charAt(2),16)/255,this;if(6===u)return this.r=parseInt(c.charAt(0)+c.charAt(1),16)/255,this.g=parseInt(c.charAt(2)+c.charAt(3),16)/255,this.b=parseInt(c.charAt(4)+c.charAt(5),16)/255,this}return t&&t.length>0?this.setColorName(t):this},e.setColorName=function(t){var e=qe[t];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this},e.clone=function(){return new this.constructor(this.r,this.g,this.b)},e.copy=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},e.copyGammaToLinear=function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},e.copyLinearToGamma=function(t,e){void 0===e&&(e=2);var n=e>0?1/e:1;return this.r=Math.pow(t.r,n),this.g=Math.pow(t.g,n),this.b=Math.pow(t.b,n),this},e.convertGammaToLinear=function(t){return this.copyGammaToLinear(this,t),this},e.convertLinearToGamma=function(t){return this.copyLinearToGamma(this,t),this},e.copySRGBToLinear=function(t){return this.r=Je(t.r),this.g=Je(t.g),this.b=Je(t.b),this},e.copyLinearToSRGB=function(t){return this.r=Qe(t.r),this.g=Qe(t.g),this.b=Qe(t.b),this},e.convertSRGBToLinear=function(){return this.copySRGBToLinear(this),this},e.convertLinearToSRGB=function(){return this.copyLinearToSRGB(this),this},e.getHex=function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},e.getHexString=function(){return("000000"+this.getHex().toString(16)).slice(-6)},e.getHSL=function(t){void 0===t&&(console.warn("THREE.Color: .getHSL() target is now required"),t={h:0,s:0,l:0});var e,n,r=this.r,i=this.g,a=this.b,o=Math.max(r,i,a),s=Math.min(r,i,a),l=(s+o)/2;if(s===o)e=0,n=0;else{var c=o-s;switch(n=l<=.5?c/(o+s):c/(2-o-s),o){case r:e=(i-a)/c+(i<a?6:0);break;case i:e=(a-r)/c+2;break;case a:e=(r-i)/c+4}e/=6}return t.h=e,t.s=n,t.l=l,t},e.getStyle=function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},e.offsetHSL=function(t,e,n){return this.getHSL(Xe),Xe.h+=t,Xe.s+=e,Xe.l+=n,this.setHSL(Xe.h,Xe.s,Xe.l),this},e.add=function(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this},e.addColors=function(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this},e.addScalar=function(t){return this.r+=t,this.g+=t,this.b+=t,this},e.sub=function(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this},e.multiply=function(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this},e.multiplyScalar=function(t){return this.r*=t,this.g*=t,this.b*=t,this},e.lerp=function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this},e.lerpColors=function(t,e,n){return this.r=t.r+(e.r-t.r)*n,this.g=t.g+(e.g-t.g)*n,this.b=t.b+(e.b-t.b)*n,this},e.lerpHSL=function(t,e){this.getHSL(Xe),t.getHSL(Ye);var n=gt.lerp(Xe.h,Ye.h,e),r=gt.lerp(Xe.s,Ye.s,e),i=gt.lerp(Xe.l,Ye.l,e);return this.setHSL(n,r,i),this},e.equals=function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b},e.fromArray=function(t,e){return void 0===e&&(e=0),this.r=t[e],this.g=t[e+1],this.b=t[e+2],this},e.toArray=function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t},e.fromBufferAttribute=function(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),!0===t.normalized&&(this.r/=255,this.g/=255,this.b/=255),this},e.toJSON=function(){return this.getHex()},t}();Ke.NAMES=qe,Ke.prototype.isColor=!0,Ke.prototype.r=1,Ke.prototype.g=1,Ke.prototype.b=1;var $e=function(t){function e(e){var n;return(n=t.call(this)||this).type="MeshBasicMaterial",n.color=new Ke(16777215),n.map=null,n.lightMap=null,n.lightMapIntensity=1,n.aoMap=null,n.aoMapIntensity=1,n.specularMap=null,n.alphaMap=null,n.envMap=null,n.combine=0,n.reflectivity=1,n.refractionRatio=.98,n.wireframe=!1,n.wireframeLinewidth=1,n.wireframeLinecap="round",n.wireframeLinejoin="round",n.skinning=!1,n.morphTargets=!1,n.setValues(e),n}return lt(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this},e}(je);$e.prototype.isMeshBasicMaterial=!0;var tn=new Rt,en=new yt;function nn(t,e,n){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===n,this.usage=nt,this.updateRange={offset:0,count:-1},this.version=0}function rn(t,e,n){nn.call(this,new Int8Array(t),e,n)}function an(t,e,n){nn.call(this,new Uint8Array(t),e,n)}function on(t,e,n){nn.call(this,new Uint8ClampedArray(t),e,n)}function sn(t,e,n){nn.call(this,new Int16Array(t),e,n)}function ln(t,e,n){nn.call(this,new Uint16Array(t),e,n)}function cn(t,e,n){nn.call(this,new Int32Array(t),e,n)}function un(t,e,n){nn.call(this,new Uint32Array(t),e,n)}function hn(t,e,n){nn.call(this,new Uint16Array(t),e,n)}function dn(t,e,n){nn.call(this,new Float32Array(t),e,n)}function pn(t,e,n){nn.call(this,new Float64Array(t),e,n)}function fn(t){if(0===t.length)return-1/0;for(var e=t[0],n=1,r=t.length;n<r;++n)t[n]>e&&(e=t[n]);return e}Object.defineProperty(nn.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(nn.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this},copyAt:function(t,e,n){t*=this.itemSize,n*=e.itemSize;for(var r=0,i=this.itemSize;r<i;r++)this.array[t+r]=e.array[n+r];return this},copyArray:function(t){return this.array.set(t),this},copyColorsArray:function(t){for(var e=this.array,n=0,r=0,i=t.length;r<i;r++){var a=t[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",r),a=new Ke),e[n++]=a.r,e[n++]=a.g,e[n++]=a.b}return this},copyVector2sArray:function(t){for(var e=this.array,n=0,r=0,i=t.length;r<i;r++){var a=t[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",r),a=new yt),e[n++]=a.x,e[n++]=a.y}return this},copyVector3sArray:function(t){for(var e=this.array,n=0,r=0,i=t.length;r<i;r++){var a=t[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",r),a=new Rt),e[n++]=a.x,e[n++]=a.y,e[n++]=a.z}return this},copyVector4sArray:function(t){for(var e=this.array,n=0,r=0,i=t.length;r<i;r++){var a=t[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",r),a=new Tt),e[n++]=a.x,e[n++]=a.y,e[n++]=a.z,e[n++]=a.w}return this},applyMatrix3:function(t){if(2===this.itemSize)for(var e=0,n=this.count;e<n;e++)en.fromBufferAttribute(this,e),en.applyMatrix3(t),this.setXY(e,en.x,en.y);else if(3===this.itemSize)for(var r=0,i=this.count;r<i;r++)tn.fromBufferAttribute(this,r),tn.applyMatrix3(t),this.setXYZ(r,tn.x,tn.y,tn.z);return this},applyMatrix4:function(t){for(var e=0,n=this.count;e<n;e++)tn.x=this.getX(e),tn.y=this.getY(e),tn.z=this.getZ(e),tn.applyMatrix4(t),this.setXYZ(e,tn.x,tn.y,tn.z);return this},applyNormalMatrix:function(t){for(var e=0,n=this.count;e<n;e++)tn.x=this.getX(e),tn.y=this.getY(e),tn.z=this.getZ(e),tn.applyNormalMatrix(t),this.setXYZ(e,tn.x,tn.y,tn.z);return this},transformDirection:function(t){for(var e=0,n=this.count;e<n;e++)tn.x=this.getX(e),tn.y=this.getY(e),tn.z=this.getZ(e),tn.transformDirection(t),this.setXYZ(e,tn.x,tn.y,tn.z);return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},getX:function(t){return this.array[t*this.itemSize]},setX:function(t,e){return this.array[t*this.itemSize]=e,this},getY:function(t){return this.array[t*this.itemSize+1]},setY:function(t,e){return this.array[t*this.itemSize+1]=e,this},getZ:function(t){return this.array[t*this.itemSize+2]},setZ:function(t,e){return this.array[t*this.itemSize+2]=e,this},getW:function(t){return this.array[t*this.itemSize+3]},setW:function(t,e){return this.array[t*this.itemSize+3]=e,this},setXY:function(t,e,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this},setXYZ:function(t,e,n,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=r,this},setXYZW:function(t,e,n,r,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=r,this.array[t+3]=i,this},onUpload:function(t){return this.onUploadCallback=t,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)},toJSON:function(){return{itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized}}}),rn.prototype=Object.create(nn.prototype),rn.prototype.constructor=rn,an.prototype=Object.create(nn.prototype),an.prototype.constructor=an,on.prototype=Object.create(nn.prototype),on.prototype.constructor=on,sn.prototype=Object.create(nn.prototype),sn.prototype.constructor=sn,ln.prototype=Object.create(nn.prototype),ln.prototype.constructor=ln,cn.prototype=Object.create(nn.prototype),cn.prototype.constructor=cn,un.prototype=Object.create(nn.prototype),un.prototype.constructor=un,hn.prototype=Object.create(nn.prototype),hn.prototype.constructor=hn,hn.prototype.isFloat16BufferAttribute=!0,dn.prototype=Object.create(nn.prototype),dn.prototype.constructor=dn,pn.prototype=Object.create(nn.prototype),pn.prototype.constructor=pn;var mn={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function vn(t,e){return new mn[t](e)}var gn=0,yn=new re,xn=new Le,_n=new Rt,bn=new Dt,wn=new Dt,Mn=new Rt;function Sn(){Object.defineProperty(this,"id",{value:gn++}),this.uuid=gt.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}Sn.prototype=Object.assign(Object.create(pt.prototype),{constructor:Sn,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(t){return Array.isArray(t)?this.index=new(fn(t)>65535?un:ln)(t,1):this.index=t,this},getAttribute:function(t){return this.attributes[t]},setAttribute:function(t,e){return this.attributes[t]=e,this},deleteAttribute:function(t){return delete this.attributes[t],this},hasAttribute:function(t){return void 0!==this.attributes[t]},addGroup:function(t,e,n){void 0===n&&(n=0),this.groups.push({start:t,count:e,materialIndex:n})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix4:function(t){var e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);var n=this.attributes.normal;if(void 0!==n){var r=(new _t).getNormalMatrix(t);n.applyNormalMatrix(r),n.needsUpdate=!0}var i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(t),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(t){return yn.makeRotationX(t),this.applyMatrix4(yn),this},rotateY:function(t){return yn.makeRotationY(t),this.applyMatrix4(yn),this},rotateZ:function(t){return yn.makeRotationZ(t),this.applyMatrix4(yn),this},translate:function(t,e,n){return yn.makeTranslation(t,e,n),this.applyMatrix4(yn),this},scale:function(t,e,n){return yn.makeScale(t,e,n),this.applyMatrix4(yn),this},lookAt:function(t){return xn.lookAt(t),xn.updateMatrix(),this.applyMatrix4(xn.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(_n).negate(),this.translate(_n.x,_n.y,_n.z),this},setFromPoints:function(t){for(var e=[],n=0,r=t.length;n<r;n++){var i=t[n];e.push(i.x,i.y,i.z||0)}return this.setAttribute("position",new dn(e,3)),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Dt);var t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingBox.set(new Rt(-1/0,-1/0,-1/0),new Rt(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(var n=0,r=e.length;n<r;n++){var i=e[n];bn.setFromBufferAttribute(i),this.morphTargetsRelative?(Mn.addVectors(this.boundingBox.min,bn.min),this.boundingBox.expandByPoint(Mn),Mn.addVectors(this.boundingBox.max,bn.max),this.boundingBox.expandByPoint(Mn)):(this.boundingBox.expandByPoint(bn.min),this.boundingBox.expandByPoint(bn.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new Yt);var t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingSphere.set(new Rt,1/0);if(t){var n=this.boundingSphere.center;if(bn.setFromBufferAttribute(t),e)for(var r=0,i=e.length;r<i;r++){var a=e[r];wn.setFromBufferAttribute(a),this.morphTargetsRelative?(Mn.addVectors(bn.min,wn.min),bn.expandByPoint(Mn),Mn.addVectors(bn.max,wn.max),bn.expandByPoint(Mn)):(bn.expandByPoint(wn.min),bn.expandByPoint(wn.max))}bn.getCenter(n);for(var o=0,s=0,l=t.count;s<l;s++)Mn.fromBufferAttribute(t,s),o=Math.max(o,n.distanceToSquared(Mn));if(e)for(var c=0,u=e.length;c<u;c++)for(var h=e[c],d=this.morphTargetsRelative,p=0,f=h.count;p<f;p++)Mn.fromBufferAttribute(h,p),d&&(_n.fromBufferAttribute(t,p),Mn.add(_n)),o=Math.max(o,n.distanceToSquared(Mn));this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}},computeFaceNormals:function(){},computeTangents:function(){var t=this.index,e=this.attributes;if(null!==t&&void 0!==e.position&&void 0!==e.normal&&void 0!==e.uv){var n=t.array,r=e.position.array,i=e.normal.array,a=e.uv.array,o=r.length/3;void 0===e.tangent&&this.setAttribute("tangent",new nn(new Float32Array(4*o),4));for(var s=e.tangent.array,l=[],c=[],u=0;u<o;u++)l[u]=new Rt,c[u]=new Rt;var h=new Rt,d=new Rt,p=new Rt,f=new yt,m=new yt,v=new yt,g=new Rt,y=new Rt,x=this.groups;0===x.length&&(x=[{start:0,count:n.length}]);for(var _=0,b=x.length;_<b;++_)for(var w=x[_],M=w.start,S=M,T=M+w.count;S<T;S+=3)O(n[S+0],n[S+1],n[S+2]);for(var E=new Rt,A=new Rt,L=new Rt,R=new Rt,C=0,P=x.length;C<P;++C)for(var D=x[C],I=D.start,N=I,B=I+D.count;N<B;N+=3)z(n[N+0]),z(n[N+1]),z(n[N+2])}else console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");function O(t,e,n){h.fromArray(r,3*t),d.fromArray(r,3*e),p.fromArray(r,3*n),f.fromArray(a,2*t),m.fromArray(a,2*e),v.fromArray(a,2*n),d.sub(h),p.sub(h),m.sub(f),v.sub(f);var i=1/(m.x*v.y-v.x*m.y);isFinite(i)&&(g.copy(d).multiplyScalar(v.y).addScaledVector(p,-m.y).multiplyScalar(i),y.copy(p).multiplyScalar(m.x).addScaledVector(d,-v.x).multiplyScalar(i),l[t].add(g),l[e].add(g),l[n].add(g),c[t].add(y),c[e].add(y),c[n].add(y))}function z(t){L.fromArray(i,3*t),R.copy(L);var e=l[t];E.copy(e),E.sub(L.multiplyScalar(L.dot(e))).normalize(),A.crossVectors(R,e);var n=A.dot(c[t])<0?-1:1;s[4*t]=E.x,s[4*t+1]=E.y,s[4*t+2]=E.z,s[4*t+3]=n}},computeVertexNormals:function(){var t=this.index,e=this.getAttribute("position");if(void 0!==e){var n=this.getAttribute("normal");if(void 0===n)n=new nn(new Float32Array(3*e.count),3),this.setAttribute("normal",n);else for(var r=0,i=n.count;r<i;r++)n.setXYZ(r,0,0,0);var a=new Rt,o=new Rt,s=new Rt,l=new Rt,c=new Rt,u=new Rt,h=new Rt,d=new Rt;if(t)for(var p=0,f=t.count;p<f;p+=3){var m=t.getX(p+0),v=t.getX(p+1),g=t.getX(p+2);a.fromBufferAttribute(e,m),o.fromBufferAttribute(e,v),s.fromBufferAttribute(e,g),h.subVectors(s,o),d.subVectors(a,o),h.cross(d),l.fromBufferAttribute(n,m),c.fromBufferAttribute(n,v),u.fromBufferAttribute(n,g),l.add(h),c.add(h),u.add(h),n.setXYZ(m,l.x,l.y,l.z),n.setXYZ(v,c.x,c.y,c.z),n.setXYZ(g,u.x,u.y,u.z)}else for(var y=0,x=e.count;y<x;y+=3)a.fromBufferAttribute(e,y+0),o.fromBufferAttribute(e,y+1),s.fromBufferAttribute(e,y+2),h.subVectors(s,o),d.subVectors(a,o),h.cross(d),n.setXYZ(y+0,h.x,h.y,h.z),n.setXYZ(y+1,h.x,h.y,h.z),n.setXYZ(y+2,h.x,h.y,h.z);this.normalizeNormals(),n.needsUpdate=!0}},merge:function(t,e){if(t&&t.isBufferGeometry){void 0===e&&(e=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));var n=this.attributes;for(var r in n)if(void 0!==t.attributes[r])for(var i=n[r].array,a=t.attributes[r],o=a.array,s=a.itemSize*e,l=Math.min(o.length,i.length-s),c=0,u=s;c<l;c++,u++)i[u]=o[c];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t)},normalizeNormals:function(){for(var t=this.attributes.normal,e=0,n=t.count;e<n;e++)Mn.fromBufferAttribute(t,e),Mn.normalize(),t.setXYZ(e,Mn.x,Mn.y,Mn.z)},toNonIndexed:function(){function t(t,e){for(var n=t.array,r=t.itemSize,i=t.normalized,a=new n.constructor(e.length*r),o=0,s=0,l=0,c=e.length;l<c;l++){o=e[l]*r;for(var u=0;u<r;u++)a[s++]=n[o++]}return new nn(a,r,i)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;var e=new Sn,n=this.index.array,r=this.attributes;for(var i in r){var a=t(r[i],n);e.setAttribute(i,a)}var o=this.morphAttributes;for(var s in o){for(var l=[],c=o[s],u=0,h=c.length;u<h;u++){var d=t(c[u],n);l.push(d)}e.morphAttributes[s]=l}e.morphTargetsRelative=this.morphTargetsRelative;for(var p=this.groups,f=0,m=p.length;f<m;f++){var v=p[f];e.addGroup(v.start,v.count,v.materialIndex)}return e},toJSON:function(){var t={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){var e=this.parameters;for(var n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};var r=this.index;null!==r&&(t.data.index={type:r.array.constructor.name,array:Array.prototype.slice.call(r.array)});var i=this.attributes;for(var a in i){var o=i[a],s=o.toJSON(t.data);""!==o.name&&(s.name=o.name),t.data.attributes[a]=s}var l={},c=!1;for(var u in this.morphAttributes){for(var h=this.morphAttributes[u],d=[],p=0,f=h.length;p<f;p++){var m=h[p],v=m.toJSON(t.data);""!==m.name&&(v.name=m.name),d.push(v)}d.length>0&&(l[u]=d,c=!0)}c&&(t.data.morphAttributes=l,t.data.morphTargetsRelative=this.morphTargetsRelative);var g=this.groups;g.length>0&&(t.data.groups=JSON.parse(JSON.stringify(g)));var y=this.boundingSphere;return null!==y&&(t.data.boundingSphere={center:y.center.toArray(),radius:y.radius}),t},clone:function(){return(new Sn).copy(this)},copy:function(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;var e={};this.name=t.name;var n=t.index;null!==n&&this.setIndex(n.clone(e));var r=t.attributes;for(var i in r){var a=r[i];this.setAttribute(i,a.clone(e))}var o=t.morphAttributes;for(var s in o){for(var l=[],c=o[s],u=0,h=c.length;u<h;u++)l.push(c[u].clone(e));this.morphAttributes[s]=l}this.morphTargetsRelative=t.morphTargetsRelative;for(var d=t.groups,p=0,f=d.length;p<f;p++){var m=d[p];this.addGroup(m.start,m.count,m.materialIndex)}var v=t.boundingBox;null!==v&&(this.boundingBox=v.clone());var g=t.boundingSphere;return null!==g&&(this.boundingSphere=g.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});var Tn=new re,En=new ne,An=new Yt,Ln=new Rt,Rn=new Rt,Cn=new Rt,Pn=new Rt,Dn=new Rt,In=new Rt,Nn=new Rt,Bn=new Rt,On=new Rt,zn=new yt,Fn=new yt,Hn=new yt,Gn=new Rt,Un=new Rt;function kn(t,e){void 0===t&&(t=new Sn),void 0===e&&(e=new $e),Le.call(this),this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}function Vn(t,e,n,r,i,a,o,s,l,c,u,h){Ln.fromBufferAttribute(i,c),Rn.fromBufferAttribute(i,u),Cn.fromBufferAttribute(i,h);var d=t.morphTargetInfluences;if(e.morphTargets&&a&&d){Nn.set(0,0,0),Bn.set(0,0,0),On.set(0,0,0);for(var p=0,f=a.length;p<f;p++){var m=d[p],v=a[p];0!==m&&(Pn.fromBufferAttribute(v,c),Dn.fromBufferAttribute(v,u),In.fromBufferAttribute(v,h),o?(Nn.addScaledVector(Pn,m),Bn.addScaledVector(Dn,m),On.addScaledVector(In,m)):(Nn.addScaledVector(Pn.sub(Ln),m),Bn.addScaledVector(Dn.sub(Rn),m),On.addScaledVector(In.sub(Cn),m)))}Ln.add(Nn),Rn.add(Bn),Cn.add(On)}t.isSkinnedMesh&&e.skinning&&(t.boneTransform(c,Ln),t.boneTransform(u,Rn),t.boneTransform(h,Cn));var g=function(t,e,n,r,i,a,o,s){if(null===(1===e.side?r.intersectTriangle(o,a,i,!0,s):r.intersectTriangle(i,a,o,2!==e.side,s)))return null;Un.copy(s),Un.applyMatrix4(t.matrixWorld);var l=n.ray.origin.distanceTo(Un);return l<n.near||l>n.far?null:{distance:l,point:Un.clone(),object:t}}(t,e,n,r,Ln,Rn,Cn,Gn);if(g){s&&(zn.fromBufferAttribute(s,c),Fn.fromBufferAttribute(s,u),Hn.fromBufferAttribute(s,h),g.uv=Ve.getUV(Gn,Ln,Rn,Cn,zn,Fn,Hn,new yt)),l&&(zn.fromBufferAttribute(l,c),Fn.fromBufferAttribute(l,u),Hn.fromBufferAttribute(l,h),g.uv2=Ve.getUV(Gn,Ln,Rn,Cn,zn,Fn,Hn,new yt));var y={a:c,b:c,c:h,normal:new Rt,materialIndex:0};Ve.getNormal(Ln,Rn,Cn,y.normal),g.face=y}return g}kn.prototype=Object.assign(Object.create(Le.prototype),{constructor:kn,isMesh:!0,copy:function(t){return Le.prototype.copy.call(this,t),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=t.material,this.geometry=t.geometry,this},updateMorphTargets:function(){var t=this.geometry;if(t.isBufferGeometry){var e=t.morphAttributes,n=Object.keys(e);if(n.length>0){var r=e[n[0]];if(void 0!==r){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var i=0,a=r.length;i<a;i++){var o=r[i].name||String(i);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=i}}}}else{var s=t.morphTargets;void 0!==s&&s.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(t,e){var n,r=this.geometry,i=this.material,a=this.matrixWorld;if(void 0!==i&&(null===r.boundingSphere&&r.computeBoundingSphere(),An.copy(r.boundingSphere),An.applyMatrix4(a),!1!==t.ray.intersectsSphere(An)&&(Tn.copy(a).invert(),En.copy(t.ray).applyMatrix4(Tn),null===r.boundingBox||!1!==En.intersectsBox(r.boundingBox))))if(r.isBufferGeometry){var o=r.index,s=r.attributes.position,l=r.morphAttributes.position,c=r.morphTargetsRelative,u=r.attributes.uv,h=r.attributes.uv2,d=r.groups,p=r.drawRange;if(null!==o)if(Array.isArray(i))for(var f=0,m=d.length;f<m;f++)for(var v=d[f],g=i[v.materialIndex],y=Math.max(v.start,p.start),x=Math.min(v.start+v.count,p.start+p.count);y<x;y+=3){var _=o.getX(y),b=o.getX(y+1),w=o.getX(y+2);(n=Vn(this,g,t,En,s,l,c,u,h,_,b,w))&&(n.faceIndex=Math.floor(y/3),n.face.materialIndex=v.materialIndex,e.push(n))}else for(var M=Math.max(0,p.start),S=Math.min(o.count,p.start+p.count);M<S;M+=3){var T=o.getX(M),E=o.getX(M+1),A=o.getX(M+2);(n=Vn(this,i,t,En,s,l,c,u,h,T,E,A))&&(n.faceIndex=Math.floor(M/3),e.push(n))}else if(void 0!==s)if(Array.isArray(i))for(var L=0,R=d.length;L<R;L++)for(var C=d[L],P=i[C.materialIndex],D=Math.max(C.start,p.start),I=Math.min(C.start+C.count,p.start+p.count);D<I;D+=3){(n=Vn(this,P,t,En,s,l,c,u,h,D,D+1,D+2))&&(n.faceIndex=Math.floor(D/3),n.face.materialIndex=C.materialIndex,e.push(n))}else for(var N=Math.max(0,p.start),B=Math.min(s.count,p.start+p.count);N<B;N+=3){(n=Vn(this,i,t,En,s,l,c,u,h,N,N+1,N+2))&&(n.faceIndex=Math.floor(N/3),e.push(n))}}else r.isGeometry&&console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}});var Wn=function(t){function e(e,n,r,i,a,o){var s;void 0===e&&(e=1),void 0===n&&(n=1),void 0===r&&(r=1),void 0===i&&(i=1),void 0===a&&(a=1),void 0===o&&(o=1),(s=t.call(this)||this).type="BoxGeometry",s.parameters={width:e,height:n,depth:r,widthSegments:i,heightSegments:a,depthSegments:o};var l=ut(s);i=Math.floor(i),a=Math.floor(a),o=Math.floor(o);var c=[],u=[],h=[],d=[],p=0,f=0;function m(t,e,n,r,i,a,o,s,m,v,g){for(var y=a/m,x=o/v,_=a/2,b=o/2,w=s/2,M=m+1,S=v+1,T=0,E=0,A=new Rt,L=0;L<S;L++)for(var R=L*x-b,C=0;C<M;C++){var P=C*y-_;A[t]=P*r,A[e]=R*i,A[n]=w,u.push(A.x,A.y,A.z),A[t]=0,A[e]=0,A[n]=s>0?1:-1,h.push(A.x,A.y,A.z),d.push(C/m),d.push(1-L/v),T+=1}for(var D=0;D<v;D++)for(var I=0;I<m;I++){var N=p+I+M*D,B=p+I+M*(D+1),O=p+(I+1)+M*(D+1),z=p+(I+1)+M*D;c.push(N,B,z),c.push(B,O,z),E+=6}l.addGroup(f,E,g),f+=E,p+=T}return m("z","y","x",-1,-1,r,n,e,o,a,0),m("z","y","x",1,-1,r,n,-e,o,a,1),m("x","z","y",1,1,e,r,n,i,o,2),m("x","z","y",1,-1,e,r,-n,i,o,3),m("x","y","z",1,-1,e,n,r,i,a,4),m("x","y","z",-1,-1,e,n,-r,i,a,5),s.setIndex(c),s.setAttribute("position",new dn(u,3)),s.setAttribute("normal",new dn(h,3)),s.setAttribute("uv",new dn(d,2)),s}return lt(e,t),e}(Sn);function jn(t){var e={};for(var n in t)for(var r in e[n]={},t[n]){var i=t[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?e[n][r]=i.clone():Array.isArray(i)?e[n][r]=i.slice():e[n][r]=i}return e}function qn(t){for(var e={},n=0;n<t.length;n++){var r=jn(t[n]);for(var i in r)e[i]=r[i]}return e}var Xn={clone:jn,merge:qn};function Yn(t){je.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,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}function Zn(){Le.call(this),this.type="Camera",this.matrixWorldInverse=new re,this.projectionMatrix=new re,this.projectionMatrixInverse=new re}function Jn(t,e,n,r){void 0===t&&(t=50),void 0===e&&(e=1),void 0===n&&(n=.1),void 0===r&&(r=2e3),Zn.call(this),this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}Yn.prototype=Object.create(je.prototype),Yn.prototype.constructor=Yn,Yn.prototype.isShaderMaterial=!0,Yn.prototype.copy=function(t){return je.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=jn(t.uniforms),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this},Yn.prototype.toJSON=function(t){var e=je.prototype.toJSON.call(this,t);for(var n in e.glslVersion=this.glslVersion,e.uniforms={},this.uniforms){var r=this.uniforms[n].value;r&&r.isTexture?e.uniforms[n]={type:"t",value:r.toJSON(t).uuid}:r&&r.isColor?e.uniforms[n]={type:"c",value:r.getHex()}:r&&r.isVector2?e.uniforms[n]={type:"v2",value:r.toArray()}:r&&r.isVector3?e.uniforms[n]={type:"v3",value:r.toArray()}:r&&r.isVector4?e.uniforms[n]={type:"v4",value:r.toArray()}:r&&r.isMatrix3?e.uniforms[n]={type:"m3",value:r.toArray()}:r&&r.isMatrix4?e.uniforms[n]={type:"m4",value:r.toArray()}:e.uniforms[n]={value:r}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;var i={};for(var a in this.extensions)!0===this.extensions[a]&&(i[a]=!0);return Object.keys(i).length>0&&(e.extensions=i),e},Zn.prototype=Object.assign(Object.create(Le.prototype),{constructor:Zn,isCamera:!0,copy:function(t,e){return Le.prototype.copy.call(this,t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this},getWorldDirection:function(t){void 0===t&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),t=new Rt),this.updateWorldMatrix(!0,!1);var e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()},updateMatrixWorld:function(t){Le.prototype.updateMatrixWorld.call(this,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()},updateWorldMatrix:function(t,e){Le.prototype.updateWorldMatrix.call(this,t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()},clone:function(){return(new this.constructor).copy(this)}}),Jn.prototype=Object.assign(Object.create(Zn.prototype),{constructor:Jn,isPerspectiveCamera:!0,copy:function(t,e){return Zn.prototype.copy.call(this,t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this},setFocalLength:function(t){var e=.5*this.getFilmHeight()/t;this.fov=2*gt.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){var t=Math.tan(.5*gt.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*gt.RAD2DEG*Math.atan(Math.tan(.5*gt.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(t,e,n,r,i,a){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=this.near,e=t*Math.tan(.5*gt.DEG2RAD*this.fov)/this.zoom,n=2*e,r=this.aspect*n,i=-.5*r,a=this.view;if(null!==this.view&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;i+=a.offsetX*r/o,e-=a.offsetY*n/s,r*=a.width/o,n*=a.height/s}var l=this.filmOffset;0!==l&&(i+=t*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,e,e-n,t,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()},toJSON:function(t){var e=Le.prototype.toJSON.call(this,t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}});var Qn=90,Kn=function(t){function e(e,n,r){var i;if((i=t.call(this)||this).type="CubeCamera",!0!==r.isWebGLCubeRenderTarget)return console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter."),ut(i);i.renderTarget=r;var a=new Jn(Qn,1,e,n);a.layers=i.layers,a.up.set(0,-1,0),a.lookAt(new Rt(1,0,0)),i.add(a);var o=new Jn(Qn,1,e,n);o.layers=i.layers,o.up.set(0,-1,0),o.lookAt(new Rt(-1,0,0)),i.add(o);var s=new Jn(Qn,1,e,n);s.layers=i.layers,s.up.set(0,0,1),s.lookAt(new Rt(0,1,0)),i.add(s);var l=new Jn(Qn,1,e,n);l.layers=i.layers,l.up.set(0,0,-1),l.lookAt(new Rt(0,-1,0)),i.add(l);var c=new Jn(Qn,1,e,n);c.layers=i.layers,c.up.set(0,-1,0),c.lookAt(new Rt(0,0,1)),i.add(c);var u=new Jn(Qn,1,e,n);return u.layers=i.layers,u.up.set(0,-1,0),u.lookAt(new Rt(0,0,-1)),i.add(u),i}return lt(e,t),e.prototype.update=function(t,e){null===this.parent&&this.updateMatrixWorld();var n=this.renderTarget,r=this.children,i=r[0],a=r[1],o=r[2],s=r[3],l=r[4],c=r[5],u=t.xr.enabled,h=t.getRenderTarget();t.xr.enabled=!1;var d=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0),t.render(e,i),t.setRenderTarget(n,1),t.render(e,a),t.setRenderTarget(n,2),t.render(e,o),t.setRenderTarget(n,3),t.render(e,s),t.setRenderTarget(n,4),t.render(e,l),n.texture.generateMipmaps=d,t.setRenderTarget(n,5),t.render(e,c),t.setRenderTarget(h),t.xr.enabled=u},e}(Le),$n=function(t){function e(e,n,r,i,o,s,l,c,u,h){var d;return e=void 0!==e?e:[],n=void 0!==n?n:a,l=void 0!==l?l:E,(d=t.call(this,e,n,r,i,o,s,l,c,u,h)||this)._needsFlipEnvMap=!0,d.flipY=!1,d}return lt(e,t),st(e,[{key:"images",get:function(){return this.image},set:function(t){this.image=t}}]),e}(Mt);$n.prototype.isCubeTexture=!0;var tr=function(t){function e(e,n,r){var i;return Number.isInteger(n)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),n=r),i=t.call(this,e,e,n)||this,n=n||{},i.texture=new $n(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),i.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,i.texture.minFilter=void 0!==n.minFilter?n.minFilter:g,i.texture._needsFlipEnvMap=!1,i}lt(e,t);var n=e.prototype;return n.fromEquirectangularTexture=function(t,e){this.texture.type=e.type,this.texture.format=A,this.texture.encoding=e.encoding,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;var n={tEquirect:{value:null}},r="\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",i="\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",a=new Wn(5,5,5),o=new Yn({name:"CubemapFromEquirect",uniforms:jn(n),vertexShader:r,fragmentShader:i,side:1,blending:0});o.uniforms.tEquirect.value=e;var s=new kn(a,o),l=e.minFilter;return e.minFilter===x&&(e.minFilter=g),new Kn(1,10,this).update(t,s),e.minFilter=l,s.geometry.dispose(),s.material.dispose(),this},n.clear=function(t,e,n,r){for(var i=t.getRenderTarget(),a=0;a<6;a++)t.setRenderTarget(this,a),t.clear(e,n,r);t.setRenderTarget(i)},e}(Et);tr.prototype.isWebGLCubeRenderTarget=!0;var er=function(t){function e(e,n,r,i,a,o,s,l,c,u,h,d){var p;return(p=t.call(this,null,o,s,l,c,u,i,a,h,d)||this).image={data:e||null,width:n||1,height:r||1},p.magFilter=void 0!==c?c:f,p.minFilter=void 0!==u?u:f,p.generateMipmaps=!1,p.flipY=!1,p.unpackAlignment=1,p.needsUpdate=!0,p}return lt(e,t),e}(Mt);er.prototype.isDataTexture=!0;var nr=new Yt,rr=new Rt,ir=function(){function t(t,e,n,r,i,a){void 0===t&&(t=new De),void 0===e&&(e=new De),void 0===n&&(n=new De),void 0===r&&(r=new De),void 0===i&&(i=new De),void 0===a&&(a=new De),this.planes=[t,e,n,r,i,a]}var e=t.prototype;return e.set=function(t,e,n,r,i,a){var o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this},e.copy=function(t){for(var e=this.planes,n=0;n<6;n++)e[n].copy(t.planes[n]);return this},e.setFromProjectionMatrix=function(t){var e=this.planes,n=t.elements,r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],l=n[5],c=n[6],u=n[7],h=n[8],d=n[9],p=n[10],f=n[11],m=n[12],v=n[13],g=n[14],y=n[15];return e[0].setComponents(o-r,u-s,f-h,y-m).normalize(),e[1].setComponents(o+r,u+s,f+h,y+m).normalize(),e[2].setComponents(o+i,u+l,f+d,y+v).normalize(),e[3].setComponents(o-i,u-l,f-d,y-v).normalize(),e[4].setComponents(o-a,u-c,f-p,y-g).normalize(),e[5].setComponents(o+a,u+c,f+p,y+g).normalize(),this},e.intersectsObject=function(t){var e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),nr.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(nr)},e.intersectsSprite=function(t){return nr.center.set(0,0,0),nr.radius=.7071067811865476,nr.applyMatrix4(t.matrixWorld),this.intersectsSphere(nr)},e.intersectsSphere=function(t){for(var e=this.planes,n=t.center,r=-t.radius,i=0;i<6;i++){if(e[i].distanceToPoint(n)<r)return!1}return!0},e.intersectsBox=function(t){for(var e=this.planes,n=0;n<6;n++){var r=e[n];if(rr.x=r.normal.x>0?t.max.x:t.min.x,rr.y=r.normal.y>0?t.max.y:t.min.y,rr.z=r.normal.z>0?t.max.z:t.min.z,r.distanceToPoint(rr)<0)return!1}return!0},e.containsPoint=function(t){for(var e=this.planes,n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0},e.clone=function(){return(new this.constructor).copy(this)},t}();function ar(){var t=null,e=!1,n=null,r=null;function i(e,a){n(e,a),r=t.requestAnimationFrame(i)}return{start:function(){!0!==e&&null!==n&&(r=t.requestAnimationFrame(i),e=!0)},stop:function(){t.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(t){n=t},setContext:function(e){t=e}}}function or(t,e){var n=e.isWebGL2,r=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),r.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);var n=r.get(e);n&&(t.deleteBuffer(n.buffer),r.delete(e))},update:function(e,i){if(e.isGLBufferAttribute){var a=r.get(e);(!a||a.version<e.version)&&r.set(e,{buffer:e.buffer,type:e.type,bytesPerElement:e.elementSize,version:e.version})}else{e.isInterleavedBufferAttribute&&(e=e.data);var o=r.get(e);void 0===o?r.set(e,function(e,r){var i=e.array,a=e.usage,o=t.createBuffer();t.bindBuffer(r,o),t.bufferData(r,i,a),e.onUploadCallback();var s=5126;return i instanceof Float32Array?s=5126:i instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):i instanceof Uint16Array?e.isFloat16BufferAttribute?n?s=5131:console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2."):s=5123:i instanceof Int16Array?s=5122:i instanceof Uint32Array?s=5125:i instanceof Int32Array?s=5124:i instanceof Int8Array?s=5120:i instanceof Uint8Array&&(s=5121),{buffer:o,type:s,bytesPerElement:i.BYTES_PER_ELEMENT,version:e.version}}(e,i)):o.version<e.version&&(!function(e,r,i){var a=r.array,o=r.updateRange;t.bindBuffer(i,e),-1===o.count?t.bufferSubData(i,0,a):(n?t.bufferSubData(i,o.offset*a.BYTES_PER_ELEMENT,a,o.offset,o.count):t.bufferSubData(i,o.offset*a.BYTES_PER_ELEMENT,a.subarray(o.offset,o.offset+o.count)),o.count=-1)}(o.buffer,e,i),o.version=e.version)}}}}var sr=function(t){function e(e,n,r,i){var a;void 0===e&&(e=1),void 0===n&&(n=1),void 0===r&&(r=1),void 0===i&&(i=1),(a=t.call(this)||this).type="PlaneGeometry",a.parameters={width:e,height:n,widthSegments:r,heightSegments:i};for(var o=e/2,s=n/2,l=Math.floor(r),c=Math.floor(i),u=l+1,h=c+1,d=e/l,p=n/c,f=[],m=[],v=[],g=[],y=0;y<h;y++)for(var x=y*p-s,_=0;_<u;_++){var b=_*d-o;m.push(b,-x,0),v.push(0,0,1),g.push(_/l),g.push(1-y/c)}for(var w=0;w<c;w++)for(var M=0;M<l;M++){var S=M+u*w,T=M+u*(w+1),E=M+1+u*(w+1),A=M+1+u*w;f.push(S,T,A),f.push(T,E,A)}return a.setIndex(f),a.setAttribute("position",new dn(m,3)),a.setAttribute("normal",new dn(v,3)),a.setAttribute("uv",new dn(g,2)),a}return lt(e,t),e}(Sn),lr={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\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\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\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}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\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 vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( 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 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\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#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( 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, float faceDirection ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor.xyz *= color.xyz;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\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}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\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 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 );\n\t\tvec2 f = fract( uv );\n\t\tuv += 0.5 - f;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tif ( mipInt < cubeUV_maxMipLevel ) {\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t}\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\t\tuv *= texelSize;\n\t\tvec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x += texelSize;\n\t\tvec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.y += texelSize;\n\t\tvec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x -= texelSize;\n\t\tvec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tvec3 tm = mix( tl, tr, f.x );\n\t\tvec3 bm = mix( bl, br, f.x );\n\t\treturn mix( tm, bm, f.y );\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",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.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\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.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\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.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, 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.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.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 = cLogLuvM * value.rgb;\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 = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\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\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 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 roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, 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\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tfogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\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",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",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n#endif",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 = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\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\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\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\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\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\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\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};\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};\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};\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 ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in 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",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\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_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat specularRoughness;\n\tvec3 specularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#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 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3(\t\t0, 1,\t\t0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * 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 defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\t\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\t\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#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 );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, mapN, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float 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}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\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\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t\tf.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t\tf.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\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",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, 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\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3(\t1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108,\t1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605,\t1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmissionmap_fragment:"#ifdef USE_TRANSMISSIONMAP\n\ttotalTransmission *= texture2D( transmissionMap, vUv ).r;\n#endif",transmissionmap_pars_fragment:"#ifdef USE_TRANSMISSIONMAP\n\tuniform sampler2D transmissionMap;\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).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\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",cube_frag:"#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\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 <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSMISSION\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSMISSION\n\tuniform float transmission;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <transmissionmap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#ifdef TRANSMISSION\n\t\tfloat totalTransmission = transmission;\n\t#endif\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <transmissionmap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#ifdef TRANSMISSION\n\t\tdiffuseColor.a *= mix( saturate( 1. - totalTransmission + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) ), 1.0, metalness );\n\t#endif\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",shadow_vert:"#include <common>\n#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}"},cr={common:{diffuse:{value:new Ke(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new _t},uv2Transform:{value:new _t},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new yt(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ke(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Ke(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new _t}},sprite:{diffuse:{value:new Ke(15658734)},opacity:{value:1},center:{value:new yt(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new _t}}},ur={basic:{uniforms:qn([cr.common,cr.specularmap,cr.envmap,cr.aomap,cr.lightmap,cr.fog]),vertexShader:lr.meshbasic_vert,fragmentShader:lr.meshbasic_frag},lambert:{uniforms:qn([cr.common,cr.specularmap,cr.envmap,cr.aomap,cr.lightmap,cr.emissivemap,cr.fog,cr.lights,{emissive:{value:new Ke(0)}}]),vertexShader:lr.meshlambert_vert,fragmentShader:lr.meshlambert_frag},phong:{uniforms:qn([cr.common,cr.specularmap,cr.envmap,cr.aomap,cr.lightmap,cr.emissivemap,cr.bumpmap,cr.normalmap,cr.displacementmap,cr.fog,cr.lights,{emissive:{value:new Ke(0)},specular:{value:new Ke(1118481)},shininess:{value:30}}]),vertexShader:lr.meshphong_vert,fragmentShader:lr.meshphong_frag},standard:{uniforms:qn([cr.common,cr.envmap,cr.aomap,cr.lightmap,cr.emissivemap,cr.bumpmap,cr.normalmap,cr.displacementmap,cr.roughnessmap,cr.metalnessmap,cr.fog,cr.lights,{emissive:{value:new Ke(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:lr.meshphysical_vert,fragmentShader:lr.meshphysical_frag},toon:{uniforms:qn([cr.common,cr.aomap,cr.lightmap,cr.emissivemap,cr.bumpmap,cr.normalmap,cr.displacementmap,cr.gradientmap,cr.fog,cr.lights,{emissive:{value:new Ke(0)}}]),vertexShader:lr.meshtoon_vert,fragmentShader:lr.meshtoon_frag},matcap:{uniforms:qn([cr.common,cr.bumpmap,cr.normalmap,cr.displacementmap,cr.fog,{matcap:{value:null}}]),vertexShader:lr.meshmatcap_vert,fragmentShader:lr.meshmatcap_frag},points:{uniforms:qn([cr.points,cr.fog]),vertexShader:lr.points_vert,fragmentShader:lr.points_frag},dashed:{uniforms:qn([cr.common,cr.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:lr.linedashed_vert,fragmentShader:lr.linedashed_frag},depth:{uniforms:qn([cr.common,cr.displacementmap]),vertexShader:lr.depth_vert,fragmentShader:lr.depth_frag},normal:{uniforms:qn([cr.common,cr.bumpmap,cr.normalmap,cr.displacementmap,{opacity:{value:1}}]),vertexShader:lr.normal_vert,fragmentShader:lr.normal_frag},sprite:{uniforms:qn([cr.sprite,cr.fog]),vertexShader:lr.sprite_vert,fragmentShader:lr.sprite_frag},background:{uniforms:{uvTransform:{value:new _t},t2D:{value:null}},vertexShader:lr.background_vert,fragmentShader:lr.background_frag},cube:{uniforms:qn([cr.envmap,{opacity:{value:1}}]),vertexShader:lr.cube_vert,fragmentShader:lr.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:lr.equirect_vert,fragmentShader:lr.equirect_frag},distanceRGBA:{uniforms:qn([cr.common,cr.displacementmap,{referencePosition:{value:new Rt},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:lr.distanceRGBA_vert,fragmentShader:lr.distanceRGBA_frag},shadow:{uniforms:qn([cr.lights,cr.fog,{color:{value:new Ke(0)},opacity:{value:1}}]),vertexShader:lr.shadow_vert,fragmentShader:lr.shadow_frag}};function hr(t,e,n,r,i){var a,o,s=new Ke(0),l=0,u=null,h=0,d=null;function p(t,e){n.buffers.color.setClear(t.r,t.g,t.b,e,i)}return{getClearColor:function(){return s},setClearColor:function(t,e){void 0===e&&(e=1),s.set(t),p(s,l=e)},getClearAlpha:function(){return l},setClearAlpha:function(t){p(s,l=t)},render:function(n,i,f,m){var v=!0===i.isScene?i.background:null;v&&v.isTexture&&(v=e.get(v));var g=t.xr,y=g.getSession&&g.getSession();y&&"additive"===y.environmentBlendMode&&(v=null),null===v?p(s,l):v&&v.isColor&&(p(v,1),m=!0),(t.autoClear||m)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),v&&(v.isCubeTexture||v.isWebGLCubeRenderTarget||v.mapping===c)?(void 0===o&&((o=new kn(new Wn(1,1,1),new Yn({name:"BackgroundCubeMaterial",uniforms:jn(ur.cube.uniforms),vertexShader:ur.cube.vertexShader,fragmentShader:ur.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),o.geometry.deleteAttribute("uv"),o.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(o.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(o)),v.isWebGLCubeRenderTarget&&(v=v.texture),o.material.uniforms.envMap.value=v,o.material.uniforms.flipEnvMap.value=v.isCubeTexture&&v._needsFlipEnvMap?-1:1,u===v&&h===v.version&&d===t.toneMapping||(o.material.needsUpdate=!0,u=v,h=v.version,d=t.toneMapping),n.unshift(o,o.geometry,o.material,0,0,null)):v&&v.isTexture&&(void 0===a&&((a=new kn(new sr(2,2),new Yn({name:"BackgroundMaterial",uniforms:jn(ur.background.uniforms),vertexShader:ur.background.vertexShader,fragmentShader:ur.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(a.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(a)),a.material.uniforms.t2D.value=v,!0===v.matrixAutoUpdate&&v.updateMatrix(),a.material.uniforms.uvTransform.value.copy(v.matrix),u===v&&h===v.version&&d===t.toneMapping||(a.material.needsUpdate=!0,u=v,h=v.version,d=t.toneMapping),n.unshift(a,a.geometry,a.material,0,0,null))}}}function dr(t,e,n,r){var i=t.getParameter(34921),a=r.isWebGL2?null:e.get("OES_vertex_array_object"),o=r.isWebGL2||null!==a,s={},l=d(null),c=l;function u(e){return r.isWebGL2?t.bindVertexArray(e):a.bindVertexArrayOES(e)}function h(e){return r.isWebGL2?t.deleteVertexArray(e):a.deleteVertexArrayOES(e)}function d(t){for(var e=[],n=[],r=[],a=0;a<i;a++)e[a]=0,n[a]=0,r[a]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:n,attributeDivisors:r,object:t,attributes:{},index:null}}function p(){for(var t=c.newAttributes,e=0,n=t.length;e<n;e++)t[e]=0}function f(t){m(t,0)}function m(n,i){var a=c.newAttributes,o=c.enabledAttributes,s=c.attributeDivisors;(a[n]=1,0===o[n]&&(t.enableVertexAttribArray(n),o[n]=1),s[n]!==i)&&((r.isWebGL2?t:e.get("ANGLE_instanced_arrays"))[r.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](n,i),s[n]=i)}function v(){for(var e=c.newAttributes,n=c.enabledAttributes,r=0,i=n.length;r<i;r++)n[r]!==e[r]&&(t.disableVertexAttribArray(r),n[r]=0)}function g(e,n,i,a,o,s){!0!==r.isWebGL2||5124!==i&&5125!==i?t.vertexAttribPointer(e,n,i,a,o,s):t.vertexAttribIPointer(e,n,i,o,s)}function y(){x(),c!==l&&u((c=l).object)}function x(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:function(i,l,h,y,x){var _=!1;if(o){var b=function(e,n,i){var o=!0===i.wireframe,l=s[e.id];void 0===l&&(l={},s[e.id]=l);var c=l[n.id];void 0===c&&(c={},l[n.id]=c);var u=c[o];void 0===u&&(u=d(r.isWebGL2?t.createVertexArray():a.createVertexArrayOES()),c[o]=u);return u}(y,h,l);c!==b&&u((c=b).object),(_=function(t,e){var n=c.attributes,r=t.attributes,i=0;for(var a in r){var o=n[a],s=r[a];if(void 0===o)return!0;if(o.attribute!==s)return!0;if(o.data!==s.data)return!0;i++}return c.attributesNum!==i||c.index!==e}(y,x))&&function(t,e){var n={},r=t.attributes,i=0;for(var a in r){var o=r[a],s={};s.attribute=o,o.data&&(s.data=o.data),n[a]=s,i++}c.attributes=n,c.attributesNum=i,c.index=e}(y,x)}else{var w=!0===l.wireframe;c.geometry===y.id&&c.program===h.id&&c.wireframe===w||(c.geometry=y.id,c.program=h.id,c.wireframe=w,_=!0)}!0===i.isInstancedMesh&&(_=!0),null!==x&&n.update(x,34963),_&&(!function(i,a,o,s){if(!1===r.isWebGL2&&(i.isInstancedMesh||s.isInstancedBufferGeometry)&&null===e.get("ANGLE_instanced_arrays"))return;p();var l=s.attributes,c=o.getAttributes(),u=a.defaultAttributeValues;for(var h in c){var d=c[h];if(d>=0){var y=l[h];if(void 0!==y){var x=y.normalized,_=y.itemSize,b=n.get(y);if(void 0===b)continue;var w=b.buffer,M=b.type,S=b.bytesPerElement;if(y.isInterleavedBufferAttribute){var T=y.data,E=T.stride,A=y.offset;T&&T.isInstancedInterleavedBuffer?(m(d,T.meshPerAttribute),void 0===s._maxInstanceCount&&(s._maxInstanceCount=T.meshPerAttribute*T.count)):f(d),t.bindBuffer(34962,w),g(d,_,M,x,E*S,A*S)}else y.isInstancedBufferAttribute?(m(d,y.meshPerAttribute),void 0===s._maxInstanceCount&&(s._maxInstanceCount=y.meshPerAttribute*y.count)):f(d),t.bindBuffer(34962,w),g(d,_,M,x,0,0)}else if("instanceMatrix"===h){var L=n.get(i.instanceMatrix);if(void 0===L)continue;var R=L.buffer,C=L.type;m(d+0,1),m(d+1,1),m(d+2,1),m(d+3,1),t.bindBuffer(34962,R),t.vertexAttribPointer(d+0,4,C,!1,64,0),t.vertexAttribPointer(d+1,4,C,!1,64,16),t.vertexAttribPointer(d+2,4,C,!1,64,32),t.vertexAttribPointer(d+3,4,C,!1,64,48)}else if("instanceColor"===h){var P=n.get(i.instanceColor);if(void 0===P)continue;var D=P.buffer,I=P.type;m(d,1),t.bindBuffer(34962,D),t.vertexAttribPointer(d,3,I,!1,12,0)}else if(void 0!==u){var N=u[h];if(void 0!==N)switch(N.length){case 2:t.vertexAttrib2fv(d,N);break;case 3:t.vertexAttrib3fv(d,N);break;case 4:t.vertexAttrib4fv(d,N);break;default:t.vertexAttrib1fv(d,N)}}}}v()}(i,l,h,y),null!==x&&t.bindBuffer(34963,n.get(x).buffer))},reset:y,resetDefaultState:x,dispose:function(){for(var t in y(),s){var e=s[t];for(var n in e){var r=e[n];for(var i in r)h(r[i].object),delete r[i];delete e[n]}delete s[t]}},releaseStatesOfGeometry:function(t){if(void 0!==s[t.id]){var e=s[t.id];for(var n in e){var r=e[n];for(var i in r)h(r[i].object),delete r[i];delete e[n]}delete s[t.id]}},releaseStatesOfProgram:function(t){for(var e in s){var n=s[e];if(void 0!==n[t.id]){var r=n[t.id];for(var i in r)h(r[i].object),delete r[i];delete n[t.id]}}},initAttributes:p,enableAttribute:f,disableUnusedAttributes:v}}function pr(t,e,n,r){var i,a=r.isWebGL2;this.setMode=function(t){i=t},this.render=function(e,r){t.drawArrays(i,e,r),n.update(r,i,1)},this.renderInstances=function(r,o,s){if(0!==s){var l,c;if(a)l=t,c="drawArraysInstanced";else if(c="drawArraysInstancedANGLE",null===(l=e.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[c](i,r,o,s),n.update(o,i,s)}}}function fr(t,e,n){var r;function i(e){if("highp"===e){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}var a="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext,o=void 0!==n.precision?n.precision:"highp",s=i(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var l=!0===n.logarithmicDepthBuffer,c=t.getParameter(34930),u=t.getParameter(35660),h=t.getParameter(3379),d=t.getParameter(34076),p=t.getParameter(34921),f=t.getParameter(36347),m=t.getParameter(36348),v=t.getParameter(36349),g=u>0,y=a||e.has("OES_texture_float");return{isWebGL2:a,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===e.has("EXT_texture_filter_anisotropic")){var n=e.get("EXT_texture_filter_anisotropic");r=t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:i,precision:o,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:u,maxTextureSize:h,maxCubemapSize:d,maxAttributes:p,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:v,vertexTextures:g,floatFragmentTextures:y,floatVertexTextures:g&&y,maxSamples:a?t.getParameter(36183):0}}function mr(t){var e=this,n=null,r=0,i=!1,a=!1,o=new De,s=new _t,l={value:null,needsUpdate:!1};function c(){l.value!==n&&(l.value=n,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function u(t,n,r,i){var a=null!==t?t.length:0,c=null;if(0!==a){if(c=l.value,!0!==i||null===c){var u=r+4*a,h=n.matrixWorldInverse;s.getNormalMatrix(h),(null===c||c.length<u)&&(c=new Float32Array(u));for(var d=0,p=r;d!==a;++d,p+=4)o.copy(t[d]).applyMatrix4(h,s),o.normal.toArray(c,p),c[p+3]=o.constant}l.value=c,l.needsUpdate=!0}return e.numPlanes=a,e.numIntersection=0,c}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e,a){var o=0!==t.length||e||0!==r||i;return i=e,n=u(t,a,0),r=t.length,o},this.beginShadows=function(){a=!0,u(null)},this.endShadows=function(){a=!1,c()},this.setState=function(e,o,s){var h=e.clippingPlanes,d=e.clipIntersection,p=e.clipShadows,f=t.get(e);if(!i||null===h||0===h.length||a&&!p)a?u(null):c();else{var m=a?0:r,v=4*m,g=f.clippingState||null;l.value=g,g=u(h,o,v,s);for(var y=0;y!==v;++y)g[y]=n[y];f.clippingState=g,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=m}}}function vr(t){var e=new WeakMap;function n(t,e){return e===s?t.mapping=a:e===l&&(t.mapping=o),t}function r(t){var n=t.target;n.removeEventListener("dispose",r);var i=e.get(n);void 0!==i&&(e.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture){var a=i.mapping;if(a===s||a===l){if(e.has(i))return n(e.get(i).texture,i.mapping);var o=i.image;if(o&&o.height>0){var c=t.getRenderTarget(),u=new tr(o.height/2);return u.fromEquirectangularTexture(t,i),e.set(i,u),t.setRenderTarget(c),i.addEventListener("dispose",r),n(u.texture,i.mapping)}return null}}return i},dispose:function(){e=new WeakMap}}}function gr(t){var e={};function n(n){if(void 0!==e[n])return e[n];var r;switch(n){case"WEBGL_depth_texture":r=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=t.getExtension(n)}return e[n]=r,r}return{has:function(t){return null!==n(t)},init:function(t){t.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float")},get:function(t){var e=n(t);return null===e&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function yr(t,e,n,r){var i={},a=new WeakMap;function o(t){var s=t.target;for(var l in null!==s.index&&e.remove(s.index),s.attributes)e.remove(s.attributes[l]);s.removeEventListener("dispose",o),delete i[s.id];var c=a.get(s);c&&(e.remove(c),a.delete(s)),r.releaseStatesOfGeometry(s),!0===s.isInstancedBufferGeometry&&delete s._maxInstanceCount,n.memory.geometries--}function s(t){var n=[],r=t.index,i=t.attributes.position,o=0;if(null!==r){var s=r.array;o=r.version;for(var l=0,c=s.length;l<c;l+=3){var u=s[l+0],h=s[l+1],d=s[l+2];n.push(u,h,h,d,d,u)}}else{var p=i.array;o=i.version;for(var f=0,m=p.length/3-1;f<m;f+=3){var v=f+0,g=f+1,y=f+2;n.push(v,g,g,y,y,v)}}var x=new(fn(n)>65535?un:ln)(n,1);x.version=o;var _=a.get(t);_&&e.remove(_),a.set(t,x)}return{get:function(t,e){return!0===i[e.id]||(e.addEventListener("dispose",o),i[e.id]=!0,n.memory.geometries++),e},update:function(t){var n=t.attributes;for(var r in n)e.update(n[r],34962);var i=t.morphAttributes;for(var a in i)for(var o=i[a],s=0,l=o.length;s<l;s++)e.update(o[s],34962)},getWireframeAttribute:function(t){var e=a.get(t);if(e){var n=t.index;null!==n&&e.version<n.version&&s(t)}else s(t);return a.get(t)}}}function xr(t,e,n,r){var i,a,o,s=r.isWebGL2;this.setMode=function(t){i=t},this.setIndex=function(t){a=t.type,o=t.bytesPerElement},this.render=function(e,r){t.drawElements(i,r,a,e*o),n.update(r,i,1)},this.renderInstances=function(r,l,c){if(0!==c){var u,h;if(s)u=t,h="drawElementsInstanced";else if(h="drawElementsInstancedANGLE",null===(u=e.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");u[h](i,l,a,r*o,c),n.update(l,i,c)}}}function _r(t){var e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.frame++,e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(t,n,r){switch(e.calls++,n){case 4:e.triangles+=r*(t/3);break;case 1:e.lines+=r*(t/2);break;case 3:e.lines+=r*(t-1);break;case 2:e.lines+=r*t;break;case 0:e.points+=r*t;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",n)}}}}function br(t,e){return t[0]-e[0]}function wr(t,e){return Math.abs(e[1])-Math.abs(t[1])}function Mr(t){for(var e={},n=new Float32Array(8),r=[],i=0;i<8;i++)r[i]=[i,0];return{update:function(i,a,o,s){var l=i.morphTargetInfluences,c=void 0===l?0:l.length,u=e[a.id];if(void 0===u){u=[];for(var h=0;h<c;h++)u[h]=[h,0];e[a.id]=u}for(var d=0;d<c;d++){var p=u[d];p[0]=d,p[1]=l[d]}u.sort(wr);for(var f=0;f<8;f++)f<c&&u[f][1]?(r[f][0]=u[f][0],r[f][1]=u[f][1]):(r[f][0]=Number.MAX_SAFE_INTEGER,r[f][1]=0);r.sort(br);for(var m=o.morphTargets&&a.morphAttributes.position,v=o.morphNormals&&a.morphAttributes.normal,g=0,y=0;y<8;y++){var x=r[y],_=x[0],b=x[1];_!==Number.MAX_SAFE_INTEGER&&b?(m&&a.getAttribute("morphTarget"+y)!==m[_]&&a.setAttribute("morphTarget"+y,m[_]),v&&a.getAttribute("morphNormal"+y)!==v[_]&&a.setAttribute("morphNormal"+y,v[_]),n[y]=b,g+=b):(m&&!0===a.hasAttribute("morphTarget"+y)&&a.deleteAttribute("morphTarget"+y),v&&!0===a.hasAttribute("morphNormal"+y)&&a.deleteAttribute("morphNormal"+y),n[y]=0)}var w=a.morphTargetsRelative?1:1-g;s.getUniforms().setValue(t,"morphTargetBaseInfluence",w),s.getUniforms().setValue(t,"morphTargetInfluences",n)}}}function Sr(t,e,n,r){var i=new WeakMap;function a(t){var e=t.target;e.removeEventListener("dispose",a),n.remove(e.instanceMatrix),null!==e.instanceColor&&n.remove(e.instanceColor)}return{update:function(t){var o=r.render.frame,s=t.geometry,l=e.get(t,s);return i.get(l)!==o&&(e.update(l),i.set(l,o)),t.isInstancedMesh&&(!1===t.hasEventListener("dispose",a)&&t.addEventListener("dispose",a),n.update(t.instanceMatrix,34962),null!==t.instanceColor&&n.update(t.instanceColor,34962)),l},dispose:function(){i=new WeakMap}}}ur.physical={uniforms:qn([ur.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new yt(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new Ke(0)},transmission:{value:0},transmissionMap:{value:null}}]),vertexShader:lr.meshphysical_vert,fragmentShader:lr.meshphysical_frag};var Tr=function(t){function e(e,n,r,i){var a;return void 0===e&&(e=null),void 0===n&&(n=1),void 0===r&&(r=1),void 0===i&&(i=1),(a=t.call(this,null)||this).image={data:e,width:n,height:r,depth:i},a.magFilter=f,a.minFilter=f,a.wrapR=d,a.generateMipmaps=!1,a.flipY=!1,a.needsUpdate=!0,a}return lt(e,t),e}(Mt);Tr.prototype.isDataTexture2DArray=!0;var Er=function(t){function e(e,n,r,i){var a;return void 0===e&&(e=null),void 0===n&&(n=1),void 0===r&&(r=1),void 0===i&&(i=1),(a=t.call(this,null)||this).image={data:e,width:n,height:r,depth:i},a.magFilter=f,a.minFilter=f,a.wrapR=d,a.generateMipmaps=!1,a.flipY=!1,a.needsUpdate=!0,a}return lt(e,t),e}(Mt);Er.prototype.isDataTexture3D=!0;var Ar=new Mt,Lr=new Tr,Rr=new Er,Cr=new $n,Pr=[],Dr=[],Ir=new Float32Array(16),Nr=new Float32Array(9),Br=new Float32Array(4);function Or(t,e,n){var r=t[0];if(r<=0||r>0)return t;var i=e*n,a=Pr[i];if(void 0===a&&(a=new Float32Array(i),Pr[i]=a),0!==e){r.toArray(a,0);for(var o=1,s=0;o!==e;++o)s+=n,t[o].toArray(a,s)}return a}function zr(t,e){if(t.length!==e.length)return!1;for(var n=0,r=t.length;n<r;n++)if(t[n]!==e[n])return!1;return!0}function Fr(t,e){for(var n=0,r=e.length;n<r;n++)t[n]=e[n]}function Hr(t,e){var n=Dr[e];void 0===n&&(n=new Int32Array(e),Dr[e]=n);for(var r=0;r!==e;++r)n[r]=t.allocateTextureUnit();return n}function Gr(t,e){var n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function Ur(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(zr(n,e))return;t.uniform2fv(this.addr,e),Fr(n,e)}}function kr(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(void 0!==e.r)n[0]===e.r&&n[1]===e.g&&n[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(zr(n,e))return;t.uniform3fv(this.addr,e),Fr(n,e)}}function Vr(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(zr(n,e))return;t.uniform4fv(this.addr,e),Fr(n,e)}}function Wr(t,e){var n=this.cache,r=e.elements;if(void 0===r){if(zr(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),Fr(n,e)}else{if(zr(n,r))return;Br.set(r),t.uniformMatrix2fv(this.addr,!1,Br),Fr(n,r)}}function jr(t,e){var n=this.cache,r=e.elements;if(void 0===r){if(zr(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),Fr(n,e)}else{if(zr(n,r))return;Nr.set(r),t.uniformMatrix3fv(this.addr,!1,Nr),Fr(n,r)}}function qr(t,e){var n=this.cache,r=e.elements;if(void 0===r){if(zr(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),Fr(n,e)}else{if(zr(n,r))return;Ir.set(r),t.uniformMatrix4fv(this.addr,!1,Ir),Fr(n,r)}}function Xr(t,e,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.safeSetTexture2D(e||Ar,i)}function Yr(t,e,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(e||Lr,i)}function Zr(t,e,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(e||Rr,i)}function Jr(t,e,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.safeSetTextureCube(e||Cr,i)}function Qr(t,e){var n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function Kr(t,e){var n=this.cache;zr(n,e)||(t.uniform2iv(this.addr,e),Fr(n,e))}function $r(t,e){var n=this.cache;zr(n,e)||(t.uniform3iv(this.addr,e),Fr(n,e))}function ti(t,e){var n=this.cache;zr(n,e)||(t.uniform4iv(this.addr,e),Fr(n,e))}function ei(t,e){var n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function ni(t,e){t.uniform1fv(this.addr,e)}function ri(t,e){t.uniform1iv(this.addr,e)}function ii(t,e){t.uniform2iv(this.addr,e)}function ai(t,e){t.uniform3iv(this.addr,e)}function oi(t,e){t.uniform4iv(this.addr,e)}function si(t,e){var n=Or(e,this.size,2);t.uniform2fv(this.addr,n)}function li(t,e){var n=Or(e,this.size,3);t.uniform3fv(this.addr,n)}function ci(t,e){var n=Or(e,this.size,4);t.uniform4fv(this.addr,n)}function ui(t,e){var n=Or(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function hi(t,e){var n=Or(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function di(t,e){var n=Or(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function pi(t,e,n){var r=e.length,i=Hr(n,r);t.uniform1iv(this.addr,i);for(var a=0;a!==r;++a)n.safeSetTexture2D(e[a]||Ar,i[a])}function fi(t,e,n){var r=e.length,i=Hr(n,r);t.uniform1iv(this.addr,i);for(var a=0;a!==r;++a)n.safeSetTextureCube(e[a]||Cr,i[a])}function mi(t,e,n){this.id=t,this.addr=n,this.cache=[],this.setValue=function(t){switch(t){case 5126:return Gr;case 35664:return Ur;case 35665:return kr;case 35666:return Vr;case 35674:return Wr;case 35675:return jr;case 35676:return qr;case 5124:case 35670:return Qr;case 35667:case 35671:return Kr;case 35668:case 35672:return $r;case 35669:case 35673:return ti;case 5125:return ei;case 35678:case 36198:case 36298:case 36306:case 35682:return Xr;case 35679:case 36299:case 36307:return Zr;case 35680:case 36300:case 36308:case 36293:return Jr;case 36289:case 36303:case 36311:case 36292:return Yr}}(e.type)}function vi(t,e,n){this.id=t,this.addr=n,this.cache=[],this.size=e.size,this.setValue=function(t){switch(t){case 5126:return ni;case 35664:return si;case 35665:return li;case 35666:return ci;case 35674:return ui;case 35675:return hi;case 35676:return di;case 5124:case 35670:return ri;case 35667:case 35671:return ii;case 35668:case 35672:return ai;case 35669:case 35673:return oi;case 35678:case 36198:case 36298:case 36306:case 35682:return pi;case 35680:case 36300:case 36308:case 36293:return fi}}(e.type)}function gi(t){this.id=t,this.seq=[],this.map={}}vi.prototype.updateCache=function(t){var e=this.cache;t instanceof Float32Array&&e.length!==t.length&&(this.cache=new Float32Array(t.length)),Fr(e,t)},gi.prototype.setValue=function(t,e,n){for(var r=this.seq,i=0,a=r.length;i!==a;++i){var o=r[i];o.setValue(t,e[o.id],n)}};var yi=/(\w+)(\])?(\[|\.)?/g;function xi(t,e){t.seq.push(e),t.map[e.id]=e}function _i(t,e,n){var r=t.name,i=r.length;for(yi.lastIndex=0;;){var a=yi.exec(r),o=yi.lastIndex,s=a[1],l="]"===a[2],c=a[3];if(l&&(s|=0),void 0===c||"["===c&&o+2===i){xi(n,void 0===c?new mi(s,t,e):new vi(s,t,e));break}var u=n.map[s];void 0===u&&xi(n,u=new gi(s)),n=u}}function bi(t,e){this.seq=[],this.map={};for(var n=t.getProgramParameter(e,35718),r=0;r<n;++r){var i=t.getActiveUniform(e,r);_i(i,t.getUniformLocation(e,i.name),this)}}function wi(t,e,n){var r=t.createShader(e);return t.shaderSource(r,n),t.compileShader(r),r}bi.prototype.setValue=function(t,e,n,r){var i=this.map[e];void 0!==i&&i.setValue(t,n,r)},bi.prototype.setOptional=function(t,e,n){var r=e[n];void 0!==r&&this.setValue(t,n,r)},bi.upload=function(t,e,n,r){for(var i=0,a=e.length;i!==a;++i){var o=e[i],s=n[o.id];!1!==s.needsUpdate&&o.setValue(t,s.value,r)}},bi.seqWithValue=function(t,e){for(var n=[],r=0,i=t.length;r!==i;++r){var a=t[r];a.id in e&&n.push(a)}return n};var Mi=0;function Si(t){switch(t){case Y:return["Linear","( value )"];case Z:return["sRGB","( value )"];case Q:return["RGBE","( value )"];case K:return["RGBM","( value, 7.0 )"];case $:return["RGBM","( value, 16.0 )"];case tt:return["RGBD","( value, 256.0 )"];case J:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case 3003:return["LogLuv","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",t),["Linear","( value )"]}}function Ti(t,e,n){var r=t.getShaderParameter(e,35713),i=t.getShaderInfoLog(e).trim();return r&&""===i?"":"THREE.WebGLShader: gl.getShaderInfoLog() "+n+"\n"+i+function(t){for(var e=t.split("\n"),n=0;n<e.length;n++)e[n]=n+1+": "+e[n];return e.join("\n")}(t.getShaderSource(e))}function Ei(t,e){var n=Si(e);return"vec4 "+t+"( vec4 value ) { return "+n[0]+"ToLinear"+n[1]+"; }"}function Ai(t,e){var n;switch(e){case 1:n="Linear";break;case 2:n="Reinhard";break;case 3:n="OptimizedCineon";break;case 4:n="ACESFilmic";break;case 5:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function Li(t){return""!==t}function Ri(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Ci(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var Pi=/^[ \t]*#include +<([\w\d./]+)>/gm;function Di(t){return t.replace(Pi,Ii)}function Ii(t,e){var n=lr[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return Di(n)}var Ni=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Bi=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Oi(t){return t.replace(Bi,Fi).replace(Ni,zi)}function zi(t,e,n,r){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Fi(t,e,n,r)}function Fi(t,e,n,r){for(var i="",a=parseInt(e);a<parseInt(n);a++)i+=r.replace(/\[\s*i\s*\]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return i}function Hi(t){var e="precision "+t.precision+" float;\nprecision "+t.precision+" int;";return"highp"===t.precision?e+="\n#define HIGH_PRECISION":"mediump"===t.precision?e+="\n#define MEDIUM_PRECISION":"lowp"===t.precision&&(e+="\n#define LOW_PRECISION"),e}function Gi(t,e,n,r){var i,s,l,h,d,p=t.getContext(),f=n.defines,m=n.vertexShader,v=n.fragmentShader,g=function(t){var e="SHADOWMAP_TYPE_BASIC";return 1===t.shadowMapType?e="SHADOWMAP_TYPE_PCF":2===t.shadowMapType?e="SHADOWMAP_TYPE_PCF_SOFT":3===t.shadowMapType&&(e="SHADOWMAP_TYPE_VSM"),e}(n),y=function(t){var e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case a:case o:e="ENVMAP_TYPE_CUBE";break;case c:case u:e="ENVMAP_TYPE_CUBE_UV"}return e}(n),x=function(t){var e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case o:case u:e="ENVMAP_MODE_REFRACTION"}return e}(n),_=function(t){var e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case 0:e="ENVMAP_BLENDING_MULTIPLY";break;case 1:e="ENVMAP_BLENDING_MIX";break;case 2:e="ENVMAP_BLENDING_ADD"}return e}(n),b=t.gammaFactor>0?t.gammaFactor:1,w=n.isWebGL2?"":function(t){return[t.extensionDerivatives||t.envMapCubeUV||t.bumpMap||t.tangentSpaceNormalMap||t.clearcoatNormalMap||t.flatShading||"physical"===t.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Li).join("\n")}(n),M=function(t){var e=[];for(var n in t){var r=t[n];!1!==r&&e.push("#define "+n+" "+r)}return e.join("\n")}(f),S=p.createProgram(),T=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?((i=[M].filter(Li).join("\n")).length>0&&(i+="\n"),(s=[w,M].filter(Li).join("\n")).length>0&&(s+="\n")):(i=[Hi(n),"#define SHADER_NAME "+n.shaderName,M,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+b,"#define MAX_BONES "+n.maxBones,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+x:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+g:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Li).join("\n"),s=[w,Hi(n),"#define SHADER_NAME "+n.shaderName,M,n.alphaTest?"#define ALPHATEST "+n.alphaTest+(n.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+b,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+y:"",n.envMap?"#define "+x:"",n.envMap?"#define "+_:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.sheen?"#define USE_SHEEN":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+g:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?lr.tonemapping_pars_fragment:"",0!==n.toneMapping?Ai("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",lr.encodings_pars_fragment,n.map?Ei("mapTexelToLinear",n.mapEncoding):"",n.matcap?Ei("matcapTexelToLinear",n.matcapEncoding):"",n.envMap?Ei("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMap?Ei("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.lightMap?Ei("lightMapTexelToLinear",n.lightMapEncoding):"",(l="linearToOutputTexel",h=n.outputEncoding,d=Si(h),"vec4 "+l+"( vec4 value ) { return LinearTo"+d[0]+d[1]+"; }"),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Li).join("\n")),m=Ci(m=Ri(m=Di(m),n),n),v=Ci(v=Ri(v=Di(v),n),n),m=Oi(m),v=Oi(v),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(T="#version 300 es\n",i=["#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+i,s=["#define varying in",n.glslVersion===it?"":"out highp vec4 pc_fragColor;",n.glslVersion===it?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+s);var E,A,L=T+s+v,R=wi(p,35633,T+i+m),C=wi(p,35632,L);if(p.attachShader(S,R),p.attachShader(S,C),void 0!==n.index0AttributeName?p.bindAttribLocation(S,0,n.index0AttributeName):!0===n.morphTargets&&p.bindAttribLocation(S,0,"position"),p.linkProgram(S),t.debug.checkShaderErrors){var P=p.getProgramInfoLog(S).trim(),D=p.getShaderInfoLog(R).trim(),I=p.getShaderInfoLog(C).trim(),N=!0,B=!0;if(!1===p.getProgramParameter(S,35714)){N=!1;var O=Ti(p,R,"vertex"),z=Ti(p,C,"fragment");console.error("THREE.WebGLProgram: shader error: ",p.getError(),"35715",p.getProgramParameter(S,35715),"gl.getProgramInfoLog",P,O,z)}else""!==P?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",P):""!==D&&""!==I||(B=!1);B&&(this.diagnostics={runnable:N,programLog:P,vertexShader:{log:D,prefix:i},fragmentShader:{log:I,prefix:s}})}return p.deleteShader(R),p.deleteShader(C),this.getUniforms=function(){return void 0===E&&(E=new bi(p,S)),E},this.getAttributes=function(){return void 0===A&&(A=function(t,e){for(var n={},r=t.getProgramParameter(e,35721),i=0;i<r;i++){var a=t.getActiveAttrib(e,i).name;n[a]=t.getAttribLocation(e,a)}return n}(p,S)),A},this.destroy=function(){r.releaseStatesOfProgram(this),p.deleteProgram(S),this.program=void 0},this.name=n.shaderName,this.id=Mi++,this.cacheKey=e,this.usedTimes=1,this.program=S,this.vertexShader=R,this.fragmentShader=C,this}function Ui(t,e,n,r,i,a){var o=[],s=r.isWebGL2,l=r.logarithmicDepthBuffer,h=r.floatVertexTextures,d=r.maxVertexUniforms,p=r.vertexTextures,f=r.precision,m={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},v=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","instancingColor","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","sheen","transmissionMap"];function g(t){var e;return t&&t.isTexture?e=t.encoding:t&&t.isWebGLRenderTarget?(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),e=t.texture.encoding):e=Y,e}return{getParameters:function(i,o,v,y,x){var _,b,w=y.fog,M=i.isMeshStandardMaterial?y.environment:null,S=e.get(i.envMap||M),T=m[i.type],E=x.isSkinnedMesh?function(t){var e=t.skeleton.bones;if(h)return 1024;var n=d,r=Math.floor((n-20)/4),i=Math.min(r,e.length);return i<e.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+e.length+" bones. This GPU supports "+i+"."),0):i}(x):0;if(null!==i.precision&&(f=r.getMaxPrecision(i.precision))!==i.precision&&console.warn("THREE.WebGLProgram.getParameters:",i.precision,"not supported, using",f,"instead."),T){var A=ur[T];_=A.vertexShader,b=A.fragmentShader}else _=i.vertexShader,b=i.fragmentShader;var L=t.getRenderTarget();return{isWebGL2:s,shaderID:T,shaderName:i.type,vertexShader:_,fragmentShader:b,defines:i.defines,isRawShaderMaterial:!0===i.isRawShaderMaterial,glslVersion:i.glslVersion,precision:f,instancing:!0===x.isInstancedMesh,instancingColor:!0===x.isInstancedMesh&&null!==x.instanceColor,supportsVertexTextures:p,outputEncoding:null!==L?g(L.texture):t.outputEncoding,map:!!i.map,mapEncoding:g(i.map),matcap:!!i.matcap,matcapEncoding:g(i.matcap),envMap:!!S,envMapMode:S&&S.mapping,envMapEncoding:g(S),envMapCubeUV:!!S&&(S.mapping===c||S.mapping===u),lightMap:!!i.lightMap,lightMapEncoding:g(i.lightMap),aoMap:!!i.aoMap,emissiveMap:!!i.emissiveMap,emissiveMapEncoding:g(i.emissiveMap),bumpMap:!!i.bumpMap,normalMap:!!i.normalMap,objectSpaceNormalMap:1===i.normalMapType,tangentSpaceNormalMap:0===i.normalMapType,clearcoatMap:!!i.clearcoatMap,clearcoatRoughnessMap:!!i.clearcoatRoughnessMap,clearcoatNormalMap:!!i.clearcoatNormalMap,displacementMap:!!i.displacementMap,roughnessMap:!!i.roughnessMap,metalnessMap:!!i.metalnessMap,specularMap:!!i.specularMap,alphaMap:!!i.alphaMap,gradientMap:!!i.gradientMap,sheen:!!i.sheen,transmissionMap:!!i.transmissionMap,combine:i.combine,vertexTangents:i.normalMap&&i.vertexTangents,vertexColors:i.vertexColors,vertexUvs:!!(i.map||i.bumpMap||i.normalMap||i.specularMap||i.alphaMap||i.emissiveMap||i.roughnessMap||i.metalnessMap||i.clearcoatMap||i.clearcoatRoughnessMap||i.clearcoatNormalMap||i.displacementMap||i.transmissionMap),uvsVertexOnly:!(i.map||i.bumpMap||i.normalMap||i.specularMap||i.alphaMap||i.emissiveMap||i.roughnessMap||i.metalnessMap||i.clearcoatNormalMap||i.transmissionMap||!i.displacementMap),fog:!!w,useFog:i.fog,fogExp2:w&&w.isFogExp2,flatShading:!!i.flatShading,sizeAttenuation:i.sizeAttenuation,logarithmicDepthBuffer:l,skinning:i.skinning&&E>0,maxBones:E,useVertexTexture:h,morphTargets:i.morphTargets,morphNormals:i.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:i.dithering,shadowMapEnabled:t.shadowMap.enabled&&v.length>0,shadowMapType:t.shadowMap.type,toneMapping:i.toneMapped?t.toneMapping:0,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:i.premultipliedAlpha,alphaTest:i.alphaTest,doubleSided:2===i.side,flipSided:1===i.side,depthPacking:void 0!==i.depthPacking&&i.depthPacking,index0AttributeName:i.index0AttributeName,extensionDerivatives:i.extensions&&i.extensions.derivatives,extensionFragDepth:i.extensions&&i.extensions.fragDepth,extensionDrawBuffers:i.extensions&&i.extensions.drawBuffers,extensionShaderTextureLOD:i.extensions&&i.extensions.shaderTextureLOD,rendererExtensionFragDepth:s||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:s||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:s||n.has("EXT_shader_texture_lod"),customProgramCacheKey:i.customProgramCacheKey()}},getProgramCacheKey:function(e){var n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.fragmentShader),n.push(e.vertexShader)),void 0!==e.defines)for(var r in e.defines)n.push(r),n.push(e.defines[r]);if(!1===e.isRawShaderMaterial){for(var i=0;i<v.length;i++)n.push(e[v[i]]);n.push(t.outputEncoding),n.push(t.gammaFactor)}return n.push(e.customProgramCacheKey),n.join()},getUniforms:function(t){var e,n=m[t.type];if(n){var r=ur[n];e=Xn.clone(r.uniforms)}else e=t.uniforms;return e},acquireProgram:function(e,n){for(var r,a=0,s=o.length;a<s;a++){var l=o[a];if(l.cacheKey===n){++(r=l).usedTimes;break}}return void 0===r&&(r=new Gi(t,n,e,i),o.push(r)),r},releaseProgram:function(t){if(0==--t.usedTimes){var e=o.indexOf(t);o[e]=o[o.length-1],o.pop(),t.destroy()}},programs:o}}function ki(){var t=new WeakMap;return{get:function(e){var n=t.get(e);return void 0===n&&(n={},t.set(e,n)),n},remove:function(e){t.delete(e)},update:function(e,n,r){t.get(e)[n]=r},dispose:function(){t=new WeakMap}}}function Vi(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.program!==e.program?t.program.id-e.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function Wi(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function ji(t){var e=[],n=0,r=[],i=[],a={id:-1};function o(r,i,o,s,l,c){var u=e[n],h=t.get(o);return void 0===u?(u={id:r.id,object:r,geometry:i,material:o,program:h.program||a,groupOrder:s,renderOrder:r.renderOrder,z:l,group:c},e[n]=u):(u.id=r.id,u.object=r,u.geometry=i,u.material=o,u.program=h.program||a,u.groupOrder=s,u.renderOrder=r.renderOrder,u.z=l,u.group=c),n++,u}return{opaque:r,transparent:i,init:function(){n=0,r.length=0,i.length=0},push:function(t,e,n,a,s,l){var c=o(t,e,n,a,s,l);(!0===n.transparent?i:r).push(c)},unshift:function(t,e,n,a,s,l){var c=o(t,e,n,a,s,l);(!0===n.transparent?i:r).unshift(c)},finish:function(){for(var t=n,r=e.length;t<r;t++){var i=e[t];if(null===i.id)break;i.id=null,i.object=null,i.geometry=null,i.material=null,i.program=null,i.group=null}},sort:function(t,e){r.length>1&&r.sort(t||Vi),i.length>1&&i.sort(e||Wi)}}}function qi(t){var e=new WeakMap;return{get:function(n,r){var i;return!1===e.has(n)?(i=new ji(t),e.set(n,[i])):r>=e.get(n).length?(i=new ji(t),e.get(n).push(i)):i=e.get(n)[r],i},dispose:function(){e=new WeakMap}}}function Xi(){var t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];var n;switch(e.type){case"DirectionalLight":n={direction:new Rt,color:new Ke};break;case"SpotLight":n={position:new Rt,direction:new Rt,color:new Ke,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Rt,color:new Ke,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Rt,skyColor:new Ke,groundColor:new Ke};break;case"RectAreaLight":n={color:new Ke,position:new Rt,halfWidth:new Rt,halfHeight:new Rt}}return t[e.id]=n,n}}}var Yi=0;function Zi(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function Ji(t,e){for(var n,r=new Xi,i=(n={},{get:function(t){if(void 0!==n[t.id])return n[t.id];var e;switch(t.type){case"DirectionalLight":case"SpotLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new yt};break;case"PointLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new yt,shadowCameraNear:1,shadowCameraFar:1e3}}return n[t.id]=e,e}}),a={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},o=0;o<9;o++)a.probe.push(new Rt);var s=new Rt,l=new re,c=new re;return{setup:function(n){for(var o=0,s=0,l=0,c=0;c<9;c++)a.probe[c].set(0,0,0);var u=0,h=0,d=0,p=0,f=0,m=0,v=0,g=0;n.sort(Zi);for(var y=0,x=n.length;y<x;y++){var _=n[y],b=_.color,w=_.intensity,M=_.distance,S=_.shadow&&_.shadow.map?_.shadow.map.texture:null;if(_.isAmbientLight)o+=b.r*w,s+=b.g*w,l+=b.b*w;else if(_.isLightProbe)for(var T=0;T<9;T++)a.probe[T].addScaledVector(_.sh.coefficients[T],w);else if(_.isDirectionalLight){var E=r.get(_);if(E.color.copy(_.color).multiplyScalar(_.intensity),_.castShadow){var A=_.shadow,L=i.get(_);L.shadowBias=A.bias,L.shadowNormalBias=A.normalBias,L.shadowRadius=A.radius,L.shadowMapSize=A.mapSize,a.directionalShadow[u]=L,a.directionalShadowMap[u]=S,a.directionalShadowMatrix[u]=_.shadow.matrix,m++}a.directional[u]=E,u++}else if(_.isSpotLight){var R=r.get(_);if(R.position.setFromMatrixPosition(_.matrixWorld),R.color.copy(b).multiplyScalar(w),R.distance=M,R.coneCos=Math.cos(_.angle),R.penumbraCos=Math.cos(_.angle*(1-_.penumbra)),R.decay=_.decay,_.castShadow){var C=_.shadow,P=i.get(_);P.shadowBias=C.bias,P.shadowNormalBias=C.normalBias,P.shadowRadius=C.radius,P.shadowMapSize=C.mapSize,a.spotShadow[d]=P,a.spotShadowMap[d]=S,a.spotShadowMatrix[d]=_.shadow.matrix,g++}a.spot[d]=R,d++}else if(_.isRectAreaLight){var D=r.get(_);D.color.copy(b).multiplyScalar(w),D.halfWidth.set(.5*_.width,0,0),D.halfHeight.set(0,.5*_.height,0),a.rectArea[p]=D,p++}else if(_.isPointLight){var I=r.get(_);if(I.color.copy(_.color).multiplyScalar(_.intensity),I.distance=_.distance,I.decay=_.decay,_.castShadow){var N=_.shadow,B=i.get(_);B.shadowBias=N.bias,B.shadowNormalBias=N.normalBias,B.shadowRadius=N.radius,B.shadowMapSize=N.mapSize,B.shadowCameraNear=N.camera.near,B.shadowCameraFar=N.camera.far,a.pointShadow[h]=B,a.pointShadowMap[h]=S,a.pointShadowMatrix[h]=_.shadow.matrix,v++}a.point[h]=I,h++}else if(_.isHemisphereLight){var O=r.get(_);O.skyColor.copy(_.color).multiplyScalar(w),O.groundColor.copy(_.groundColor).multiplyScalar(w),a.hemi[f]=O,f++}}p>0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(a.rectAreaLTC1=cr.LTC_FLOAT_1,a.rectAreaLTC2=cr.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(a.rectAreaLTC1=cr.LTC_HALF_1,a.rectAreaLTC2=cr.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),a.ambient[0]=o,a.ambient[1]=s,a.ambient[2]=l;var z=a.hash;z.directionalLength===u&&z.pointLength===h&&z.spotLength===d&&z.rectAreaLength===p&&z.hemiLength===f&&z.numDirectionalShadows===m&&z.numPointShadows===v&&z.numSpotShadows===g||(a.directional.length=u,a.spot.length=d,a.rectArea.length=p,a.point.length=h,a.hemi.length=f,a.directionalShadow.length=m,a.directionalShadowMap.length=m,a.pointShadow.length=v,a.pointShadowMap.length=v,a.spotShadow.length=g,a.spotShadowMap.length=g,a.directionalShadowMatrix.length=m,a.pointShadowMatrix.length=v,a.spotShadowMatrix.length=g,z.directionalLength=u,z.pointLength=h,z.spotLength=d,z.rectAreaLength=p,z.hemiLength=f,z.numDirectionalShadows=m,z.numPointShadows=v,z.numSpotShadows=g,a.version=Yi++)},setupView:function(t,e){for(var n=0,r=0,i=0,o=0,u=0,h=e.matrixWorldInverse,d=0,p=t.length;d<p;d++){var f=t[d];if(f.isDirectionalLight){var m=a.directional[n];m.direction.setFromMatrixPosition(f.matrixWorld),s.setFromMatrixPosition(f.target.matrixWorld),m.direction.sub(s),m.direction.transformDirection(h),n++}else if(f.isSpotLight){var v=a.spot[i];v.position.setFromMatrixPosition(f.matrixWorld),v.position.applyMatrix4(h),v.direction.setFromMatrixPosition(f.matrixWorld),s.setFromMatrixPosition(f.target.matrixWorld),v.direction.sub(s),v.direction.transformDirection(h),i++}else if(f.isRectAreaLight){var g=a.rectArea[o];g.position.setFromMatrixPosition(f.matrixWorld),g.position.applyMatrix4(h),c.identity(),l.copy(f.matrixWorld),l.premultiply(h),c.extractRotation(l),g.halfWidth.set(.5*f.width,0,0),g.halfHeight.set(0,.5*f.height,0),g.halfWidth.applyMatrix4(c),g.halfHeight.applyMatrix4(c),o++}else if(f.isPointLight){var y=a.point[r];y.position.setFromMatrixPosition(f.matrixWorld),y.position.applyMatrix4(h),r++}else if(f.isHemisphereLight){var x=a.hemi[u];x.direction.setFromMatrixPosition(f.matrixWorld),x.direction.transformDirection(h),x.direction.normalize(),u++}}},state:a}}function Qi(t,e){var n=new Ji(t,e),r=[],i=[];return{init:function(){r.length=0,i.length=0},state:{lightsArray:r,shadowsArray:i,lights:n},setupLights:function(){n.setup(r)},setupLightsView:function(t){n.setupView(r,t)},pushLight:function(t){r.push(t)},pushShadow:function(t){i.push(t)}}}function Ki(t,e){var n=new WeakMap;return{get:function(r,i){var a;return void 0===i&&(i=0),!1===n.has(r)?(a=new Qi(t,e),n.set(r,[a])):i>=n.get(r).length?(a=new Qi(t,e),n.get(r).push(a)):a=n.get(r)[i],a},dispose:function(){n=new WeakMap}}}var $i=function(t){function e(e){var n;return(n=t.call(this)||this).type="MeshDepthMaterial",n.depthPacking=3200,n.skinning=!1,n.morphTargets=!1,n.map=null,n.alphaMap=null,n.displacementMap=null,n.displacementScale=1,n.displacementBias=0,n.wireframe=!1,n.wireframeLinewidth=1,n.fog=!1,n.setValues(e),n}return lt(e,t),e.prototype.copy=function(e){return t.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},e}(je);$i.prototype.isMeshDepthMaterial=!0;var ta=function(t){function e(e){var n;return(n=t.call(this)||this).type="MeshDistanceMaterial",n.referencePosition=new Rt,n.nearDistance=1,n.farDistance=1e3,n.skinning=!1,n.morphTargets=!1,n.map=null,n.alphaMap=null,n.displacementMap=null,n.displacementScale=1,n.displacementBias=0,n.fog=!1,n.setValues(e),n}return lt(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,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},e}(je);ta.prototype.isMeshDistanceMaterial=!0;function ea(t,e,n){var r=new ir,i=new yt,a=new yt,o=new Tt,s=[],l=[],c={},u={0:1,1:0,2:2},h=new Yn({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new yt},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n\tfor ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean * HALF_SAMPLE_RATE;\n\tsquared_mean = squared_mean * HALF_SAMPLE_RATE;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),d=h.clone();d.defines.HORIZONTAL_PASS=1;var p=new Sn;p.setAttribute("position",new nn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var m=new kn(p,h),v=this;function y(n,r){var i=e.update(m);h.uniforms.shadow_pass.value=n.map.texture,h.uniforms.resolution.value=n.mapSize,h.uniforms.radius.value=n.radius,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(r,null,i,h,m,null),d.uniforms.shadow_pass.value=n.mapPass.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(r,null,i,d,m,null)}function x(t,e,n){var r=t<<0|e<<1|n<<2,i=s[r];return void 0===i&&(i=new $i({depthPacking:3201,morphTargets:t,skinning:e}),s[r]=i),i}function _(t,e,n){var r=t<<0|e<<1|n<<2,i=l[r];return void 0===i&&(i=new ta({morphTargets:t,skinning:e}),l[r]=i),i}function b(e,n,r,i,a,o,s){var l=null,h=x,d=e.customDepthMaterial;if(!0===i.isPointLight&&(h=_,d=e.customDistanceMaterial),void 0===d){var p=!1;!0===r.morphTargets&&(p=n.morphAttributes&&n.morphAttributes.position&&n.morphAttributes.position.length>0);var f=!1;!0===e.isSkinnedMesh&&(!0===r.skinning?f=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e)),l=h(p,f,!0===e.isInstancedMesh)}else l=d;if(t.localClippingEnabled&&!0===r.clipShadows&&0!==r.clippingPlanes.length){var m=l.uuid,v=r.uuid,g=c[m];void 0===g&&(g={},c[m]=g);var y=g[v];void 0===y&&(y=l.clone(),g[v]=y),l=y}return l.visible=r.visible,l.wireframe=r.wireframe,l.side=3===s?null!==r.shadowSide?r.shadowSide:r.side:null!==r.shadowSide?r.shadowSide:u[r.side],l.clipShadows=r.clipShadows,l.clippingPlanes=r.clippingPlanes,l.clipIntersection=r.clipIntersection,l.wireframeLinewidth=r.wireframeLinewidth,l.linewidth=r.linewidth,!0===i.isPointLight&&!0===l.isMeshDistanceMaterial&&(l.referencePosition.setFromMatrixPosition(i.matrixWorld),l.nearDistance=a,l.farDistance=o),l}function w(n,i,a,o,s){if(!1!==n.visible){if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===s)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);var l=e.update(n),c=n.material;if(Array.isArray(c))for(var u=l.groups,h=0,d=u.length;h<d;h++){var p=u[h],f=c[p.materialIndex];if(f&&f.visible){var m=b(n,l,f,o,a.near,a.far,s);t.renderBufferDirect(a,null,l,m,n,p)}}else if(c.visible){var v=b(n,l,c,o,a.near,a.far,s);t.renderBufferDirect(a,null,l,v,n,null)}}for(var g=n.children,y=0,x=g.length;y<x;y++)w(g[y],i,a,o,s)}}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.render=function(e,s,l){if(!1!==v.enabled&&(!1!==v.autoUpdate||!1!==v.needsUpdate)&&0!==e.length){var c=t.getRenderTarget(),u=t.getActiveCubeFace(),h=t.getActiveMipmapLevel(),d=t.state;d.setBlending(0),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);for(var p=0,m=e.length;p<m;p++){var x=e[p],_=x.shadow;if(void 0!==_){if(!1!==_.autoUpdate||!1!==_.needsUpdate){i.copy(_.mapSize);var b=_.getFrameExtents();if(i.multiply(b),a.copy(_.mapSize),(i.x>n||i.y>n)&&(i.x>n&&(a.x=Math.floor(n/b.x),i.x=a.x*b.x,_.mapSize.x=a.x),i.y>n&&(a.y=Math.floor(n/b.y),i.y=a.y*b.y,_.mapSize.y=a.y)),null===_.map&&!_.isPointLightShadow&&3===this.type){var M={minFilter:g,magFilter:g,format:A};_.map=new Et(i.x,i.y,M),_.map.texture.name=x.name+".shadowMap",_.mapPass=new Et(i.x,i.y,M),_.camera.updateProjectionMatrix()}if(null===_.map){var S={minFilter:f,magFilter:f,format:A};_.map=new Et(i.x,i.y,S),_.map.texture.name=x.name+".shadowMap",_.camera.updateProjectionMatrix()}t.setRenderTarget(_.map),t.clear();for(var T=_.getViewportCount(),E=0;E<T;E++){var L=_.getViewport(E);o.set(a.x*L.x,a.y*L.y,a.x*L.z,a.y*L.w),d.viewport(o),_.updateMatrices(x,E),r=_.getFrustum(),w(s,l,_.camera,x,this.type)}_.isPointLightShadow||3!==this.type||y(_,l),_.needsUpdate=!1}}else console.warn("THREE.WebGLShadowMap:",x,"has no shadow.")}v.needsUpdate=!1,t.setRenderTarget(c,u,h)}}}function na(t,e,n){var i,a,o=n.isWebGL2;var s=new function(){var e=!1,n=new Tt,r=null,i=new Tt(0,0,0,0);return{setMask:function(n){r===n||e||(t.colorMask(n,n,n,n),r=n)},setLocked:function(t){e=t},setClear:function(e,r,a,o,s){!0===s&&(e*=o,r*=o,a*=o),n.set(e,r,a,o),!1===i.equals(n)&&(t.clearColor(e,r,a,o),i.copy(n))},reset:function(){e=!1,r=null,i.set(-1,0,0,0)}}},l=new function(){var e=!1,n=null,r=null,i=null;return{setTest:function(t){t?O(2929):z(2929)},setMask:function(r){n===r||e||(t.depthMask(r),n=r)},setFunc:function(e){if(r!==e){if(e)switch(e){case 0:t.depthFunc(512);break;case 1:t.depthFunc(519);break;case 2:t.depthFunc(513);break;case 3:t.depthFunc(515);break;case 4:t.depthFunc(514);break;case 5:t.depthFunc(518);break;case 6:t.depthFunc(516);break;case 7:t.depthFunc(517);break;default:t.depthFunc(515)}else t.depthFunc(515);r=e}},setLocked:function(t){e=t},setClear:function(e){i!==e&&(t.clearDepth(e),i=e)},reset:function(){e=!1,n=null,r=null,i=null}}},c=new function(){var e=!1,n=null,r=null,i=null,a=null,o=null,s=null,l=null,c=null;return{setTest:function(t){e||(t?O(2960):z(2960))},setMask:function(r){n===r||e||(t.stencilMask(r),n=r)},setFunc:function(e,n,o){r===e&&i===n&&a===o||(t.stencilFunc(e,n,o),r=e,i=n,a=o)},setOp:function(e,n,r){o===e&&s===n&&l===r||(t.stencilOp(e,n,r),o=e,s=n,l=r)},setLocked:function(t){e=t},setClear:function(e){c!==e&&(t.clearStencil(e),c=e)},reset:function(){e=!1,n=null,r=null,i=null,a=null,o=null,s=null,l=null,c=null}}},u={},h=null,d=!1,p=null,f=null,m=null,v=null,g=null,y=null,x=null,_=!1,b=null,w=null,M=null,S=null,T=null,E=t.getParameter(35661),A=!1,L=0,R=t.getParameter(7938);-1!==R.indexOf("WebGL")?(L=parseFloat(/^WebGL (\d)/.exec(R)[1]),A=L>=1):-1!==R.indexOf("OpenGL ES")&&(L=parseFloat(/^OpenGL ES (\d)/.exec(R)[1]),A=L>=2);var C=null,P={},D=new Tt,I=new Tt;function N(e,n,r){var i=new Uint8Array(4),a=t.createTexture();t.bindTexture(e,a),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(var o=0;o<r;o++)t.texImage2D(n+o,0,6408,1,1,0,6408,5121,i);return a}var B={};function O(e){!0!==u[e]&&(t.enable(e),u[e]=!0)}function z(e){!1!==u[e]&&(t.disable(e),u[e]=!1)}B[3553]=N(3553,3553,1),B[34067]=N(34067,34069,6),s.setClear(0,0,0,1),l.setClear(1),c.setClear(0),O(2929),l.setFunc(3),k(!1),V(1),O(2884),U(0);var F=((i={})[100]=32774,i[101]=32778,i[102]=32779,i);if(o)F[103]=32775,F[104]=32776;else{var H=e.get("EXT_blend_minmax");null!==H&&(F[103]=H.MIN_EXT,F[104]=H.MAX_EXT)}var G=((a={})[200]=0,a[201]=1,a[202]=768,a[204]=770,a[210]=776,a[208]=774,a[206]=772,a[203]=769,a[205]=771,a[209]=775,a[207]=773,a);function U(e,n,i,a,o,s,l,c){if(0!==e){if(!1===d&&(O(3042),d=!0),5===e)o=o||n,s=s||i,l=l||a,n===f&&o===g||(t.blendEquationSeparate(F[n],F[o]),f=n,g=o),i===m&&a===v&&s===y&&l===x||(t.blendFuncSeparate(G[i],G[a],G[s],G[l]),m=i,v=a,y=s,x=l),p=e,_=null;else if(e!==p||c!==_){if(f===r&&g===r||(t.blendEquation(32774),f=r,g=r),c)switch(e){case 1:t.blendFuncSeparate(1,771,1,771);break;case 2:t.blendFunc(1,1);break;case 3:t.blendFuncSeparate(0,0,769,771);break;case 4:t.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case 1:t.blendFuncSeparate(770,771,1,771);break;case 2:t.blendFunc(770,1);break;case 3:t.blendFunc(0,769);break;case 4:t.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}m=null,v=null,y=null,x=null,p=e,_=c}}else!0===d&&(z(3042),d=!1)}function k(e){b!==e&&(e?t.frontFace(2304):t.frontFace(2305),b=e)}function V(e){0!==e?(O(2884),e!==w&&(1===e?t.cullFace(1029):2===e?t.cullFace(1028):t.cullFace(1032))):z(2884),w=e}function W(e,n,r){e?(O(32823),S===n&&T===r||(t.polygonOffset(n,r),S=n,T=r)):z(32823)}function j(e){void 0===e&&(e=33984+E-1),C!==e&&(t.activeTexture(e),C=e)}return{buffers:{color:s,depth:l,stencil:c},enable:O,disable:z,useProgram:function(e){return h!==e&&(t.useProgram(e),h=e,!0)},setBlending:U,setMaterial:function(t,e){2===t.side?z(2884):O(2884);var n=1===t.side;e&&(n=!n),k(n),1===t.blending&&!1===t.transparent?U(0):U(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha),l.setFunc(t.depthFunc),l.setTest(t.depthTest),l.setMask(t.depthWrite),s.setMask(t.colorWrite);var r=t.stencilWrite;c.setTest(r),r&&(c.setMask(t.stencilWriteMask),c.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),c.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),W(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)},setFlipSided:k,setCullFace:V,setLineWidth:function(e){e!==M&&(A&&t.lineWidth(e),M=e)},setPolygonOffset:W,setScissorTest:function(t){t?O(3089):z(3089)},activeTexture:j,bindTexture:function(e,n){null===C&&j();var r=P[C];void 0===r&&(r={type:void 0,texture:void 0},P[C]=r),r.type===e&&r.texture===n||(t.bindTexture(e,n||B[e]),r.type=e,r.texture=n)},unbindTexture:function(){var e=P[C];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage3D:function(){try{t.texImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(e){!1===D.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),D.copy(e))},viewport:function(e){!1===I.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),I.copy(e))},reset:function(){t.disable(3042),t.disable(2884),t.disable(2929),t.disable(32823),t.disable(3089),t.disable(2960),t.blendEquation(32774),t.blendFunc(1,0),t.blendFuncSeparate(1,0,1,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(513),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(519,0,4294967295),t.stencilOp(7680,7680,7680),t.clearStencil(0),t.cullFace(1029),t.frontFace(2305),t.polygonOffset(0,0),t.activeTexture(33984),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),u={},C=null,P={},h=null,d=!1,p=null,f=null,m=null,v=null,g=null,y=null,x=null,_=!1,b=null,w=null,M=null,S=null,T=null,s.reset(),l.reset(),c.reset()}}}function ra(t,e,n,r,i,a,o){var s,l,c,u=i.isWebGL2,h=i.maxTextures,p=i.maxCubemapSize,y=i.maxTextureSize,x=i.maxSamples,_=new WeakMap,C=!1;try{C="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(t){}function P(t,e){return C?new OffscreenCanvas(t,e):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function D(t,e,n,r){var i=1;if((t.width>r||t.height>r)&&(i=r/Math.max(t.width,t.height)),i<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){var a=e?gt.floorPowerOfTwo:Math.floor,o=a(i*t.width),s=a(i*t.height);void 0===c&&(c=P(o,s));var l=n?P(o,s):c;return l.width=o,l.height=s,l.getContext("2d").drawImage(t,0,0,o,s),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+o+"x"+s+")."),l}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function I(t){return gt.isPowerOfTwo(t.width)&&gt.isPowerOfTwo(t.height)}function N(t,e){return t.generateMipmaps&&e&&t.minFilter!==f&&t.minFilter!==g}function B(e,n,i,a){t.generateMipmap(e),r.get(n).__maxMipLevel=Math.log2(Math.max(i,a))}function O(n,r,i){if(!1===u)return r;if(null!==n){if(void 0!==t[n])return t[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}var a=r;return 6403===r&&(5126===i&&(a=33326),5131===i&&(a=33325),5121===i&&(a=33321)),6407===r&&(5126===i&&(a=34837),5131===i&&(a=34843),5121===i&&(a=32849)),6408===r&&(5126===i&&(a=34836),5131===i&&(a=34842),5121===i&&(a=32856)),33325!==a&&33326!==a&&34842!==a&&34836!==a||e.get("EXT_color_buffer_float"),a}function z(t){return t===f||t===m||t===v?9728:9729}function F(e){var n=e.target;n.removeEventListener("dispose",F),function(e){var n=r.get(e);if(void 0===n.__webglInit)return;t.deleteTexture(n.__webglTexture),r.remove(e)}(n),n.isVideoTexture&&_.delete(n),o.memory.textures--}function H(e){var n=e.target;n.removeEventListener("dispose",H),function(e){var n=e.texture,i=r.get(e),a=r.get(n);if(!e)return;void 0!==a.__webglTexture&&t.deleteTexture(a.__webglTexture);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLCubeRenderTarget)for(var o=0;o<6;o++)t.deleteFramebuffer(i.__webglFramebuffer[o]),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer[o]);else t.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&t.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer&&t.deleteRenderbuffer(i.__webglColorRenderbuffer),i.__webglDepthRenderbuffer&&t.deleteRenderbuffer(i.__webglDepthRenderbuffer);r.remove(n),r.remove(e)}(n),o.memory.textures--}var G=0;function U(t,e){var i=r.get(t);if(t.isVideoTexture&&function(t){var e=o.render.frame;_.get(t)!==e&&(_.set(t,e),t.update())}(t),t.version>0&&i.__version!==t.version){var a=t.image;if(void 0===a)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==a.complete)return void X(i,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+e),n.bindTexture(3553,i.__webglTexture)}function k(e,i){var o=r.get(e);e.version>0&&o.__version!==e.version?function(e,r,i){if(6!==r.image.length)return;q(e,r),n.activeTexture(33984+i),n.bindTexture(34067,e.__webglTexture),t.pixelStorei(37440,r.flipY),t.pixelStorei(37441,r.premultiplyAlpha),t.pixelStorei(3317,r.unpackAlignment),t.pixelStorei(37443,0);for(var o=r&&(r.isCompressedTexture||r.image[0].isCompressedTexture),s=r.image[0]&&r.image[0].isDataTexture,l=[],c=0;c<6;c++)l[c]=o||s?s?r.image[c].image:r.image[c]:D(r.image[c],!1,!0,p);var h,d=l[0],f=I(d)||u,m=a.convert(r.format),v=a.convert(r.type),g=O(r.internalFormat,m,v);if(j(34067,r,f),o){for(var y=0;y<6;y++){h=l[y].mipmaps;for(var x=0;x<h.length;x++){var _=h[x];r.format!==A&&r.format!==E?null!==m?n.compressedTexImage2D(34069+y,x,g,_.width,_.height,0,_.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(34069+y,x,g,_.width,_.height,0,m,v,_.data)}}e.__maxMipLevel=h.length-1}else{h=r.mipmaps;for(var b=0;b<6;b++)if(s){n.texImage2D(34069+b,0,g,l[b].width,l[b].height,0,m,v,l[b].data);for(var w=0;w<h.length;w++){var M=h[w].image[b].image;n.texImage2D(34069+b,w+1,g,M.width,M.height,0,m,v,M.data)}}else{n.texImage2D(34069+b,0,g,m,v,l[b]);for(var S=0;S<h.length;S++){var T=h[S];n.texImage2D(34069+b,S+1,g,m,v,T.image[b])}}e.__maxMipLevel=h.length}N(r,f)&&B(34067,r,d.width,d.height);e.__version=r.version,r.onUpdate&&r.onUpdate(r)}(o,e,i):(n.activeTexture(33984+i),n.bindTexture(34067,o.__webglTexture))}var V=((s={})[1e3]=10497,s[1001]=33071,s[1002]=33648,s),W=((l={})[1003]=9728,l[1004]=9984,l[1005]=9986,l[1006]=9729,l[1007]=9985,l[1008]=9987,l);function j(n,a,o){if(o?(t.texParameteri(n,10242,V[a.wrapS]),t.texParameteri(n,10243,V[a.wrapT]),32879!==n&&35866!==n||t.texParameteri(n,32882,V[a.wrapR]),t.texParameteri(n,10240,W[a.magFilter]),t.texParameteri(n,10241,W[a.minFilter])):(t.texParameteri(n,10242,33071),t.texParameteri(n,10243,33071),32879!==n&&35866!==n||t.texParameteri(n,32882,33071),a.wrapS===d&&a.wrapT===d||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(n,10240,z(a.magFilter)),t.texParameteri(n,10241,z(a.minFilter)),a.minFilter!==f&&a.minFilter!==g&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!0===e.has("EXT_texture_filter_anisotropic")){var s=e.get("EXT_texture_filter_anisotropic");if(a.type===M&&!1===e.has("OES_texture_float_linear"))return;if(!1===u&&a.type===S&&!1===e.has("OES_texture_half_float_linear"))return;(a.anisotropy>1||r.get(a).__currentAnisotropy)&&(t.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy)}}function q(e,n){void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",F),e.__webglTexture=t.createTexture(),o.memory.textures++)}function X(e,r,i){var o=3553;r.isDataTexture2DArray&&(o=35866),r.isDataTexture3D&&(o=32879),q(e,r),n.activeTexture(33984+i),n.bindTexture(o,e.__webglTexture),t.pixelStorei(37440,r.flipY),t.pixelStorei(37441,r.premultiplyAlpha),t.pixelStorei(3317,r.unpackAlignment),t.pixelStorei(37443,0);var s,l=function(t){return!u&&(t.wrapS!==d||t.wrapT!==d||t.minFilter!==f&&t.minFilter!==g)}(r)&&!1===I(r.image),c=D(r.image,l,!1,y),h=I(c)||u,p=a.convert(r.format),m=a.convert(r.type),v=O(r.internalFormat,p,m);j(o,r,h);var x=r.mipmaps;if(r.isDepthTexture)v=6402,u?v=r.type===M?36012:r.type===w?33190:r.type===T?35056:33189:r.type===M&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),r.format===L&&6402===v&&r.type!==b&&r.type!==w&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=b,m=a.convert(r.type)),r.format===R&&6402===v&&(v=34041,r.type!==T&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=T,m=a.convert(r.type))),n.texImage2D(3553,0,v,c.width,c.height,0,p,m,null);else if(r.isDataTexture)if(x.length>0&&h){for(var _=0,S=x.length;_<S;_++)s=x[_],n.texImage2D(3553,_,v,s.width,s.height,0,p,m,s.data);r.generateMipmaps=!1,e.__maxMipLevel=x.length-1}else n.texImage2D(3553,0,v,c.width,c.height,0,p,m,c.data),e.__maxMipLevel=0;else if(r.isCompressedTexture){for(var C=0,P=x.length;C<P;C++)s=x[C],r.format!==A&&r.format!==E?null!==p?n.compressedTexImage2D(3553,C,v,s.width,s.height,0,s.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(3553,C,v,s.width,s.height,0,p,m,s.data);e.__maxMipLevel=x.length-1}else if(r.isDataTexture2DArray)n.texImage3D(35866,0,v,c.width,c.height,c.depth,0,p,m,c.data),e.__maxMipLevel=0;else if(r.isDataTexture3D)n.texImage3D(32879,0,v,c.width,c.height,c.depth,0,p,m,c.data),e.__maxMipLevel=0;else if(x.length>0&&h){for(var z=0,F=x.length;z<F;z++)s=x[z],n.texImage2D(3553,z,v,p,m,s);r.generateMipmaps=!1,e.__maxMipLevel=x.length-1}else n.texImage2D(3553,0,v,p,m,c),e.__maxMipLevel=0;N(r,h)&&B(o,r,c.width,c.height),e.__version=r.version,r.onUpdate&&r.onUpdate(r)}function Y(e,i,o,s){var l=i.texture,c=a.convert(l.format),u=a.convert(l.type),h=O(l.internalFormat,c,u);32879===s||35866===s?n.texImage3D(s,0,h,i.width,i.height,i.depth,0,c,u,null):n.texImage2D(s,0,h,i.width,i.height,0,c,u,null),t.bindFramebuffer(36160,e),t.framebufferTexture2D(36160,o,s,r.get(l).__webglTexture,0),t.bindFramebuffer(36160,null)}function Z(e,n,r){if(t.bindRenderbuffer(36161,e),n.depthBuffer&&!n.stencilBuffer){var i=33189;if(r){var o=n.depthTexture;o&&o.isDepthTexture&&(o.type===M?i=36012:o.type===w&&(i=33190));var s=Q(n);t.renderbufferStorageMultisample(36161,s,i,n.width,n.height)}else t.renderbufferStorage(36161,i,n.width,n.height);t.framebufferRenderbuffer(36160,36096,36161,e)}else if(n.depthBuffer&&n.stencilBuffer){if(r){var l=Q(n);t.renderbufferStorageMultisample(36161,l,35056,n.width,n.height)}else t.renderbufferStorage(36161,34041,n.width,n.height);t.framebufferRenderbuffer(36160,33306,36161,e)}else{var c=n.texture,u=a.convert(c.format),h=a.convert(c.type),d=O(c.internalFormat,u,h);if(r){var p=Q(n);t.renderbufferStorageMultisample(36161,p,d,n.width,n.height)}else t.renderbufferStorage(36161,d,n.width,n.height)}t.bindRenderbuffer(36161,null)}function J(e){var n=r.get(e),i=!0===e.isWebGLCubeRenderTarget;if(e.depthTexture){if(i)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,n){if(n&&n.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,e),!n.depthTexture||!n.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");r.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),U(n.depthTexture,0);var i=r.get(n.depthTexture).__webglTexture;if(n.depthTexture.format===L)t.framebufferTexture2D(36160,36096,3553,i,0);else{if(n.depthTexture.format!==R)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(36160,33306,3553,i,0)}}(n.__webglFramebuffer,e)}else if(i){n.__webglDepthbuffer=[];for(var a=0;a<6;a++)t.bindFramebuffer(36160,n.__webglFramebuffer[a]),n.__webglDepthbuffer[a]=t.createRenderbuffer(),Z(n.__webglDepthbuffer[a],e,!1)}else t.bindFramebuffer(36160,n.__webglFramebuffer),n.__webglDepthbuffer=t.createRenderbuffer(),Z(n.__webglDepthbuffer,e,!1);t.bindFramebuffer(36160,null)}function Q(t){return u&&t.isWebGLMultisampleRenderTarget?Math.min(x,t.samples):0}var K=!1,$=!1;this.allocateTextureUnit=function(){var t=G;return t>=h&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+h),G+=1,t},this.resetTextureUnits=function(){G=0},this.setTexture2D=U,this.setTexture2DArray=function(t,e){var i=r.get(t);t.version>0&&i.__version!==t.version?X(i,t,e):(n.activeTexture(33984+e),n.bindTexture(35866,i.__webglTexture))},this.setTexture3D=function(t,e){var i=r.get(t);t.version>0&&i.__version!==t.version?X(i,t,e):(n.activeTexture(33984+e),n.bindTexture(32879,i.__webglTexture))},this.setTextureCube=k,this.setupRenderTarget=function(e){var i=e.texture,s=r.get(e),l=r.get(i);e.addEventListener("dispose",H),l.__webglTexture=t.createTexture(),o.memory.textures++;var c=!0===e.isWebGLCubeRenderTarget,h=!0===e.isWebGLMultisampleRenderTarget,d=i.isDataTexture3D||i.isDataTexture2DArray,p=I(e)||u;if(!u||i.format!==E||i.type!==M&&i.type!==S||(i.format=A,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),c){s.__webglFramebuffer=[];for(var f=0;f<6;f++)s.__webglFramebuffer[f]=t.createFramebuffer()}else if(s.__webglFramebuffer=t.createFramebuffer(),h)if(u){s.__webglMultisampledFramebuffer=t.createFramebuffer(),s.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,s.__webglColorRenderbuffer);var m=a.convert(i.format),v=a.convert(i.type),g=O(i.internalFormat,m,v),y=Q(e);t.renderbufferStorageMultisample(36161,y,g,e.width,e.height),t.bindFramebuffer(36160,s.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,s.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),e.depthBuffer&&(s.__webglDepthRenderbuffer=t.createRenderbuffer(),Z(s.__webglDepthRenderbuffer,e,!0)),t.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(c){n.bindTexture(34067,l.__webglTexture),j(34067,i,p);for(var x=0;x<6;x++)Y(s.__webglFramebuffer[x],e,36064,34069+x);N(i,p)&&B(34067,i,e.width,e.height),n.bindTexture(34067,null)}else{var _=3553;if(d)if(u)_=i.isDataTexture3D?32879:35866;else console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.");n.bindTexture(_,l.__webglTexture),j(_,i,p),Y(s.__webglFramebuffer,e,36064,_),N(i,p)&&B(3553,i,e.width,e.height),n.bindTexture(3553,null)}e.depthBuffer&&J(e)},this.updateRenderTargetMipmap=function(t){var e=t.texture;if(N(e,I(t)||u)){var i=t.isWebGLCubeRenderTarget?34067:3553,a=r.get(e).__webglTexture;n.bindTexture(i,a),B(i,e,t.width,t.height),n.bindTexture(i,null)}},this.updateMultisampleRenderTarget=function(e){if(e.isWebGLMultisampleRenderTarget)if(u){var n=r.get(e);t.bindFramebuffer(36008,n.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,n.__webglFramebuffer);var i=e.width,a=e.height,o=16384;e.depthBuffer&&(o|=256),e.stencilBuffer&&(o|=1024),t.blitFramebuffer(0,0,i,a,0,0,i,a,o,9728),t.bindFramebuffer(36160,n.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(t,e){t&&t.isWebGLRenderTarget&&(!1===K&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),K=!0),t=t.texture),U(t,e)},this.safeSetTextureCube=function(t,e){t&&t.isWebGLCubeRenderTarget&&(!1===$&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),$=!0),t=t.texture),k(t,e)}}function ia(t,e,n){var r=n.isWebGL2;return{convert:function(t){var n;if(t===_)return 5121;if(1017===t)return 32819;if(1018===t)return 32820;if(1019===t)return 33635;if(1010===t)return 5120;if(1011===t)return 5122;if(t===b)return 5123;if(1013===t)return 5124;if(t===w)return 5125;if(t===M)return 5126;if(t===S)return r?5131:null!==(n=e.get("OES_texture_half_float"))?n.HALF_FLOAT_OES:null;if(1021===t)return 6406;if(t===E)return 6407;if(t===A)return 6408;if(1024===t)return 6409;if(1025===t)return 6410;if(t===L)return 6402;if(t===R)return 34041;if(1028===t)return 6403;if(1029===t)return 36244;if(1030===t)return 33319;if(1031===t)return 33320;if(1032===t)return 36248;if(1033===t)return 36249;if(t===C||t===P||t===D||t===I){if(null===(n=e.get("WEBGL_compressed_texture_s3tc")))return null;if(t===C)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===P)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===D)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===I)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(t===N||t===B||t===O||t===z){if(null===(n=e.get("WEBGL_compressed_texture_pvrtc")))return null;if(t===N)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===B)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===O)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===z)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===t)return null!==(n=e.get("WEBGL_compressed_texture_etc1"))?n.COMPRESSED_RGB_ETC1_WEBGL:null;if((t===F||t===H)&&null!==(n=e.get("WEBGL_compressed_texture_etc"))){if(t===F)return n.COMPRESSED_RGB8_ETC2;if(t===H)return n.COMPRESSED_RGBA8_ETC2_EAC}return 37808===t||37809===t||37810===t||37811===t||37812===t||37813===t||37814===t||37815===t||37816===t||37817===t||37818===t||37819===t||37820===t||37821===t||37840===t||37841===t||37842===t||37843===t||37844===t||37845===t||37846===t||37847===t||37848===t||37849===t||37850===t||37851===t||37852===t||37853===t?null!==(n=e.get("WEBGL_compressed_texture_astc"))?t:null:36492===t?null!==(n=e.get("EXT_texture_compression_bptc"))?t:null:t===T?r?34042:null!==(n=e.get("WEBGL_depth_texture"))?n.UNSIGNED_INT_24_8_WEBGL:null:void 0}}}function aa(t){void 0===t&&(t=[]),Jn.call(this),this.cameras=t}aa.prototype=Object.assign(Object.create(Jn.prototype),{constructor:aa,isArrayCamera:!0});var oa=function(t){function e(){var e;return(e=t.call(this)||this).type="Group",e}return lt(e,t),e}(Le);function sa(){this._targetRay=null,this._grip=null,this._hand=null}function la(t,e){var n=this,r=null,i=1,a=null,o="local-floor",s=null,l=[],c=new Map,u=new Jn;u.layers.enable(1),u.viewport=new Tt;var h=new Jn;h.layers.enable(2),h.viewport=new Tt;var d=[u,h],p=new aa;p.layers.enable(1),p.layers.enable(2);var f=null,m=null;function v(t){var e=c.get(t.inputSource);e&&e.dispatchEvent({type:t.type,data:t.inputSource})}function g(){c.forEach((function(t,e){t.disconnect(e)})),c.clear(),f=null,m=null,t.setFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),M.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function y(t){for(var e=r.inputSources,n=0;n<l.length;n++)c.set(e[n],l[n]);for(var i=0;i<t.removed.length;i++){var a=t.removed[i],o=c.get(a);o&&(o.dispatchEvent({type:"disconnected",data:a}),c.delete(a))}for(var s=0;s<t.added.length;s++){var u=t.added[s],h=c.get(u);h&&h.dispatchEvent({type:"connected",data:u})}}this.enabled=!1,this.isPresenting=!1,this.getController=function(t){var e=l[t];return void 0===e&&(e=new sa,l[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){var e=l[t];return void 0===e&&(e=new sa,l[t]=e),e.getGripSpace()},this.getHand=function(t){var e=l[t];return void 0===e&&(e=new sa,l[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){i=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){o=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return a},this.getSession=function(){return r},this.setSession=function(){var t,s=(t=regeneratorRuntime.mark((function t(s){var l,c,u;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null===(r=s)){t.next=24;break}if(r.addEventListener("select",v),r.addEventListener("selectstart",v),r.addEventListener("selectend",v),r.addEventListener("squeeze",v),r.addEventListener("squeezestart",v),r.addEventListener("squeezeend",v),r.addEventListener("end",g),r.addEventListener("inputsourceschange",y),!0===(l=e.getContextAttributes()).xrCompatible){t.next=14;break}return t.next=14,e.makeXRCompatible();case 14:return c={antialias:l.antialias,alpha:l.alpha,depth:l.depth,stencil:l.stencil,framebufferScaleFactor:i},u=new XRWebGLLayer(r,e,c),r.updateRenderState({baseLayer:u}),t.next=19,r.requestReferenceSpace(o);case 19:a=t.sent,M.setContext(r),M.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"});case 24:case"end":return t.stop()}}),t)})),function(){var e=this,n=arguments;return new Promise((function(r,i){var a=t.apply(e,n);function o(t){at(a,r,i,o,s,"next",t)}function s(t){at(a,r,i,o,s,"throw",t)}o(void 0)}))});return function(t){return s.apply(this,arguments)}}();var x=new Rt,_=new Rt;function b(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.getCamera=function(t){p.near=h.near=u.near=t.near,p.far=h.far=u.far=t.far,f===p.near&&m===p.far||(r.updateRenderState({depthNear:p.near,depthFar:p.far}),f=p.near,m=p.far);var e=t.parent,n=p.cameras;b(p,e);for(var i=0;i<n.length;i++)b(n[i],e);t.matrixWorld.copy(p.matrixWorld),t.matrix.copy(p.matrix),t.matrix.decompose(t.position,t.quaternion,t.scale);for(var a=t.children,o=0,s=a.length;o<s;o++)a[o].updateMatrixWorld(!0);return 2===n.length?function(t,e,n){x.setFromMatrixPosition(e.matrixWorld),_.setFromMatrixPosition(n.matrixWorld);var r=x.distanceTo(_),i=e.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),l=(i[9]+1)/i[5],c=(i[9]-1)/i[5],u=(i[8]-1)/i[0],h=(a[8]+1)/a[0],d=o*u,p=o*h,f=r/(-u+h),m=f*-u;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(m),t.translateZ(f),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert();var v=o+f,g=s+f,y=d-m,b=p+(r-m),w=l*s/g*v,M=c*s/g*v;t.projectionMatrix.makePerspective(y,b,w,M,v,g)}(p,u,h):p.projectionMatrix.copy(u.projectionMatrix),p};var w=null;var M=new ar;M.setAnimationLoop((function(e,n){if(null!==(s=n.getViewerPose(a))){var i=s.views,o=r.renderState.baseLayer;t.setFramebuffer(o.framebuffer);var c=!1;i.length!==p.cameras.length&&(p.cameras.length=0,c=!0);for(var u=0;u<i.length;u++){var h=i[u],f=o.getViewport(h),m=d[u];m.matrix.fromArray(h.transform.matrix),m.projectionMatrix.fromArray(h.projectionMatrix),m.viewport.set(f.x,f.y,f.width,f.height),0===u&&p.matrix.copy(m.matrix),!0===c&&p.cameras.push(m)}}for(var v=r.inputSources,g=0;g<l.length;g++){var y=l[g],x=v[g];y.update(x,n,a)}w&&w(e,n)})),this.setAnimationLoop=function(t){w=t},this.dispose=function(){}}function ca(t){function e(e,n){e.opacity.value=n.opacity,n.color&&e.diffuse.value.copy(n.color),n.emissive&&e.emissive.value.copy(n.emissive).multiplyScalar(n.emissiveIntensity),n.map&&(e.map.value=n.map),n.alphaMap&&(e.alphaMap.value=n.alphaMap),n.specularMap&&(e.specularMap.value=n.specularMap);var r,i,a=t.get(n).envMap;if(a){e.envMap.value=a,e.flipEnvMap.value=a.isCubeTexture&&a._needsFlipEnvMap?-1:1,e.reflectivity.value=n.reflectivity,e.refractionRatio.value=n.refractionRatio;var o=t.get(a).__maxMipLevel;void 0!==o&&(e.maxMipLevel.value=o)}n.lightMap&&(e.lightMap.value=n.lightMap,e.lightMapIntensity.value=n.lightMapIntensity),n.aoMap&&(e.aoMap.value=n.aoMap,e.aoMapIntensity.value=n.aoMapIntensity),n.map?r=n.map:n.specularMap?r=n.specularMap:n.displacementMap?r=n.displacementMap:n.normalMap?r=n.normalMap:n.bumpMap?r=n.bumpMap:n.roughnessMap?r=n.roughnessMap:n.metalnessMap?r=n.metalnessMap:n.alphaMap?r=n.alphaMap:n.emissiveMap?r=n.emissiveMap:n.clearcoatMap?r=n.clearcoatMap:n.clearcoatNormalMap?r=n.clearcoatNormalMap:n.clearcoatRoughnessMap&&(r=n.clearcoatRoughnessMap),void 0!==r&&(r.isWebGLRenderTarget&&(r=r.texture),!0===r.matrixAutoUpdate&&r.updateMatrix(),e.uvTransform.value.copy(r.matrix)),n.aoMap?i=n.aoMap:n.lightMap&&(i=n.lightMap),void 0!==i&&(i.isWebGLRenderTarget&&(i=i.texture),!0===i.matrixAutoUpdate&&i.updateMatrix(),e.uv2Transform.value.copy(i.matrix))}function n(e,n){e.roughness.value=n.roughness,e.metalness.value=n.metalness,n.roughnessMap&&(e.roughnessMap.value=n.roughnessMap),n.metalnessMap&&(e.metalnessMap.value=n.metalnessMap),n.emissiveMap&&(e.emissiveMap.value=n.emissiveMap),n.bumpMap&&(e.bumpMap.value=n.bumpMap,e.bumpScale.value=n.bumpScale,1===n.side&&(e.bumpScale.value*=-1)),n.normalMap&&(e.normalMap.value=n.normalMap,e.normalScale.value.copy(n.normalScale),1===n.side&&e.normalScale.value.negate()),n.displacementMap&&(e.displacementMap.value=n.displacementMap,e.displacementScale.value=n.displacementScale,e.displacementBias.value=n.displacementBias),t.get(n).envMap&&(e.envMapIntensity.value=n.envMapIntensity)}return{refreshFogUniforms:function(t,e){t.fogColor.value.copy(e.color),e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)},refreshMaterialUniforms:function(t,r,i,a){r.isMeshBasicMaterial?e(t,r):r.isMeshLambertMaterial?(e(t,r),function(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}(t,r)):r.isMeshToonMaterial?(e(t,r),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap);e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,r)):r.isMeshPhongMaterial?(e(t,r),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,r)):r.isMeshStandardMaterial?(e(t,r),r.isMeshPhysicalMaterial?function(t,e){n(t,e),t.reflectivity.value=e.reflectivity,t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.sheen&&t.sheen.value.copy(e.sheen);e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap);e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap);e.clearcoatNormalMap&&(t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),t.clearcoatNormalMap.value=e.clearcoatNormalMap,1===e.side&&t.clearcoatNormalScale.value.negate());t.transmission.value=e.transmission,e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap)}(t,r):n(t,r)):r.isMeshMatcapMaterial?(e(t,r),function(t,e){e.matcap&&(t.matcap.value=e.matcap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,r)):r.isMeshDepthMaterial?(e(t,r),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,r)):r.isMeshDistanceMaterial?(e(t,r),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias);t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}(t,r)):r.isMeshNormalMaterial?(e(t,r),function(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,r)):r.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity}(t,r),r.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,r)):r.isPointsMaterial?function(t,e,n,r){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*n,t.scale.value=.5*r,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);var i;e.map?i=e.map:e.alphaMap&&(i=e.alphaMap);void 0!==i&&(!0===i.matrixAutoUpdate&&i.updateMatrix(),t.uvTransform.value.copy(i.matrix))}(t,r,i,a):r.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);var n;e.map?n=e.map:e.alphaMap&&(n=e.alphaMap);void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),t.uvTransform.value.copy(n.matrix))}(t,r):r.isShadowMaterial?(t.color.value.copy(r.color),t.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function ua(t){var e,n=void 0!==(t=t||{}).canvas?t.canvas:((e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")).style.display="block",e),r=void 0!==t.context?t.context:null,i=void 0!==t.alpha&&t.alpha,a=void 0===t.depth||t.depth,o=void 0===t.stencil||t.stencil,s=void 0!==t.antialias&&t.antialias,l=void 0===t.premultipliedAlpha||t.premultipliedAlpha,c=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,u=void 0!==t.powerPreference?t.powerPreference:"default",h=void 0!==t.failIfMajorPerformanceCaveat&&t.failIfMajorPerformanceCaveat,d=null,p=null,f=[],m=[];this.domElement=n,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.outputEncoding=Y,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var v=this,g=!1,y=null,x=0,b=0,w=null,T=null,E=-1,L=null,R=new Tt,C=new Tt,P=null,D=n.width,I=n.height,N=1,B=null,O=null,z=new Tt(0,0,D,I),F=new Tt(0,0,D,I),H=!1,G=new ir,U=!1,k=!1,V=new re,W=new Rt,j={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function q(){return null===w?N:1}var X,Z,J,Q,K,$,tt,et,nt,rt,it,at,ot,st,lt,ct,ut,ht,dt,pt,ft,mt=r;function vt(t,e){for(var r=0;r<t.length;r++){var i=t[r],a=n.getContext(i,e);if(null!==a)return a}return null}try{var xt={alpha:i,depth:a,stencil:o,antialias:s,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:h};if(n.addEventListener("webglcontextlost",St,!1),n.addEventListener("webglcontextrestored",Et,!1),null===mt){var _t=["webgl2","webgl","experimental-webgl"];if(!0===v.isWebGL1Renderer&&_t.shift(),null===(mt=vt(_t,xt)))throw vt(_t)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}void 0===mt.getShaderPrecisionFormat&&(mt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(t){throw console.error("THREE.WebGLRenderer: "+t.message),t}function bt(){X=new gr(mt),Z=new fr(mt,X,t),X.init(Z),pt=new ia(mt,X,Z),(J=new na(mt,X,Z)).scissor(C.copy(F).multiplyScalar(N).floor()),J.viewport(R.copy(z).multiplyScalar(N).floor()),Q=new _r(mt),K=new ki,$=new ra(mt,X,J,K,Z,pt,Q),tt=new vr(v),et=new or(mt,Z),ft=new dr(mt,X,et,Z),nt=new yr(mt,et,Q,ft),rt=new Sr(mt,nt,et,Q),ut=new Mr(mt),lt=new mr(K),it=new Ui(v,tt,X,Z,ft,lt),at=new ca(K),ot=new qi(K),st=new Ki(X,Z),ct=new hr(v,tt,J,rt,l),ht=new pr(mt,X,Q,Z),dt=new xr(mt,X,Q,Z),Q.programs=it.programs,v.capabilities=Z,v.extensions=X,v.properties=K,v.renderLists=ot,v.state=J,v.info=Q}bt();var wt=new la(v,mt);this.xr=wt;var Mt=new ea(v,rt,Z.maxTextureSize);function St(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),g=!0}function Et(){console.log("THREE.WebGLRenderer: Context Restored."),g=!1,bt()}function At(t){var e=t.target;e.removeEventListener("dispose",At),function(t){Lt(t),K.remove(t)}(e)}function Lt(t){var e=K.get(t).program;void 0!==e&&it.releaseProgram(e)}this.shadowMap=Mt,this.getContext=function(){return mt},this.getContextAttributes=function(){return mt.getContextAttributes()},this.forceContextLoss=function(){var t=X.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){var t=X.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return N},this.setPixelRatio=function(t){void 0!==t&&(N=t,this.setSize(D,I,!1))},this.getSize=function(t){return void 0===t&&(console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),t=new yt),t.set(D,I)},this.setSize=function(t,e,r){wt.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(D=t,I=e,n.width=Math.floor(t*N),n.height=Math.floor(e*N),!1!==r&&(n.style.width=t+"px",n.style.height=e+"px"),this.setViewport(0,0,t,e))},this.getDrawingBufferSize=function(t){return void 0===t&&(console.warn("WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument"),t=new yt),t.set(D*N,I*N).floor()},this.setDrawingBufferSize=function(t,e,r){D=t,I=e,N=r,n.width=Math.floor(t*r),n.height=Math.floor(e*r),this.setViewport(0,0,t,e)},this.getCurrentViewport=function(t){return void 0===t&&(console.warn("WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument"),t=new Tt),t.copy(R)},this.getViewport=function(t){return t.copy(z)},this.setViewport=function(t,e,n,r){t.isVector4?z.set(t.x,t.y,t.z,t.w):z.set(t,e,n,r),J.viewport(R.copy(z).multiplyScalar(N).floor())},this.getScissor=function(t){return t.copy(F)},this.setScissor=function(t,e,n,r){t.isVector4?F.set(t.x,t.y,t.z,t.w):F.set(t,e,n,r),J.scissor(C.copy(F).multiplyScalar(N).floor())},this.getScissorTest=function(){return H},this.setScissorTest=function(t){J.setScissorTest(H=t)},this.setOpaqueSort=function(t){B=t},this.setTransparentSort=function(t){O=t},this.getClearColor=function(t){return void 0===t&&(console.warn("WebGLRenderer: .getClearColor() now requires a Color as an argument"),t=new Ke),t.copy(ct.getClearColor())},this.setClearColor=function(){ct.setClearColor.apply(ct,arguments)},this.getClearAlpha=function(){return ct.getClearAlpha()},this.setClearAlpha=function(){ct.setClearAlpha.apply(ct,arguments)},this.clear=function(t,e,n){var r=0;(void 0===t||t)&&(r|=16384),(void 0===e||e)&&(r|=256),(void 0===n||n)&&(r|=1024),mt.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){n.removeEventListener("webglcontextlost",St,!1),n.removeEventListener("webglcontextrestored",Et,!1),ot.dispose(),st.dispose(),K.dispose(),tt.dispose(),rt.dispose(),ft.dispose(),wt.dispose(),Pt.stop()},this.renderBufferImmediate=function(t,e){ft.initAttributes();var n=K.get(t);t.hasPositions&&!n.position&&(n.position=mt.createBuffer()),t.hasNormals&&!n.normal&&(n.normal=mt.createBuffer()),t.hasUvs&&!n.uv&&(n.uv=mt.createBuffer()),t.hasColors&&!n.color&&(n.color=mt.createBuffer());var r=e.getAttributes();t.hasPositions&&(mt.bindBuffer(34962,n.position),mt.bufferData(34962,t.positionArray,35048),ft.enableAttribute(r.position),mt.vertexAttribPointer(r.position,3,5126,!1,0,0)),t.hasNormals&&(mt.bindBuffer(34962,n.normal),mt.bufferData(34962,t.normalArray,35048),ft.enableAttribute(r.normal),mt.vertexAttribPointer(r.normal,3,5126,!1,0,0)),t.hasUvs&&(mt.bindBuffer(34962,n.uv),mt.bufferData(34962,t.uvArray,35048),ft.enableAttribute(r.uv),mt.vertexAttribPointer(r.uv,2,5126,!1,0,0)),t.hasColors&&(mt.bindBuffer(34962,n.color),mt.bufferData(34962,t.colorArray,35048),ft.enableAttribute(r.color),mt.vertexAttribPointer(r.color,3,5126,!1,0,0)),ft.disableUnusedAttributes(),mt.drawArrays(4,0,t.count),t.count=0},this.renderBufferDirect=function(t,e,n,r,i,a){null===e&&(e=j);var o=i.isMesh&&i.matrixWorld.determinant()<0,s=Ot(t,e,r,i);J.setMaterial(r,o);var l=n.index,c=n.attributes.position;if(null===l){if(void 0===c||0===c.count)return}else if(0===l.count)return;var u,h=1;!0===r.wireframe&&(l=nt.getWireframeAttribute(n),h=2),(r.morphTargets||r.morphNormals)&&ut.update(i,n,r,s),ft.setup(i,r,s,n,l);var d=ht;null!==l&&(u=et.get(l),(d=dt).setIndex(u));var p=null!==l?l.count:c.count,f=n.drawRange.start*h,m=n.drawRange.count*h,v=null!==a?a.start*h:0,g=null!==a?a.count*h:1/0,y=Math.max(f,v),x=Math.min(p,f+m,v+g)-1,_=Math.max(0,x-y+1);if(0!==_){if(i.isMesh)!0===r.wireframe?(J.setLineWidth(r.wireframeLinewidth*q()),d.setMode(1)):d.setMode(4);else if(i.isLine){var b=r.linewidth;void 0===b&&(b=1),J.setLineWidth(b*q()),i.isLineSegments?d.setMode(1):i.isLineLoop?d.setMode(2):d.setMode(3)}else i.isPoints?d.setMode(0):i.isSprite&&d.setMode(4);if(i.isInstancedMesh)d.renderInstances(y,_,i.count);else if(n.isInstancedBufferGeometry){var w=Math.min(n.instanceCount,n._maxInstanceCount);d.renderInstances(y,_,w)}else d.render(y,_)}},this.compile=function(t,e){(p=st.get(t)).init(),t.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(p.pushLight(t),t.castShadow&&p.pushShadow(t))})),p.setupLights();var n=new WeakMap;t.traverse((function(e){var r=e.material;if(r)if(Array.isArray(r))for(var i=0;i<r.length;i++){var a=r[i];!1===n.has(a)&&(Bt(a,t,e),n.set(a))}else!1===n.has(r)&&(Bt(r,t,e),n.set(r))}))};var Ct=null;var Pt=new ar;function Dt(t,e,n,r){if(!1!==t.visible){if(t.layers.test(e.layers))if(t.isGroup)n=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(e);else if(t.isLight)p.pushLight(t),t.castShadow&&p.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||G.intersectsSprite(t)){r&&W.setFromMatrixPosition(t.matrixWorld).applyMatrix4(V);var i=rt.update(t),a=t.material;a.visible&&d.push(t,i,a,n,W.z,null)}}else if(t.isImmediateRenderObject)r&&W.setFromMatrixPosition(t.matrixWorld).applyMatrix4(V),d.push(t,null,t.material,n,W.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.frame!==Q.render.frame&&(t.skeleton.update(),t.skeleton.frame=Q.render.frame),!t.frustumCulled||G.intersectsObject(t))){r&&W.setFromMatrixPosition(t.matrixWorld).applyMatrix4(V);var o=rt.update(t),s=t.material;if(Array.isArray(s))for(var l=o.groups,c=0,u=l.length;c<u;c++){var h=l[c],f=s[h.materialIndex];f&&f.visible&&d.push(t,o,f,n,W.z,h)}else s.visible&&d.push(t,o,s,n,W.z,null)}for(var m=t.children,v=0,g=m.length;v<g;v++)Dt(m[v],e,n,r)}}function It(t,e,n){for(var r=!0===e.isScene?e.overrideMaterial:null,i=0,a=t.length;i<a;i++){var o=t[i],s=o.object,l=o.geometry,c=null===r?o.material:r,u=o.group;if(n.isArrayCamera)for(var h=n.cameras,d=0,f=h.length;d<f;d++){var m=h[d];s.layers.test(m.layers)&&(J.viewport(R.copy(m.viewport)),p.setupLightsView(m),Nt(s,e,m,l,c,u))}else Nt(s,e,n,l,c,u)}}function Nt(t,e,n,r,i,a){if(t.onBeforeRender(v,e,n,r,i,a),t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),t.isImmediateRenderObject){var o=Ot(n,e,i,t);J.setMaterial(i),ft.reset(),function(t,e){t.render((function(t){v.renderBufferImmediate(t,e)}))}(t,o)}else v.renderBufferDirect(n,e,r,i,t,a);t.onAfterRender(v,e,n,r,i,a)}function Bt(t,e,n){!0!==e.isScene&&(e=j);var r=K.get(t),i=p.state.lights,a=p.state.shadowsArray,o=i.state.version,s=it.getParameters(t,i.state,a,e,n),l=it.getProgramCacheKey(s),c=r.program,u=!0;if(r.environment=t.isMeshStandardMaterial?e.environment:null,r.fog=e.fog,r.envMap=tt.get(t.envMap||r.environment),void 0===c)t.addEventListener("dispose",At);else if(c.cacheKey!==l)Lt(t);else if(r.lightsStateVersion!==o)u=!1;else{if(void 0!==s.shaderID)return;u=!1}u&&(s.uniforms=it.getUniforms(t),t.onBeforeCompile(s,v),c=it.acquireProgram(s,l),r.program=c,r.uniforms=s.uniforms,r.outputEncoding=s.outputEncoding);var h=r.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(r.numClippingPlanes=lt.numPlanes,r.numIntersection=lt.numIntersection,h.clippingPlanes=lt.uniform),r.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),r.lightsStateVersion=o,r.needsLights&&(h.ambientLightColor.value=i.state.ambient,h.lightProbe.value=i.state.probe,h.directionalLights.value=i.state.directional,h.directionalLightShadows.value=i.state.directionalShadow,h.spotLights.value=i.state.spot,h.spotLightShadows.value=i.state.spotShadow,h.rectAreaLights.value=i.state.rectArea,h.ltc_1.value=i.state.rectAreaLTC1,h.ltc_2.value=i.state.rectAreaLTC2,h.pointLights.value=i.state.point,h.pointLightShadows.value=i.state.pointShadow,h.hemisphereLights.value=i.state.hemi,h.directionalShadowMap.value=i.state.directionalShadowMap,h.directionalShadowMatrix.value=i.state.directionalShadowMatrix,h.spotShadowMap.value=i.state.spotShadowMap,h.spotShadowMatrix.value=i.state.spotShadowMatrix,h.pointShadowMap.value=i.state.pointShadowMap,h.pointShadowMatrix.value=i.state.pointShadowMatrix);var d=r.program.getUniforms(),f=bi.seqWithValue(d.seq,h);r.uniformsList=f}function Ot(t,e,n,r){!0!==e.isScene&&(e=j),$.resetTextureUnits();var i=e.fog,a=n.isMeshStandardMaterial?e.environment:null,o=null===w?v.outputEncoding:w.texture.encoding,s=tt.get(n.envMap||a),l=K.get(n),c=p.state.lights;if(!0===U&&(!0===k||t!==L)){var u=t===L&&n.id===E;lt.setState(n,t,u)}n.version===l.__version?n.fog&&l.fog!==i||l.environment!==a||l.needsLights&&l.lightsStateVersion!==c.state.version?Bt(n,e,r):void 0===l.numClippingPlanes||l.numClippingPlanes===lt.numPlanes&&l.numIntersection===lt.numIntersection?(l.outputEncoding!==o||l.envMap!==s)&&Bt(n,e,r):Bt(n,e,r):(Bt(n,e,r),l.__version=n.version);var h,d,f=!1,m=!1,g=!1,y=l.program,x=y.getUniforms(),_=l.uniforms;if(J.useProgram(y.program)&&(f=!0,m=!0,g=!0),n.id!==E&&(E=n.id,m=!0),f||L!==t){if(x.setValue(mt,"projectionMatrix",t.projectionMatrix),Z.logarithmicDepthBuffer&&x.setValue(mt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),L!==t&&(L=t,m=!0,g=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshStandardMaterial||n.envMap){var b=x.map.cameraPosition;void 0!==b&&b.setValue(mt,W.setFromMatrixPosition(t.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&x.setValue(mt,"isOrthographic",!0===t.isOrthographicCamera),(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.isShadowMaterial||n.skinning)&&x.setValue(mt,"viewMatrix",t.matrixWorldInverse)}if(n.skinning){x.setOptional(mt,r,"bindMatrix"),x.setOptional(mt,r,"bindMatrixInverse");var S=r.skeleton;if(S){var T=S.bones;if(Z.floatVertexTextures){if(null===S.boneTexture){var R=Math.sqrt(4*T.length);R=gt.ceilPowerOfTwo(R),R=Math.max(R,4);var C=new Float32Array(R*R*4);C.set(S.boneMatrices);var P=new er(C,R,R,A,M);S.boneMatrices=C,S.boneTexture=P,S.boneTextureSize=R}x.setValue(mt,"boneTexture",S.boneTexture,$),x.setValue(mt,"boneTextureSize",S.boneTextureSize)}else x.setOptional(mt,S,"boneMatrices")}}return(m||l.receiveShadow!==r.receiveShadow)&&(l.receiveShadow=r.receiveShadow,x.setValue(mt,"receiveShadow",r.receiveShadow)),m&&(x.setValue(mt,"toneMappingExposure",v.toneMappingExposure),l.needsLights&&(d=g,(h=_).ambientLightColor.needsUpdate=d,h.lightProbe.needsUpdate=d,h.directionalLights.needsUpdate=d,h.directionalLightShadows.needsUpdate=d,h.pointLights.needsUpdate=d,h.pointLightShadows.needsUpdate=d,h.spotLights.needsUpdate=d,h.spotLightShadows.needsUpdate=d,h.rectAreaLights.needsUpdate=d,h.hemisphereLights.needsUpdate=d),i&&n.fog&&at.refreshFogUniforms(_,i),at.refreshMaterialUniforms(_,n,N,I),bi.upload(mt,l.uniformsList,_,$)),n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(bi.upload(mt,l.uniformsList,_,$),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&x.setValue(mt,"center",r.center),x.setValue(mt,"modelViewMatrix",r.modelViewMatrix),x.setValue(mt,"normalMatrix",r.normalMatrix),x.setValue(mt,"modelMatrix",r.matrixWorld),y}Pt.setAnimationLoop((function(t){wt.isPresenting||Ct&&Ct(t)})),"undefined"!=typeof window&&Pt.setContext(window),this.setAnimationLoop=function(t){Ct=t,wt.setAnimationLoop(t),null===t?Pt.stop():Pt.start()},this.render=function(t,e){var n,r;if(void 0!==arguments[2]&&(console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead."),n=arguments[2]),void 0!==arguments[3]&&(console.warn("THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead."),r=arguments[3]),void 0===e||!0===e.isCamera){if(!0!==g){ft.resetDefaultState(),E=-1,L=null,!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),!0===wt.enabled&&!0===wt.isPresenting&&(e=wt.getCamera(e)),!0===t.isScene&&t.onBeforeRender(v,t,e,n||w),(p=st.get(t,m.length)).init(),m.push(p),V.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),G.setFromProjectionMatrix(V),k=this.localClippingEnabled,U=lt.init(this.clippingPlanes,k,e),(d=ot.get(t,f.length)).init(),f.push(d),Dt(t,e,0,v.sortObjects),d.finish(),!0===v.sortObjects&&d.sort(B,O),!0===U&&lt.beginShadows();var i=p.state.shadowsArray;Mt.render(i,t,e),p.setupLights(),p.setupLightsView(e),!0===U&&lt.endShadows(),!0===this.info.autoReset&&this.info.reset(),void 0!==n&&this.setRenderTarget(n),ct.render(d,t,e,r);var a=d.opaque,o=d.transparent;a.length>0&&It(a,t,e),o.length>0&&It(o,t,e),!0===t.isScene&&t.onAfterRender(v,t,e),null!==w&&($.updateRenderTargetMipmap(w),$.updateMultisampleRenderTarget(w)),J.buffers.depth.setTest(!0),J.buffers.depth.setMask(!0),J.buffers.color.setMask(!0),J.setPolygonOffset(!1),m.pop(),p=m.length>0?m[m.length-1]:null,f.pop(),d=f.length>0?f[f.length-1]:null}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.setFramebuffer=function(t){y!==t&&null===w&&mt.bindFramebuffer(36160,t),y=t},this.getActiveCubeFace=function(){return x},this.getActiveMipmapLevel=function(){return b},this.getRenderTarget=function(){return w},this.setRenderTarget=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=0),w=t,x=e,b=n,t&&void 0===K.get(t).__webglFramebuffer&&$.setupRenderTarget(t);var r=y,i=!1,a=!1;if(t){var o=t.texture;(o.isDataTexture3D||o.isDataTexture2DArray)&&(a=!0);var s=K.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=s[e],i=!0):r=t.isWebGLMultisampleRenderTarget?K.get(t).__webglMultisampledFramebuffer:s,R.copy(t.viewport),C.copy(t.scissor),P=t.scissorTest}else R.copy(z).multiplyScalar(N).floor(),C.copy(F).multiplyScalar(N).floor(),P=H;if(T!==r&&(mt.bindFramebuffer(36160,r),T=r),J.viewport(R),J.scissor(C),J.setScissorTest(P),i){var l=K.get(t.texture);mt.framebufferTexture2D(36160,36064,34069+e,l.__webglTexture,n)}else if(a){var c=K.get(t.texture),u=e||0;mt.framebufferTextureLayer(36160,36064,c.__webglTexture,n||0,u)}},this.readRenderTargetPixels=function(t,e,n,r,i,a,o){if(t&&t.isWebGLRenderTarget){var s=K.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==o&&(s=s[o]),s){var l=!1;s!==T&&(mt.bindFramebuffer(36160,s),l=!0);try{var c=t.texture,u=c.format,h=c.type;if(u!==A&&pt.convert(u)!==mt.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");var d=h===S&&(X.has("EXT_color_buffer_half_float")||Z.isWebGL2&&X.has("EXT_color_buffer_float"));if(!(h===_||pt.convert(h)===mt.getParameter(35738)||h===M&&(Z.isWebGL2||X.has("OES_texture_float")||X.has("WEBGL_color_buffer_float"))||d))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===mt.checkFramebufferStatus(36160)?e>=0&&e<=t.width-r&&n>=0&&n<=t.height-i&&mt.readPixels(e,n,r,i,pt.convert(u),pt.convert(h),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{l&&mt.bindFramebuffer(36160,T)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(t,e,n){void 0===n&&(n=0);var r=Math.pow(2,-n),i=Math.floor(e.image.width*r),a=Math.floor(e.image.height*r),o=pt.convert(e.format);$.setTexture2D(e,0),mt.copyTexImage2D(3553,n,o,t.x,t.y,i,a,0),J.unbindTexture()},this.copyTextureToTexture=function(t,e,n,r){void 0===r&&(r=0);var i=e.image.width,a=e.image.height,o=pt.convert(n.format),s=pt.convert(n.type);$.setTexture2D(n,0),mt.pixelStorei(37440,n.flipY),mt.pixelStorei(37441,n.premultiplyAlpha),mt.pixelStorei(3317,n.unpackAlignment),e.isDataTexture?mt.texSubImage2D(3553,r,t.x,t.y,i,a,o,s,e.image.data):e.isCompressedTexture?mt.compressedTexSubImage2D(3553,r,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,o,e.mipmaps[0].data):mt.texSubImage2D(3553,r,t.x,t.y,o,s,e.image),0===r&&n.generateMipmaps&&mt.generateMipmap(3553),J.unbindTexture()},this.copyTextureToTexture3D=function(t,e,n,r,i){if(void 0===i&&(i=0),v.isWebGL1Renderer)console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");else{var a,o=n.image,s=o.width,l=o.height,c=o.data,u=pt.convert(r.format),h=pt.convert(r.type);if(r.isDataTexture3D)$.setTexture3D(r,0),a=32879;else{if(!r.isDataTexture2DArray)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");$.setTexture2DArray(r,0),a=35866}mt.pixelStorei(37440,r.flipY),mt.pixelStorei(37441,r.premultiplyAlpha),mt.pixelStorei(3317,r.unpackAlignment);var d=mt.getParameter(3314),p=mt.getParameter(32878),f=mt.getParameter(3316),m=mt.getParameter(3315),g=mt.getParameter(32877);mt.pixelStorei(3314,s),mt.pixelStorei(32878,l),mt.pixelStorei(3316,t.min.x),mt.pixelStorei(3315,t.min.y),mt.pixelStorei(32877,t.min.z),mt.texSubImage3D(a,i,e.x,e.y,e.z,t.max.x-t.min.x+1,t.max.y-t.min.y+1,t.max.z-t.min.z+1,u,h,c),mt.pixelStorei(3314,d),mt.pixelStorei(32878,p),mt.pixelStorei(3316,f),mt.pixelStorei(3315,m),mt.pixelStorei(32877,g),0===i&&r.generateMipmaps&&mt.generateMipmap(a),J.unbindTexture()}},this.initTexture=function(t){$.setTexture2D(t,0),J.unbindTexture()},this.resetState=function(){J.reset(),ft.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}oa.prototype.isGroup=!0,Object.assign(sa.prototype,{constructor:sa,getHandSpace:function(){return null===this._hand&&(this._hand=new oa,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand},getTargetRaySpace:function(){return null===this._targetRay&&(this._targetRay=new oa,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1),this._targetRay},getGripSpace:function(){return null===this._grip&&(this._grip=new oa,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1),this._grip},dispatchEvent:function(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this},disconnect:function(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this},update:function(t,e,n){var r=null,i=null,a=null,o=this._targetRay,s=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState)if(l&&t.hand){a=!0;for(var c,u=dt(t.hand.values());!(c=u()).done;){var h=c.value,d=e.getJointPose(h,n);if(void 0===l.joints[h.jointName]){var p=new oa;p.matrixAutoUpdate=!1,p.visible=!1,l.joints[h.jointName]=p,l.add(p)}var f=l.joints[h.jointName];null!==d&&(f.matrix.fromArray(d.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.jointRadius=d.radius),f.visible=null!==d}var m=l.joints["index-finger-tip"],v=l.joints["thumb-tip"],g=m.position.distanceTo(v.position);l.inputState.pinching&&g>.025?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&g<=.015&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&null!==(r=e.getPose(t.targetRaySpace,n))&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale)),null!==s&&t.gripSpace&&null!==(i=e.getPose(t.gripSpace,n))&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale));return null!==o&&(o.visible=null!==r),null!==s&&(s.visible=null!==i),null!==l&&(l.visible=null!==a),this}}),Object.assign(la.prototype,pt.prototype);var ha=function(t){function e(){return t.apply(this,arguments)||this}return lt(e,t),e}(ua);ha.prototype.isWebGL1Renderer=!0;var da=function(){function t(t,e){this.name="",this.color=new Ke(t),this.density=void 0!==e?e:25e-5}var e=t.prototype;return e.clone=function(){return new t(this.color,this.density)},e.toJSON=function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}},t}();da.prototype.isFogExp2=!0;var pa=function(){function t(t,e,n){this.name="",this.color=new Ke(t),this.near=void 0!==e?e:1,this.far=void 0!==n?n:1e3}var e=t.prototype;return e.clone=function(){return new t(this.color,this.near,this.far)},e.toJSON=function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}},t}();pa.prototype.isFog=!0;var fa=function(t){function e(){var e;return(e=t.call(this)||this).type="Scene",e.background=null,e.environment=null,e.fog=null,e.overrideMaterial=null,e.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:ut(e)})),e}lt(e,t);var n=e.prototype;return n.copy=function(e,n){return t.prototype.copy.call(this,e,n),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this},n.toJSON=function(e){var n=t.prototype.toJSON.call(this,e);return null!==this.background&&(n.object.background=this.background.toJSON(e)),null!==this.environment&&(n.object.environment=this.environment.toJSON(e)),null!==this.fog&&(n.object.fog=this.fog.toJSON()),n},e}(Le);function ma(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=nt,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=gt.generateUUID()}fa.prototype.isScene=!0,Object.defineProperty(ma.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(ma.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this},copyAt:function(t,e,n){t*=this.stride,n*=e.stride;for(var r=0,i=this.stride;r<i;r++)this.array[t+r]=e.array[n+r];return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},clone:function(t){void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=gt.generateUUID()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);var e=new ma(new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),this.stride);return e.setUsage(this.usage),e},onUpload:function(t){return this.onUploadCallback=t,this},toJSON:function(t){return void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=gt.generateUUID()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=Array.prototype.slice.call(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}});var va=new Rt;function ga(t,e,n,r){this.name="",this.data=t,this.itemSize=e,this.offset=n,this.normalized=!0===r}Object.defineProperties(ga.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}},needsUpdate:{set:function(t){this.data.needsUpdate=t}}}),Object.assign(ga.prototype,{isInterleavedBufferAttribute:!0,applyMatrix4:function(t){for(var e=0,n=this.data.count;e<n;e++)va.x=this.getX(e),va.y=this.getY(e),va.z=this.getZ(e),va.applyMatrix4(t),this.setXYZ(e,va.x,va.y,va.z);return this},setX:function(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this},setY:function(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this},setZ:function(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this},setW:function(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this},getX:function(t){return this.data.array[t*this.data.stride+this.offset]},getY:function(t){return this.data.array[t*this.data.stride+this.offset+1]},getZ:function(t){return this.data.array[t*this.data.stride+this.offset+2]},getW:function(t){return this.data.array[t*this.data.stride+this.offset+3]},setXY:function(t,e,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this},setXYZ:function(t,e,n,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=r,this},setXYZW:function(t,e,n,r,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=r,this.data.array[t+3]=i,this},clone:function(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");for(var e=[],n=0;n<this.count;n++)for(var r=n*this.data.stride+this.offset,i=0;i<this.itemSize;i++)e.push(this.data.array[r+i]);return new nn(new this.array.constructor(e),this.itemSize,this.normalized)}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new ga(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)},toJSON:function(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");for(var e=[],n=0;n<this.count;n++)for(var r=n*this.data.stride+this.offset,i=0;i<this.itemSize;i++)e.push(this.data.array[r+i]);return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}});var ya,xa=function(t){function e(e){var n;return(n=t.call(this)||this).type="SpriteMaterial",n.color=new Ke(16777215),n.map=null,n.alphaMap=null,n.rotation=0,n.sizeAttenuation=!0,n.transparent=!0,n.setValues(e),n}return lt(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this},e}(je);xa.prototype.isSpriteMaterial=!0;var _a=new Rt,ba=new Rt,wa=new Rt,Ma=new yt,Sa=new yt,Ta=new re,Ea=new Rt,Aa=new Rt,La=new Rt,Ra=new yt,Ca=new yt,Pa=new yt,Da=function(t){function e(e){var n;if((n=t.call(this)||this).type="Sprite",void 0===ya){ya=new Sn;var r=new ma(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);ya.setIndex([0,1,2,0,2,3]),ya.setAttribute("position",new ga(r,3,0,!1)),ya.setAttribute("uv",new ga(r,2,3,!1))}return n.geometry=ya,n.material=void 0!==e?e:new xa,n.center=new yt(.5,.5),n}lt(e,t);var n=e.prototype;return n.raycast=function(t,e){null===t.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),ba.setFromMatrixScale(this.matrixWorld),Ta.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),wa.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&ba.multiplyScalar(-wa.z);var n,r,i=this.material.rotation;0!==i&&(r=Math.cos(i),n=Math.sin(i));var a=this.center;Ia(Ea.set(-.5,-.5,0),wa,a,ba,n,r),Ia(Aa.set(.5,-.5,0),wa,a,ba,n,r),Ia(La.set(.5,.5,0),wa,a,ba,n,r),Ra.set(0,0),Ca.set(1,0),Pa.set(1,1);var o=t.ray.intersectTriangle(Ea,Aa,La,!1,_a);if(null!==o||(Ia(Aa.set(-.5,.5,0),wa,a,ba,n,r),Ca.set(0,1),null!==(o=t.ray.intersectTriangle(Ea,La,Aa,!1,_a)))){var s=t.ray.origin.distanceTo(_a);s<t.near||s>t.far||e.push({distance:s,point:_a.clone(),uv:Ve.getUV(_a,Ea,Aa,La,Ra,Ca,Pa,new yt),face:null,object:this})}},n.copy=function(e){return t.prototype.copy.call(this,e),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this},e}(Le);function Ia(t,e,n,r,i,a){Ma.subVectors(t,n).addScalar(.5).multiply(r),void 0!==i?(Sa.x=a*Ma.x-i*Ma.y,Sa.y=i*Ma.x+a*Ma.y):Sa.copy(Ma),t.copy(e),t.x+=Sa.x,t.y+=Sa.y,t.applyMatrix4(Ta)}Da.prototype.isSprite=!0;var Na=new Rt,Ba=new Rt,Oa=function(t){function e(){var e;return(e=t.call(this)||this)._currentLevel=0,e.type="LOD",Object.defineProperties(ut(e),{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),e.autoUpdate=!0,e}lt(e,t);var n=e.prototype;return n.copy=function(e){t.prototype.copy.call(this,e,!1);for(var n=e.levels,r=0,i=n.length;r<i;r++){var a=n[r];this.addLevel(a.object.clone(),a.distance)}return this.autoUpdate=e.autoUpdate,this},n.addLevel=function(t,e){void 0===e&&(e=0),e=Math.abs(e);var n,r=this.levels;for(n=0;n<r.length&&!(e<r[n].distance);n++);return r.splice(n,0,{distance:e,object:t}),this.add(t),this},n.getCurrentLevel=function(){return this._currentLevel},n.getObjectForDistance=function(t){var e=this.levels;if(e.length>0){var n,r;for(n=1,r=e.length;n<r&&!(t<e[n].distance);n++);return e[n-1].object}return null},n.raycast=function(t,e){if(this.levels.length>0){Na.setFromMatrixPosition(this.matrixWorld);var n=t.ray.origin.distanceTo(Na);this.getObjectForDistance(n).raycast(t,e)}},n.update=function(t){var e=this.levels;if(e.length>1){Na.setFromMatrixPosition(t.matrixWorld),Ba.setFromMatrixPosition(this.matrixWorld);var n,r,i=Na.distanceTo(Ba)/t.zoom;for(e[0].object.visible=!0,n=1,r=e.length;n<r&&i>=e[n].distance;n++)e[n-1].object.visible=!1,e[n].object.visible=!0;for(this._currentLevel=n-1;n<r;n++)e[n].object.visible=!1}},n.toJSON=function(e){var n=t.prototype.toJSON.call(this,e);!1===this.autoUpdate&&(n.object.autoUpdate=!1),n.object.levels=[];for(var r=this.levels,i=0,a=r.length;i<a;i++){var o=r[i];n.object.levels.push({object:o.object.uuid,distance:o.distance})}return n},e}(Le),za=new Rt,Fa=new Tt,Ha=new Tt,Ga=new Rt,Ua=new re;function ka(t,e){kn.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new re,this.bindMatrixInverse=new re}function Va(){Le.call(this),this.type="Bone"}ka.prototype=Object.assign(Object.create(kn.prototype),{constructor:ka,isSkinnedMesh:!0,copy:function(t){return kn.prototype.copy.call(this,t),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,this},bind:function(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){for(var t=new Tt,e=this.geometry.attributes.skinWeight,n=0,r=e.count;n<r;n++){t.x=e.getX(n),t.y=e.getY(n),t.z=e.getZ(n),t.w=e.getW(n);var i=1/t.manhattanLength();i!==1/0?t.multiplyScalar(i):t.set(1,0,0,0),e.setXYZW(n,t.x,t.y,t.z,t.w)}},updateMatrixWorld:function(t){kn.prototype.updateMatrixWorld.call(this,t),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},boneTransform:function(t,e){var n=this.skeleton,r=this.geometry;Fa.fromBufferAttribute(r.attributes.skinIndex,t),Ha.fromBufferAttribute(r.attributes.skinWeight,t),za.fromBufferAttribute(r.attributes.position,t).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(var i=0;i<4;i++){var a=Ha.getComponent(i);if(0!==a){var o=Fa.getComponent(i);Ua.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),e.addScaledVector(Ga.copy(za).applyMatrix4(Ua),a)}}return e.applyMatrix4(this.bindMatrixInverse)}}),Va.prototype=Object.assign(Object.create(Le.prototype),{constructor:Va,isBone:!0});var Wa=new re,ja=new re,qa=function(){function t(t,e){void 0===t&&(t=[]),void 0===e&&(e=[]),this.uuid=gt.generateUUID(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}var e=t.prototype;return e.init=function(){var t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(16*t.length),0===e.length)this.calculateInverses();else if(t.length!==e.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(var n=0,r=this.bones.length;n<r;n++)this.boneInverses.push(new re)}},e.calculateInverses=function(){this.boneInverses.length=0;for(var t=0,e=this.bones.length;t<e;t++){var n=new re;this.bones[t]&&n.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(n)}},e.pose=function(){for(var t=0,e=this.bones.length;t<e;t++){var n=this.bones[t];n&&n.matrixWorld.copy(this.boneInverses[t]).invert()}for(var r=0,i=this.bones.length;r<i;r++){var a=this.bones[r];a&&(a.parent&&a.parent.isBone?(a.matrix.copy(a.parent.matrixWorld).invert(),a.matrix.multiply(a.matrixWorld)):a.matrix.copy(a.matrixWorld),a.matrix.decompose(a.position,a.quaternion,a.scale))}},e.update=function(){for(var t=this.bones,e=this.boneInverses,n=this.boneMatrices,r=this.boneTexture,i=0,a=t.length;i<a;i++){var o=t[i]?t[i].matrixWorld:ja;Wa.multiplyMatrices(o,e[i]),Wa.toArray(n,16*i)}null!==r&&(r.needsUpdate=!0)},e.clone=function(){return new t(this.bones,this.boneInverses)},e.getBoneByName=function(t){for(var e=0,n=this.bones.length;e<n;e++){var r=this.bones[e];if(r.name===t)return r}},e.dispose=function(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)},e.fromJSON=function(t,e){this.uuid=t.uuid;for(var n=0,r=t.bones.length;n<r;n++){var i=t.bones[n],a=e[i];void 0===a&&(console.warn("THREE.Skeleton: No bone found with UUID:",i),a=new Va),this.bones.push(a),this.boneInverses.push((new re).fromArray(t.boneInverses[n]))}return this.init(),this},e.toJSON=function(){var t={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;for(var e=this.bones,n=this.boneInverses,r=0,i=e.length;r<i;r++){var a=e[r];t.bones.push(a.uuid);var o=n[r];t.boneInverses.push(o.toArray())}return t},t}(),Xa=new re,Ya=new re,Za=[],Ja=new kn;function Qa(t,e,n){kn.call(this,t,e),this.instanceMatrix=new nn(new Float32Array(16*n),16),this.instanceColor=null,this.count=n,this.frustumCulled=!1}Qa.prototype=Object.assign(Object.create(kn.prototype),{constructor:Qa,isInstancedMesh:!0,copy:function(t){return kn.prototype.copy.call(this,t),this.instanceMatrix.copy(t.instanceMatrix),null!==t.instanceColor&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,this},getColorAt:function(t,e){e.fromArray(this.instanceColor.array,3*t)},getMatrixAt:function(t,e){e.fromArray(this.instanceMatrix.array,16*t)},raycast:function(t,e){var n=this.matrixWorld,r=this.count;if(Ja.geometry=this.geometry,Ja.material=this.material,void 0!==Ja.material)for(var i=0;i<r;i++){this.getMatrixAt(i,Xa),Ya.multiplyMatrices(n,Xa),Ja.matrixWorld=Ya,Ja.raycast(t,Za);for(var a=0,o=Za.length;a<o;a++){var s=Za[a];s.instanceId=i,s.object=this,e.push(s)}Za.length=0}},setColorAt:function(t,e){null===this.instanceColor&&(this.instanceColor=new nn(new Float32Array(3*this.count),3)),e.toArray(this.instanceColor.array,3*t)},setMatrixAt:function(t,e){e.toArray(this.instanceMatrix.array,16*t)},updateMorphTargets:function(){},dispose:function(){this.dispatchEvent({type:"dispose"})}});var Ka=function(t){function e(e){var n;return(n=t.call(this)||this).type="LineBasicMaterial",n.color=new Ke(16777215),n.linewidth=1,n.linecap="round",n.linejoin="round",n.morphTargets=!1,n.setValues(e),n}return lt(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.morphTargets=e.morphTargets,this},e}(je);Ka.prototype.isLineBasicMaterial=!0;var $a=new Rt,to=new Rt,eo=new re,no=new ne,ro=new Yt;function io(t,e){void 0===t&&(t=new Sn),void 0===e&&(e=new Ka),Le.call(this),this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}io.prototype=Object.assign(Object.create(Le.prototype),{constructor:io,isLine:!0,copy:function(t){return Le.prototype.copy.call(this,t),this.material=t.material,this.geometry=t.geometry,this},computeLineDistances:function(){var t=this.geometry;if(t.isBufferGeometry)if(null===t.index){for(var e=t.attributes.position,n=[0],r=1,i=e.count;r<i;r++)$a.fromBufferAttribute(e,r-1),to.fromBufferAttribute(e,r),n[r]=n[r-1],n[r]+=$a.distanceTo(to);t.setAttribute("lineDistance",new dn(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this},raycast:function(t,e){var n=this.geometry,r=this.matrixWorld,i=t.params.Line.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),ro.copy(n.boundingSphere),ro.applyMatrix4(r),ro.radius+=i,!1!==t.ray.intersectsSphere(ro)){eo.copy(r).invert(),no.copy(t.ray).applyMatrix4(eo);var a=i/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,s=new Rt,l=new Rt,c=new Rt,u=new Rt,h=this.isLineSegments?2:1;if(n.isBufferGeometry){var d=n.index,p=n.attributes.position;if(null!==d)for(var f=d.array,m=0,v=f.length-1;m<v;m+=h){var g=f[m],y=f[m+1];if(s.fromBufferAttribute(p,g),l.fromBufferAttribute(p,y),!(no.distanceSqToSegment(s,l,u,c)>o)){u.applyMatrix4(this.matrixWorld);var x=t.ray.origin.distanceTo(u);x<t.near||x>t.far||e.push({distance:x,point:c.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}}else for(var _=0,b=p.count-1;_<b;_+=h){if(s.fromBufferAttribute(p,_),l.fromBufferAttribute(p,_+1),!(no.distanceSqToSegment(s,l,u,c)>o)){u.applyMatrix4(this.matrixWorld);var w=t.ray.origin.distanceTo(u);w<t.near||w>t.far||e.push({distance:w,point:c.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},updateMorphTargets:function(){var t=this.geometry;if(t.isBufferGeometry){var e=t.morphAttributes,n=Object.keys(e);if(n.length>0){var r=e[n[0]];if(void 0!==r){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var i=0,a=r.length;i<a;i++){var o=r[i].name||String(i);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=i}}}}else{var s=t.morphTargets;void 0!==s&&s.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}});var ao=new Rt,oo=new Rt;function so(t,e){io.call(this,t,e),this.type="LineSegments"}so.prototype=Object.assign(Object.create(io.prototype),{constructor:so,isLineSegments:!0,computeLineDistances:function(){var t=this.geometry;if(t.isBufferGeometry)if(null===t.index){for(var e=t.attributes.position,n=[],r=0,i=e.count;r<i;r+=2)ao.fromBufferAttribute(e,r),oo.fromBufferAttribute(e,r+1),n[r]=0===r?0:n[r-1],n[r+1]=n[r]+ao.distanceTo(oo);t.setAttribute("lineDistance",new dn(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}});var lo=function(t){function e(e,n){var r;return(r=t.call(this,e,n)||this).type="LineLoop",r}return lt(e,t),e}(io);lo.prototype.isLineLoop=!0;var co=function(t){function e(e){var n;return(n=t.call(this)||this).type="PointsMaterial",n.color=new Ke(16777215),n.map=null,n.alphaMap=null,n.size=1,n.sizeAttenuation=!0,n.morphTargets=!1,n.setValues(e),n}return lt(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.morphTargets=e.morphTargets,this},e}(je);co.prototype.isPointsMaterial=!0;var uo=new re,ho=new ne,po=new Yt,fo=new Rt;function mo(t,e){void 0===t&&(t=new Sn),void 0===e&&(e=new co),Le.call(this),this.type="Points",this.geometry=t,this.material=e,this.updateMorphTargets()}function vo(t,e,n,r,i,a,o){var s=ho.distanceSqToPoint(t);if(s<n){var l=new Rt;ho.closestPointToPoint(t,l),l.applyMatrix4(r);var c=i.ray.origin.distanceTo(l);if(c<i.near||c>i.far)return;a.push({distance:c,distanceToRay:Math.sqrt(s),point:l,index:e,face:null,object:o})}}mo.prototype=Object.assign(Object.create(Le.prototype),{constructor:mo,isPoints:!0,copy:function(t){return Le.prototype.copy.call(this,t),this.material=t.material,this.geometry=t.geometry,this},raycast:function(t,e){var n=this.geometry,r=this.matrixWorld,i=t.params.Points.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),po.copy(n.boundingSphere),po.applyMatrix4(r),po.radius+=i,!1!==t.ray.intersectsSphere(po)){uo.copy(r).invert(),ho.copy(t.ray).applyMatrix4(uo);var a=i/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a;if(n.isBufferGeometry){var s=n.index,l=n.attributes.position;if(null!==s)for(var c=s.array,u=0,h=c.length;u<h;u++){var d=c[u];fo.fromBufferAttribute(l,d),vo(fo,d,o,r,t,e,this)}else for(var p=0,f=l.count;p<f;p++)fo.fromBufferAttribute(l,p),vo(fo,p,o,r,t,e,this)}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},updateMorphTargets:function(){var t=this.geometry;if(t.isBufferGeometry){var e=t.morphAttributes,n=Object.keys(e);if(n.length>0){var r=e[n[0]];if(void 0!==r){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var i=0,a=r.length;i<a;i++){var o=r[i].name||String(i);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=i}}}}else{var s=t.morphTargets;void 0!==s&&s.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}});var go=function(t){function e(e,n,r,i,a,o,s,l,c){var u;(u=t.call(this,e,n,r,i,a,o,s,l,c)||this).format=void 0!==s?s:E,u.minFilter=void 0!==o?o:g,u.magFilter=void 0!==a?a:g,u.generateMipmaps=!1;var h=ut(u);return"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback((function t(){h.needsUpdate=!0,e.requestVideoFrameCallback(t)})),u}lt(e,t);var n=e.prototype;return n.clone=function(){return new this.constructor(this.image).copy(this)},n.update=function(){var t=this.image;!1==="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)},e}(Mt);go.prototype.isVideoTexture=!0;var yo=function(t){function e(e,n,r,i,a,o,s,l,c,u,h,d){var p;return(p=t.call(this,null,o,s,l,c,u,i,a,h,d)||this).image={width:n,height:r},p.mipmaps=e,p.flipY=!1,p.generateMipmaps=!1,p}return lt(e,t),e}(Mt);yo.prototype.isCompressedTexture=!0;var xo=function(t){function e(e,n,r,i,a,o,s,l,c){var u;return(u=t.call(this,e,n,r,i,a,o,s,l,c)||this).needsUpdate=!0,u}return lt(e,t),e}(Mt);xo.prototype.isCanvasTexture=!0;var _o=function(t){function e(e,n,r,i,a,o,s,l,c,u){var h;if((u=void 0!==u?u:L)!==L&&u!==R)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");return void 0===r&&u===L&&(r=b),void 0===r&&u===R&&(r=T),(h=t.call(this,null,i,a,o,s,l,u,r,c)||this).image={width:e,height:n},h.magFilter=void 0!==s?s:f,h.minFilter=void 0!==l?l:f,h.flipY=!1,h.generateMipmaps=!1,h}return lt(e,t),e}(Mt);_o.prototype.isDepthTexture=!0;var bo=function(t){function e(e,n,r,i){var a;void 0===e&&(e=1),void 0===n&&(n=8),void 0===r&&(r=0),void 0===i&&(i=2*Math.PI),(a=t.call(this)||this).type="CircleGeometry",a.parameters={radius:e,segments:n,thetaStart:r,thetaLength:i},n=Math.max(3,n);var o=[],s=[],l=[],c=[],u=new Rt,h=new yt;s.push(0,0,0),l.push(0,0,1),c.push(.5,.5);for(var d=0,p=3;d<=n;d++,p+=3){var f=r+d/n*i;u.x=e*Math.cos(f),u.y=e*Math.sin(f),s.push(u.x,u.y,u.z),l.push(0,0,1),h.x=(s[p]/e+1)/2,h.y=(s[p+1]/e+1)/2,c.push(h.x,h.y)}for(var m=1;m<=n;m++)o.push(m,m+1,0);return a.setIndex(o),a.setAttribute("position",new dn(s,3)),a.setAttribute("normal",new dn(l,3)),a.setAttribute("uv",new dn(c,2)),a}return lt(e,t),e}(Sn),wo=function(t){function e(e,n,r,i,a,o,s,l){var c;void 0===e&&(e=1),void 0===n&&(n=1),void 0===r&&(r=1),void 0===i&&(i=8),void 0===a&&(a=1),void 0===o&&(o=!1),void 0===s&&(s=0),void 0===l&&(l=2*Math.PI),(c=t.call(this)||this).type="CylinderGeometry",c.parameters={radiusTop:e,radiusBottom:n,height:r,radialSegments:i,heightSegments:a,openEnded:o,thetaStart:s,thetaLength:l};var u=ut(c);i=Math.floor(i),a=Math.floor(a);var h=[],d=[],p=[],f=[],m=0,v=[],g=r/2,y=0;function x(t){for(var r=m,a=new yt,o=new Rt,c=0,v=!0===t?e:n,x=!0===t?1:-1,_=1;_<=i;_++)d.push(0,g*x,0),p.push(0,x,0),f.push(.5,.5),m++;for(var b=m,w=0;w<=i;w++){var M=w/i*l+s,S=Math.cos(M),T=Math.sin(M);o.x=v*T,o.y=g*x,o.z=v*S,d.push(o.x,o.y,o.z),p.push(0,x,0),a.x=.5*S+.5,a.y=.5*T*x+.5,f.push(a.x,a.y),m++}for(var E=0;E<i;E++){var A=r+E,L=b+E;!0===t?h.push(L,L+1,A):h.push(L+1,L,A),c+=3}u.addGroup(y,c,!0===t?1:2),y+=c}return function(){for(var t=new Rt,o=new Rt,c=0,x=(n-e)/r,_=0;_<=a;_++){for(var b=[],w=_/a,M=w*(n-e)+e,S=0;S<=i;S++){var T=S/i,E=T*l+s,A=Math.sin(E),L=Math.cos(E);o.x=M*A,o.y=-w*r+g,o.z=M*L,d.push(o.x,o.y,o.z),t.set(A,x,L).normalize(),p.push(t.x,t.y,t.z),f.push(T,1-w),b.push(m++)}v.push(b)}for(var R=0;R<i;R++)for(var C=0;C<a;C++){var P=v[C][R],D=v[C+1][R],I=v[C+1][R+1],N=v[C][R+1];h.push(P,D,N),h.push(D,I,N),c+=6}u.addGroup(y,c,0),y+=c}(),!1===o&&(e>0&&x(!0),n>0&&x(!1)),c.setIndex(h),c.setAttribute("position",new dn(d,3)),c.setAttribute("normal",new dn(p,3)),c.setAttribute("uv",new dn(f,2)),c}return lt(e,t),e}(Sn),Mo=function(t){function e(e,n,r,i,a,o,s){var l;return void 0===e&&(e=1),void 0===n&&(n=1),void 0===r&&(r=8),void 0===i&&(i=1),void 0===a&&(a=!1),void 0===o&&(o=0),void 0===s&&(s=2*Math.PI),(l=t.call(this,0,e,n,r,i,a,o,s)||this).type="ConeGeometry",l.parameters={radius:e,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s},l}return lt(e,t),e}(wo),So=function(t){function e(e,n,r,i){var a;void 0===r&&(r=1),void 0===i&&(i=0),(a=t.call(this)||this).type="PolyhedronGeometry",a.parameters={vertices:e,indices:n,radius:r,detail:i};var o=[],s=[];function l(t,e,n,r){for(var i=r+1,a=[],o=0;o<=i;o++){a[o]=[];for(var s=t.clone().lerp(n,o/i),l=e.clone().lerp(n,o/i),u=i-o,h=0;h<=u;h++)a[o][h]=0===h&&o===i?s:s.clone().lerp(l,h/u)}for(var d=0;d<i;d++)for(var p=0;p<2*(i-d)-1;p++){var f=Math.floor(p/2);p%2==0?(c(a[d][f+1]),c(a[d+1][f]),c(a[d][f])):(c(a[d][f+1]),c(a[d+1][f+1]),c(a[d+1][f]))}}function c(t){o.push(t.x,t.y,t.z)}function u(t,n){var r=3*t;n.x=e[r+0],n.y=e[r+1],n.z=e[r+2]}function h(t,e,n,r){r<0&&1===t.x&&(s[e]=t.x-1),0===n.x&&0===n.z&&(s[e]=r/2/Math.PI+.5)}function d(t){return Math.atan2(t.z,-t.x)}return function(t){for(var e=new Rt,r=new Rt,i=new Rt,a=0;a<n.length;a+=3)u(n[a+0],e),u(n[a+1],r),u(n[a+2],i),l(e,r,i,t)}(i),function(t){for(var e=new Rt,n=0;n<o.length;n+=3)e.x=o[n+0],e.y=o[n+1],e.z=o[n+2],e.normalize().multiplyScalar(t),o[n+0]=e.x,o[n+1]=e.y,o[n+2]=e.z}(r),function(){for(var t=new Rt,e=0;e<o.length;e+=3){t.x=o[e+0],t.y=o[e+1],t.z=o[e+2];var n=d(t)/2/Math.PI+.5,r=(i=t,Math.atan2(-i.y,Math.sqrt(i.x*i.x+i.z*i.z))/Math.PI+.5);s.push(n,1-r)}var i;(function(){for(var t=new Rt,e=new Rt,n=new Rt,r=new Rt,i=new yt,a=new yt,l=new yt,c=0,u=0;c<o.length;c+=9,u+=6){t.set(o[c+0],o[c+1],o[c+2]),e.set(o[c+3],o[c+4],o[c+5]),n.set(o[c+6],o[c+7],o[c+8]),i.set(s[u+0],s[u+1]),a.set(s[u+2],s[u+3]),l.set(s[u+4],s[u+5]),r.copy(t).add(e).add(n).divideScalar(3);var p=d(r);h(i,u+0,t,p),h(a,u+2,e,p),h(l,u+4,n,p)}})(),function(){for(var t=0;t<s.length;t+=6){var e=s[t+0],n=s[t+2],r=s[t+4],i=Math.max(e,n,r),a=Math.min(e,n,r);i>.9&&a<.1&&(e<.2&&(s[t+0]+=1),n<.2&&(s[t+2]+=1),r<.2&&(s[t+4]+=1))}}()}(),a.setAttribute("position",new dn(o,3)),a.setAttribute("normal",new dn(o.slice(),3)),a.setAttribute("uv",new dn(s,2)),0===i?a.computeVertexNormals():a.normalizeNormals(),a}return lt(e,t),e}(Sn),To=function(t){function e(e,n){var r;void 0===e&&(e=1),void 0===n&&(n=0);var i=(1+Math.sqrt(5))/2,a=1/i,o=[-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,-a,-i,0,-a,i,0,a,-i,0,a,i,-a,-i,0,-a,i,0,a,-i,0,a,i,0,-i,0,-a,i,0,-a,-i,0,a,i,0,a];return(r=t.call(this,o,[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,n)||this).type="DodecahedronGeometry",r.parameters={radius:e,detail:n},r}return lt(e,t),e}(So),Eo=new Rt,Ao=new Rt,Lo=new Rt,Ro=new Ve,Co=function(t){function e(e,n){var r;if((r=t.call(this)||this).type="EdgesGeometry",r.parameters={thresholdAngle:n},n=void 0!==n?n:1,!0===e.isGeometry)return console.error("THREE.EdgesGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),ut(r);for(var i=Math.pow(10,4),a=Math.cos(gt.DEG2RAD*n),o=e.getIndex(),s=e.getAttribute("position"),l=o?o.count:s.count,c=[0,0,0],u=["a","b","c"],h=new Array(3),d={},p=[],f=0;f<l;f+=3){o?(c[0]=o.getX(f),c[1]=o.getX(f+1),c[2]=o.getX(f+2)):(c[0]=f,c[1]=f+1,c[2]=f+2);var m=Ro.a,v=Ro.b,g=Ro.c;if(m.fromBufferAttribute(s,c[0]),v.fromBufferAttribute(s,c[1]),g.fromBufferAttribute(s,c[2]),Ro.getNormal(Lo),h[0]=Math.round(m.x*i)+","+Math.round(m.y*i)+","+Math.round(m.z*i),h[1]=Math.round(v.x*i)+","+Math.round(v.y*i)+","+Math.round(v.z*i),h[2]=Math.round(g.x*i)+","+Math.round(g.y*i)+","+Math.round(g.z*i),h[0]!==h[1]&&h[1]!==h[2]&&h[2]!==h[0])for(var y=0;y<3;y++){var x=(y+1)%3,_=h[y],b=h[x],w=Ro[u[y]],M=Ro[u[x]],S=_+"_"+b,T=b+"_"+_;T in d&&d[T]?(Lo.dot(d[T].normal)<=a&&(p.push(w.x,w.y,w.z),p.push(M.x,M.y,M.z)),d[T]=null):S in d||(d[S]={index0:c[y],index1:c[x],normal:Lo.clone()})}}for(var E in d)if(d[E]){var A=d[E],L=A.index0,R=A.index1;Eo.fromBufferAttribute(s,L),Ao.fromBufferAttribute(s,R),p.push(Eo.x,Eo.y,Eo.z),p.push(Ao.x,Ao.y,Ao.z)}return r.setAttribute("position",new dn(p,3)),r}return lt(e,t),e}(Sn),Po=function(t,e,n){n=n||2;var r,i,a,o,s,l,c,u=e&&e.length,h=u?e[0]*n:t.length,d=Do(t,0,h,n,!0),p=[];if(!d||d.next===d.prev)return p;if(u&&(d=function(t,e,n,r){var i,a,o,s=[];for(i=0,a=e.length;i<a;i++)(o=Do(t,e[i]*r,i<a-1?e[i+1]*r:t.length,r,!1))===o.next&&(o.steiner=!0),s.push(Vo(o));for(s.sort(Ho),i=0;i<s.length;i++)Go(s[i],n),n=Io(n,n.next);return n}(t,e,d,n)),t.length>80*n){r=a=t[0],i=o=t[1];for(var f=n;f<h;f+=n)(s=t[f])<r&&(r=s),(l=t[f+1])<i&&(i=l),s>a&&(a=s),l>o&&(o=l);c=0!==(c=Math.max(a-r,o-i))?1/c:0}return No(d,p,n,r,i,c),p};function Do(t,e,n,r,i){var a,o;if(i===function(t,e,n,r){for(var i=0,a=e,o=n-r;a<n;a+=r)i+=(t[o]-t[a])*(t[a+1]+t[o+1]),o=a;return i}(t,e,n,r)>0)for(a=e;a<n;a+=r)o=$o(a,t[a],t[a+1],o);else for(a=n-r;a>=e;a-=r)o=$o(a,t[a],t[a+1],o);return o&&Xo(o,o.next)&&(ts(o),o=o.next),o}function Io(t,e){if(!t)return t;e||(e=t);var n,r=t;do{if(n=!1,r.steiner||!Xo(r,r.next)&&0!==qo(r.prev,r,r.next))r=r.next;else{if(ts(r),(r=e=r.prev)===r.next)break;n=!0}}while(n||r!==e);return e}function No(t,e,n,r,i,a,o){if(t){!o&&a&&function(t,e,n,r){var i=t;do{null===i.z&&(i.z=ko(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,n,r,i,a,o,s,l,c=1;do{for(n=t,t=null,a=null,o=0;n;){for(o++,r=n,s=0,e=0;e<c&&(s++,r=r.nextZ);e++);for(l=c;s>0||l>0&&r;)0!==s&&(0===l||!r||n.z<=r.z)?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,l--),a?a.nextZ=i:t=i,i.prevZ=a,a=i;n=r}a.nextZ=null,c*=2}while(o>1)}(i)}(t,r,i,a);for(var s,l,c=t;t.prev!==t.next;)if(s=t.prev,l=t.next,a?Oo(t,r,i,a):Bo(t))e.push(s.i/n),e.push(t.i/n),e.push(l.i/n),ts(t),t=l.next,c=l.next;else if((t=l)===c){o?1===o?No(t=zo(Io(t),e,n),e,n,r,i,a,2):2===o&&Fo(t,e,n,r,i,a):No(Io(t),e,n,r,i,a,1);break}}}function Bo(t){var e=t.prev,n=t,r=t.next;if(qo(e,n,r)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(Wo(e.x,e.y,n.x,n.y,r.x,r.y,i.x,i.y)&&qo(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function Oo(t,e,n,r){var i=t.prev,a=t,o=t.next;if(qo(i,a,o)>=0)return!1;for(var s=i.x<a.x?i.x<o.x?i.x:o.x:a.x<o.x?a.x:o.x,l=i.y<a.y?i.y<o.y?i.y:o.y:a.y<o.y?a.y:o.y,c=i.x>a.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,u=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,h=ko(s,l,e,n,r),d=ko(c,u,e,n,r),p=t.prevZ,f=t.nextZ;p&&p.z>=h&&f&&f.z<=d;){if(p!==t.prev&&p!==t.next&&Wo(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&qo(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==t.prev&&f!==t.next&&Wo(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&qo(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=h;){if(p!==t.prev&&p!==t.next&&Wo(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&qo(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==t.prev&&f!==t.next&&Wo(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&qo(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function zo(t,e,n){var r=t;do{var i=r.prev,a=r.next.next;!Xo(i,a)&&Yo(i,r,r.next,a)&&Qo(i,a)&&Qo(a,i)&&(e.push(i.i/n),e.push(r.i/n),e.push(a.i/n),ts(r),ts(r.next),r=t=a),r=r.next}while(r!==t);return Io(r)}function Fo(t,e,n,r,i,a){var o=t;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&jo(o,s)){var l=Ko(o,s);return o=Io(o,o.next),l=Io(l,l.next),No(o,e,n,r,i,a),void No(l,e,n,r,i,a)}s=s.next}o=o.next}while(o!==t)}function Ho(t,e){return t.x-e.x}function Go(t,e){if(e=function(t,e){var n,r=e,i=t.x,a=t.y,o=-1/0;do{if(a<=r.y&&a>=r.next.y&&r.next.y!==r.y){var s=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=i&&s>o){if(o=s,s===i){if(a===r.y)return r;if(a===r.next.y)return r.next}n=r.x<r.next.x?r:r.next}}r=r.next}while(r!==e);if(!n)return null;if(i===o)return n;var l,c=n,u=n.x,h=n.y,d=1/0;r=n;do{i>=r.x&&r.x>=u&&i!==r.x&&Wo(a<h?i:o,a,u,h,a<h?o:i,a,r.x,r.y)&&(l=Math.abs(a-r.y)/(i-r.x),Qo(r,t)&&(l<d||l===d&&(r.x>n.x||r.x===n.x&&Uo(n,r)))&&(n=r,d=l)),r=r.next}while(r!==c);return n}(t,e)){var n=Ko(e,t);Io(e,e.next),Io(n,n.next)}}function Uo(t,e){return qo(t.prev,t,e.prev)<0&&qo(e.next,t,t.next)<0}function ko(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Vo(t){var e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function Wo(t,e,n,r,i,a,o,s){return(i-o)*(e-s)-(t-o)*(a-s)>=0&&(t-o)*(r-s)-(n-o)*(e-s)>=0&&(n-o)*(a-s)-(i-o)*(r-s)>=0}function jo(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&Yo(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(Qo(t,e)&&Qo(e,t)&&function(t,e){var n=t,r=!1,i=(t.x+e.x)/2,a=(t.y+e.y)/2;do{n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)&&(qo(t.prev,t,e.prev)||qo(t,e.prev,e))||Xo(t,e)&&qo(t.prev,t,t.next)>0&&qo(e.prev,e,e.next)>0)}function qo(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Xo(t,e){return t.x===e.x&&t.y===e.y}function Yo(t,e,n,r){var i=Jo(qo(t,e,n)),a=Jo(qo(t,e,r)),o=Jo(qo(n,r,t)),s=Jo(qo(n,r,e));return i!==a&&o!==s||(!(0!==i||!Zo(t,n,e))||(!(0!==a||!Zo(t,r,e))||(!(0!==o||!Zo(n,t,r))||!(0!==s||!Zo(n,e,r)))))}function Zo(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function Jo(t){return t>0?1:t<0?-1:0}function Qo(t,e){return qo(t.prev,t,t.next)<0?qo(t,e,t.next)>=0&&qo(t,t.prev,e)>=0:qo(t,e,t.prev)<0||qo(t,t.next,e)<0}function Ko(t,e){var n=new es(t.i,t.x,t.y),r=new es(e.i,e.x,e.y),i=t.next,a=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function $o(t,e,n,r){var i=new es(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function ts(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function es(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var ns={area:function(t){for(var e=t.length,n=0,r=e-1,i=0;i<e;r=i++)n+=t[r].x*t[i].y-t[i].x*t[r].y;return.5*n},isClockWise:function(t){return ns.area(t)<0},triangulateShape:function(t,e){var n=[],r=[],i=[];rs(t),is(n,t);var a=t.length;e.forEach(rs);for(var o=0;o<e.length;o++)r.push(a),a+=e[o].length,is(n,e[o]);for(var s=Po(n,r),l=0;l<s.length;l+=3)i.push(s.slice(l,l+3));return i}};function rs(t){var e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function is(t,e){for(var n=0;n<e.length;n++)t.push(e[n].x),t.push(e[n].y)}var as=function(t){function e(e,n){var r;(r=t.call(this)||this).type="ExtrudeGeometry",r.parameters={shapes:e,options:n},e=Array.isArray(e)?e:[e];for(var i=ut(r),a=[],o=[],s=0,l=e.length;s<l;s++){c(e[s])}function c(t){var e=[],r=void 0!==n.curveSegments?n.curveSegments:12,s=void 0!==n.steps?n.steps:1,l=void 0!==n.depth?n.depth:100,c=void 0===n.bevelEnabled||n.bevelEnabled,u=void 0!==n.bevelThickness?n.bevelThickness:6,h=void 0!==n.bevelSize?n.bevelSize:u-2,d=void 0!==n.bevelOffset?n.bevelOffset:0,p=void 0!==n.bevelSegments?n.bevelSegments:3,f=n.extrudePath,m=void 0!==n.UVGenerator?n.UVGenerator:os;void 0!==n.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),l=n.amount);var v,g,y,x,_,b=!1;f&&(v=f.getSpacedPoints(s),b=!0,c=!1,g=f.computeFrenetFrames(s,!1),y=new Rt,x=new Rt,_=new Rt),c||(p=0,u=0,h=0,d=0);var w=t.extractPoints(r),M=w.shape,S=w.holes;if(!ns.isClockWise(M)){M=M.reverse();for(var T=0,E=S.length;T<E;T++){var A=S[T];ns.isClockWise(A)&&(S[T]=A.reverse())}}for(var L=ns.triangulateShape(M,S),R=M,C=0,P=S.length;C<P;C++){var D=S[C];M=M.concat(D)}function I(t,e,n){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(n).add(t)}var N=M.length,B=L.length;function O(t,e,n){var r,i,a,o=t.x-e.x,s=t.y-e.y,l=n.x-t.x,c=n.y-t.y,u=o*o+s*s,h=o*c-s*l;if(Math.abs(h)>Number.EPSILON){var d=Math.sqrt(u),p=Math.sqrt(l*l+c*c),f=e.x-s/d,m=e.y+o/d,v=((n.x-c/p-f)*c-(n.y+l/p-m)*l)/(o*c-s*l),g=(r=f+o*v-t.x)*r+(i=m+s*v-t.y)*i;if(g<=2)return new yt(r,i);a=Math.sqrt(g/2)}else{var y=!1;o>Number.EPSILON?l>Number.EPSILON&&(y=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(c)&&(y=!0),y?(r=-s,i=o,a=Math.sqrt(u)):(r=o,i=s,a=Math.sqrt(u/2))}return new yt(r/a,i/a)}for(var z=[],F=0,H=R.length,G=H-1,U=F+1;F<H;F++,G++,U++)G===H&&(G=0),U===H&&(U=0),z[F]=O(R[F],R[G],R[U]);for(var k,V=[],W=z.concat(),j=0,q=S.length;j<q;j++){var X=S[j];k=[];for(var Y=0,Z=X.length,J=Z-1,Q=Y+1;Y<Z;Y++,J++,Q++)J===Z&&(J=0),Q===Z&&(Q=0),k[Y]=O(X[Y],X[J],X[Q]);V.push(k),W=W.concat(k)}for(var K=0;K<p;K++){for(var $=K/p,tt=u*Math.cos($*Math.PI/2),et=h*Math.sin($*Math.PI/2)+d,nt=0,rt=R.length;nt<rt;nt++){var it=I(R[nt],z[nt],et);It(it.x,it.y,-tt)}for(var at=0,ot=S.length;at<ot;at++){var st=S[at];k=V[at];for(var lt=0,ct=st.length;lt<ct;lt++){var ut=I(st[lt],k[lt],et);It(ut.x,ut.y,-tt)}}}for(var ht=h+d,dt=0;dt<N;dt++){var pt=c?I(M[dt],W[dt],ht):M[dt];b?(x.copy(g.normals[0]).multiplyScalar(pt.x),y.copy(g.binormals[0]).multiplyScalar(pt.y),_.copy(v[0]).add(x).add(y),It(_.x,_.y,_.z)):It(pt.x,pt.y,0)}for(var ft=1;ft<=s;ft++)for(var mt=0;mt<N;mt++){var vt=c?I(M[mt],W[mt],ht):M[mt];b?(x.copy(g.normals[ft]).multiplyScalar(vt.x),y.copy(g.binormals[ft]).multiplyScalar(vt.y),_.copy(v[ft]).add(x).add(y),It(_.x,_.y,_.z)):It(vt.x,vt.y,l/s*ft)}for(var gt=p-1;gt>=0;gt--){for(var xt=gt/p,_t=u*Math.cos(xt*Math.PI/2),bt=h*Math.sin(xt*Math.PI/2)+d,wt=0,Mt=R.length;wt<Mt;wt++){var St=I(R[wt],z[wt],bt);It(St.x,St.y,l+_t)}for(var Tt=0,Et=S.length;Tt<Et;Tt++){var At=S[Tt];k=V[Tt];for(var Lt=0,Ct=At.length;Lt<Ct;Lt++){var Pt=I(At[Lt],k[Lt],bt);b?It(Pt.x,Pt.y+v[s-1].y,v[s-1].x+_t):It(Pt.x,Pt.y,l+_t)}}}function Dt(t,e){for(var n=t.length;--n>=0;){var r=n,i=n-1;i<0&&(i=t.length-1);for(var a=0,o=s+2*p;a<o;a++){var l=N*a,c=N*(a+1);Bt(e+r+l,e+i+l,e+i+c,e+r+c)}}}function It(t,n,r){e.push(t),e.push(n),e.push(r)}function Nt(t,e,n){Ot(t),Ot(e),Ot(n);var r=a.length/3,o=m.generateTopUV(i,a,r-3,r-2,r-1);zt(o[0]),zt(o[1]),zt(o[2])}function Bt(t,e,n,r){Ot(t),Ot(e),Ot(r),Ot(e),Ot(n),Ot(r);var o=a.length/3,s=m.generateSideWallUV(i,a,o-6,o-3,o-2,o-1);zt(s[0]),zt(s[1]),zt(s[3]),zt(s[1]),zt(s[2]),zt(s[3])}function Ot(t){a.push(e[3*t+0]),a.push(e[3*t+1]),a.push(e[3*t+2])}function zt(t){o.push(t.x),o.push(t.y)}!function(){var t=a.length/3;if(c){for(var e=0,n=N*e,r=0;r<B;r++){var o=L[r];Nt(o[2]+n,o[1]+n,o[0]+n)}n=N*(e=s+2*p);for(var l=0;l<B;l++){var u=L[l];Nt(u[0]+n,u[1]+n,u[2]+n)}}else{for(var h=0;h<B;h++){var d=L[h];Nt(d[2],d[1],d[0])}for(var f=0;f<B;f++){var m=L[f];Nt(m[0]+N*s,m[1]+N*s,m[2]+N*s)}}i.addGroup(t,a.length/3-t,0)}(),function(){var t=a.length/3,e=0;Dt(R,e),e+=R.length;for(var n=0,r=S.length;n<r;n++){var o=S[n];Dt(o,e),e+=o.length}i.addGroup(t,a.length/3-t,1)}()}return r.setAttribute("position",new dn(a,3)),r.setAttribute("uv",new dn(o,2)),r.computeVertexNormals(),r}return lt(e,t),e.prototype.toJSON=function(){var t=Sn.prototype.toJSON.call(this);return function(t,e,n){if(n.shapes=[],Array.isArray(t))for(var r=0,i=t.length;r<i;r++){var a=t[r];n.shapes.push(a.uuid)}else n.shapes.push(t.uuid);void 0!==e.extrudePath&&(n.options.extrudePath=e.extrudePath.toJSON());return n}(this.parameters.shapes,this.parameters.options,t)},e}(Sn),os={generateTopUV:function(t,e,n,r,i){var a=e[3*n],o=e[3*n+1],s=e[3*r],l=e[3*r+1],c=e[3*i],u=e[3*i+1];return[new yt(a,o),new yt(s,l),new yt(c,u)]},generateSideWallUV:function(t,e,n,r,i,a){var o=e[3*n],s=e[3*n+1],l=e[3*n+2],c=e[3*r],u=e[3*r+1],h=e[3*r+2],d=e[3*i],p=e[3*i+1],f=e[3*i+2],m=e[3*a],v=e[3*a+1],g=e[3*a+2];return Math.abs(s-u)<.01?[new yt(o,1-l),new yt(c,1-h),new yt(d,1-f),new yt(m,1-g)]:[new yt(s,1-l),new yt(u,1-h),new yt(p,1-f),new yt(v,1-g)]}};var ss=function(t){function e(e,n){var r;void 0===e&&(e=1),void 0===n&&(n=0);var i=(1+Math.sqrt(5))/2,a=[-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1];return(r=t.call(this,a,[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,n)||this).type="IcosahedronGeometry",r.parameters={radius:e,detail:n},r}return lt(e,t),e}(So),ls=function(t){function e(e,n,r,i){var a;void 0===n&&(n=12),void 0===r&&(r=0),void 0===i&&(i=2*Math.PI),(a=t.call(this)||this).type="LatheGeometry",a.parameters={points:e,segments:n,phiStart:r,phiLength:i},n=Math.floor(n),i=gt.clamp(i,0,2*Math.PI);for(var o=[],s=[],l=[],c=1/n,u=new Rt,h=new yt,d=0;d<=n;d++)for(var p=r+d*c*i,f=Math.sin(p),m=Math.cos(p),v=0;v<=e.length-1;v++)u.x=e[v].x*f,u.y=e[v].y,u.z=e[v].x*m,s.push(u.x,u.y,u.z),h.x=d/n,h.y=v/(e.length-1),l.push(h.x,h.y);for(var g=0;g<n;g++)for(var y=0;y<e.length-1;y++){var x=y+g*e.length,_=x,b=x+e.length,w=x+e.length+1,M=x+1;o.push(_,b,M),o.push(b,w,M)}if(a.setIndex(o),a.setAttribute("position",new dn(s,3)),a.setAttribute("uv",new dn(l,2)),a.computeVertexNormals(),i===2*Math.PI)for(var S=a.attributes.normal.array,T=new Rt,E=new Rt,A=new Rt,L=n*e.length*3,R=0,C=0;R<e.length;R++,C+=3)T.x=S[C+0],T.y=S[C+1],T.z=S[C+2],E.x=S[L+C+0],E.y=S[L+C+1],E.z=S[L+C+2],A.addVectors(T,E).normalize(),S[C+0]=S[L+C+0]=A.x,S[C+1]=S[L+C+1]=A.y,S[C+2]=S[L+C+2]=A.z;return a}return lt(e,t),e}(Sn),cs=function(t){function e(e,n){var r;void 0===e&&(e=1),void 0===n&&(n=0);return(r=t.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,n)||this).type="OctahedronGeometry",r.parameters={radius:e,detail:n},r}return lt(e,t),e}(So);function us(t,e,n){Sn.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:n};var r=[],i=[],a=[],o=[],s=1e-5,l=new Rt,c=new Rt,u=new Rt,h=new Rt,d=new Rt;t.length<3&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");for(var p=e+1,f=0;f<=n;f++)for(var m=f/n,v=0;v<=e;v++){var g=v/e;t(g,m,c),i.push(c.x,c.y,c.z),g-s>=0?(t(g-s,m,u),h.subVectors(c,u)):(t(g+s,m,u),h.subVectors(u,c)),m-s>=0?(t(g,m-s,u),d.subVectors(c,u)):(t(g,m+s,u),d.subVectors(u,c)),l.crossVectors(h,d).normalize(),a.push(l.x,l.y,l.z),o.push(g,m)}for(var y=0;y<n;y++)for(var x=0;x<e;x++){var _=y*p+x,b=y*p+x+1,w=(y+1)*p+x+1,M=(y+1)*p+x;r.push(_,b,M),r.push(b,w,M)}this.setIndex(r),this.setAttribute("position",new dn(i,3)),this.setAttribute("normal",new dn(a,3)),this.setAttribute("uv",new dn(o,2))}us.prototype=Object.create(Sn.prototype),us.prototype.constructor=us;var hs=function(t){function e(e,n,r,i,a,o){var s;void 0===e&&(e=.5),void 0===n&&(n=1),void 0===r&&(r=8),void 0===i&&(i=1),void 0===a&&(a=0),void 0===o&&(o=2*Math.PI),(s=t.call(this)||this).type="RingGeometry",s.parameters={innerRadius:e,outerRadius:n,thetaSegments:r,phiSegments:i,thetaStart:a,thetaLength:o},r=Math.max(3,r);for(var l=[],c=[],u=[],h=[],d=e,p=(n-e)/(i=Math.max(1,i)),f=new Rt,m=new yt,v=0;v<=i;v++){for(var g=0;g<=r;g++){var y=a+g/r*o;f.x=d*Math.cos(y),f.y=d*Math.sin(y),c.push(f.x,f.y,f.z),u.push(0,0,1),m.x=(f.x/n+1)/2,m.y=(f.y/n+1)/2,h.push(m.x,m.y)}d+=p}for(var x=0;x<i;x++)for(var _=x*(r+1),b=0;b<r;b++){var w=b+_,M=w,S=w+r+1,T=w+r+2,E=w+1;l.push(M,S,E),l.push(S,T,E)}return s.setIndex(l),s.setAttribute("position",new dn(c,3)),s.setAttribute("normal",new dn(u,3)),s.setAttribute("uv",new dn(h,2)),s}return lt(e,t),e}(Sn),ds=function(t){function e(e,n){var r;void 0===n&&(n=12),(r=t.call(this)||this).type="ShapeGeometry",r.parameters={shapes:e,curveSegments:n};var i=[],a=[],o=[],s=[],l=0,c=0;if(!1===Array.isArray(e))h(e);else for(var u=0;u<e.length;u++)h(e[u]),r.addGroup(l,c,u),l+=c,c=0;function h(t){var e=a.length/3,r=t.extractPoints(n),l=r.shape,u=r.holes;!1===ns.isClockWise(l)&&(l=l.reverse());for(var h=0,d=u.length;h<d;h++){var p=u[h];!0===ns.isClockWise(p)&&(u[h]=p.reverse())}for(var f=ns.triangulateShape(l,u),m=0,v=u.length;m<v;m++){var g=u[m];l=l.concat(g)}for(var y=0,x=l.length;y<x;y++){var _=l[y];a.push(_.x,_.y,0),o.push(0,0,1),s.push(_.x,_.y)}for(var b=0,w=f.length;b<w;b++){var M=f[b],S=M[0]+e,T=M[1]+e,E=M[2]+e;i.push(S,T,E),c+=3}}return r.setIndex(i),r.setAttribute("position",new dn(a,3)),r.setAttribute("normal",new dn(o,3)),r.setAttribute("uv",new dn(s,2)),r}return lt(e,t),e.prototype.toJSON=function(){var t=Sn.prototype.toJSON.call(this);return function(t,e){if(e.shapes=[],Array.isArray(t))for(var n=0,r=t.length;n<r;n++){var i=t[n];e.shapes.push(i.uuid)}else e.shapes.push(t.uuid);return e}(this.parameters.shapes,t)},e}(Sn);var ps=function(t){function e(e,n,r,i,a,o,s){var l;void 0===e&&(e=1),void 0===n&&(n=8),void 0===r&&(r=6),void 0===i&&(i=0),void 0===a&&(a=2*Math.PI),void 0===o&&(o=0),void 0===s&&(s=Math.PI),(l=t.call(this)||this).type="SphereGeometry",l.parameters={radius:e,widthSegments:n,heightSegments:r,phiStart:i,phiLength:a,thetaStart:o,thetaLength:s},n=Math.max(3,Math.floor(n)),r=Math.max(2,Math.floor(r));for(var c=Math.min(o+s,Math.PI),u=0,h=[],d=new Rt,p=new Rt,f=[],m=[],v=[],g=[],y=0;y<=r;y++){var x=[],_=y/r,b=0;0==y&&0==o?b=.5/n:y==r&&c==Math.PI&&(b=-.5/n);for(var w=0;w<=n;w++){var M=w/n;d.x=-e*Math.cos(i+M*a)*Math.sin(o+_*s),d.y=e*Math.cos(o+_*s),d.z=e*Math.sin(i+M*a)*Math.sin(o+_*s),m.push(d.x,d.y,d.z),p.copy(d).normalize(),v.push(p.x,p.y,p.z),g.push(M+b,1-_),x.push(u++)}h.push(x)}for(var S=0;S<r;S++)for(var T=0;T<n;T++){var E=h[S][T+1],A=h[S][T],L=h[S+1][T],R=h[S+1][T+1];(0!==S||o>0)&&f.push(E,A,R),(S!==r-1||c<Math.PI)&&f.push(A,L,R)}return l.setIndex(f),l.setAttribute("position",new dn(m,3)),l.setAttribute("normal",new dn(v,3)),l.setAttribute("uv",new dn(g,2)),l}return lt(e,t),e}(Sn),fs=function(t){function e(e,n){var r;void 0===e&&(e=1),void 0===n&&(n=0);return(r=t.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,n)||this).type="TetrahedronGeometry",r.parameters={radius:e,detail:n},r}return lt(e,t),e}(So),ms=function(t){function e(e,n){var r;void 0===n&&(n={});var i=n.font;if(!i||!i.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new Sn||ut(r);var a=i.generateShapes(e,n.size);return n.depth=void 0!==n.height?n.height:50,void 0===n.bevelThickness&&(n.bevelThickness=10),void 0===n.bevelSize&&(n.bevelSize=8),void 0===n.bevelEnabled&&(n.bevelEnabled=!1),(r=t.call(this,a,n)||this).type="TextGeometry",r}return lt(e,t),e}(as),vs=function(t){function e(e,n,r,i,a){var o;void 0===e&&(e=1),void 0===n&&(n=.4),void 0===r&&(r=8),void 0===i&&(i=6),void 0===a&&(a=2*Math.PI),(o=t.call(this)||this).type="TorusGeometry",o.parameters={radius:e,tube:n,radialSegments:r,tubularSegments:i,arc:a},r=Math.floor(r),i=Math.floor(i);for(var s=[],l=[],c=[],u=[],h=new Rt,d=new Rt,p=new Rt,f=0;f<=r;f++)for(var m=0;m<=i;m++){var v=m/i*a,g=f/r*Math.PI*2;d.x=(e+n*Math.cos(g))*Math.cos(v),d.y=(e+n*Math.cos(g))*Math.sin(v),d.z=n*Math.sin(g),l.push(d.x,d.y,d.z),h.x=e*Math.cos(v),h.y=e*Math.sin(v),p.subVectors(d,h).normalize(),c.push(p.x,p.y,p.z),u.push(m/i),u.push(f/r)}for(var y=1;y<=r;y++)for(var x=1;x<=i;x++){var _=(i+1)*y+x-1,b=(i+1)*(y-1)+x-1,w=(i+1)*(y-1)+x,M=(i+1)*y+x;s.push(_,b,M),s.push(b,w,M)}return o.setIndex(s),o.setAttribute("position",new dn(l,3)),o.setAttribute("normal",new dn(c,3)),o.setAttribute("uv",new dn(u,2)),o}return lt(e,t),e}(Sn),gs=function(t){function e(e,n,r,i,a,o){var s;void 0===e&&(e=1),void 0===n&&(n=.4),void 0===r&&(r=64),void 0===i&&(i=8),void 0===a&&(a=2),void 0===o&&(o=3),(s=t.call(this)||this).type="TorusKnotGeometry",s.parameters={radius:e,tube:n,tubularSegments:r,radialSegments:i,p:a,q:o},r=Math.floor(r),i=Math.floor(i);for(var l=[],c=[],u=[],h=[],d=new Rt,p=new Rt,f=new Rt,m=new Rt,v=new Rt,g=new Rt,y=new Rt,x=0;x<=r;++x){var _=x/r*a*Math.PI*2;P(_,a,o,e,f),P(_+.01,a,o,e,m),g.subVectors(m,f),y.addVectors(m,f),v.crossVectors(g,y),y.crossVectors(v,g),v.normalize(),y.normalize();for(var b=0;b<=i;++b){var w=b/i*Math.PI*2,M=-n*Math.cos(w),S=n*Math.sin(w);d.x=f.x+(M*y.x+S*v.x),d.y=f.y+(M*y.y+S*v.y),d.z=f.z+(M*y.z+S*v.z),c.push(d.x,d.y,d.z),p.subVectors(d,f).normalize(),u.push(p.x,p.y,p.z),h.push(x/r),h.push(b/i)}}for(var T=1;T<=r;T++)for(var E=1;E<=i;E++){var A=(i+1)*(T-1)+(E-1),L=(i+1)*T+(E-1),R=(i+1)*T+E,C=(i+1)*(T-1)+E;l.push(A,L,C),l.push(L,R,C)}function P(t,e,n,r,i){var a=Math.cos(t),o=Math.sin(t),s=n/e*t,l=Math.cos(s);i.x=r*(2+l)*.5*a,i.y=r*(2+l)*o*.5,i.z=r*Math.sin(s)*.5}return s.setIndex(l),s.setAttribute("position",new dn(c,3)),s.setAttribute("normal",new dn(u,3)),s.setAttribute("uv",new dn(h,2)),s}return lt(e,t),e}(Sn),ys=function(t){function e(e,n,r,i,a){var o;void 0===n&&(n=64),void 0===r&&(r=1),void 0===i&&(i=8),void 0===a&&(a=!1),(o=t.call(this)||this).type="TubeGeometry",o.parameters={path:e,tubularSegments:n,radius:r,radialSegments:i,closed:a};var s=e.computeFrenetFrames(n,a);o.tangents=s.tangents,o.normals=s.normals,o.binormals=s.binormals;var l=new Rt,c=new Rt,u=new yt,h=new Rt,d=[],p=[],f=[],m=[];function v(t){h=e.getPointAt(t/n,h);for(var a=s.normals[t],o=s.binormals[t],u=0;u<=i;u++){var f=u/i*Math.PI*2,m=Math.sin(f),v=-Math.cos(f);c.x=v*a.x+m*o.x,c.y=v*a.y+m*o.y,c.z=v*a.z+m*o.z,c.normalize(),p.push(c.x,c.y,c.z),l.x=h.x+r*c.x,l.y=h.y+r*c.y,l.z=h.z+r*c.z,d.push(l.x,l.y,l.z)}}return function(){for(var t=0;t<n;t++)v(t);v(!1===a?n:0),function(){for(var t=0;t<=n;t++)for(var e=0;e<=i;e++)u.x=t/n,u.y=e/i,f.push(u.x,u.y)}(),function(){for(var t=1;t<=n;t++)for(var e=1;e<=i;e++){var r=(i+1)*(t-1)+(e-1),a=(i+1)*t+(e-1),o=(i+1)*t+e,s=(i+1)*(t-1)+e;m.push(r,a,s),m.push(a,o,s)}}()}(),o.setIndex(m),o.setAttribute("position",new dn(d,3)),o.setAttribute("normal",new dn(p,3)),o.setAttribute("uv",new dn(f,2)),o}return lt(e,t),e.prototype.toJSON=function(){var t=Sn.prototype.toJSON.call(this);return t.path=this.parameters.path.toJSON(),t},e}(Sn),xs=function(t){function e(e){var n;if((n=t.call(this)||this).type="WireframeGeometry",!0===e.isGeometry)return console.error("THREE.WireframeGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),ut(n);var r=[],i=[0,0],a={},o=new Rt;if(null!==e.index){var s=e.attributes.position,l=e.index,c=e.groups;0===c.length&&(c=[{start:0,count:l.count,materialIndex:0}]);for(var u=0,h=c.length;u<h;++u)for(var d=c[u],p=d.start,f=p,m=p+d.count;f<m;f+=3)for(var v=0;v<3;v++){var g=l.getX(f+v),y=l.getX(f+(v+1)%3);i[0]=Math.min(g,y),i[1]=Math.max(g,y);var x=i[0]+","+i[1];void 0===a[x]&&(a[x]={index1:i[0],index2:i[1]})}for(var _ in a){var b=a[_];o.fromBufferAttribute(s,b.index1),r.push(o.x,o.y,o.z),o.fromBufferAttribute(s,b.index2),r.push(o.x,o.y,o.z)}}else for(var w=e.attributes.position,M=0,S=w.count/3;M<S;M++)for(var T=0;T<3;T++){var E=3*M+T;o.fromBufferAttribute(w,E),r.push(o.x,o.y,o.z);var A=3*M+(T+1)%3;o.fromBufferAttribute(w,A),r.push(o.x,o.y,o.z)}return n.setAttribute("position",new dn(r,3)),n}return lt(e,t),e}(Sn),_s=Object.freeze({__proto__:null,BoxGeometry:Wn,BoxBufferGeometry:Wn,CircleGeometry:bo,CircleBufferGeometry:bo,ConeGeometry:Mo,ConeBufferGeometry:Mo,CylinderGeometry:wo,CylinderBufferGeometry:wo,DodecahedronGeometry:To,DodecahedronBufferGeometry:To,EdgesGeometry:Co,ExtrudeGeometry:as,ExtrudeBufferGeometry:as,IcosahedronGeometry:ss,IcosahedronBufferGeometry:ss,LatheGeometry:ls,LatheBufferGeometry:ls,OctahedronGeometry:cs,OctahedronBufferGeometry:cs,ParametricGeometry:us,ParametricBufferGeometry:us,PlaneGeometry:sr,PlaneBufferGeometry:sr,PolyhedronGeometry:So,PolyhedronBufferGeometry:So,RingGeometry:hs,RingBufferGeometry:hs,ShapeGeometry:ds,ShapeBufferGeometry:ds,SphereGeometry:ps,SphereBufferGeometry:ps,TetrahedronGeometry:fs,TetrahedronBufferGeometry:fs,TextGeometry:ms,TextBufferGeometry:ms,TorusGeometry:vs,TorusBufferGeometry:vs,TorusKnotGeometry:gs,TorusKnotBufferGeometry:gs,TubeGeometry:ys,TubeBufferGeometry:ys,WireframeGeometry:xs}),bs=function(t){function e(e){var n;return(n=t.call(this)||this).type="ShadowMaterial",n.color=new Ke(0),n.transparent=!0,n.setValues(e),n}return lt(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.color.copy(e.color),this},e}(je);bs.prototype.isShadowMaterial=!0;var ws=function(t){function e(e){var n;return(n=t.call(this,e)||this).type="RawShaderMaterial",n}return lt(e,t),e}(Yn);function Ms(t){je.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Ke(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ke(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new yt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.vertexTangents=!1,this.setValues(t)}function Ss(t){Ms.call(this),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new yt(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,Object.defineProperty(this,"ior",{get:function(){return(1+.4*this.reflectivity)/(1-.4*this.reflectivity)},set:function(t){this.reflectivity=gt.clamp(2.5*(t-1)/(t+1),0,1)}}),this.sheen=null,this.transmission=0,this.transmissionMap=null,this.setValues(t)}ws.prototype.isRawShaderMaterial=!0,Ms.prototype=Object.create(je.prototype),Ms.prototype.constructor=Ms,Ms.prototype.isMeshStandardMaterial=!0,Ms.prototype.copy=function(t){return je.prototype.copy.call(this,t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this.vertexTangents=t.vertexTangents,this},Ss.prototype=Object.create(Ms.prototype),Ss.prototype.constructor=Ss,Ss.prototype.isMeshPhysicalMaterial=!0,Ss.prototype.copy=function(t){return Ms.prototype.copy.call(this,t),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.reflectivity=t.reflectivity,t.sheen?this.sheen=(this.sheen||new Ke).copy(t.sheen):this.sheen=null,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this};var Ts=function(t){function e(e){var n;return(n=t.call(this)||this).type="MeshPhongMaterial",n.color=new Ke(16777215),n.specular=new Ke(1118481),n.shininess=30,n.map=null,n.lightMap=null,n.lightMapIntensity=1,n.aoMap=null,n.aoMapIntensity=1,n.emissive=new Ke(0),n.emissiveIntensity=1,n.emissiveMap=null,n.bumpMap=null,n.bumpScale=1,n.normalMap=null,n.normalMapType=0,n.normalScale=new yt(1,1),n.displacementMap=null,n.displacementScale=1,n.displacementBias=0,n.specularMap=null,n.alphaMap=null,n.envMap=null,n.combine=0,n.reflectivity=1,n.refractionRatio=.98,n.wireframe=!1,n.wireframeLinewidth=1,n.wireframeLinecap="round",n.wireframeLinejoin="round",n.skinning=!1,n.morphTargets=!1,n.morphNormals=!1,n.flatShading=!1,n.setValues(e),n}return lt(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.flatShading=e.flatShading,this},e}(je);Ts.prototype.isMeshPhongMaterial=!0;var Es=function(t){function e(e){var n;return(n=t.call(this)||this).defines={TOON:""},n.type="MeshToonMaterial",n.color=new Ke(16777215),n.map=null,n.gradientMap=null,n.lightMap=null,n.lightMapIntensity=1,n.aoMap=null,n.aoMapIntensity=1,n.emissive=new Ke(0),n.emissiveIntensity=1,n.emissiveMap=null,n.bumpMap=null,n.bumpScale=1,n.normalMap=null,n.normalMapType=0,n.normalScale=new yt(1,1),n.displacementMap=null,n.displacementScale=1,n.displacementBias=0,n.alphaMap=null,n.wireframe=!1,n.wireframeLinewidth=1,n.wireframeLinecap="round",n.wireframeLinejoin="round",n.skinning=!1,n.morphTargets=!1,n.morphNormals=!1,n.setValues(e),n}return lt(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},e}(je);Es.prototype.isMeshToonMaterial=!0;var As=function(t){function e(e){var n;return(n=t.call(this)||this).type="MeshNormalMaterial",n.bumpMap=null,n.bumpScale=1,n.normalMap=null,n.normalMapType=0,n.normalScale=new yt(1,1),n.displacementMap=null,n.displacementScale=1,n.displacementBias=0,n.wireframe=!1,n.wireframeLinewidth=1,n.fog=!1,n.skinning=!1,n.morphTargets=!1,n.morphNormals=!1,n.flatShading=!1,n.setValues(e),n}return lt(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.flatShading=e.flatShading,this},e}(je);As.prototype.isMeshNormalMaterial=!0;var Ls=function(t){function e(e){var n;return(n=t.call(this)||this).type="MeshLambertMaterial",n.color=new Ke(16777215),n.map=null,n.lightMap=null,n.lightMapIntensity=1,n.aoMap=null,n.aoMapIntensity=1,n.emissive=new Ke(0),n.emissiveIntensity=1,n.emissiveMap=null,n.specularMap=null,n.alphaMap=null,n.envMap=null,n.combine=0,n.reflectivity=1,n.refractionRatio=.98,n.wireframe=!1,n.wireframeLinewidth=1,n.wireframeLinecap="round",n.wireframeLinejoin="round",n.skinning=!1,n.morphTargets=!1,n.morphNormals=!1,n.setValues(e),n}return lt(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},e}(je);Ls.prototype.isMeshLambertMaterial=!0;var Rs=function(t){function e(e){var n;return(n=t.call(this)||this).defines={MATCAP:""},n.type="MeshMatcapMaterial",n.color=new Ke(16777215),n.matcap=null,n.map=null,n.bumpMap=null,n.bumpScale=1,n.normalMap=null,n.normalMapType=0,n.normalScale=new yt(1,1),n.displacementMap=null,n.displacementScale=1,n.displacementBias=0,n.alphaMap=null,n.skinning=!1,n.morphTargets=!1,n.morphNormals=!1,n.flatShading=!1,n.setValues(e),n}return lt(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.flatShading=e.flatShading,this},e}(je);Rs.prototype.isMeshMatcapMaterial=!0;var Cs=function(t){function e(e){var n;return(n=t.call(this)||this).type="LineDashedMaterial",n.scale=1,n.dashSize=3,n.gapSize=1,n.setValues(e),n}return lt(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this},e}(Ka);Cs.prototype.isLineDashedMaterial=!0;var Ps=Object.freeze({__proto__:null,ShadowMaterial:bs,SpriteMaterial:xa,RawShaderMaterial:ws,ShaderMaterial:Yn,PointsMaterial:co,MeshPhysicalMaterial:Ss,MeshStandardMaterial:Ms,MeshPhongMaterial:Ts,MeshToonMaterial:Es,MeshNormalMaterial:As,MeshLambertMaterial:Ls,MeshDepthMaterial:$i,MeshDistanceMaterial:ta,MeshBasicMaterial:$e,MeshMatcapMaterial:Rs,LineDashedMaterial:Cs,LineBasicMaterial:Ka,Material:je}),Ds={arraySlice:function(t,e,n){return Ds.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==n?n:t.length)):t.slice(e,n)},convertArray:function(t,e,n){return!t||!n&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){for(var e=t.length,n=new Array(e),r=0;r!==e;++r)n[r]=r;return n.sort((function(e,n){return t[e]-t[n]})),n},sortedArray:function(t,e,n){for(var r=t.length,i=new t.constructor(r),a=0,o=0;o!==r;++a)for(var s=n[a]*e,l=0;l!==e;++l)i[o++]=t[s+l];return i},flattenJSON:function(t,e,n,r){for(var i=1,a=t[0];void 0!==a&&void 0===a[r];)a=t[i++];if(void 0!==a){var o=a[r];if(void 0!==o)if(Array.isArray(o))do{void 0!==(o=a[r])&&(e.push(a.time),n.push.apply(n,o)),a=t[i++]}while(void 0!==a);else if(void 0!==o.toArray)do{void 0!==(o=a[r])&&(e.push(a.time),o.toArray(n,n.length)),a=t[i++]}while(void 0!==a);else do{void 0!==(o=a[r])&&(e.push(a.time),n.push(o)),a=t[i++]}while(void 0!==a)}},subclip:function(t,e,n,r,i){void 0===i&&(i=30);var a=t.clone();a.name=e;for(var o=[],s=0;s<a.tracks.length;++s){for(var l=a.tracks[s],c=l.getValueSize(),u=[],h=[],d=0;d<l.times.length;++d){var p=l.times[d]*i;if(!(p<n||p>=r)){u.push(l.times[d]);for(var f=0;f<c;++f)h.push(l.values[d*c+f])}}0!==u.length&&(l.times=Ds.convertArray(u,l.times.constructor),l.values=Ds.convertArray(h,l.values.constructor),o.push(l))}a.tracks=o;for(var m=1/0,v=0;v<a.tracks.length;++v)m>a.tracks[v].times[0]&&(m=a.tracks[v].times[0]);for(var g=0;g<a.tracks.length;++g)a.tracks[g].shift(-1*m);return a.resetDuration(),a},makeClipAdditive:function(t,e,n,r){void 0===e&&(e=0),void 0===n&&(n=t),void 0===r&&(r=30),r<=0&&(r=30);for(var i=n.tracks.length,a=e/r,o=function(e){var r=n.tracks[e],i=r.ValueTypeName;if("bool"===i||"string"===i)return"continue";var o=t.tracks.find((function(t){return t.name===r.name&&t.ValueTypeName===i}));if(void 0===o)return"continue";var s=0,l=r.getValueSize();r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(s=l/3);var c=0,u=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(c=u/3);var h=r.times.length-1,d=void 0;if(a<=r.times[0]){var p=s,f=l-s;d=Ds.arraySlice(r.values,p,f)}else if(a>=r.times[h]){var m=h*l+s,v=m+l-s;d=Ds.arraySlice(r.values,m,v)}else{var g=r.createInterpolant(),y=s,x=l-s;g.evaluate(a),d=Ds.arraySlice(g.resultBuffer,y,x)}"quaternion"===i&&(new Lt).fromArray(d).normalize().conjugate().toArray(d);for(var _=o.times.length,b=0;b<_;++b){var w=b*u+c;if("quaternion"===i)Lt.multiplyQuaternionsFlat(o.values,w,d,0,o.values,w);else for(var M=u-2*c,S=0;S<M;++S)o.values[w+S]-=d[S]}},s=0;s<i;++s)o(s);return t.blendMode=X,t}};function Is(t,e,n,r){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new e.constructor(n),this.sampleValues=e,this.valueSize=n}function Ns(t,e,n,r){Is.call(this,t,e,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Bs(t,e,n,r){Is.call(this,t,e,n,r)}function Os(t,e,n,r){Is.call(this,t,e,n,r)}Object.assign(Is.prototype,{evaluate:function(t){var e=this.parameterPositions,n=this._cachedIndex,r=e[n],i=e[n-1];t:{e:{var a;n:{r:if(!(t<r)){for(var o=n+2;;){if(void 0===r){if(t<i)break r;return n=e.length,this._cachedIndex=n,this.afterEnd_(n-1,t,i)}if(n===o)break;if(i=r,t<(r=e[++n]))break e}a=e.length;break n}if(t>=i)break t;var s=e[1];t<s&&(n=2,i=s);for(var l=n-2;;){if(void 0===i)return this._cachedIndex=0,this.beforeStart_(0,t,r);if(n===l)break;if(r=i,t>=(i=e[--n-1]))break e}a=n,n=0}for(;n<a;){var c=n+a>>>1;t<e[c]?a=c:n=c+1}if(r=e[n],void 0===(i=e[n-1]))return this._cachedIndex=0,this.beforeStart_(0,t,r);if(void 0===r)return n=e.length,this._cachedIndex=n,this.afterEnd_(n-1,i,t)}this._cachedIndex=n,this.intervalChanged_(n,i,r)}return this.interpolate_(n,i,t,r)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(t){for(var e=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=t*r,a=0;a!==r;++a)e[a]=n[i+a];return e},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}}),Object.assign(Is.prototype,{beforeStart_:Is.prototype.copySampleValue_,afterEnd_:Is.prototype.copySampleValue_}),Ns.prototype=Object.assign(Object.create(Is.prototype),{constructor:Ns,DefaultSettings_:{endingStart:V,endingEnd:V},intervalChanged_:function(t,e,n){var r=this.parameterPositions,i=t-2,a=t+1,o=r[i],s=r[a];if(void 0===o)switch(this.getSettings_().endingStart){case W:i=t,o=2*e-n;break;case j:o=e+r[i=r.length-2]-r[i+1];break;default:i=t,o=n}if(void 0===s)switch(this.getSettings_().endingEnd){case W:a=t,s=2*n-e;break;case j:a=1,s=n+r[1]-r[0];break;default:a=t-1,s=e}var l=.5*(n-e),c=this.valueSize;this._weightPrev=l/(e-o),this._weightNext=l/(s-n),this._offsetPrev=i*c,this._offsetNext=a*c},interpolate_:function(t,e,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,l=s-o,c=this._offsetPrev,u=this._offsetNext,h=this._weightPrev,d=this._weightNext,p=(n-e)/(r-e),f=p*p,m=f*p,v=-h*m+2*h*f-h*p,g=(1+h)*m+(-1.5-2*h)*f+(-.5+h)*p+1,y=(-1-d)*m+(1.5+d)*f+.5*p,x=d*m-d*f,_=0;_!==o;++_)i[_]=v*a[c+_]+g*a[l+_]+y*a[s+_]+x*a[u+_];return i}}),Bs.prototype=Object.assign(Object.create(Is.prototype),{constructor:Bs,interpolate_:function(t,e,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,l=s-o,c=(n-e)/(r-e),u=1-c,h=0;h!==o;++h)i[h]=a[l+h]*u+a[s+h]*c;return i}}),Os.prototype=Object.assign(Object.create(Is.prototype),{constructor:Os,interpolate_:function(t){return this.copySampleValue_(t-1)}});var zs=function(){function t(t,e,n,r){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Ds.convertArray(e,this.TimeBufferType),this.values=Ds.convertArray(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}t.toJSON=function(t){var e,n=t.constructor;if(n.toJSON!==this.toJSON)e=n.toJSON(t);else{e={name:t.name,times:Ds.convertArray(t.times,Array),values:Ds.convertArray(t.values,Array)};var r=t.getInterpolation();r!==t.DefaultInterpolation&&(e.interpolation=r)}return e.type=t.ValueTypeName,e};var e=t.prototype;return e.InterpolantFactoryMethodDiscrete=function(t){return new Os(this.times,this.values,this.getValueSize(),t)},e.InterpolantFactoryMethodLinear=function(t){return new Bs(this.times,this.values,this.getValueSize(),t)},e.InterpolantFactoryMethodSmooth=function(t){return new Ns(this.times,this.values,this.getValueSize(),t)},e.setInterpolation=function(t){var e;switch(t){case G:e=this.InterpolantFactoryMethodDiscrete;break;case U:e=this.InterpolantFactoryMethodLinear;break;case k:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){var n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(n);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=e,this},e.getInterpolation=function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return G;case this.InterpolantFactoryMethodLinear:return U;case this.InterpolantFactoryMethodSmooth:return k}},e.getValueSize=function(){return this.values.length/this.times.length},e.shift=function(t){if(0!==t)for(var e=this.times,n=0,r=e.length;n!==r;++n)e[n]+=t;return this},e.scale=function(t){if(1!==t)for(var e=this.times,n=0,r=e.length;n!==r;++n)e[n]*=t;return this},e.trim=function(t,e){for(var n=this.times,r=n.length,i=0,a=r-1;i!==r&&n[i]<t;)++i;for(;-1!==a&&n[a]>e;)--a;if(++a,0!==i||a!==r){i>=a&&(i=(a=Math.max(a,1))-1);var o=this.getValueSize();this.times=Ds.arraySlice(n,i,a),this.values=Ds.arraySlice(this.values,i*o,a*o)}return this},e.validate=function(){var t=!0,e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);var n=this.times,r=this.values,i=n.length;0===i&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);for(var a=null,o=0;o!==i;o++){var s=n[o];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,s),t=!1;break}if(null!==a&&a>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,s,a),t=!1;break}a=s}if(void 0!==r&&Ds.isTypedArray(r))for(var l=0,c=r.length;l!==c;++l){var u=r[l];if(isNaN(u)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,l,u),t=!1;break}}return t},e.optimize=function(){for(var t=Ds.arraySlice(this.times),e=Ds.arraySlice(this.values),n=this.getValueSize(),r=this.getInterpolation()===k,i=t.length-1,a=1,o=1;o<i;++o){var s=!1,l=t[o];if(l!==t[o+1]&&(1!==o||l!==t[0]))if(r)s=!0;else for(var c=o*n,u=c-n,h=c+n,d=0;d!==n;++d){var p=e[c+d];if(p!==e[u+d]||p!==e[h+d]){s=!0;break}}if(s){if(o!==a){t[a]=t[o];for(var f=o*n,m=a*n,v=0;v!==n;++v)e[m+v]=e[f+v]}++a}}if(i>0){t[a]=t[i];for(var g=i*n,y=a*n,x=0;x!==n;++x)e[y+x]=e[g+x];++a}return a!==t.length?(this.times=Ds.arraySlice(t,0,a),this.values=Ds.arraySlice(e,0,a*n)):(this.times=t,this.values=e),this},e.clone=function(){var t=Ds.arraySlice(this.times,0),e=Ds.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n},t}();zs.prototype.TimeBufferType=Float32Array,zs.prototype.ValueBufferType=Float32Array,zs.prototype.DefaultInterpolation=U;var Fs=function(t){function e(){return t.apply(this,arguments)||this}return lt(e,t),e}(zs);Fs.prototype.ValueTypeName="bool",Fs.prototype.ValueBufferType=Array,Fs.prototype.DefaultInterpolation=G,Fs.prototype.InterpolantFactoryMethodLinear=void 0,Fs.prototype.InterpolantFactoryMethodSmooth=void 0;var Hs=function(t){function e(){return t.apply(this,arguments)||this}return lt(e,t),e}(zs);Hs.prototype.ValueTypeName="color";var Gs=function(t){function e(){return t.apply(this,arguments)||this}return lt(e,t),e}(zs);function Us(t,e,n,r){Is.call(this,t,e,n,r)}Gs.prototype.ValueTypeName="number",Us.prototype=Object.assign(Object.create(Is.prototype),{constructor:Us,interpolate_:function(t,e,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(n-e)/(r-e),l=t*o,c=l+o;l!==c;l+=4)Lt.slerpFlat(i,0,a,l-o,a,l,s);return i}});var ks=function(t){function e(){return t.apply(this,arguments)||this}return lt(e,t),e.prototype.InterpolantFactoryMethodLinear=function(t){return new Us(this.times,this.values,this.getValueSize(),t)},e}(zs);ks.prototype.ValueTypeName="quaternion",ks.prototype.DefaultInterpolation=U,ks.prototype.InterpolantFactoryMethodSmooth=void 0;var Vs=function(t){function e(){return t.apply(this,arguments)||this}return lt(e,t),e}(zs);Vs.prototype.ValueTypeName="string",Vs.prototype.ValueBufferType=Array,Vs.prototype.DefaultInterpolation=G,Vs.prototype.InterpolantFactoryMethodLinear=void 0,Vs.prototype.InterpolantFactoryMethodSmooth=void 0;var Ws=function(t){function e(){return t.apply(this,arguments)||this}return lt(e,t),e}(zs);Ws.prototype.ValueTypeName="vector";var js=function(){function t(t,e,n,r){void 0===e&&(e=-1),void 0===r&&(r=q),this.name=t,this.tracks=n,this.duration=e,this.blendMode=r,this.uuid=gt.generateUUID(),this.duration<0&&this.resetDuration()}t.parse=function(t){for(var e=[],n=t.tracks,r=1/(t.fps||1),i=0,a=n.length;i!==a;++i)e.push(qs(n[i]).scale(r));var o=new this(t.name,t.duration,e,t.blendMode);return o.uuid=t.uuid,o},t.toJSON=function(t){for(var e=[],n=t.tracks,r={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode},i=0,a=n.length;i!==a;++i)e.push(zs.toJSON(n[i]));return r},t.CreateFromMorphTargetSequence=function(t,e,n,r){for(var i=e.length,a=[],o=0;o<i;o++){var s=[],l=[];s.push((o+i-1)%i,o,(o+1)%i),l.push(0,1,0);var c=Ds.getKeyframeOrder(s);s=Ds.sortedArray(s,1,c),l=Ds.sortedArray(l,1,c),r||0!==s[0]||(s.push(i),l.push(l[0])),a.push(new Gs(".morphTargetInfluences["+e[o].name+"]",s,l).scale(1/n))}return new this(t,-1,a)},t.findByName=function(t,e){var n=t;if(!Array.isArray(t)){var r=t;n=r.geometry&&r.geometry.animations||r.animations}for(var i=0;i<n.length;i++)if(n[i].name===e)return n[i];return null},t.CreateClipsFromMorphTargetSequences=function(t,e,n){for(var r={},i=/^([\w-]*?)([\d]+)$/,a=0,o=t.length;a<o;a++){var s=t[a],l=s.name.match(i);if(l&&l.length>1){var c=l[1],u=r[c];u||(r[c]=u=[]),u.push(s)}}var h=[];for(var d in r)h.push(this.CreateFromMorphTargetSequence(d,r[d],e,n));return h},t.parseAnimation=function(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(t,e,n,r,i){if(0!==n.length){var a=[],o=[];Ds.flattenJSON(n,a,o,r),0!==a.length&&i.push(new t(e,a,o))}},r=[],i=t.name||"default",a=t.fps||30,o=t.blendMode,s=t.length||-1,l=t.hierarchy||[],c=0;c<l.length;c++){var u=l[c].keys;if(u&&0!==u.length)if(u[0].morphTargets){var h={},d=void 0;for(d=0;d<u.length;d++)if(u[d].morphTargets)for(var p=0;p<u[d].morphTargets.length;p++)h[u[d].morphTargets[p]]=-1;for(var f in h){for(var m=[],v=[],g=0;g!==u[d].morphTargets.length;++g){var y=u[d];m.push(y.time),v.push(y.morphTarget===f?1:0)}r.push(new Gs(".morphTargetInfluence["+f+"]",m,v))}s=h.length*(a||1)}else{var x=".bones["+e[c].name+"]";n(Ws,x+".position",u,"pos",r),n(ks,x+".quaternion",u,"rot",r),n(Ws,x+".scale",u,"scl",r)}}return 0===r.length?null:new this(i,s,r,o)};var e=t.prototype;return e.resetDuration=function(){for(var t=0,e=0,n=this.tracks.length;e!==n;++e){var r=this.tracks[e];t=Math.max(t,r.times[r.times.length-1])}return this.duration=t,this},e.trim=function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this},e.validate=function(){for(var t=!0,e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t},e.optimize=function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this},e.clone=function(){for(var t=[],e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new this.constructor(this.name,this.duration,t,this.blendMode)},e.toJSON=function(){return this.constructor.toJSON(this)},t}();function qs(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");var e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Gs;case"vector":case"vector2":case"vector3":case"vector4":return Ws;case"color":return Hs;case"quaternion":return ks;case"bool":case"boolean":return Fs;case"string":return Vs}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){var n=[],r=[];Ds.flattenJSON(t.keys,n,r,"value"),t.times=n,t.values=r}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}var Xs={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};function Ys(t,e,n){var r=this,i=!1,a=0,o=0,s=void 0,l=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){o++,!1===i&&void 0!==r.onStart&&r.onStart(t,a,o),i=!0},this.itemEnd=function(t){a++,void 0!==r.onProgress&&r.onProgress(t,a,o),a===o&&(i=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(t){void 0!==r.onError&&r.onError(t)},this.resolveURL=function(t){return s?s(t):t},this.setURLModifier=function(t){return s=t,this},this.addHandler=function(t,e){return l.push(t,e),this},this.removeHandler=function(t){var e=l.indexOf(t);return-1!==e&&l.splice(e,2),this},this.getHandler=function(t){for(var e=0,n=l.length;e<n;e+=2){var r=l[e],i=l[e+1];if(r.global&&(r.lastIndex=0),r.test(t))return i}return null}}var Zs=new Ys;function Js(t){this.manager=void 0!==t?t:Zs,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}Object.assign(Js.prototype,{load:function(){},loadAsync:function(t,e){var n=this;return new Promise((function(r,i){n.load(t,r,e,i)}))},parse:function(){},setCrossOrigin:function(t){return this.crossOrigin=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setPath:function(t){return this.path=t,this},setResourcePath:function(t){return this.resourcePath=t,this},setRequestHeader:function(t){return this.requestHeader=t,this}});var Qs={};function Ks(t){Js.call(this,t)}Ks.prototype=Object.assign(Object.create(Js.prototype),{constructor:Ks,load:function(t,e,n,r){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);var i=this,a=Xs.get(t);if(void 0!==a)return i.manager.itemStart(t),setTimeout((function(){e&&e(a),i.manager.itemEnd(t)}),0),a;if(void 0===Qs[t]){var o,s=t.match(/^data:(.*?)(;base64)?,(.*)$/);if(s){var l=s[1],c=!!s[2],u=s[3];u=decodeURIComponent(u),c&&(u=atob(u));try{var h,d=(this.responseType||"").toLowerCase();switch(d){case"arraybuffer":case"blob":for(var p=new Uint8Array(u.length),f=0;f<u.length;f++)p[f]=u.charCodeAt(f);h="blob"===d?new Blob([p.buffer],{type:l}):p.buffer;break;case"document":var m=new DOMParser;h=m.parseFromString(u,l);break;case"json":h=JSON.parse(u);break;default:h=u}setTimeout((function(){e&&e(h),i.manager.itemEnd(t)}),0)}catch(e){setTimeout((function(){r&&r(e),i.manager.itemError(t),i.manager.itemEnd(t)}),0)}}else{for(var v in Qs[t]=[],Qs[t].push({onLoad:e,onProgress:n,onError:r}),(o=new XMLHttpRequest).open("GET",t,!0),o.addEventListener("load",(function(e){var n=this.response,r=Qs[t];if(delete Qs[t],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),Xs.add(t,n);for(var a=0,o=r.length;a<o;a++){var s=r[a];s.onLoad&&s.onLoad(n)}i.manager.itemEnd(t)}else{for(var l=0,c=r.length;l<c;l++){var u=r[l];u.onError&&u.onError(e)}i.manager.itemError(t),i.manager.itemEnd(t)}}),!1),o.addEventListener("progress",(function(e){for(var n=Qs[t],r=0,i=n.length;r<i;r++){var a=n[r];a.onProgress&&a.onProgress(e)}}),!1),o.addEventListener("error",(function(e){var n=Qs[t];delete Qs[t];for(var r=0,a=n.length;r<a;r++){var o=n[r];o.onError&&o.onError(e)}i.manager.itemError(t),i.manager.itemEnd(t)}),!1),o.addEventListener("abort",(function(e){var n=Qs[t];delete Qs[t];for(var r=0,a=n.length;r<a;r++){var o=n[r];o.onError&&o.onError(e)}i.manager.itemError(t),i.manager.itemEnd(t)}),!1),void 0!==this.responseType&&(o.responseType=this.responseType),void 0!==this.withCredentials&&(o.withCredentials=this.withCredentials),o.overrideMimeType&&o.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain"),this.requestHeader)o.setRequestHeader(v,this.requestHeader[v]);o.send(null)}return i.manager.itemStart(t),o}Qs[t].push({onLoad:e,onProgress:n,onError:r})},setResponseType:function(t){return this.responseType=t,this},setMimeType:function(t){return this.mimeType=t,this}});var $s=function(t){function e(e){return t.call(this,e)||this}lt(e,t);var n=e.prototype;return n.load=function(t,e,n,r){var i=this,a=new Ks(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,(function(n){try{e(i.parse(JSON.parse(n)))}catch(e){r?r(e):console.error(e),i.manager.itemError(t)}}),n,r)},n.parse=function(t){for(var e=[],n=0;n<t.length;n++){var r=js.parse(t[n]);e.push(r)}return e},e}(Js);function tl(t){Js.call(this,t)}tl.prototype=Object.assign(Object.create(Js.prototype),{constructor:tl,load:function(t,e,n,r){var i=this,a=[],o=new yo,s=new Ks(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(i.withCredentials);var l=0;function c(c){s.load(t[c],(function(t){var n=i.parse(t,!0);a[c]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},6===(l+=1)&&(1===n.mipmapCount&&(o.minFilter=g),o.image=a,o.format=n.format,o.needsUpdate=!0,e&&e(o))}),n,r)}if(Array.isArray(t))for(var u=0,h=t.length;u<h;++u)c(u);else s.load(t,(function(t){var n=i.parse(t,!0);if(n.isCubemap){for(var r=n.mipmaps.length/n.mipmapCount,s=0;s<r;s++){a[s]={mipmaps:[]};for(var l=0;l<n.mipmapCount;l++)a[s].mipmaps.push(n.mipmaps[s*n.mipmapCount+l]),a[s].format=n.format,a[s].width=n.width,a[s].height=n.height}o.image=a}else o.image.width=n.width,o.image.height=n.height,o.mipmaps=n.mipmaps;1===n.mipmapCount&&(o.minFilter=g),o.format=n.format,o.needsUpdate=!0,e&&e(o)}),n,r);return o}});var el=function(t){function e(e){return t.call(this,e)||this}return lt(e,t),e.prototype.load=function(t,e,n,r){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);var i=this,a=Xs.get(t);if(void 0!==a)return i.manager.itemStart(t),setTimeout((function(){e&&e(a),i.manager.itemEnd(t)}),0),a;var o=document.createElementNS("http://www.w3.org/1999/xhtml","img");function s(){o.removeEventListener("load",s,!1),o.removeEventListener("error",l,!1),Xs.add(t,this),e&&e(this),i.manager.itemEnd(t)}function l(e){o.removeEventListener("load",s,!1),o.removeEventListener("error",l,!1),r&&r(e),i.manager.itemError(t),i.manager.itemEnd(t)}return o.addEventListener("load",s,!1),o.addEventListener("error",l,!1),"data:"!==t.substr(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),i.manager.itemStart(t),o.src=t,o},e}(Js),nl=function(t){function e(e){return t.call(this,e)||this}return lt(e,t),e.prototype.load=function(t,e,n,r){var i=new $n,a=new el(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var o=0;function s(n){a.load(t[n],(function(t){i.images[n]=t,6===++o&&(i.needsUpdate=!0,e&&e(i))}),void 0,r)}for(var l=0;l<t.length;++l)s(l);return i},e}(Js);function rl(t){Js.call(this,t)}function il(t){Js.call(this,t)}function al(){this.type="Curve",this.arcLengthDivisions=200}rl.prototype=Object.assign(Object.create(Js.prototype),{constructor:rl,load:function(t,e,n,r){var i=this,a=new er,o=new Ks(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(i.withCredentials),o.load(t,(function(t){var n=i.parse(t);n&&(void 0!==n.image?a.image=n.image:void 0!==n.data&&(a.image.width=n.width,a.image.height=n.height,a.image.data=n.data),a.wrapS=void 0!==n.wrapS?n.wrapS:d,a.wrapT=void 0!==n.wrapT?n.wrapT:d,a.magFilter=void 0!==n.magFilter?n.magFilter:g,a.minFilter=void 0!==n.minFilter?n.minFilter:g,a.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.encoding&&(a.encoding=n.encoding),void 0!==n.flipY&&(a.flipY=n.flipY),void 0!==n.format&&(a.format=n.format),void 0!==n.type&&(a.type=n.type),void 0!==n.mipmaps&&(a.mipmaps=n.mipmaps,a.minFilter=x),1===n.mipmapCount&&(a.minFilter=g),a.needsUpdate=!0,e&&e(a,n))}),n,r),a}}),il.prototype=Object.assign(Object.create(Js.prototype),{constructor:il,load:function(t,e,n,r){var i=new Mt,a=new el(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(t,(function(n){i.image=n;var r=t.search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/);i.format=r?E:A,i.needsUpdate=!0,void 0!==e&&e(i)}),n,r),i}}),Object.assign(al.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(t,e){var n=this.getUtoTmapping(t);return this.getPoint(n,e)},getPoints:function(t){void 0===t&&(t=5);for(var e=[],n=0;n<=t;n++)e.push(this.getPoint(n/t));return e},getSpacedPoints:function(t){void 0===t&&(t=5);for(var e=[],n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,n=[],r=this.getPoint(0),i=0;n.push(0);for(var a=1;a<=t;a++)i+=(e=this.getPoint(a/t)).distanceTo(r),n.push(i),r=e;return this.cacheArcLengths=n,n},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){var n,r=this.getLengths(),i=0,a=r.length;n=e||t*r[a-1];for(var o,s=0,l=a-1;s<=l;)if((o=r[i=Math.floor(s+(l-s)/2)]-n)<0)s=i+1;else{if(!(o>0)){l=i;break}l=i-1}if(r[i=l]===n)return i/(a-1);var c=r[i];return(i+(n-c)/(r[i+1]-c))/(a-1)},getTangent:function(t,e){var n=1e-4,r=t-n,i=t+n;r<0&&(r=0),i>1&&(i=1);var a=this.getPoint(r),o=this.getPoint(i),s=e||(a.isVector2?new yt:new Rt);return s.copy(o).sub(a).normalize(),s},getTangentAt:function(t,e){var n=this.getUtoTmapping(t);return this.getTangent(n,e)},computeFrenetFrames:function(t,e){for(var n=new Rt,r=[],i=[],a=[],o=new Rt,s=new re,l=0;l<=t;l++){var c=l/t;r[l]=this.getTangentAt(c,new Rt),r[l].normalize()}i[0]=new Rt,a[0]=new Rt;var u=Number.MAX_VALUE,h=Math.abs(r[0].x),d=Math.abs(r[0].y),p=Math.abs(r[0].z);h<=u&&(u=h,n.set(1,0,0)),d<=u&&(u=d,n.set(0,1,0)),p<=u&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],o),a[0].crossVectors(r[0],i[0]);for(var f=1;f<=t;f++){if(i[f]=i[f-1].clone(),a[f]=a[f-1].clone(),o.crossVectors(r[f-1],r[f]),o.length()>Number.EPSILON){o.normalize();var m=Math.acos(gt.clamp(r[f-1].dot(r[f]),-1,1));i[f].applyMatrix4(s.makeRotationAxis(o,m))}a[f].crossVectors(r[f],i[f])}if(!0===e){var v=Math.acos(gt.clamp(i[0].dot(i[t]),-1,1));v/=t,r[0].dot(o.crossVectors(i[0],i[t]))>0&&(v=-v);for(var g=1;g<=t;g++)i[g].applyMatrix4(s.makeRotationAxis(r[g],v*g)),a[g].crossVectors(r[g],i[g])}return{tangents:r,normals:i,binormals:a}},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this},toJSON:function(){var t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t},fromJSON:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}});var ol=function(t){function e(e,n,r,i,a,o,s,l){var c;return void 0===e&&(e=0),void 0===n&&(n=0),void 0===r&&(r=1),void 0===i&&(i=1),void 0===a&&(a=0),void 0===o&&(o=2*Math.PI),void 0===s&&(s=!1),void 0===l&&(l=0),(c=t.call(this)||this).type="EllipseCurve",c.aX=e,c.aY=n,c.xRadius=r,c.yRadius=i,c.aStartAngle=a,c.aEndAngle=o,c.aClockwise=s,c.aRotation=l,c}lt(e,t);var n=e.prototype;return n.getPoint=function(t,e){for(var n=e||new yt,r=2*Math.PI,i=this.aEndAngle-this.aStartAngle,a=Math.abs(i)<Number.EPSILON;i<0;)i+=r;for(;i>r;)i-=r;i<Number.EPSILON&&(i=a?0:r),!0!==this.aClockwise||a||(i===r?i=-r:i-=r);var o=this.aStartAngle+t*i,s=this.aX+this.xRadius*Math.cos(o),l=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){var c=Math.cos(this.aRotation),u=Math.sin(this.aRotation),h=s-this.aX,d=l-this.aY;s=h*c-d*u+this.aX,l=h*u+d*c+this.aY}return n.set(s,l)},n.copy=function(e){return t.prototype.copy.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},n.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e},n.fromJSON=function(e){return t.prototype.fromJSON.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},e}(al);ol.prototype.isEllipseCurve=!0;var sl=function(t){function e(e,n,r,i,a,o){var s;return(s=t.call(this,e,n,r,r,i,a,o)||this).type="ArcCurve",s}return lt(e,t),e}(ol);function ll(){var t=0,e=0,n=0,r=0;function i(i,a,o,s){t=i,e=o,n=-3*i+3*a-2*o-s,r=2*i-2*a+o+s}return{initCatmullRom:function(t,e,n,r,a){i(e,n,a*(n-t),a*(r-e))},initNonuniformCatmullRom:function(t,e,n,r,a,o,s){var l=(e-t)/a-(n-t)/(a+o)+(n-e)/o,c=(n-e)/o-(r-e)/(o+s)+(r-n)/s;i(e,n,l*=o,c*=o)},calc:function(i){var a=i*i;return t+e*i+n*a+r*(a*i)}}}sl.prototype.isArcCurve=!0;var cl=new Rt,ul=new ll,hl=new ll,dl=new ll,pl=function(t){function e(e,n,r,i){var a;return void 0===e&&(e=[]),void 0===n&&(n=!1),void 0===r&&(r="centripetal"),void 0===i&&(i=.5),(a=t.call(this)||this).type="CatmullRomCurve3",a.points=e,a.closed=n,a.curveType=r,a.tension=i,a}lt(e,t);var n=e.prototype;return n.getPoint=function(t,e){void 0===e&&(e=new Rt);var n,r,i=e,a=this.points,o=a.length,s=(o-(this.closed?0:1))*t,l=Math.floor(s),c=s-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/o)+1)*o:0===c&&l===o-1&&(l=o-2,c=1),this.closed||l>0?n=a[(l-1)%o]:(cl.subVectors(a[0],a[1]).add(a[0]),n=cl);var u=a[l%o],h=a[(l+1)%o];if(this.closed||l+2<o?r=a[(l+2)%o]:(cl.subVectors(a[o-1],a[o-2]).add(a[o-1]),r=cl),"centripetal"===this.curveType||"chordal"===this.curveType){var d="chordal"===this.curveType?.5:.25,p=Math.pow(n.distanceToSquared(u),d),f=Math.pow(u.distanceToSquared(h),d),m=Math.pow(h.distanceToSquared(r),d);f<1e-4&&(f=1),p<1e-4&&(p=f),m<1e-4&&(m=f),ul.initNonuniformCatmullRom(n.x,u.x,h.x,r.x,p,f,m),hl.initNonuniformCatmullRom(n.y,u.y,h.y,r.y,p,f,m),dl.initNonuniformCatmullRom(n.z,u.z,h.z,r.z,p,f,m)}else"catmullrom"===this.curveType&&(ul.initCatmullRom(n.x,u.x,h.x,r.x,this.tension),hl.initCatmullRom(n.y,u.y,h.y,r.y,this.tension),dl.initCatmullRom(n.z,u.z,h.z,r.z,this.tension));return i.set(ul.calc(c),hl.calc(c),dl.calc(c)),i},n.copy=function(e){t.prototype.copy.call(this,e),this.points=[];for(var n=0,r=e.points.length;n<r;n++){var i=e.points[n];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},n.toJSON=function(){var e=t.prototype.toJSON.call(this);e.points=[];for(var n=0,r=this.points.length;n<r;n++){var i=this.points[n];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e},n.fromJSON=function(e){t.prototype.fromJSON.call(this,e),this.points=[];for(var n=0,r=e.points.length;n<r;n++){var i=e.points[n];this.points.push((new Rt).fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},e}(al);function fl(t,e,n,r,i){var a=.5*(r-e),o=.5*(i-n),s=t*t;return(2*n-2*r+a+o)*(t*s)+(-3*n+3*r-2*a-o)*s+a*t+n}function ml(t,e,n,r){return function(t,e){var n=1-t;return n*n*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,n)+function(t,e){return t*t*e}(t,r)}function vl(t,e,n,r,i){return function(t,e){var n=1-t;return n*n*n*e}(t,e)+function(t,e){var n=1-t;return 3*n*n*t*e}(t,n)+function(t,e){return 3*(1-t)*t*t*e}(t,r)+function(t,e){return t*t*t*e}(t,i)}pl.prototype.isCatmullRomCurve3=!0;var gl=function(t){function e(e,n,r,i){var a;return void 0===e&&(e=new yt),void 0===n&&(n=new yt),void 0===r&&(r=new yt),void 0===i&&(i=new yt),(a=t.call(this)||this).type="CubicBezierCurve",a.v0=e,a.v1=n,a.v2=r,a.v3=i,a}lt(e,t);var n=e.prototype;return n.getPoint=function(t,e){void 0===e&&(e=new yt);var n=e,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(vl(t,r.x,i.x,a.x,o.x),vl(t,r.y,i.y,a.y,o.y)),n},n.copy=function(e){return t.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},n.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},n.fromJSON=function(e){return t.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},e}(al);gl.prototype.isCubicBezierCurve=!0;var yl=function(t){function e(e,n,r,i){var a;return void 0===e&&(e=new Rt),void 0===n&&(n=new Rt),void 0===r&&(r=new Rt),void 0===i&&(i=new Rt),(a=t.call(this)||this).type="CubicBezierCurve3",a.v0=e,a.v1=n,a.v2=r,a.v3=i,a}lt(e,t);var n=e.prototype;return n.getPoint=function(t,e){void 0===e&&(e=new Rt);var n=e,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(vl(t,r.x,i.x,a.x,o.x),vl(t,r.y,i.y,a.y,o.y),vl(t,r.z,i.z,a.z,o.z)),n},n.copy=function(e){return t.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},n.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},n.fromJSON=function(e){return t.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},e}(al);yl.prototype.isCubicBezierCurve3=!0;var xl=function(t){function e(e,n){var r;return void 0===e&&(e=new yt),void 0===n&&(n=new yt),(r=t.call(this)||this).type="LineCurve",r.v1=e,r.v2=n,r}lt(e,t);var n=e.prototype;return n.getPoint=function(t,e){void 0===e&&(e=new yt);var n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n},n.getPointAt=function(t,e){return this.getPoint(t,e)},n.getTangent=function(t,e){var n=e||new yt;return n.copy(this.v2).sub(this.v1).normalize(),n},n.copy=function(e){return t.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},n.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},n.fromJSON=function(e){return t.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},e}(al);xl.prototype.isLineCurve=!0;var _l=function(t){function e(e,n){var r;return void 0===e&&(e=new Rt),void 0===n&&(n=new Rt),(r=t.call(this)||this).type="LineCurve3",r.isLineCurve3=!0,r.v1=e,r.v2=n,r}lt(e,t);var n=e.prototype;return n.getPoint=function(t,e){void 0===e&&(e=new Rt);var n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n},n.getPointAt=function(t,e){return this.getPoint(t,e)},n.copy=function(e){return t.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},n.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},n.fromJSON=function(e){return t.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},e}(al),bl=function(t){function e(e,n,r){var i;return void 0===e&&(e=new yt),void 0===n&&(n=new yt),void 0===r&&(r=new yt),(i=t.call(this)||this).type="QuadraticBezierCurve",i.v0=e,i.v1=n,i.v2=r,i}lt(e,t);var n=e.prototype;return n.getPoint=function(t,e){void 0===e&&(e=new yt);var n=e,r=this.v0,i=this.v1,a=this.v2;return n.set(ml(t,r.x,i.x,a.x),ml(t,r.y,i.y,a.y)),n},n.copy=function(e){return t.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},n.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},n.fromJSON=function(e){return t.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},e}(al);bl.prototype.isQuadraticBezierCurve=!0;var wl=function(t){function e(e,n,r){var i;return void 0===e&&(e=new Rt),void 0===n&&(n=new Rt),void 0===r&&(r=new Rt),(i=t.call(this)||this).type="QuadraticBezierCurve3",i.v0=e,i.v1=n,i.v2=r,i}lt(e,t);var n=e.prototype;return n.getPoint=function(t,e){void 0===e&&(e=new Rt);var n=e,r=this.v0,i=this.v1,a=this.v2;return n.set(ml(t,r.x,i.x,a.x),ml(t,r.y,i.y,a.y),ml(t,r.z,i.z,a.z)),n},n.copy=function(e){return t.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},n.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},n.fromJSON=function(e){return t.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},e}(al);wl.prototype.isQuadraticBezierCurve3=!0;var Ml=function(t){function e(e){var n;return void 0===e&&(e=[]),(n=t.call(this)||this).type="SplineCurve",n.points=e,n}lt(e,t);var n=e.prototype;return n.getPoint=function(t,e){void 0===e&&(e=new yt);var n=e,r=this.points,i=(r.length-1)*t,a=Math.floor(i),o=i-a,s=r[0===a?a:a-1],l=r[a],c=r[a>r.length-2?r.length-1:a+1],u=r[a>r.length-3?r.length-1:a+2];return n.set(fl(o,s.x,l.x,c.x,u.x),fl(o,s.y,l.y,c.y,u.y)),n},n.copy=function(e){t.prototype.copy.call(this,e),this.points=[];for(var n=0,r=e.points.length;n<r;n++){var i=e.points[n];this.points.push(i.clone())}return this},n.toJSON=function(){var e=t.prototype.toJSON.call(this);e.points=[];for(var n=0,r=this.points.length;n<r;n++){var i=this.points[n];e.points.push(i.toArray())}return e},n.fromJSON=function(e){t.prototype.fromJSON.call(this,e),this.points=[];for(var n=0,r=e.points.length;n<r;n++){var i=e.points[n];this.points.push((new yt).fromArray(i))}return this},e}(al);Ml.prototype.isSplineCurve=!0;var Sl=Object.freeze({__proto__:null,ArcCurve:sl,CatmullRomCurve3:pl,CubicBezierCurve:gl,CubicBezierCurve3:yl,EllipseCurve:ol,LineCurve:xl,LineCurve3:_l,QuadraticBezierCurve:bl,QuadraticBezierCurve3:wl,SplineCurve:Ml}),Tl=function(t){function e(){var e;return(e=t.call(this)||this).type="CurvePath",e.curves=[],e.autoClose=!1,e}lt(e,t);var n=e.prototype;return n.add=function(t){this.curves.push(t)},n.closePath=function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new xl(e,t))},n.getPoint=function(t){for(var e=t*this.getLength(),n=this.getCurveLengths(),r=0;r<n.length;){if(n[r]>=e){var i=n[r]-e,a=this.curves[r],o=a.getLength(),s=0===o?0:1-i/o;return a.getPointAt(s)}r++}return null},n.getLength=function(){var t=this.getCurveLengths();return t[t.length-1]},n.updateArcLengths=function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},n.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,n=0,r=this.curves.length;n<r;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t,t},n.getSpacedPoints=function(t){void 0===t&&(t=40);for(var e=[],n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e},n.getPoints=function(t){void 0===t&&(t=12);for(var e,n=[],r=0,i=this.curves;r<i.length;r++)for(var a=i[r],o=a&&a.isEllipseCurve?2*t:a&&(a.isLineCurve||a.isLineCurve3)?1:a&&a.isSplineCurve?t*a.points.length:t,s=a.getPoints(o),l=0;l<s.length;l++){var c=s[l];e&&e.equals(c)||(n.push(c),e=c)}return this.autoClose&&n.length>1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},n.copy=function(e){t.prototype.copy.call(this,e),this.curves=[];for(var n=0,r=e.curves.length;n<r;n++){var i=e.curves[n];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this},n.toJSON=function(){var e=t.prototype.toJSON.call(this);e.autoClose=this.autoClose,e.curves=[];for(var n=0,r=this.curves.length;n<r;n++){var i=this.curves[n];e.curves.push(i.toJSON())}return e},n.fromJSON=function(e){t.prototype.fromJSON.call(this,e),this.autoClose=e.autoClose,this.curves=[];for(var n=0,r=e.curves.length;n<r;n++){var i=e.curves[n];this.curves.push((new Sl[i.type]).fromJSON(i))}return this},e}(al),El=function(t){function e(e){var n;return(n=t.call(this)||this).type="Path",n.currentPoint=new yt,e&&n.setFromPoints(e),n}lt(e,t);var n=e.prototype;return n.setFromPoints=function(t){this.moveTo(t[0].x,t[0].y);for(var e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y);return this},n.moveTo=function(t,e){return this.currentPoint.set(t,e),this},n.lineTo=function(t,e){var n=new xl(this.currentPoint.clone(),new yt(t,e));return this.curves.push(n),this.currentPoint.set(t,e),this},n.quadraticCurveTo=function(t,e,n,r){var i=new bl(this.currentPoint.clone(),new yt(t,e),new yt(n,r));return this.curves.push(i),this.currentPoint.set(n,r),this},n.bezierCurveTo=function(t,e,n,r,i,a){var o=new gl(this.currentPoint.clone(),new yt(t,e),new yt(n,r),new yt(i,a));return this.curves.push(o),this.currentPoint.set(i,a),this},n.splineThru=function(t){var e=[this.currentPoint.clone()].concat(t),n=new Ml(e);return this.curves.push(n),this.currentPoint.copy(t[t.length-1]),this},n.arc=function(t,e,n,r,i,a){var o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(t+o,e+s,n,r,i,a),this},n.absarc=function(t,e,n,r,i,a){return this.absellipse(t,e,n,n,r,i,a),this},n.ellipse=function(t,e,n,r,i,a,o,s){var l=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(t+l,e+c,n,r,i,a,o,s),this},n.absellipse=function(t,e,n,r,i,a,o,s){var l=new ol(t,e,n,r,i,a,o,s);if(this.curves.length>0){var c=l.getPoint(0);c.equals(this.currentPoint)||this.lineTo(c.x,c.y)}this.curves.push(l);var u=l.getPoint(1);return this.currentPoint.copy(u),this},n.copy=function(e){return t.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},n.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},n.fromJSON=function(e){return t.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this},e}(Tl),Al=function(t){function e(e){var n;return(n=t.call(this,e)||this).uuid=gt.generateUUID(),n.type="Shape",n.holes=[],n}lt(e,t);var n=e.prototype;return n.getPointsHoles=function(t){for(var e=[],n=0,r=this.holes.length;n<r;n++)e[n]=this.holes[n].getPoints(t);return e},n.extractPoints=function(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}},n.copy=function(e){t.prototype.copy.call(this,e),this.holes=[];for(var n=0,r=e.holes.length;n<r;n++){var i=e.holes[n];this.holes.push(i.clone())}return this},n.toJSON=function(){var e=t.prototype.toJSON.call(this);e.uuid=this.uuid,e.holes=[];for(var n=0,r=this.holes.length;n<r;n++){var i=this.holes[n];e.holes.push(i.toJSON())}return e},n.fromJSON=function(e){t.prototype.fromJSON.call(this,e),this.uuid=e.uuid,this.holes=[];for(var n=0,r=e.holes.length;n<r;n++){var i=e.holes[n];this.holes.push((new El).fromJSON(i))}return this},e}(El),Ll=function(t){function e(e,n){var r;return void 0===n&&(n=1),(r=t.call(this)||this).type="Light",r.color=new Ke(e),r.intensity=n,r}lt(e,t);var n=e.prototype;return n.copy=function(e){return t.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},n.toJSON=function(e){var n=t.prototype.toJSON.call(this,e);return n.object.color=this.color.getHex(),n.object.intensity=this.intensity,void 0!==this.groundColor&&(n.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(n.object.distance=this.distance),void 0!==this.angle&&(n.object.angle=this.angle),void 0!==this.decay&&(n.object.decay=this.decay),void 0!==this.penumbra&&(n.object.penumbra=this.penumbra),void 0!==this.shadow&&(n.object.shadow=this.shadow.toJSON()),n},e}(Le);Ll.prototype.isLight=!0;var Rl=function(t){function e(e,n,r){var i;return(i=t.call(this,e,r)||this).type="HemisphereLight",i.position.copy(Le.DefaultUp),i.updateMatrix(),i.groundColor=new Ke(n),i}return lt(e,t),e.prototype.copy=function(t){return Ll.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this},e}(Ll);Rl.prototype.isHemisphereLight=!0;var Cl=new re,Pl=new Rt,Dl=new Rt,Il=function(){function t(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.mapSize=new yt(512,512),this.map=null,this.mapPass=null,this.matrix=new re,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new ir,this._frameExtents=new yt(1,1),this._viewportCount=1,this._viewports=[new Tt(0,0,1,1)]}var e=t.prototype;return e.getViewportCount=function(){return this._viewportCount},e.getFrustum=function(){return this._frustum},e.updateMatrices=function(t){var e=this.camera,n=this.matrix;Pl.setFromMatrixPosition(t.matrixWorld),e.position.copy(Pl),Dl.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(Dl),e.updateMatrixWorld(),Cl.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Cl),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(e.projectionMatrix),n.multiply(e.matrixWorldInverse)},e.getViewport=function(t){return this._viewports[t]},e.getFrameExtents=function(){return this._frameExtents},e.copy=function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this},e.clone=function(){return(new this.constructor).copy(this)},e.toJSON=function(){var t={};return 0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t},t}(),Nl=function(t){function e(){var e;return(e=t.call(this,new Jn(50,1,.5,500))||this).focus=1,e}return lt(e,t),e.prototype.updateMatrices=function(e){var n=this.camera,r=2*gt.RAD2DEG*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,a=e.distance||n.far;r===n.fov&&i===n.aspect&&a===n.far||(n.fov=r,n.aspect=i,n.far=a,n.updateProjectionMatrix()),t.prototype.updateMatrices.call(this,e)},e}(Il);Nl.prototype.isSpotLightShadow=!0;var Bl=function(t){function e(e,n,r,i,a,o){var s;return void 0===r&&(r=0),void 0===i&&(i=Math.PI/3),void 0===a&&(a=0),void 0===o&&(o=1),(s=t.call(this,e,n)||this).type="SpotLight",s.position.copy(Le.DefaultUp),s.updateMatrix(),s.target=new Le,s.distance=r,s.angle=i,s.penumbra=a,s.decay=o,s.shadow=new Nl,s}return lt(e,t),e.prototype.copy=function(e){return t.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},st(e,[{key:"power",get:function(){return this.intensity*Math.PI},set:function(t){this.intensity=t/Math.PI}}]),e}(Ll);Bl.prototype.isSpotLight=!0;var Ol=new re,zl=new Rt,Fl=new Rt,Hl=function(t){function e(){var e;return(e=t.call(this,new Jn(90,1,.5,500))||this)._frameExtents=new yt(4,2),e._viewportCount=6,e._viewports=[new Tt(2,1,1,1),new Tt(0,1,1,1),new Tt(3,1,1,1),new Tt(1,1,1,1),new Tt(3,0,1,1),new Tt(1,0,1,1)],e._cubeDirections=[new Rt(1,0,0),new Rt(-1,0,0),new Rt(0,0,1),new Rt(0,0,-1),new Rt(0,1,0),new Rt(0,-1,0)],e._cubeUps=[new Rt(0,1,0),new Rt(0,1,0),new Rt(0,1,0),new Rt(0,1,0),new Rt(0,0,1),new Rt(0,0,-1)],e}return lt(e,t),e.prototype.updateMatrices=function(t,e){void 0===e&&(e=0);var n=this.camera,r=this.matrix;zl.setFromMatrixPosition(t.matrixWorld),n.position.copy(zl),Fl.copy(n.position),Fl.add(this._cubeDirections[e]),n.up.copy(this._cubeUps[e]),n.lookAt(Fl),n.updateMatrixWorld(),r.makeTranslation(-zl.x,-zl.y,-zl.z),Ol.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Ol)},e}(Il);Hl.prototype.isPointLightShadow=!0;var Gl=function(t){function e(e,n,r,i){var a;return void 0===r&&(r=0),void 0===i&&(i=1),(a=t.call(this,e,n)||this).type="PointLight",a.distance=r,a.decay=i,a.shadow=new Hl,a}return lt(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this},st(e,[{key:"power",get:function(){return 4*this.intensity*Math.PI},set:function(t){this.intensity=t/(4*Math.PI)}}]),e}(Ll);Gl.prototype.isPointLight=!0;var Ul=function(t){function e(e,n,r,i,a,o){var s;return void 0===e&&(e=-1),void 0===n&&(n=1),void 0===r&&(r=1),void 0===i&&(i=-1),void 0===a&&(a=.1),void 0===o&&(o=2e3),(s=t.call(this)||this).type="OrthographicCamera",s.zoom=1,s.view=null,s.left=e,s.right=n,s.top=r,s.bottom=i,s.near=a,s.far=o,s.updateProjectionMatrix(),s}lt(e,t);var n=e.prototype;return n.copy=function(e,n){return t.prototype.copy.call(this,e,n),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this},n.setViewOffset=function(t,e,n,r,i,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()},n.clearViewOffset=function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},n.updateProjectionMatrix=function(){var t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,i=n-t,a=n+t,o=r+e,s=r-e;if(null!==this.view&&this.view.enabled){var l=(this.right-this.left)/this.view.fullWidth/this.zoom,c=(this.top-this.bottom)/this.view.fullHeight/this.zoom;a=(i+=l*this.view.offsetX)+l*this.view.width,s=(o-=c*this.view.offsetY)-c*this.view.height}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()},n.toJSON=function(t){var e=Le.prototype.toJSON.call(this,t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e},e}(Zn);Ul.prototype.isOrthographicCamera=!0;var kl=function(t){function e(){return t.call(this,new Ul(-5,5,5,-5,.5,500))||this}return lt(e,t),e}(Il);kl.prototype.isDirectionalLightShadow=!0;var Vl=function(t){function e(e,n){var r;return(r=t.call(this,e,n)||this).type="DirectionalLight",r.position.copy(Le.DefaultUp),r.updateMatrix(),r.target=new Le,r.shadow=new kl,r}return lt(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this},e}(Ll);Vl.prototype.isDirectionalLight=!0;var Wl=function(t){function e(e,n){var r;return(r=t.call(this,e,n)||this).type="AmbientLight",r}return lt(e,t),e}(Ll);Wl.prototype.isAmbientLight=!0;var jl=function(t){function e(e,n,r,i){var a;return void 0===r&&(r=10),void 0===i&&(i=10),(a=t.call(this,e,n)||this).type="RectAreaLight",a.width=r,a.height=i,a}lt(e,t);var n=e.prototype;return n.copy=function(e){return t.prototype.copy.call(this,e),this.width=e.width,this.height=e.height,this},n.toJSON=function(e){var n=t.prototype.toJSON.call(this,e);return n.object.width=this.width,n.object.height=this.height,n},e}(Ll);jl.prototype.isRectAreaLight=!0;var ql=function(){function t(){this.coefficients=[];for(var t=0;t<9;t++)this.coefficients.push(new Rt)}var e=t.prototype;return e.set=function(t){for(var e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this},e.zero=function(){for(var t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this},e.getAt=function(t,e){var n=t.x,r=t.y,i=t.z,a=this.coefficients;return e.copy(a[0]).multiplyScalar(.282095),e.addScaledVector(a[1],.488603*r),e.addScaledVector(a[2],.488603*i),e.addScaledVector(a[3],.488603*n),e.addScaledVector(a[4],n*r*1.092548),e.addScaledVector(a[5],r*i*1.092548),e.addScaledVector(a[6],.315392*(3*i*i-1)),e.addScaledVector(a[7],n*i*1.092548),e.addScaledVector(a[8],.546274*(n*n-r*r)),e},e.getIrradianceAt=function(t,e){var n=t.x,r=t.y,i=t.z,a=this.coefficients;return e.copy(a[0]).multiplyScalar(.886227),e.addScaledVector(a[1],1.023328*r),e.addScaledVector(a[2],1.023328*i),e.addScaledVector(a[3],1.023328*n),e.addScaledVector(a[4],.858086*n*r),e.addScaledVector(a[5],.858086*r*i),e.addScaledVector(a[6],.743125*i*i-.247708),e.addScaledVector(a[7],.858086*n*i),e.addScaledVector(a[8],.429043*(n*n-r*r)),e},e.add=function(t){for(var e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this},e.addScaledSH=function(t,e){for(var n=0;n<9;n++)this.coefficients[n].addScaledVector(t.coefficients[n],e);return this},e.scale=function(t){for(var e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this},e.lerp=function(t,e){for(var n=0;n<9;n++)this.coefficients[n].lerp(t.coefficients[n],e);return this},e.equals=function(t){for(var e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0},e.copy=function(t){return this.set(t.coefficients)},e.clone=function(){return(new this.constructor).copy(this)},e.fromArray=function(t,e){void 0===e&&(e=0);for(var n=this.coefficients,r=0;r<9;r++)n[r].fromArray(t,e+3*r);return this},e.toArray=function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);for(var n=this.coefficients,r=0;r<9;r++)n[r].toArray(t,e+3*r);return t},t.getBasisAt=function(t,e){var n=t.x,r=t.y,i=t.z;e[0]=.282095,e[1]=.488603*r,e[2]=.488603*i,e[3]=.488603*n,e[4]=1.092548*n*r,e[5]=1.092548*r*i,e[6]=.315392*(3*i*i-1),e[7]=1.092548*n*i,e[8]=.546274*(n*n-r*r)},t}();ql.prototype.isSphericalHarmonics3=!0;var Xl=function(t){function e(e,n){var r;return void 0===e&&(e=new ql),void 0===n&&(n=1),(r=t.call(this,void 0,n)||this).sh=e,r}lt(e,t);var n=e.prototype;return n.copy=function(e){return t.prototype.copy.call(this,e),this.sh.copy(e.sh),this},n.fromJSON=function(t){return this.intensity=t.intensity,this.sh.fromArray(t.sh),this},n.toJSON=function(e){var n=t.prototype.toJSON.call(this,e);return n.object.sh=this.sh.toArray(),n},e}(Ll);Xl.prototype.isLightProbe=!0;var Yl=function(t){function e(e){var n;return(n=t.call(this,e)||this).textures={},n}lt(e,t);var n=e.prototype;return n.load=function(t,e,n,r){var i=this,a=new Ks(i.manager);a.setPath(i.path),a.setRequestHeader(i.requestHeader),a.setWithCredentials(i.withCredentials),a.load(t,(function(n){try{e(i.parse(JSON.parse(n)))}catch(e){r?r(e):console.error(e),i.manager.itemError(t)}}),n,r)},n.parse=function(t){var e=this.textures;function n(t){return void 0===e[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),e[t]}var r=new Ps[t.type];if(void 0!==t.uuid&&(r.uuid=t.uuid),void 0!==t.name&&(r.name=t.name),void 0!==t.color&&void 0!==r.color&&r.color.setHex(t.color),void 0!==t.roughness&&(r.roughness=t.roughness),void 0!==t.metalness&&(r.metalness=t.metalness),void 0!==t.sheen&&(r.sheen=(new Ke).setHex(t.sheen)),void 0!==t.emissive&&void 0!==r.emissive&&r.emissive.setHex(t.emissive),void 0!==t.specular&&void 0!==r.specular&&r.specular.setHex(t.specular),void 0!==t.shininess&&(r.shininess=t.shininess),void 0!==t.clearcoat&&(r.clearcoat=t.clearcoat),void 0!==t.clearcoatRoughness&&(r.clearcoatRoughness=t.clearcoatRoughness),void 0!==t.fog&&(r.fog=t.fog),void 0!==t.flatShading&&(r.flatShading=t.flatShading),void 0!==t.blending&&(r.blending=t.blending),void 0!==t.combine&&(r.combine=t.combine),void 0!==t.side&&(r.side=t.side),void 0!==t.opacity&&(r.opacity=t.opacity),void 0!==t.transparent&&(r.transparent=t.transparent),void 0!==t.alphaTest&&(r.alphaTest=t.alphaTest),void 0!==t.depthTest&&(r.depthTest=t.depthTest),void 0!==t.depthWrite&&(r.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(r.colorWrite=t.colorWrite),void 0!==t.stencilWrite&&(r.stencilWrite=t.stencilWrite),void 0!==t.stencilWriteMask&&(r.stencilWriteMask=t.stencilWriteMask),void 0!==t.stencilFunc&&(r.stencilFunc=t.stencilFunc),void 0!==t.stencilRef&&(r.stencilRef=t.stencilRef),void 0!==t.stencilFuncMask&&(r.stencilFuncMask=t.stencilFuncMask),void 0!==t.stencilFail&&(r.stencilFail=t.stencilFail),void 0!==t.stencilZFail&&(r.stencilZFail=t.stencilZFail),void 0!==t.stencilZPass&&(r.stencilZPass=t.stencilZPass),void 0!==t.wireframe&&(r.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(r.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.wireframeLinecap&&(r.wireframeLinecap=t.wireframeLinecap),void 0!==t.wireframeLinejoin&&(r.wireframeLinejoin=t.wireframeLinejoin),void 0!==t.rotation&&(r.rotation=t.rotation),1!==t.linewidth&&(r.linewidth=t.linewidth),void 0!==t.dashSize&&(r.dashSize=t.dashSize),void 0!==t.gapSize&&(r.gapSize=t.gapSize),void 0!==t.scale&&(r.scale=t.scale),void 0!==t.polygonOffset&&(r.polygonOffset=t.polygonOffset),void 0!==t.polygonOffsetFactor&&(r.polygonOffsetFactor=t.polygonOffsetFactor),void 0!==t.polygonOffsetUnits&&(r.polygonOffsetUnits=t.polygonOffsetUnits),void 0!==t.skinning&&(r.skinning=t.skinning),void 0!==t.morphTargets&&(r.morphTargets=t.morphTargets),void 0!==t.morphNormals&&(r.morphNormals=t.morphNormals),void 0!==t.dithering&&(r.dithering=t.dithering),void 0!==t.vertexTangents&&(r.vertexTangents=t.vertexTangents),void 0!==t.visible&&(r.visible=t.visible),void 0!==t.toneMapped&&(r.toneMapped=t.toneMapped),void 0!==t.userData&&(r.userData=t.userData),void 0!==t.vertexColors&&("number"==typeof t.vertexColors?r.vertexColors=t.vertexColors>0:r.vertexColors=t.vertexColors),void 0!==t.uniforms)for(var i in t.uniforms){var a=t.uniforms[i];switch(r.uniforms[i]={},a.type){case"t":r.uniforms[i].value=n(a.value);break;case"c":r.uniforms[i].value=(new Ke).setHex(a.value);break;case"v2":r.uniforms[i].value=(new yt).fromArray(a.value);break;case"v3":r.uniforms[i].value=(new Rt).fromArray(a.value);break;case"v4":r.uniforms[i].value=(new Tt).fromArray(a.value);break;case"m3":r.uniforms[i].value=(new _t).fromArray(a.value);break;case"m4":r.uniforms[i].value=(new re).fromArray(a.value);break;default:r.uniforms[i].value=a.value}}if(void 0!==t.defines&&(r.defines=t.defines),void 0!==t.vertexShader&&(r.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(r.fragmentShader=t.fragmentShader),void 0!==t.extensions)for(var o in t.extensions)r.extensions[o]=t.extensions[o];if(void 0!==t.shading&&(r.flatShading=1===t.shading),void 0!==t.size&&(r.size=t.size),void 0!==t.sizeAttenuation&&(r.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(r.map=n(t.map)),void 0!==t.matcap&&(r.matcap=n(t.matcap)),void 0!==t.alphaMap&&(r.alphaMap=n(t.alphaMap)),void 0!==t.bumpMap&&(r.bumpMap=n(t.bumpMap)),void 0!==t.bumpScale&&(r.bumpScale=t.bumpScale),void 0!==t.normalMap&&(r.normalMap=n(t.normalMap)),void 0!==t.normalMapType&&(r.normalMapType=t.normalMapType),void 0!==t.normalScale){var s=t.normalScale;!1===Array.isArray(s)&&(s=[s,s]),r.normalScale=(new yt).fromArray(s)}return void 0!==t.displacementMap&&(r.displacementMap=n(t.displacementMap)),void 0!==t.displacementScale&&(r.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(r.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(r.roughnessMap=n(t.roughnessMap)),void 0!==t.metalnessMap&&(r.metalnessMap=n(t.metalnessMap)),void 0!==t.emissiveMap&&(r.emissiveMap=n(t.emissiveMap)),void 0!==t.emissiveIntensity&&(r.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(r.specularMap=n(t.specularMap)),void 0!==t.envMap&&(r.envMap=n(t.envMap)),void 0!==t.envMapIntensity&&(r.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(r.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(r.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(r.lightMap=n(t.lightMap)),void 0!==t.lightMapIntensity&&(r.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(r.aoMap=n(t.aoMap)),void 0!==t.aoMapIntensity&&(r.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(r.gradientMap=n(t.gradientMap)),void 0!==t.clearcoatMap&&(r.clearcoatMap=n(t.clearcoatMap)),void 0!==t.clearcoatRoughnessMap&&(r.clearcoatRoughnessMap=n(t.clearcoatRoughnessMap)),void 0!==t.clearcoatNormalMap&&(r.clearcoatNormalMap=n(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(r.clearcoatNormalScale=(new yt).fromArray(t.clearcoatNormalScale)),void 0!==t.transmission&&(r.transmission=t.transmission),void 0!==t.transmissionMap&&(r.transmissionMap=n(t.transmissionMap)),r},n.setTextures=function(t){return this.textures=t,this},e}(Js),Zl={decodeText:function(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);for(var e="",n=0,r=t.length;n<r;n++)e+=String.fromCharCode(t[n]);try{return decodeURIComponent(escape(e))}catch(t){return e}},extractUrlBase:function(t){var e=t.lastIndexOf("/");return-1===e?"./":t.substr(0,e+1)}};function Jl(){Sn.call(this),this.type="InstancedBufferGeometry",this.instanceCount=1/0}function Ql(t,e,n,r){"number"==typeof n&&(r=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),nn.call(this,t,e,n),this.meshPerAttribute=r||1}Jl.prototype=Object.assign(Object.create(Sn.prototype),{constructor:Jl,isInstancedBufferGeometry:!0,copy:function(t){return Sn.prototype.copy.call(this,t),this.instanceCount=t.instanceCount,this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var t=Sn.prototype.toJSON.call(this);return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}),Ql.prototype=Object.assign(Object.create(nn.prototype),{constructor:Ql,isInstancedBufferAttribute:!0,copy:function(t){return nn.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this},toJSON:function(){var t=nn.prototype.toJSON.call(this);return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}});var Kl=function(t){function e(e){return t.call(this,e)||this}lt(e,t);var n=e.prototype;return n.load=function(t,e,n,r){var i=this,a=new Ks(i.manager);a.setPath(i.path),a.setRequestHeader(i.requestHeader),a.setWithCredentials(i.withCredentials),a.load(t,(function(n){try{e(i.parse(JSON.parse(n)))}catch(e){r?r(e):console.error(e),i.manager.itemError(t)}}),n,r)},n.parse=function(t){var e={},n={};function r(t,r){if(void 0!==e[r])return e[r];var i=t.interleavedBuffers[r],a=function(t,e){if(void 0!==n[e])return n[e];var r=t.arrayBuffers[e],i=new Uint32Array(r).buffer;return n[e]=i,i}(t,i.buffer),o=new ma(vn(i.type,a),i.stride);return o.uuid=i.uuid,e[r]=o,o}var i=t.isInstancedBufferGeometry?new Jl:new Sn,a=t.data.index;if(void 0!==a){var o=vn(a.type,a.array);i.setIndex(new nn(o,1))}var s=t.data.attributes;for(var l in s){var c=s[l],u=void 0;if(c.isInterleavedBufferAttribute){u=new ga(r(t.data,c.data),c.itemSize,c.offset,c.normalized)}else{var h=vn(c.type,c.array);u=new(c.isInstancedBufferAttribute?Ql:nn)(h,c.itemSize,c.normalized)}void 0!==c.name&&(u.name=c.name),i.setAttribute(l,u)}var d=t.data.morphAttributes;if(d)for(var p in d){for(var f=d[p],m=[],v=0,g=f.length;v<g;v++){var y=f[v],x=void 0;if(y.isInterleavedBufferAttribute)x=new ga(r(t.data,y.data),y.itemSize,y.offset,y.normalized);else x=new nn(vn(y.type,y.array),y.itemSize,y.normalized);void 0!==y.name&&(x.name=y.name),m.push(x)}i.morphAttributes[p]=m}t.data.morphTargetsRelative&&(i.morphTargetsRelative=!0);var _=t.data.groups||t.data.drawcalls||t.data.offsets;if(void 0!==_)for(var b=0,w=_.length;b!==w;++b){var M=_[b];i.addGroup(M.start,M.count,M.materialIndex)}var S=t.data.boundingSphere;if(void 0!==S){var T=new Rt;void 0!==S.center&&T.fromArray(S.center),i.boundingSphere=new Yt(T,S.radius)}return t.name&&(i.name=t.name),t.userData&&(i.userData=t.userData),i},e}(Js),$l=function(t){function e(e){return t.call(this,e)||this}lt(e,t);var n=e.prototype;return n.load=function(t,e,n,r){var i=this,a=""===this.path?Zl.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||a;var o=new Ks(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,(function(n){var a=null;try{a=JSON.parse(n)}catch(e){return void 0!==r&&r(e),void console.error("THREE:ObjectLoader: Can't parse "+t+".",e.message)}var o=a.metadata;void 0!==o&&void 0!==o.type&&"geometry"!==o.type.toLowerCase()?i.parse(a,e):console.error("THREE.ObjectLoader: Can't load "+t)}),n,r)},n.parse=function(t,e){var n=this.parseAnimations(t.animations),r=this.parseShapes(t.shapes),i=this.parseGeometries(t.geometries,r),a=this.parseImages(t.images,(function(){void 0!==e&&e(l)})),o=this.parseTextures(t.textures,a),s=this.parseMaterials(t.materials,o),l=this.parseObject(t.object,i,s,n),c=this.parseSkeletons(t.skeletons,l);if(this.bindSkeletons(l,c),void 0!==e){var u=!1;for(var h in a)if(a[h]instanceof HTMLImageElement){u=!0;break}!1===u&&e(l)}return l},n.parseShapes=function(t){var e={};if(void 0!==t)for(var n=0,r=t.length;n<r;n++){var i=(new Al).fromJSON(t[n]);e[i.uuid]=i}return e},n.parseSkeletons=function(t,e){var n={},r={};if(e.traverse((function(t){t.isBone&&(r[t.uuid]=t)})),void 0!==t)for(var i=0,a=t.length;i<a;i++){var o=(new qa).fromJSON(t[i],r);n[o.uuid]=o}return n},n.parseGeometries=function(t,e){var n,r={};if(void 0!==t)for(var i=new Kl,a=0,o=t.length;a<o;a++){var s=void 0,l=t[a];switch(l.type){case"PlaneGeometry":case"PlaneBufferGeometry":s=new _s[l.type](l.width,l.height,l.widthSegments,l.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":s=new _s[l.type](l.width,l.height,l.depth,l.widthSegments,l.heightSegments,l.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":s=new _s[l.type](l.radius,l.segments,l.thetaStart,l.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":s=new _s[l.type](l.radiusTop,l.radiusBottom,l.height,l.radialSegments,l.heightSegments,l.openEnded,l.thetaStart,l.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":s=new _s[l.type](l.radius,l.height,l.radialSegments,l.heightSegments,l.openEnded,l.thetaStart,l.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":s=new _s[l.type](l.radius,l.widthSegments,l.heightSegments,l.phiStart,l.phiLength,l.thetaStart,l.thetaLength);break;case"DodecahedronGeometry":case"DodecahedronBufferGeometry":case"IcosahedronGeometry":case"IcosahedronBufferGeometry":case"OctahedronGeometry":case"OctahedronBufferGeometry":case"TetrahedronGeometry":case"TetrahedronBufferGeometry":s=new _s[l.type](l.radius,l.detail);break;case"RingGeometry":case"RingBufferGeometry":s=new _s[l.type](l.innerRadius,l.outerRadius,l.thetaSegments,l.phiSegments,l.thetaStart,l.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":s=new _s[l.type](l.radius,l.tube,l.radialSegments,l.tubularSegments,l.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":s=new _s[l.type](l.radius,l.tube,l.tubularSegments,l.radialSegments,l.p,l.q);break;case"TubeGeometry":case"TubeBufferGeometry":s=new _s[l.type]((new Sl[l.path.type]).fromJSON(l.path),l.tubularSegments,l.radius,l.radialSegments,l.closed);break;case"LatheGeometry":case"LatheBufferGeometry":s=new _s[l.type](l.points,l.segments,l.phiStart,l.phiLength);break;case"PolyhedronGeometry":case"PolyhedronBufferGeometry":s=new _s[l.type](l.vertices,l.indices,l.radius,l.details);break;case"ShapeGeometry":case"ShapeBufferGeometry":n=[];for(var c=0,u=l.shapes.length;c<u;c++){var h=e[l.shapes[c]];n.push(h)}s=new _s[l.type](n,l.curveSegments);break;case"ExtrudeGeometry":case"ExtrudeBufferGeometry":n=[];for(var d=0,p=l.shapes.length;d<p;d++){var f=e[l.shapes[d]];n.push(f)}var m=l.options.extrudePath;void 0!==m&&(l.options.extrudePath=(new Sl[m.type]).fromJSON(m)),s=new _s[l.type](n,l.options);break;case"BufferGeometry":case"InstancedBufferGeometry":s=i.parse(l);break;case"Geometry":console.error('THREE.ObjectLoader: Loading "Geometry" is not supported anymore.');break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+l.type+'"');continue}s.uuid=l.uuid,void 0!==l.name&&(s.name=l.name),!0===s.isBufferGeometry&&void 0!==l.userData&&(s.userData=l.userData),r[l.uuid]=s}return r},n.parseMaterials=function(t,e){var n={},r={};if(void 0!==t){var i=new Yl;i.setTextures(e);for(var a=0,o=t.length;a<o;a++){var s=t[a];if("MultiMaterial"===s.type){for(var l=[],c=0;c<s.materials.length;c++){var u=s.materials[c];void 0===n[u.uuid]&&(n[u.uuid]=i.parse(u)),l.push(n[u.uuid])}r[s.uuid]=l}else void 0===n[s.uuid]&&(n[s.uuid]=i.parse(s)),r[s.uuid]=n[s.uuid]}}return r},n.parseAnimations=function(t){var e={};if(void 0!==t)for(var n=0;n<t.length;n++){var r=t[n],i=js.parse(r);e[i.uuid]=i}return e},n.parseImages=function(t,e){var n,r=this,i={};function a(t){if("string"==typeof t){var e=t;return function(t){return r.manager.itemStart(t),n.load(t,(function(){r.manager.itemEnd(t)}),void 0,(function(){r.manager.itemError(t),r.manager.itemEnd(t)}))}(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(e)?e:r.resourcePath+e)}return t.data?{data:vn(t.type,t.data),width:t.width,height:t.height}:null}if(void 0!==t&&t.length>0){var o=new Ys(e);(n=new el(o)).setCrossOrigin(this.crossOrigin);for(var s=0,l=t.length;s<l;s++){var c=t[s],u=c.url;if(Array.isArray(u)){i[c.uuid]=[];for(var h=0,d=u.length;h<d;h++){var p=a(u[h]);null!==p&&(p instanceof HTMLImageElement?i[c.uuid].push(p):i[c.uuid].push(new er(p.data,p.width,p.height)))}}else{var f=a(c.url);null!==f&&(i[c.uuid]=f)}}}return i},n.parseTextures=function(t,e){function n(t,e){return"number"==typeof t?t:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",t),e[t])}var r={};if(void 0!==t)for(var i=0,a=t.length;i<a;i++){var o=t[i];void 0===o.image&&console.warn('THREE.ObjectLoader: No "image" specified for',o.uuid),void 0===e[o.image]&&console.warn("THREE.ObjectLoader: Undefined image",o.image);var s=void 0,l=e[o.image];Array.isArray(l)?(s=new $n(l),6===l.length&&(s.needsUpdate=!0)):(s=l&&l.data?new er(l.data,l.width,l.height):new Mt(l),l&&(s.needsUpdate=!0)),s.uuid=o.uuid,void 0!==o.name&&(s.name=o.name),void 0!==o.mapping&&(s.mapping=n(o.mapping,tc)),void 0!==o.offset&&s.offset.fromArray(o.offset),void 0!==o.repeat&&s.repeat.fromArray(o.repeat),void 0!==o.center&&s.center.fromArray(o.center),void 0!==o.rotation&&(s.rotation=o.rotation),void 0!==o.wrap&&(s.wrapS=n(o.wrap[0],ec),s.wrapT=n(o.wrap[1],ec)),void 0!==o.format&&(s.format=o.format),void 0!==o.type&&(s.type=o.type),void 0!==o.encoding&&(s.encoding=o.encoding),void 0!==o.minFilter&&(s.minFilter=n(o.minFilter,nc)),void 0!==o.magFilter&&(s.magFilter=n(o.magFilter,nc)),void 0!==o.anisotropy&&(s.anisotropy=o.anisotropy),void 0!==o.flipY&&(s.flipY=o.flipY),void 0!==o.premultiplyAlpha&&(s.premultiplyAlpha=o.premultiplyAlpha),void 0!==o.unpackAlignment&&(s.unpackAlignment=o.unpackAlignment),r[o.uuid]=s}return r},n.parseObject=function(t,e,n,r){var i,a,o;function s(t){return void 0===e[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),e[t]}function l(t){if(void 0!==t){if(Array.isArray(t)){for(var e=[],r=0,i=t.length;r<i;r++){var a=t[r];void 0===n[a]&&console.warn("THREE.ObjectLoader: Undefined material",a),e.push(n[a])}return e}return void 0===n[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),n[t]}}switch(t.type){case"Scene":i=new fa,void 0!==t.background&&Number.isInteger(t.background)&&(i.background=new Ke(t.background)),void 0!==t.fog&&("Fog"===t.fog.type?i.fog=new pa(t.fog.color,t.fog.near,t.fog.far):"FogExp2"===t.fog.type&&(i.fog=new da(t.fog.color,t.fog.density)));break;case"PerspectiveCamera":i=new Jn(t.fov,t.aspect,t.near,t.far),void 0!==t.focus&&(i.focus=t.focus),void 0!==t.zoom&&(i.zoom=t.zoom),void 0!==t.filmGauge&&(i.filmGauge=t.filmGauge),void 0!==t.filmOffset&&(i.filmOffset=t.filmOffset),void 0!==t.view&&(i.view=Object.assign({},t.view));break;case"OrthographicCamera":i=new Ul(t.left,t.right,t.top,t.bottom,t.near,t.far),void 0!==t.zoom&&(i.zoom=t.zoom),void 0!==t.view&&(i.view=Object.assign({},t.view));break;case"AmbientLight":i=new Wl(t.color,t.intensity);break;case"DirectionalLight":i=new Vl(t.color,t.intensity);break;case"PointLight":i=new Gl(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":i=new jl(t.color,t.intensity,t.width,t.height);break;case"SpotLight":i=new Bl(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay);break;case"HemisphereLight":i=new Rl(t.color,t.groundColor,t.intensity);break;case"LightProbe":i=(new Xl).fromJSON(t);break;case"SkinnedMesh":i=new ka(a=s(t.geometry),o=l(t.material)),void 0!==t.bindMode&&(i.bindMode=t.bindMode),void 0!==t.bindMatrix&&i.bindMatrix.fromArray(t.bindMatrix),void 0!==t.skeleton&&(i.skeleton=t.skeleton);break;case"Mesh":i=new kn(a=s(t.geometry),o=l(t.material));break;case"InstancedMesh":a=s(t.geometry),o=l(t.material);var c=t.count,u=t.instanceMatrix;(i=new Qa(a,o,c)).instanceMatrix=new nn(new Float32Array(u.array),16);break;case"LOD":i=new Oa;break;case"Line":i=new io(s(t.geometry),l(t.material));break;case"LineLoop":i=new lo(s(t.geometry),l(t.material));break;case"LineSegments":i=new so(s(t.geometry),l(t.material));break;case"PointCloud":case"Points":i=new mo(s(t.geometry),l(t.material));break;case"Sprite":i=new Da(l(t.material));break;case"Group":i=new oa;break;case"Bone":i=new Va;break;default:i=new Le}if(i.uuid=t.uuid,void 0!==t.name&&(i.name=t.name),void 0!==t.matrix?(i.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(i.matrixAutoUpdate=t.matrixAutoUpdate),i.matrixAutoUpdate&&i.matrix.decompose(i.position,i.quaternion,i.scale)):(void 0!==t.position&&i.position.fromArray(t.position),void 0!==t.rotation&&i.rotation.fromArray(t.rotation),void 0!==t.quaternion&&i.quaternion.fromArray(t.quaternion),void 0!==t.scale&&i.scale.fromArray(t.scale)),void 0!==t.castShadow&&(i.castShadow=t.castShadow),void 0!==t.receiveShadow&&(i.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(i.shadow.bias=t.shadow.bias),void 0!==t.shadow.normalBias&&(i.shadow.normalBias=t.shadow.normalBias),void 0!==t.shadow.radius&&(i.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&i.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(i.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(i.visible=t.visible),void 0!==t.frustumCulled&&(i.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(i.renderOrder=t.renderOrder),void 0!==t.userData&&(i.userData=t.userData),void 0!==t.layers&&(i.layers.mask=t.layers),void 0!==t.children)for(var h=t.children,d=0;d<h.length;d++)i.add(this.parseObject(h[d],e,n,r));if(void 0!==t.animations)for(var p=t.animations,f=0;f<p.length;f++){var m=p[f];i.animations.push(r[m])}if("LOD"===t.type){void 0!==t.autoUpdate&&(i.autoUpdate=t.autoUpdate);for(var v=t.levels,g=0;g<v.length;g++){var y=v[g],x=i.getObjectByProperty("uuid",y.object);void 0!==x&&i.addLevel(x,y.distance)}}return i},n.bindSkeletons=function(t,e){0!==Object.keys(e).length&&t.traverse((function(t){if(!0===t.isSkinnedMesh&&void 0!==t.skeleton){var n=e[t.skeleton];void 0===n?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",t.skeleton):t.bind(n,t.bindMatrix)}}))},n.setTexturePath=function(t){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(t)},e}(Js),tc={UVMapping:i,CubeReflectionMapping:a,CubeRefractionMapping:o,EquirectangularReflectionMapping:s,EquirectangularRefractionMapping:l,CubeUVReflectionMapping:c,CubeUVRefractionMapping:u},ec={RepeatWrapping:h,ClampToEdgeWrapping:d,MirroredRepeatWrapping:p},nc={NearestFilter:f,NearestMipmapNearestFilter:m,NearestMipmapLinearFilter:v,LinearFilter:g,LinearMipmapNearestFilter:y,LinearMipmapLinearFilter:x};function rc(t){"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),Js.call(this,t),this.options={premultiplyAlpha:"none"}}rc.prototype=Object.assign(Object.create(Js.prototype),{constructor:rc,isImageBitmapLoader:!0,setOptions:function(t){return this.options=t,this},load:function(t,e,n,r){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);var i=this,a=Xs.get(t);if(void 0!==a)return i.manager.itemStart(t),setTimeout((function(){e&&e(a),i.manager.itemEnd(t)}),0),a;var o={};o.credentials="anonymous"===this.crossOrigin?"same-origin":"include",o.headers=this.requestHeader,fetch(t,o).then((function(t){return t.blob()})).then((function(t){return createImageBitmap(t,Object.assign(i.options,{colorSpaceConversion:"none"}))})).then((function(n){Xs.add(t,n),e&&e(n),i.manager.itemEnd(t)})).catch((function(e){r&&r(e),i.manager.itemError(t),i.manager.itemEnd(t)})),i.manager.itemStart(t)}});var ic=function(){function t(){this.type="ShapePath",this.color=new Ke,this.subPaths=[],this.currentPath=null}var e=t.prototype;return e.moveTo=function(t,e){return this.currentPath=new El,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this},e.lineTo=function(t,e){return this.currentPath.lineTo(t,e),this},e.quadraticCurveTo=function(t,e,n,r){return this.currentPath.quadraticCurveTo(t,e,n,r),this},e.bezierCurveTo=function(t,e,n,r,i,a){return this.currentPath.bezierCurveTo(t,e,n,r,i,a),this},e.splineThru=function(t){return this.currentPath.splineThru(t),this},e.toShapes=function(t,e){function n(t){for(var e=[],n=0,r=t.length;n<r;n++){var i=t[n],a=new Al;a.curves=i.curves,e.push(a)}return e}function r(t,e){for(var n=e.length,r=!1,i=n-1,a=0;a<n;i=a++){var o=e[i],s=e[a],l=s.x-o.x,c=s.y-o.y;if(Math.abs(c)>Number.EPSILON){if(c<0&&(o=e[a],l=-l,s=e[i],c=-c),t.y<o.y||t.y>s.y)continue;if(t.y===o.y){if(t.x===o.x)return!0}else{var u=c*(t.x-o.x)-l*(t.y-o.y);if(0===u)return!0;if(u<0)continue;r=!r}}else{if(t.y!==o.y)continue;if(s.x<=t.x&&t.x<=o.x||o.x<=t.x&&t.x<=s.x)return!0}}return r}var i,a,o,s=ns.isClockWise,l=this.subPaths;if(0===l.length)return[];if(!0===e)return n(l);var c=[];if(1===l.length)return a=l[0],(o=new Al).curves=a.curves,c.push(o),c;var u=!s(l[0].getPoints());u=t?!u:u;var h,d,p=[],f=[],m=[],v=0;f[v]=void 0,m[v]=[];for(var g=0,y=l.length;g<y;g++)i=s(h=(a=l[g]).getPoints()),(i=t?!i:i)?(!u&&f[v]&&v++,f[v]={s:new Al,p:h},f[v].s.curves=a.curves,u&&v++,m[v]=[]):m[v].push({h:a,p:h[0]});if(!f[0])return n(l);if(f.length>1){for(var x=!1,_=[],b=0,w=f.length;b<w;b++)p[b]=[];for(var M=0,S=f.length;M<S;M++)for(var T=m[M],E=0;E<T.length;E++){for(var A=T[E],L=!0,R=0;R<f.length;R++)r(A.p,f[R].p)&&(M!==R&&_.push({froms:M,tos:R,hole:E}),L?(L=!1,p[R].push(A)):x=!0);L&&p[M].push(A)}_.length>0&&(x||(m=p))}for(var C=0,P=f.length;C<P;C++){o=f[C].s,c.push(o);for(var D=0,I=(d=m[C]).length;D<I;D++)o.holes.push(d[D].h)}return c},t}(),ac=function(){function t(t){this.type="Font",this.data=t}return t.prototype.generateShapes=function(t,e){void 0===e&&(e=100);for(var n=[],r=function(t,e,n){for(var r=Array.from(t),i=e/n.resolution,a=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*i,o=[],s=0,l=0,c=0;c<r.length;c++){var u=r[c];if("\n"===u)s=0,l-=a;else{var h=oc(u,i,s,l,n);s+=h.offsetX,o.push(h.path)}}return o}(t,e,this.data),i=0,a=r.length;i<a;i++)Array.prototype.push.apply(n,r[i].toShapes());return n},t}();function oc(t,e,n,r,i){var a=i.glyphs[t]||i.glyphs["?"];if(a){var o,s,l,c,u,h,d,p,f=new ic;if(a.o)for(var m=a._cachedOutline||(a._cachedOutline=a.o.split(" ")),v=0,g=m.length;v<g;){switch(m[v++]){case"m":o=m[v++]*e+n,s=m[v++]*e+r,f.moveTo(o,s);break;case"l":o=m[v++]*e+n,s=m[v++]*e+r,f.lineTo(o,s);break;case"q":l=m[v++]*e+n,c=m[v++]*e+r,u=m[v++]*e+n,h=m[v++]*e+r,f.quadraticCurveTo(u,h,l,c);break;case"b":l=m[v++]*e+n,c=m[v++]*e+r,u=m[v++]*e+n,h=m[v++]*e+r,d=m[v++]*e+n,p=m[v++]*e+r,f.bezierCurveTo(u,h,d,p,l,c)}}return{offsetX:a.ha*e,path:f}}console.error('THREE.Font: character "'+t+'" does not exists in font family '+i.familyName+".")}ac.prototype.isFont=!0;var sc,lc=function(t){function e(e){return t.call(this,e)||this}lt(e,t);var n=e.prototype;return n.load=function(t,e,n,r){var i=this,a=new Ks(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(i.withCredentials),a.load(t,(function(t){var n;try{n=JSON.parse(t)}catch(e){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),n=JSON.parse(t.substring(65,t.length-2))}var r=i.parse(n);e&&e(r)}),n,r)},n.parse=function(t){return new ac(t)},e}(Js),cc={getContext:function(){return void 0===sc&&(sc=new(window.AudioContext||window.webkitAudioContext)),sc},setContext:function(t){sc=t}},uc=function(t){function e(e){return t.call(this,e)||this}return lt(e,t),e.prototype.load=function(t,e,n,r){var i=this,a=new Ks(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,(function(n){try{var a=n.slice(0);cc.getContext().decodeAudioData(a,(function(t){e(t)}))}catch(e){r?r(e):console.error(e),i.manager.itemError(t)}}),n,r)},e}(Js),hc=function(t){function e(e,n,r){var i;void 0===r&&(r=1),i=t.call(this,void 0,r)||this;var a=(new Ke).set(e),o=(new Ke).set(n),s=new Rt(a.r,a.g,a.b),l=new Rt(o.r,o.g,o.b),c=Math.sqrt(Math.PI),u=c*Math.sqrt(.75);return i.sh.coefficients[0].copy(s).add(l).multiplyScalar(c),i.sh.coefficients[1].copy(s).sub(l).multiplyScalar(u),i}return lt(e,t),e}(Xl);hc.prototype.isHemisphereLightProbe=!0;var dc=function(t){function e(e,n){var r;void 0===n&&(n=1),r=t.call(this,void 0,n)||this;var i=(new Ke).set(e);return r.sh.coefficients[0].set(i.r,i.g,i.b).multiplyScalar(2*Math.sqrt(Math.PI)),r}return lt(e,t),e}(Xl);dc.prototype.isAmbientLightProbe=!0;var pc=new re,fc=new re,mc=function(){function t(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Jn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Jn,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}return t.prototype.update=function(t){var e=this._cache;if(e.focus!==t.focus||e.fov!==t.fov||e.aspect!==t.aspect*this.aspect||e.near!==t.near||e.far!==t.far||e.zoom!==t.zoom||e.eyeSep!==this.eyeSep){e.focus=t.focus,e.fov=t.fov,e.aspect=t.aspect*this.aspect,e.near=t.near,e.far=t.far,e.zoom=t.zoom,e.eyeSep=this.eyeSep;var n,r,i=t.projectionMatrix.clone(),a=e.eyeSep/2,o=a*e.near/e.focus,s=e.near*Math.tan(gt.DEG2RAD*e.fov*.5)/e.zoom;fc.elements[12]=-a,pc.elements[12]=a,n=-s*e.aspect+o,r=s*e.aspect+o,i.elements[0]=2*e.near/(r-n),i.elements[8]=(r+n)/(r-n),this.cameraL.projectionMatrix.copy(i),n=-s*e.aspect-o,r=s*e.aspect-o,i.elements[0]=2*e.near/(r-n),i.elements[8]=(r+n)/(r-n),this.cameraR.projectionMatrix.copy(i)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(fc),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(pc)},t}(),vc=function(){function t(t){this.autoStart=void 0===t||t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}var e=t.prototype;return e.start=function(){this.startTime=gc(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},e.stop=function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1},e.getElapsedTime=function(){return this.getDelta(),this.elapsedTime},e.getDelta=function(){var t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var e=gc();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t},t}();function gc(){return("undefined"==typeof performance?Date:performance).now()}var yc=new Rt,xc=new Lt,_c=new Rt,bc=new Rt,wc=function(t){function e(){var e;return(e=t.call(this)||this).type="AudioListener",e.context=cc.getContext(),e.gain=e.context.createGain(),e.gain.connect(e.context.destination),e.filter=null,e.timeDelta=0,e._clock=new vc,e}lt(e,t);var n=e.prototype;return n.getInput=function(){return this.gain},n.removeFilter=function(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this},n.getFilter=function(){return this.filter},n.setFilter=function(t){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this},n.getMasterVolume=function(){return this.gain.gain.value},n.setMasterVolume=function(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this},n.updateMatrixWorld=function(e){t.prototype.updateMatrixWorld.call(this,e);var n=this.context.listener,r=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(yc,xc,_c),bc.set(0,0,-1).applyQuaternion(xc),n.positionX){var i=this.context.currentTime+this.timeDelta;n.positionX.linearRampToValueAtTime(yc.x,i),n.positionY.linearRampToValueAtTime(yc.y,i),n.positionZ.linearRampToValueAtTime(yc.z,i),n.forwardX.linearRampToValueAtTime(bc.x,i),n.forwardY.linearRampToValueAtTime(bc.y,i),n.forwardZ.linearRampToValueAtTime(bc.z,i),n.upX.linearRampToValueAtTime(r.x,i),n.upY.linearRampToValueAtTime(r.y,i),n.upZ.linearRampToValueAtTime(r.z,i)}else n.setPosition(yc.x,yc.y,yc.z),n.setOrientation(bc.x,bc.y,bc.z,r.x,r.y,r.z)},e}(Le),Mc=function(t){function e(e){var n;return(n=t.call(this)||this).type="Audio",n.listener=e,n.context=e.context,n.gain=n.context.createGain(),n.gain.connect(e.getInput()),n.autoplay=!1,n.buffer=null,n.detune=0,n.loop=!1,n.loopStart=0,n.loopEnd=0,n.offset=0,n.duration=void 0,n.playbackRate=1,n.isPlaying=!1,n.hasPlaybackControl=!0,n.source=null,n.sourceType="empty",n._startedAt=0,n._progress=0,n._connected=!1,n.filters=[],n}lt(e,t);var n=e.prototype;return n.getOutput=function(){return this.gain},n.setNodeSource=function(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this},n.setMediaElementSource=function(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this},n.setMediaStreamSource=function(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this},n.setBuffer=function(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this},n.play=function(t){if(void 0===t&&(t=0),!0!==this.isPlaying){if(!1!==this.hasPlaybackControl){this._startedAt=this.context.currentTime+t;var e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}console.warn("THREE.Audio: this Audio has no playback control.")}else console.warn("THREE.Audio: Audio is already playing.")},n.pause=function(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")},n.stop=function(){if(!1!==this.hasPlaybackControl)return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")},n.connect=function(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(var t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this},n.disconnect=function(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(var t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this},n.getFilters=function(){return this.filters},n.setFilters=function(t){return t||(t=[]),!0===this._connected?(this.disconnect(),this.filters=t.slice(),this.connect()):this.filters=t.slice(),this},n.setDetune=function(t){if(this.detune=t,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this},n.getDetune=function(){return this.detune},n.getFilter=function(){return this.getFilters()[0]},n.setFilter=function(t){return this.setFilters(t?[t]:[])},n.setPlaybackRate=function(t){if(!1!==this.hasPlaybackControl)return this.playbackRate=t,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")},n.getPlaybackRate=function(){return this.playbackRate},n.onEnded=function(){this.isPlaying=!1},n.getLoop=function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop},n.setLoop=function(t){if(!1!==this.hasPlaybackControl)return this.loop=t,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")},n.setLoopStart=function(t){return this.loopStart=t,this},n.setLoopEnd=function(t){return this.loopEnd=t,this},n.getVolume=function(){return this.gain.gain.value},n.setVolume=function(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this},e}(Le),Sc=new Rt,Tc=new Lt,Ec=new Rt,Ac=new Rt,Lc=function(t){function e(e){var n;return(n=t.call(this,e)||this).panner=n.context.createPanner(),n.panner.panningModel="HRTF",n.panner.connect(n.gain),n}lt(e,t);var n=e.prototype;return n.getOutput=function(){return this.panner},n.getRefDistance=function(){return this.panner.refDistance},n.setRefDistance=function(t){return this.panner.refDistance=t,this},n.getRolloffFactor=function(){return this.panner.rolloffFactor},n.setRolloffFactor=function(t){return this.panner.rolloffFactor=t,this},n.getDistanceModel=function(){return this.panner.distanceModel},n.setDistanceModel=function(t){return this.panner.distanceModel=t,this},n.getMaxDistance=function(){return this.panner.maxDistance},n.setMaxDistance=function(t){return this.panner.maxDistance=t,this},n.setDirectionalCone=function(t,e,n){return this.panner.coneInnerAngle=t,this.panner.coneOuterAngle=e,this.panner.coneOuterGain=n,this},n.updateMatrixWorld=function(e){if(t.prototype.updateMatrixWorld.call(this,e),!0!==this.hasPlaybackControl||!1!==this.isPlaying){this.matrixWorld.decompose(Sc,Tc,Ec),Ac.set(0,0,1).applyQuaternion(Tc);var n=this.panner;if(n.positionX){var r=this.context.currentTime+this.listener.timeDelta;n.positionX.linearRampToValueAtTime(Sc.x,r),n.positionY.linearRampToValueAtTime(Sc.y,r),n.positionZ.linearRampToValueAtTime(Sc.z,r),n.orientationX.linearRampToValueAtTime(Ac.x,r),n.orientationY.linearRampToValueAtTime(Ac.y,r),n.orientationZ.linearRampToValueAtTime(Ac.z,r)}else n.setPosition(Sc.x,Sc.y,Sc.z),n.setOrientation(Ac.x,Ac.y,Ac.z)}},e}(Mc),Rc=function(){function t(t,e){void 0===e&&(e=2048),this.analyser=t.context.createAnalyser(),this.analyser.fftSize=e,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}var e=t.prototype;return e.getFrequencyData=function(){return this.analyser.getByteFrequencyData(this.data),this.data},e.getAverageFrequency=function(){for(var t=0,e=this.getFrequencyData(),n=0;n<e.length;n++)t+=e[n];return t/e.length},t}(),Cc=function(){function t(t,e,n){var r,i,a;switch(this.binding=t,this.valueSize=n,e){case"quaternion":r=this._slerp,i=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":r=this._select,i=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(5*n);break;default:r=this._lerp,i=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=i,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}var e=t.prototype;return e.accumulate=function(t,e){var n=this.buffer,r=this.valueSize,i=t*r+r,a=this.cumulativeWeight;if(0===a){for(var o=0;o!==r;++o)n[i+o]=n[o];a=e}else{var s=e/(a+=e);this._mixBufferRegion(n,i,0,s,r)}this.cumulativeWeight=a},e.accumulateAdditive=function(t){var e=this.buffer,n=this.valueSize,r=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(e,r,0,t,n),this.cumulativeWeightAdditive+=t},e.apply=function(t){var e=this.valueSize,n=this.buffer,r=t*e+e,i=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,i<1){var s=e*this._origIndex;this._mixBufferRegion(n,r,s,1-i,e)}a>0&&this._mixBufferRegionAdditive(n,r,this._addIndex*e,1,e);for(var l=e,c=e+e;l!==c;++l)if(n[l]!==n[l+e]){o.setValue(n,r);break}},e.saveOriginalState=function(){var t=this.binding,e=this.buffer,n=this.valueSize,r=n*this._origIndex;t.getValue(e,r);for(var i=n,a=r;i!==a;++i)e[i]=e[r+i%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0},e.restoreOriginalState=function(){var t=3*this.valueSize;this.binding.setValue(this.buffer,t)},e._setAdditiveIdentityNumeric=function(){for(var t=this._addIndex*this.valueSize,e=t+this.valueSize,n=t;n<e;n++)this.buffer[n]=0},e._setAdditiveIdentityQuaternion=function(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1},e._setAdditiveIdentityOther=function(){for(var t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize,n=0;n<this.valueSize;n++)this.buffer[e+n]=this.buffer[t+n]},e._select=function(t,e,n,r,i){if(r>=.5)for(var a=0;a!==i;++a)t[e+a]=t[n+a]},e._slerp=function(t,e,n,r){Lt.slerpFlat(t,e,t,e,t,n,r)},e._slerpAdditive=function(t,e,n,r,i){var a=this._workIndex*i;Lt.multiplyQuaternionsFlat(t,a,t,e,t,n),Lt.slerpFlat(t,e,t,e,t,a,r)},e._lerp=function(t,e,n,r,i){for(var a=1-r,o=0;o!==i;++o){var s=e+o;t[s]=t[s]*a+t[n+o]*r}},e._lerpAdditive=function(t,e,n,r,i){for(var a=0;a!==i;++a){var o=e+a;t[o]=t[o]+t[n+a]*r}},t}(),Pc="\\[\\]\\.:\\/",Dc=new RegExp("[\\[\\]\\.:\\/]","g"),Ic="[^\\[\\]\\.:\\/]",Nc="[^"+Pc.replace("\\.","")+"]",Bc=/((?:WC+[\/:])*)/.source.replace("WC",Ic),Oc=/(WCOD+)?/.source.replace("WCOD",Nc),zc=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Ic),Fc=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Ic),Hc=new RegExp("^"+Bc+Oc+zc+Fc+"$"),Gc=["material","materials","bones"];function Uc(t,e,n){var r=n||kc.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,r)}function kc(t,e,n){this.path=e,this.parsedPath=n||kc.parseTrackName(e),this.node=kc.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}Object.assign(Uc.prototype,{getValue:function(t,e){this.bind();var n=this._targetGroup.nCachedObjects_,r=this._bindings[n];void 0!==r&&r.getValue(t,e)},setValue:function(t,e){for(var n=this._bindings,r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(t,e)},bind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()},unbind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}}),Object.assign(kc,{Composite:Uc,create:function(t,e,n){return t&&t.isAnimationObjectGroup?new kc.Composite(t,e,n):new kc(t,e,n)},sanitizeNodeName:function(t){return t.replace(/\s/g,"_").replace(Dc,"")},parseTrackName:function(t){var e=Hc.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);var n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){var i=n.nodeName.substring(r+1);-1!==Gc.indexOf(i)&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=i)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n},findNode:function(t,e){if(!e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){var n=t.skeleton.getBoneByName(e);if(void 0!==n)return n}if(t.children){var r=function t(n){for(var r=0;r<n.length;r++){var i=n[r];if(i.name===e||i.uuid===e)return i;var a=t(i.children);if(a)return a}return null}(t.children);if(r)return r}return null}}),Object.assign(kc.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(t,e){t[e]=this.node[this.propertyName]},function(t,e){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)t[e++]=n[r]},function(t,e){t[e]=this.resolvedProperty[this.propertyIndex]},function(t,e){this.resolvedProperty.toArray(t,e)}],SetterByBindingTypeAndVersioning:[[function(t,e){this.targetObject[this.propertyName]=t[e]},function(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=t[e++]},function(t,e){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=t[e++];this.targetObject.needsUpdate=!0},function(t,e){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty[this.propertyIndex]=t[e]},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty.fromArray(t,e)},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(t,e){this.bind(),this.getValue(t,e)},setValue:function(t,e){this.bind(),this.setValue(t,e)},bind:function(){var t=this.node,e=this.parsedPath,n=e.objectName,r=e.propertyName,i=e.propertyIndex;if(t||(t=kc.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,t){if(n){var a=e.objectIndex;switch(n){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(var o=0;o<t.length;o++)if(t[o].name===a){a=o;break}break;default:if(void 0===t[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[n]}if(void 0!==a){if(void 0===t[a])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[a]}}var s=t[r];if(void 0!==s){var l=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?l=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(l=this.Versioning.MatrixWorldNeedsUpdate);var c=this.BindingType.Direct;if(void 0!==i){if("morphTargetInfluences"===r){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.isBufferGeometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[i]&&(i=t.morphTargetDictionary[i])}c=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=i}else void 0!==s.fromArray&&void 0!==s.toArray?(c=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(c=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=r;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][l]}else{var u=e.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+u+"."+r+" but it wasn't found.",t)}}else console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.")},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),Object.assign(kc.prototype,{_getValue_unbound:kc.prototype.getValue,_setValue_unbound:kc.prototype.setValue});var Vc=function(){function t(){this.uuid=gt.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var t={};this._indicesByUUID=t;for(var e=0,n=arguments.length;e!==n;++e)t[arguments[e].uuid]=e;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var r=this;this.stats={objects:{get total(){return r._objects.length},get inUse(){return this.total-r.nCachedObjects_}},get bindingsPerObject(){return r._bindings.length}}}var e=t.prototype;return e.add=function(){for(var t=this._objects,e=this._indicesByUUID,n=this._paths,r=this._parsedPaths,i=this._bindings,a=i.length,o=void 0,s=t.length,l=this.nCachedObjects_,c=0,u=arguments.length;c!==u;++c){var h=arguments[c],d=h.uuid,p=e[d];if(void 0===p){p=s++,e[d]=p,t.push(h);for(var f=0,m=a;f!==m;++f)i[f].push(new kc(h,n[f],r[f]))}else if(p<l){o=t[p];var v=--l,g=t[v];e[g.uuid]=p,t[p]=g,e[d]=v,t[v]=h;for(var y=0,x=a;y!==x;++y){var _=i[y],b=_[v],w=_[p];_[p]=b,void 0===w&&(w=new kc(h,n[y],r[y])),_[v]=w}}else t[p]!==o&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=l},e.remove=function(){for(var t=this._objects,e=this._indicesByUUID,n=this._bindings,r=n.length,i=this.nCachedObjects_,a=0,o=arguments.length;a!==o;++a){var s=arguments[a],l=s.uuid,c=e[l];if(void 0!==c&&c>=i){var u=i++,h=t[u];e[h.uuid]=c,t[c]=h,e[l]=u,t[u]=s;for(var d=0,p=r;d!==p;++d){var f=n[d],m=f[u],v=f[c];f[c]=m,f[u]=v}}}this.nCachedObjects_=i},e.uncache=function(){for(var t=this._objects,e=this._indicesByUUID,n=this._bindings,r=n.length,i=this.nCachedObjects_,a=t.length,o=0,s=arguments.length;o!==s;++o){var l=arguments[o],c=l.uuid,u=e[c];if(void 0!==u)if(delete e[c],u<i){var h=--i,d=t[h],p=--a,f=t[p];e[d.uuid]=u,t[u]=d,e[f.uuid]=h,t[h]=f,t.pop();for(var m=0,v=r;m!==v;++m){var g=n[m],y=g[h],x=g[p];g[u]=y,g[h]=x,g.pop()}}else{var _=--a,b=t[_];_>0&&(e[b.uuid]=u),t[u]=b,t.pop();for(var w=0,M=r;w!==M;++w){var S=n[w];S[u]=S[_],S.pop()}}}this.nCachedObjects_=i},e.subscribe_=function(t,e){var n=this._bindingsIndicesByPath,r=n[t],i=this._bindings;if(void 0!==r)return i[r];var a=this._paths,o=this._parsedPaths,s=this._objects,l=s.length,c=this.nCachedObjects_,u=new Array(l);r=i.length,n[t]=r,a.push(t),o.push(e),i.push(u);for(var h=c,d=s.length;h!==d;++h){var p=s[h];u[h]=new kc(p,t,e)}return u},e.unsubscribe_=function(t){var e=this._bindingsIndicesByPath,n=e[t];if(void 0!==n){var r=this._paths,i=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o];e[t[o]]=n,a[n]=s,a.pop(),i[n]=i[o],i.pop(),r[n]=r[o],r.pop()}},t}();Vc.prototype.isAnimationObjectGroup=!0;var Wc=function(){function t(t,e,n,r){void 0===n&&(n=null),void 0===r&&(r=e.blendMode),this._mixer=t,this._clip=e,this._localRoot=n,this.blendMode=r;for(var i=e.tracks,a=i.length,o=new Array(a),s={endingStart:V,endingEnd:V},l=0;l!==a;++l){var c=i[l].createInterpolant(null);o[l]=c,c.settings=s}this._interpolantSettings=s,this._interpolants=o,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}var e=t.prototype;return e.play=function(){return this._mixer._activateAction(this),this},e.stop=function(){return this._mixer._deactivateAction(this),this.reset()},e.reset=function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},e.isRunning=function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},e.isScheduled=function(){return this._mixer._isActiveAction(this)},e.startAt=function(t){return this._startTime=t,this},e.setLoop=function(t,e){return this.loop=t,this.repetitions=e,this},e.setEffectiveWeight=function(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()},e.getEffectiveWeight=function(){return this._effectiveWeight},e.fadeIn=function(t){return this._scheduleFading(t,0,1)},e.fadeOut=function(t){return this._scheduleFading(t,1,0)},e.crossFadeFrom=function(t,e,n){if(t.fadeOut(e),this.fadeIn(e),n){var r=this._clip.duration,i=t._clip.duration,a=i/r,o=r/i;t.warp(1,a,e),this.warp(o,1,e)}return this},e.crossFadeTo=function(t,e,n){return t.crossFadeFrom(this,e,n)},e.stopFading=function(){var t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},e.setEffectiveTimeScale=function(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()},e.getEffectiveTimeScale=function(){return this._effectiveTimeScale},e.setDuration=function(t){return this.timeScale=this._clip.duration/t,this.stopWarping()},e.syncWith=function(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()},e.halt=function(t){return this.warp(this._effectiveTimeScale,0,t)},e.warp=function(t,e,n){var r=this._mixer,i=r.time,a=this.timeScale,o=this._timeScaleInterpolant;null===o&&(o=r._lendControlInterpolant(),this._timeScaleInterpolant=o);var s=o.parameterPositions,l=o.sampleValues;return s[0]=i,s[1]=i+n,l[0]=t/a,l[1]=e/a,this},e.stopWarping=function(){var t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},e.getMixer=function(){return this._mixer},e.getClip=function(){return this._clip},e.getRoot=function(){return this._localRoot||this._mixer._root},e._update=function(t,e,n,r){if(this.enabled){var i=this._startTime;if(null!==i){var a=(t-i)*n;if(a<0||0===n)return;this._startTime=null,e=n*a}e*=this._updateTimeScale(t);var o=this._updateTime(e),s=this._updateWeight(t);if(s>0){var l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case X:for(var u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulateAdditive(s);break;case q:default:for(var d=0,p=l.length;d!==p;++d)l[d].evaluate(o),c[d].accumulate(r,s)}}}else this._updateWeight(t)},e._updateWeight=function(t){var e=0;if(this.enabled){e=this.weight;var n=this._weightInterpolant;if(null!==n){var r=n.evaluate(t)[0];e*=r,t>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=e,e},e._updateTimeScale=function(t){var e=0;if(!this.paused){e=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n)e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}return this._effectiveTimeScale=e,e},e._updateTime=function(t){var e=this._clip.duration,n=this.loop,r=this.time+t,i=this._loopCount,a=2202===n;if(0===t)return-1===i?r:a&&1==(1&i)?e-r:r;if(2200===n){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(r>=e)r=e;else{if(!(r<0)){this.time=r;break t}r=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===i&&(t>=0?(i=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),r>=e||r<0){var o=Math.floor(r/e);r-=e*o,i+=Math.abs(o);var s=this.repetitions-i;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=t>0?e:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===s){var l=t<0;this._setEndings(l,!l,a)}else this._setEndings(!1,!1,a);this._loopCount=i,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=r;if(a&&1==(1&i))return e-r}return r},e._setEndings=function(t,e,n){var r=this._interpolantSettings;n?(r.endingStart=W,r.endingEnd=W):(r.endingStart=t?this.zeroSlopeAtStart?W:V:j,r.endingEnd=e?this.zeroSlopeAtEnd?W:V:j)},e._scheduleFading=function(t,e,n){var r=this._mixer,i=r.time,a=this._weightInterpolant;null===a&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=i,s[0]=e,o[1]=i+t,s[1]=n,this},t}(),jc=function(t){function e(e){var n;return(n=t.call(this)||this)._root=e,n._initMemoryManager(),n._accuIndex=0,n.time=0,n.timeScale=1,n}lt(e,t);var n=e.prototype;return n._bindAction=function(t,e){var n=t._localRoot||this._root,r=t._clip.tracks,i=r.length,a=t._propertyBindings,o=t._interpolants,s=n.uuid,l=this._bindingsByRootAndName,c=l[s];void 0===c&&(c={},l[s]=c);for(var u=0;u!==i;++u){var h=r[u],d=h.name,p=c[d];if(void 0!==p)a[u]=p;else{if(void 0!==(p=a[u])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,d));continue}var f=e&&e._propertyBindings[u].binding.parsedPath;++(p=new Cc(kc.create(n,d,f),h.ValueTypeName,h.getValueSize())).referenceCount,this._addInactiveBinding(p,s,d),a[u]=p}o[u].resultBuffer=p.buffer}},n._activateAction=function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,n=t._clip.uuid,r=this._actionsByClip[n];this._bindAction(t,r&&r.knownActions[0]),this._addInactiveAction(t,n,e)}for(var i=t._propertyBindings,a=0,o=i.length;a!==o;++a){var s=i[a];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(t)}},n._deactivateAction=function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,n=0,r=e.length;n!==r;++n){var i=e[n];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(t)}},n._initMemoryManager=function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},n._isActiveAction=function(t){var e=t._cacheIndex;return null!==e&&e<this._nActiveActions},n._addInactiveAction=function(t,e,n){var r=this._actions,i=this._actionsByClip,a=i[e];if(void 0===a)a={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,i[e]=a;else{var o=a.knownActions;t._byClipCacheIndex=o.length,o.push(t)}t._cacheIndex=r.length,r.push(t),a.actionByRoot[n]=t},n._removeInactiveAction=function(t){var e=this._actions,n=e[e.length-1],r=t._cacheIndex;n._cacheIndex=r,e[r]=n,e.pop(),t._cacheIndex=null;var i=t._clip.uuid,a=this._actionsByClip,o=a[i],s=o.knownActions,l=s[s.length-1],c=t._byClipCacheIndex;l._byClipCacheIndex=c,s[c]=l,s.pop(),t._byClipCacheIndex=null,delete o.actionByRoot[(t._localRoot||this._root).uuid],0===s.length&&delete a[i],this._removeInactiveBindingsForAction(t)},n._removeInactiveBindingsForAction=function(t){for(var e=t._propertyBindings,n=0,r=e.length;n!==r;++n){var i=e[n];0==--i.referenceCount&&this._removeInactiveBinding(i)}},n._lendAction=function(t){var e=this._actions,n=t._cacheIndex,r=this._nActiveActions++,i=e[r];t._cacheIndex=r,e[r]=t,i._cacheIndex=n,e[n]=i},n._takeBackAction=function(t){var e=this._actions,n=t._cacheIndex,r=--this._nActiveActions,i=e[r];t._cacheIndex=r,e[r]=t,i._cacheIndex=n,e[n]=i},n._addInactiveBinding=function(t,e,n){var r=this._bindingsByRootAndName,i=this._bindings,a=r[e];void 0===a&&(a={},r[e]=a),a[n]=t,t._cacheIndex=i.length,i.push(t)},n._removeInactiveBinding=function(t){var e=this._bindings,n=t.binding,r=n.rootNode.uuid,i=n.path,a=this._bindingsByRootAndName,o=a[r],s=e[e.length-1],l=t._cacheIndex;s._cacheIndex=l,e[l]=s,e.pop(),delete o[i],0===Object.keys(o).length&&delete a[r]},n._lendBinding=function(t){var e=this._bindings,n=t._cacheIndex,r=this._nActiveBindings++,i=e[r];t._cacheIndex=r,e[r]=t,i._cacheIndex=n,e[n]=i},n._takeBackBinding=function(t){var e=this._bindings,n=t._cacheIndex,r=--this._nActiveBindings,i=e[r];t._cacheIndex=r,e[r]=t,i._cacheIndex=n,e[n]=i},n._lendControlInterpolant=function(){var t=this._controlInterpolants,e=this._nActiveControlInterpolants++,n=t[e];return void 0===n&&((n=new Bs(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=e,t[e]=n),n},n._takeBackControlInterpolant=function(t){var e=this._controlInterpolants,n=t.__cacheIndex,r=--this._nActiveControlInterpolants,i=e[r];t.__cacheIndex=r,e[r]=t,i.__cacheIndex=n,e[n]=i},n.clipAction=function(t,e,n){var r=e||this._root,i=r.uuid,a="string"==typeof t?js.findByName(r,t):t,o=null!==a?a.uuid:t,s=this._actionsByClip[o],l=null;if(void 0===n&&(n=null!==a?a.blendMode:q),void 0!==s){var c=s.actionByRoot[i];if(void 0!==c&&c.blendMode===n)return c;l=s.knownActions[0],null===a&&(a=l._clip)}if(null===a)return null;var u=new Wc(this,a,e,n);return this._bindAction(u,l),this._addInactiveAction(u,o,i),u},n.existingAction=function(t,e){var n=e||this._root,r=n.uuid,i="string"==typeof t?js.findByName(n,t):t,a=i?i.uuid:t,o=this._actionsByClip[a];return void 0!==o&&o.actionByRoot[r]||null},n.stopAllAction=function(){for(var t=this._actions,e=this._nActiveActions-1;e>=0;--e)t[e].stop();return this},n.update=function(t){t*=this.timeScale;for(var e=this._actions,n=this._nActiveActions,r=this.time+=t,i=Math.sign(t),a=this._accuIndex^=1,o=0;o!==n;++o){e[o]._update(r,t,i,a)}for(var s=this._bindings,l=this._nActiveBindings,c=0;c!==l;++c)s[c].apply(a);return this},n.setTime=function(t){this.time=0;for(var e=0;e<this._actions.length;e++)this._actions[e].time=0;return this.update(t)},n.getRoot=function(){return this._root},n.uncacheClip=function(t){var e=this._actions,n=t.uuid,r=this._actionsByClip,i=r[n];if(void 0!==i){for(var a=i.knownActions,o=0,s=a.length;o!==s;++o){var l=a[o];this._deactivateAction(l);var c=l._cacheIndex,u=e[e.length-1];l._cacheIndex=null,l._byClipCacheIndex=null,u._cacheIndex=c,e[c]=u,e.pop(),this._removeInactiveBindingsForAction(l)}delete r[n]}},n.uncacheRoot=function(t){var e=t.uuid,n=this._actionsByClip;for(var r in n){var i=n[r].actionByRoot[e];void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}var a=this._bindingsByRootAndName[e];if(void 0!==a)for(var o in a){var s=a[o];s.restoreOriginalState(),this._removeInactiveBinding(s)}},n.uncacheAction=function(t,e){var n=this.existingAction(t,e);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))},e}(pt);jc.prototype._controlInterpolantsResultBuffer=new Float32Array(1);var qc=function(){function t(t){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}return t.prototype.clone=function(){return new t(void 0===this.value.clone?this.value:this.value.clone())},t}();function Xc(t,e,n){ma.call(this,t,e),this.meshPerAttribute=n||1}function Yc(t,e,n,r,i){this.buffer=t,this.type=e,this.itemSize=n,this.elementSize=r,this.count=i,this.version=0}function Zc(t,e,n,r){void 0===n&&(n=0),void 0===r&&(r=1/0),this.ray=new ne(t,e),this.near=n,this.far=r,this.camera=null,this.layers=new fe,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function Jc(t,e){return t.distance-e.distance}function Qc(t,e,n,r){if(t.layers.test(e.layers)&&t.raycast(e,n),!0===r)for(var i=t.children,a=0,o=i.length;a<o;a++)Qc(i[a],e,n,!0)}Xc.prototype=Object.assign(Object.create(ma.prototype),{constructor:Xc,isInstancedInterleavedBuffer:!0,copy:function(t){return ma.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this},clone:function(t){var e=ma.prototype.clone.call(this,t);return e.meshPerAttribute=this.meshPerAttribute,e},toJSON:function(t){var e=ma.prototype.toJSON.call(this,t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}}),Object.defineProperty(Yc.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(Yc.prototype,{isGLBufferAttribute:!0,setBuffer:function(t){return this.buffer=t,this},setType:function(t,e){return this.type=t,this.elementSize=e,this},setItemSize:function(t){return this.itemSize=t,this},setCount:function(t){return this.count=t,this}}),Object.assign(Zc.prototype,{set:function(t,e){this.ray.set(t,e)},setFromCamera:function(t,e){e&&e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e&&e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):console.error("THREE.Raycaster: Unsupported camera type: "+e.type)},intersectObject:function(t,e,n){return void 0===e&&(e=!1),void 0===n&&(n=[]),Qc(t,this,n,e),n.sort(Jc),n},intersectObjects:function(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=[]);for(var r=0,i=t.length;r<i;r++)Qc(t[r],this,n,e);return n.sort(Jc),n}});var Kc=function(){function t(t,e,n){return void 0===t&&(t=1),void 0===e&&(e=0),void 0===n&&(n=0),this.radius=t,this.phi=e,this.theta=n,this}var e=t.prototype;return e.set=function(t,e,n){return this.radius=t,this.phi=e,this.theta=n,this},e.copy=function(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this},e.makeSafe=function(){var t=1e-6;return this.phi=Math.max(t,Math.min(Math.PI-t,this.phi)),this},e.setFromVector3=function(t){return this.setFromCartesianCoords(t.x,t.y,t.z)},e.setFromCartesianCoords=function(t,e,n){return this.radius=Math.sqrt(t*t+e*e+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,n),this.phi=Math.acos(gt.clamp(e/this.radius,-1,1))),this},e.clone=function(){return(new this.constructor).copy(this)},t}(),$c=function(){function t(t,e,n){return void 0===t&&(t=1),void 0===e&&(e=0),void 0===n&&(n=0),this.radius=t,this.theta=e,this.y=n,this}var e=t.prototype;return e.set=function(t,e,n){return this.radius=t,this.theta=e,this.y=n,this},e.copy=function(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this},e.setFromVector3=function(t){return this.setFromCartesianCoords(t.x,t.y,t.z)},e.setFromCartesianCoords=function(t,e,n){return this.radius=Math.sqrt(t*t+n*n),this.theta=Math.atan2(t,n),this.y=e,this},e.clone=function(){return(new this.constructor).copy(this)},t}(),tu=new yt,eu=function(){function t(t,e){void 0===t&&(t=new yt(1/0,1/0)),void 0===e&&(e=new yt(-1/0,-1/0)),this.min=t,this.max=e}var e=t.prototype;return e.set=function(t,e){return this.min.copy(t),this.max.copy(e),this},e.setFromPoints=function(t){this.makeEmpty();for(var e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this},e.setFromCenterAndSize=function(t,e){var n=tu.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this},e.clone=function(){return(new this.constructor).copy(this)},e.copy=function(t){return this.min.copy(t.min),this.max.copy(t.max),this},e.makeEmpty=function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},e.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y},e.getCenter=function(t){return void 0===t&&(console.warn("THREE.Box2: .getCenter() target is now required"),t=new yt),this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},e.getSize=function(t){return void 0===t&&(console.warn("THREE.Box2: .getSize() target is now required"),t=new yt),this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)},e.expandByPoint=function(t){return this.min.min(t),this.max.max(t),this},e.expandByVector=function(t){return this.min.sub(t),this.max.add(t),this},e.expandByScalar=function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},e.containsPoint=function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)},e.containsBox=function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},e.getParameter=function(t,e){return void 0===e&&(console.warn("THREE.Box2: .getParameter() target is now required"),e=new yt),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},e.intersectsBox=function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)},e.clampPoint=function(t,e){return void 0===e&&(console.warn("THREE.Box2: .clampPoint() target is now required"),e=new yt),e.copy(t).clamp(this.min,this.max)},e.distanceToPoint=function(t){return tu.copy(t).clamp(this.min,this.max).sub(t).length()},e.intersect=function(t){return this.min.max(t.min),this.max.min(t.max),this},e.union=function(t){return this.min.min(t.min),this.max.max(t.max),this},e.translate=function(t){return this.min.add(t),this.max.add(t),this},e.equals=function(t){return t.min.equals(this.min)&&t.max.equals(this.max)},t}();eu.prototype.isBox2=!0;var nu=new Rt,ru=new Rt,iu=function(){function t(t,e){void 0===t&&(t=new Rt),void 0===e&&(e=new Rt),this.start=t,this.end=e}var e=t.prototype;return e.set=function(t,e){return this.start.copy(t),this.end.copy(e),this},e.copy=function(t){return this.start.copy(t.start),this.end.copy(t.end),this},e.getCenter=function(t){return void 0===t&&(console.warn("THREE.Line3: .getCenter() target is now required"),t=new Rt),t.addVectors(this.start,this.end).multiplyScalar(.5)},e.delta=function(t){return void 0===t&&(console.warn("THREE.Line3: .delta() target is now required"),t=new Rt),t.subVectors(this.end,this.start)},e.distanceSq=function(){return this.start.distanceToSquared(this.end)},e.distance=function(){return this.start.distanceTo(this.end)},e.at=function(t,e){return void 0===e&&(console.warn("THREE.Line3: .at() target is now required"),e=new Rt),this.delta(e).multiplyScalar(t).add(this.start)},e.closestPointToPointParameter=function(t,e){nu.subVectors(t,this.start),ru.subVectors(this.end,this.start);var n=ru.dot(ru),r=ru.dot(nu)/n;return e&&(r=gt.clamp(r,0,1)),r},e.closestPointToPoint=function(t,e,n){var r=this.closestPointToPointParameter(t,e);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new Rt),this.delta(n).multiplyScalar(r).add(this.start)},e.applyMatrix4=function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},e.equals=function(t){return t.start.equals(this.start)&&t.end.equals(this.end)},e.clone=function(){return(new this.constructor).copy(this)},t}();function au(t){Le.call(this),this.material=t,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}au.prototype=Object.create(Le.prototype),au.prototype.constructor=au,au.prototype.isImmediateRenderObject=!0;var ou=new Rt,su=function(t){function e(e,n){var r;(r=t.call(this)||this).light=e,r.light.updateMatrixWorld(),r.matrix=e.matrixWorld,r.matrixAutoUpdate=!1,r.color=n;for(var i=new Sn,a=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],o=0,s=1;o<32;o++,s++){var l=o/32*Math.PI*2,c=s/32*Math.PI*2;a.push(Math.cos(l),Math.sin(l),1,Math.cos(c),Math.sin(c),1)}i.setAttribute("position",new dn(a,3));var u=new Ka({fog:!1,toneMapped:!1});return r.cone=new so(i,u),r.add(r.cone),r.update(),r}lt(e,t);var n=e.prototype;return n.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},n.update=function(){this.light.updateMatrixWorld();var t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),ou.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(ou),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)},e}(Le),lu=new Rt,cu=new re,uu=new re,hu=function(t){function e(e){for(var n,r=du(e),i=new Sn,a=[],o=[],s=new Ke(0,0,1),l=new Ke(0,1,0),c=0;c<r.length;c++){var u=r[c];u.parent&&u.parent.isBone&&(a.push(0,0,0),a.push(0,0,0),o.push(s.r,s.g,s.b),o.push(l.r,l.g,l.b))}i.setAttribute("position",new dn(a,3)),i.setAttribute("color",new dn(o,3));var h=new Ka({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});return(n=t.call(this,i,h)||this).type="SkeletonHelper",n.isSkeletonHelper=!0,n.root=e,n.bones=r,n.matrix=e.matrixWorld,n.matrixAutoUpdate=!1,n}return lt(e,t),e.prototype.updateMatrixWorld=function(e){var n=this.bones,r=this.geometry,i=r.getAttribute("position");uu.copy(this.root.matrixWorld).invert();for(var a=0,o=0;a<n.length;a++){var s=n[a];s.parent&&s.parent.isBone&&(cu.multiplyMatrices(uu,s.matrixWorld),lu.setFromMatrixPosition(cu),i.setXYZ(o,lu.x,lu.y,lu.z),cu.multiplyMatrices(uu,s.parent.matrixWorld),lu.setFromMatrixPosition(cu),i.setXYZ(o+1,lu.x,lu.y,lu.z),o+=2)}r.getAttribute("position").needsUpdate=!0,t.prototype.updateMatrixWorld.call(this,e)},e}(so);function du(t){var e=[];t&&t.isBone&&e.push(t);for(var n=0;n<t.children.length;n++)e.push.apply(e,du(t.children[n]));return e}var pu=function(t){function e(e,n,r){var i,a=new ps(n,4,2),o=new $e({wireframe:!0,fog:!1,toneMapped:!1});return(i=t.call(this,a,o)||this).light=e,i.light.updateMatrixWorld(),i.color=r,i.type="PointLightHelper",i.matrix=i.light.matrixWorld,i.matrixAutoUpdate=!1,i.update(),i}lt(e,t);var n=e.prototype;return n.dispose=function(){this.geometry.dispose(),this.material.dispose()},n.update=function(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)},e}(kn),fu=new Rt,mu=new Ke,vu=new Ke,gu=function(t){function e(e,n,r){var i;(i=t.call(this)||this).light=e,i.light.updateMatrixWorld(),i.matrix=e.matrixWorld,i.matrixAutoUpdate=!1,i.color=r;var a=new cs(n);a.rotateY(.5*Math.PI),i.material=new $e({wireframe:!0,fog:!1,toneMapped:!1}),void 0===i.color&&(i.material.vertexColors=!0);var o=a.getAttribute("position"),s=new Float32Array(3*o.count);return a.setAttribute("color",new nn(s,3)),i.add(new kn(a,i.material)),i.update(),i}lt(e,t);var n=e.prototype;return n.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},n.update=function(){var t=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{var e=t.geometry.getAttribute("color");mu.copy(this.light.color),vu.copy(this.light.groundColor);for(var n=0,r=e.count;n<r;n++){var i=n<r/2?mu:vu;e.setXYZ(n,i.r,i.g,i.b)}e.needsUpdate=!0}t.lookAt(fu.setFromMatrixPosition(this.light.matrixWorld).negate())},e}(Le),yu=function(t){function e(e,n,r,i){var a;void 0===e&&(e=10),void 0===n&&(n=10),void 0===r&&(r=4473924),void 0===i&&(i=8947848),r=new Ke(r),i=new Ke(i);for(var o=n/2,s=e/n,l=e/2,c=[],u=[],h=0,d=0,p=-l;h<=n;h++,p+=s){c.push(-l,0,p,l,0,p),c.push(p,0,-l,p,0,l);var f=h===o?r:i;f.toArray(u,d),d+=3,f.toArray(u,d),d+=3,f.toArray(u,d),d+=3,f.toArray(u,d),d+=3}var m=new Sn;m.setAttribute("position",new dn(c,3)),m.setAttribute("color",new dn(u,3));var v=new Ka({vertexColors:!0,toneMapped:!1});return(a=t.call(this,m,v)||this).type="GridHelper",a}return lt(e,t),e}(so),xu=function(t){function e(e,n,r,i,a,o){var s;void 0===e&&(e=10),void 0===n&&(n=16),void 0===r&&(r=8),void 0===i&&(i=64),void 0===a&&(a=4473924),void 0===o&&(o=8947848),a=new Ke(a),o=new Ke(o);for(var l=[],c=[],u=0;u<=n;u++){var h=u/n*(2*Math.PI),d=Math.sin(h)*e,p=Math.cos(h)*e;l.push(0,0,0),l.push(d,0,p);var f=1&u?a:o;c.push(f.r,f.g,f.b),c.push(f.r,f.g,f.b)}for(var m=0;m<=r;m++)for(var v=1&m?a:o,g=e-e/r*m,y=0;y<i;y++){var x=y/i*(2*Math.PI),_=Math.sin(x)*g,b=Math.cos(x)*g;l.push(_,0,b),c.push(v.r,v.g,v.b),x=(y+1)/i*(2*Math.PI),_=Math.sin(x)*g,b=Math.cos(x)*g,l.push(_,0,b),c.push(v.r,v.g,v.b)}var w=new Sn;w.setAttribute("position",new dn(l,3)),w.setAttribute("color",new dn(c,3));var M=new Ka({vertexColors:!0,toneMapped:!1});return(s=t.call(this,w,M)||this).type="PolarGridHelper",s}return lt(e,t),e}(so),_u=new Rt,bu=new Rt,wu=new Rt,Mu=function(t){function e(e,n,r){var i;(i=t.call(this)||this).light=e,i.light.updateMatrixWorld(),i.matrix=e.matrixWorld,i.matrixAutoUpdate=!1,i.color=r,void 0===n&&(n=1);var a=new Sn;a.setAttribute("position",new dn([-n,n,0,n,n,0,n,-n,0,-n,-n,0,-n,n,0],3));var o=new Ka({fog:!1,toneMapped:!1});return i.lightPlane=new io(a,o),i.add(i.lightPlane),(a=new Sn).setAttribute("position",new dn([0,0,0,0,0,1],3)),i.targetLine=new io(a,o),i.add(i.targetLine),i.update(),i}lt(e,t);var n=e.prototype;return n.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},n.update=function(){_u.setFromMatrixPosition(this.light.matrixWorld),bu.setFromMatrixPosition(this.light.target.matrixWorld),wu.subVectors(bu,_u),this.lightPlane.lookAt(bu),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(bu),this.targetLine.scale.z=wu.length()},e}(Le),Su=new Rt,Tu=new Zn,Eu=function(t){function e(e){var n,r=new Sn,i=new Ka({color:16777215,vertexColors:!0,toneMapped:!1}),a=[],o=[],s={},l=new Ke(16755200),c=new Ke(16711680),u=new Ke(43775),h=new Ke(16777215),d=new Ke(3355443);function p(t,e,n){f(t,n),f(e,n)}function f(t,e){a.push(0,0,0),o.push(e.r,e.g,e.b),void 0===s[t]&&(s[t]=[]),s[t].push(a.length/3-1)}return p("n1","n2",l),p("n2","n4",l),p("n4","n3",l),p("n3","n1",l),p("f1","f2",l),p("f2","f4",l),p("f4","f3",l),p("f3","f1",l),p("n1","f1",l),p("n2","f2",l),p("n3","f3",l),p("n4","f4",l),p("p","n1",c),p("p","n2",c),p("p","n3",c),p("p","n4",c),p("u1","u2",u),p("u2","u3",u),p("u3","u1",u),p("c","t",h),p("p","c",d),p("cn1","cn2",d),p("cn3","cn4",d),p("cf1","cf2",d),p("cf3","cf4",d),r.setAttribute("position",new dn(a,3)),r.setAttribute("color",new dn(o,3)),(n=t.call(this,r,i)||this).type="CameraHelper",n.camera=e,n.camera.updateProjectionMatrix&&n.camera.updateProjectionMatrix(),n.matrix=e.matrixWorld,n.matrixAutoUpdate=!1,n.pointMap=s,n.update(),n}return lt(e,t),e.prototype.update=function(){var t=this.geometry,e=this.pointMap;Tu.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),Au("c",e,t,Tu,0,0,-1),Au("t",e,t,Tu,0,0,1),Au("n1",e,t,Tu,-1,-1,-1),Au("n2",e,t,Tu,1,-1,-1),Au("n3",e,t,Tu,-1,1,-1),Au("n4",e,t,Tu,1,1,-1),Au("f1",e,t,Tu,-1,-1,1),Au("f2",e,t,Tu,1,-1,1),Au("f3",e,t,Tu,-1,1,1),Au("f4",e,t,Tu,1,1,1),Au("u1",e,t,Tu,.7,1.1,-1),Au("u2",e,t,Tu,-.7,1.1,-1),Au("u3",e,t,Tu,0,2,-1),Au("cf1",e,t,Tu,-1,0,1),Au("cf2",e,t,Tu,1,0,1),Au("cf3",e,t,Tu,0,-1,1),Au("cf4",e,t,Tu,0,1,1),Au("cn1",e,t,Tu,-1,0,-1),Au("cn2",e,t,Tu,1,0,-1),Au("cn3",e,t,Tu,0,-1,-1),Au("cn4",e,t,Tu,0,1,-1),t.getAttribute("position").needsUpdate=!0},e}(so);function Au(t,e,n,r,i,a,o){Su.set(i,a,o).unproject(r);var s=e[t];if(void 0!==s)for(var l=n.getAttribute("position"),c=0,u=s.length;c<u;c++)l.setXYZ(s[c],Su.x,Su.y,Su.z)}var Lu,Ru,Cu,Pu=new Dt,Du=function(t){function e(e,n){var r;void 0===n&&(n=16776960);var i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),a=new Float32Array(24),o=new Sn;return o.setIndex(new nn(i,1)),o.setAttribute("position",new nn(a,3)),(r=t.call(this,o,new Ka({color:n,toneMapped:!1}))||this).object=e,r.type="BoxHelper",r.matrixAutoUpdate=!1,r.update(),r}lt(e,t);var n=e.prototype;return n.update=function(t){if(void 0!==t&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&Pu.setFromObject(this.object),!Pu.isEmpty()){var e=Pu.min,n=Pu.max,r=this.geometry.attributes.position,i=r.array;i[0]=n.x,i[1]=n.y,i[2]=n.z,i[3]=e.x,i[4]=n.y,i[5]=n.z,i[6]=e.x,i[7]=e.y,i[8]=n.z,i[9]=n.x,i[10]=e.y,i[11]=n.z,i[12]=n.x,i[13]=n.y,i[14]=e.z,i[15]=e.x,i[16]=n.y,i[17]=e.z,i[18]=e.x,i[19]=e.y,i[20]=e.z,i[21]=n.x,i[22]=e.y,i[23]=e.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}},n.setFromObject=function(t){return this.object=t,this.update(),this},n.copy=function(t){return so.prototype.copy.call(this,t),this.object=t.object,this},e}(so),Iu=function(t){function e(e,n){var r;void 0===n&&(n=16776960);var i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),a=new Sn;return a.setIndex(new nn(i,1)),a.setAttribute("position",new dn([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),(r=t.call(this,a,new Ka({color:n,toneMapped:!1}))||this).box=e,r.type="Box3Helper",r.geometry.computeBoundingSphere(),r}return lt(e,t),e.prototype.updateMatrixWorld=function(e){var n=this.box;n.isEmpty()||(n.getCenter(this.position),n.getSize(this.scale),this.scale.multiplyScalar(.5),t.prototype.updateMatrixWorld.call(this,e))},e}(so),Nu=function(t){function e(e,n,r){var i;void 0===n&&(n=1),void 0===r&&(r=16776960);var a=r,o=new Sn;o.setAttribute("position",new dn([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,0,1,0,0,0],3)),o.computeBoundingSphere(),(i=t.call(this,o,new Ka({color:a,toneMapped:!1}))||this).type="PlaneHelper",i.plane=e,i.size=n;var s=new Sn;return s.setAttribute("position",new dn([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),s.computeBoundingSphere(),i.add(new kn(s,new $e({color:a,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1}))),i}return lt(e,t),e.prototype.updateMatrixWorld=function(e){var n=-this.plane.constant;Math.abs(n)<1e-8&&(n=1e-8),this.scale.set(.5*this.size,.5*this.size,n),this.children[0].material.side=n<0?1:0,this.lookAt(this.plane.normal),t.prototype.updateMatrixWorld.call(this,e)},e}(io),Bu=new Rt,Ou=function(t){function e(e,n,r,i,a,o){var s;return void 0===e&&(e=new Rt(0,0,1)),void 0===n&&(n=new Rt(0,0,0)),void 0===r&&(r=1),void 0===i&&(i=16776960),void 0===a&&(a=.2*r),void 0===o&&(o=.2*a),(s=t.call(this)||this).type="ArrowHelper",void 0===Lu&&((Lu=new Sn).setAttribute("position",new dn([0,0,0,0,1,0],3)),(Ru=new wo(0,.5,1,5,1)).translate(0,-.5,0)),s.position.copy(n),s.line=new io(Lu,new Ka({color:i,toneMapped:!1})),s.line.matrixAutoUpdate=!1,s.add(s.line),s.cone=new kn(Ru,new $e({color:i,toneMapped:!1})),s.cone.matrixAutoUpdate=!1,s.add(s.cone),s.setDirection(e),s.setLength(r,a,o),s}lt(e,t);var n=e.prototype;return n.setDirection=function(t){if(t.y>.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{Bu.set(t.z,0,-t.x).normalize();var e=Math.acos(t.y);this.quaternion.setFromAxisAngle(Bu,e)}},n.setLength=function(t,e,n){void 0===e&&(e=.2*t),void 0===n&&(n=.2*e),this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()},n.setColor=function(t){this.line.material.color.set(t),this.cone.material.color.set(t)},n.copy=function(e){return t.prototype.copy.call(this,e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this},e}(Le),zu=function(t){function e(e){var n;void 0===e&&(e=1);var r=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],i=new Sn;i.setAttribute("position",new dn(r,3)),i.setAttribute("color",new dn([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));var a=new Ka({vertexColors:!0,toneMapped:!1});return(n=t.call(this,i,a)||this).type="AxesHelper",n}return lt(e,t),e}(so),Fu=new Float32Array(1),Hu=new Int32Array(Fu.buffer),Gu={toHalfFloat:function(t){Fu[0]=t;var e=Hu[0],n=e>>16&32768,r=e>>12&2047,i=e>>23&255;return i<103?n:i>142?(n|=31744,n|=(255==i?0:1)&&8388607&e):i<113?n|=((r|=2048)>>114-i)+(r>>113-i&1):(n|=i-112<<10|r>>1,n+=1&r)}},Uu=Math.pow(2,8),ku=[.125,.215,.35,.446,.526,.582],Vu=5+ku.length,Wu=20,ju=((Cu={})[3e3]=0,Cu[3001]=1,Cu[3002]=2,Cu[3004]=3,Cu[3005]=4,Cu[3006]=5,Cu[3007]=6,Cu),qu=new $e({side:1,depthWrite:!1,depthTest:!1}),Xu=new kn(new Wn,qu),Yu=new Ul,Zu=sh(),Ju=Zu._lodPlanes,Qu=Zu._sizeLods,Ku=Zu._sigmas,$u=new Ke,th=null,eh=(1+Math.sqrt(5))/2,nh=1/eh,rh=[new Rt(1,1,1),new Rt(-1,1,1),new Rt(1,1,-1),new Rt(-1,1,-1),new Rt(0,eh,nh),new Rt(0,eh,-nh),new Rt(nh,0,eh),new Rt(-nh,0,eh),new Rt(eh,nh,0),new Rt(-eh,nh,0)];function ih(t){var e=Math.max(t.r,t.g,t.b),n=Math.min(Math.max(Math.ceil(Math.log2(e)),-128),127);return t.multiplyScalar(Math.pow(2,-n)),(n+128)/255}var ah=function(){function t(t){var e,n,r;this._renderer=t,this._pingPongRenderTarget=null,this._blurMaterial=(e=Wu,n=new Float32Array(e),r=new Rt(0,1,0),new ws({name:"SphericalGaussianBlur",defines:{n:e},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r},inputEncoding:{value:ju[3e3]},outputEncoding:{value:ju[3e3]}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include <encodings_pars_fragment>\n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}var e=t.prototype;return e.fromScene=function(t,e,n,r){void 0===e&&(e=0),void 0===n&&(n=.1),void 0===r&&(r=100),th=this._renderer.getRenderTarget();var i=this._allocateTargets();return this._sceneToCubeUV(t,n,r,i),e>0&&this._blur(i,0,0,e),this._applyPMREM(i),this._cleanup(i),i},e.fromEquirectangular=function(t){return this._fromTexture(t)},e.fromCubemap=function(t){return this._fromTexture(t)},e.compileCubemapShader=function(){null===this._cubemapShader&&(this._cubemapShader=hh(),this._compileMaterial(this._cubemapShader))},e.compileEquirectangularShader=function(){null===this._equirectShader&&(this._equirectShader=uh(),this._compileMaterial(this._equirectShader))},e.dispose=function(){this._blurMaterial.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(var t=0;t<Ju.length;t++)Ju[t].dispose()},e._cleanup=function(t){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(th),t.scissorTest=!1,ch(t,0,0,t.width,t.height)},e._fromTexture=function(t){th=this._renderer.getRenderTarget();var e=this._allocateTargets(t);return this._textureToCubeUV(t,e),this._applyPMREM(e),this._cleanup(e),e},e._allocateTargets=function(t){var e={magFilter:f,minFilter:f,generateMipmaps:!1,type:_,format:1023,encoding:oh(t)?t.encoding:Q,depthBuffer:!1},n=lh(e);return n.depthBuffer=!t,this._pingPongRenderTarget=lh(e),n},e._compileMaterial=function(t){var e=new kn(Ju[0],t);this._renderer.compile(e,Yu)},e._sceneToCubeUV=function(t,e,n,r){var i=new Jn(90,1,e,n),a=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],s=this._renderer,l=s.autoClear,c=s.outputEncoding,u=s.toneMapping;s.getClearColor($u),s.toneMapping=0,s.outputEncoding=Y,s.autoClear=!1;var h=!1,d=t.background;if(d){if(d.isColor){qu.color.copy(d).convertSRGBToLinear(),t.background=null;var p=ih(qu.color);qu.opacity=p,h=!0}}else{qu.color.copy($u).convertSRGBToLinear();var f=ih(qu.color);qu.opacity=f,h=!0}for(var m=0;m<6;m++){var v=m%3;0==v?(i.up.set(0,a[m],0),i.lookAt(o[m],0,0)):1==v?(i.up.set(0,0,a[m]),i.lookAt(0,o[m],0)):(i.up.set(0,a[m],0),i.lookAt(0,0,o[m])),ch(r,v*Uu,m>2?Uu:0,Uu,Uu),s.setRenderTarget(r),h&&s.render(Xu,i),s.render(t,i)}s.toneMapping=u,s.outputEncoding=c,s.autoClear=l},e._textureToCubeUV=function(t,e){var n=this._renderer;t.isCubeTexture?null==this._cubemapShader&&(this._cubemapShader=hh()):null==this._equirectShader&&(this._equirectShader=uh());var r=t.isCubeTexture?this._cubemapShader:this._equirectShader,i=new kn(Ju[0],r),a=r.uniforms;a.envMap.value=t,t.isCubeTexture||a.texelSize.value.set(1/t.image.width,1/t.image.height),a.inputEncoding.value=ju[t.encoding],a.outputEncoding.value=ju[e.texture.encoding],ch(e,0,0,3*Uu,2*Uu),n.setRenderTarget(e),n.render(i,Yu)},e._applyPMREM=function(t){var e=this._renderer,n=e.autoClear;e.autoClear=!1;for(var r=1;r<Vu;r++){var i=Math.sqrt(Ku[r]*Ku[r]-Ku[r-1]*Ku[r-1]),a=rh[(r-1)%rh.length];this._blur(t,r-1,r,i,a)}e.autoClear=n},e._blur=function(t,e,n,r,i){var a=this._pingPongRenderTarget;this._halfBlur(t,a,e,n,r,"latitudinal",i),this._halfBlur(a,t,n,n,r,"longitudinal",i)},e._halfBlur=function(t,e,n,r,i,a,o){var s=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");var c=new kn(Ju[r],l),u=l.uniforms,h=Qu[n]-1,d=isFinite(i)?Math.PI/(2*h):2*Math.PI/39,p=i/d,f=isFinite(i)?1+Math.floor(3*p):Wu;f>Wu&&console.warn("sigmaRadians, "+i+", is too large and will clip, as it requested "+f+" samples when the maximum is set to "+Wu);for(var m=[],v=0,g=0;g<Wu;++g){var y=g/p,x=Math.exp(-y*y/2);m.push(x),0==g?v+=x:g<f&&(v+=2*x)}for(var _=0;_<m.length;_++)m[_]=m[_]/v;u.envMap.value=t.texture,u.samples.value=f,u.weights.value=m,u.latitudinal.value="latitudinal"===a,o&&(u.poleAxis.value=o),u.dTheta.value=d,u.mipInt.value=8-n,u.inputEncoding.value=ju[t.texture.encoding],u.outputEncoding.value=ju[t.texture.encoding];var b=Qu[r];ch(e,3*Math.max(0,Uu-2*b),(0===r?0:2*Uu)+2*b*(r>4?r-8+4:0),3*b,2*b),s.setRenderTarget(e),s.render(c,Yu)},t}();function oh(t){return void 0!==t&&t.type===_&&(t.encoding===Y||t.encoding===Z||t.encoding===J)}function sh(){for(var t=[],e=[],n=[],r=8,i=0;i<Vu;i++){var a=Math.pow(2,r);e.push(a);var o=1/a;i>4?o=ku[i-8+4-1]:0==i&&(o=0),n.push(o);for(var s=1/(a-1),l=-s/2,c=1+s/2,u=[l,l,c,l,c,c,l,l,c,c,l,c],h=new Float32Array(108),d=new Float32Array(72),p=new Float32Array(36),f=0;f<6;f++){var m=f%3*2/3-1,v=f>2?0:-1,g=[m,v,0,m+2/3,v,0,m+2/3,v+1,0,m,v,0,m+2/3,v+1,0,m,v+1,0];h.set(g,18*f),d.set(u,12*f);var y=[f,f,f,f,f,f];p.set(y,6*f)}var x=new Sn;x.setAttribute("position",new nn(h,3)),x.setAttribute("uv",new nn(d,2)),x.setAttribute("faceIndex",new nn(p,1)),t.push(x),r>4&&r--}return{_lodPlanes:t,_sizeLods:e,_sigmas:n}}function lh(t){var e=new Et(3*Uu,3*Uu,t);return e.texture.mapping=c,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function ch(t,e,n,r,i){t.viewport.set(e,n,r,i),t.scissor.set(e,n,r,i)}function uh(){var t=new yt(1,1);return new ws({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:t},inputEncoding:{value:ju[3e3]},outputEncoding:{value:ju[3e3]}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform vec2 texelSize;\n\n\t\t\t\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include <encodings_pars_fragment>\n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tvec2 f = fract( uv / texelSize - 0.5 );\n\t\t\t\tuv -= f * texelSize;\n\t\t\t\tvec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x += texelSize.x;\n\t\t\t\tvec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.y += texelSize.y;\n\t\t\t\tvec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x -= texelSize.x;\n\t\t\t\tvec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\n\t\t\t\tvec3 tm = mix( tl, tr, f.x );\n\t\t\t\tvec3 bm = mix( bl, br, f.x );\n\t\t\t\tgl_FragColor.rgb = mix( tm, bm, f.y );\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function hh(){return new ws({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:ju[3e3]},outputEncoding:{value:ju[3e3]}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\t\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include <encodings_pars_fragment>\n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}al.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(al.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},El.prototype.fromPoints=function(t){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(t)},yu.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},hu.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Js.prototype.extractUrlBase=function(t){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Zl.extractUrlBase(t)},Js.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}},eu.prototype.center=function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},eu.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},eu.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},eu.prototype.size=function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)},Dt.prototype.center=function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},Dt.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Dt.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},Dt.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},Dt.prototype.size=function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)},Yt.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},ir.prototype.setFromMatrix=function(t){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(t)},iu.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},gt.random16=function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},gt.nearestPowerOfTwo=function(t){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),gt.floorPowerOfTwo(t)},gt.nextPowerOfTwo=function(t){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),gt.ceilPowerOfTwo(t)},_t.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},_t.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},_t.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},_t.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},_t.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},_t.prototype.getInverse=function(t){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},re.prototype.extractPosition=function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},re.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},re.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new Rt).setFromMatrixColumn(this,3)},re.prototype.setRotationFromQuaternion=function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},re.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},re.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},re.prototype.multiplyVector4=function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},re.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},re.prototype.rotateAxis=function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},re.prototype.crossVector=function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},re.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},re.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},re.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},re.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},re.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},re.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},re.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},re.prototype.makeFrustum=function(t,e,n,r,i,a){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,r,n,i,a)},re.prototype.getInverse=function(t){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},De.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},Lt.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},Lt.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},ne.prototype.isIntersectionBox=function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},ne.prototype.isIntersectionPlane=function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},ne.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},Ve.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},Ve.prototype.barycoordFromPoint=function(t,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(t,e)},Ve.prototype.midpoint=function(t){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(t)},Ve.prototypenormal=function(t){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(t)},Ve.prototype.plane=function(t){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(t)},Ve.barycoordFromPoint=function(t,e,n,r,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),Ve.getBarycoord(t,e,n,r,i)},Ve.normal=function(t,e,n,r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),Ve.getNormal(t,e,n,r)},Al.prototype.extractAllPoints=function(t){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(t)},Al.prototype.extrude=function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new as(this,t)},Al.prototype.makeGeometry=function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new ds(this,t)},yt.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},yt.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},yt.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Rt.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},Rt.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},Rt.prototype.getPositionFromMatrix=function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},Rt.prototype.getScaleFromMatrix=function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},Rt.prototype.getColumnFromMatrix=function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},Rt.prototype.applyProjection=function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},Rt.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},Rt.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},Rt.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Tt.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},Tt.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Le.prototype.getChildByName=function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},Le.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},Le.prototype.translate=function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)},Le.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},Le.prototype.applyMatrix=function(t){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(Le.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),kn.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")},Object.defineProperties(kn.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),0},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),Object.defineProperties(Oa.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(qa.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),ka.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Object.defineProperty(al.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(t){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=t}}),Jn.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(Ll.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(nn.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===rt},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(rt)}}}),nn.prototype.setDynamic=function(t){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?rt:nt),this},nn.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},nn.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},Sn.prototype.addIndex=function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},Sn.prototype.addAttribute=function(t,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(t,e):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(t,new nn(arguments[1],arguments[2])))},Sn.prototype.addDrawCall=function(t,e,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},Sn.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},Sn.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},Sn.prototype.removeAttribute=function(t){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(t)},Sn.prototype.applyMatrix=function(t){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(Sn.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Object.defineProperties(Jl.prototype,{maxInstancedCount:{get:function(){return console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount},set:function(t){console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount=t}}}),Object.defineProperties(Zc.prototype,{linePrecision:{get:function(){return console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold},set:function(t){console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold=t}}}),Object.defineProperties(ma.prototype,{dynamic:{get:function(){return console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.usage===rt},set:function(t){console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.setUsage(t)}}}),ma.prototype.setDynamic=function(t){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?rt:nt),this},ma.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},as.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},as.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},as.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},fa.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},Object.defineProperties(qc.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(je.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new Ke}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===t}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(t){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=t}}}),Object.defineProperties(Ts.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(Ss.prototype,{transparency:{get:function(){return console.warn("THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission."),this.transmission},set:function(t){console.warn("THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission."),this.transmission=t}}}),Object.defineProperties(Yn.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),ua.prototype.clearTarget=function(t,e,n,r){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(t),this.clear(e,n,r)},ua.prototype.animate=function(t){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(t)},ua.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},ua.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},ua.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},ua.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},ua.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},ua.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},ua.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},ua.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},ua.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},ua.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},ua.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},ua.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},ua.prototype.enableScissorTest=function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},ua.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},ua.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},ua.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},ua.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},ua.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},ua.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},ua.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},ua.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},ua.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},ua.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(ua.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(t){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===t?Z:Y}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}}}),Object.defineProperties(ea.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(Et.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),Object.defineProperties(Mc.prototype,{load:{value:function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var e=this;return(new uc).load(t,(function(t){e.setBuffer(t)})),this}},startTime:{set:function(){console.warn("THREE.Audio: .startTime is now .play( delay ).")}}}),Rc.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},Kn.prototype.updateCubeMap=function(t,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(t,e)},Kn.prototype.clear=function(t,e,n,r){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(t,e,n,r)},bt.crossOrigin=void 0,bt.loadTexture=function(t,e,n,r){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var i=new il;i.setCrossOrigin(this.crossOrigin);var a=i.load(t,n,void 0,r);return e&&(a.mapping=e),a},bt.loadTextureCube=function(t,e,n,r){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var i=new nl;i.setCrossOrigin(this.crossOrigin);var a=i.load(t,n,void 0,r);return e&&(a.mapping=e),a},bt.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},bt.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};var dh={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:n}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=n),t.ACESFilmicToneMapping=4,t.AddEquation=r,t.AddOperation=2,t.AdditiveAnimationBlendMode=X,t.AdditiveBlending=2,t.AlphaFormat=1021,t.AlwaysDepth=1,t.AlwaysStencilFunc=519,t.AmbientLight=Wl,t.AmbientLightProbe=dc,t.AnimationClip=js,t.AnimationLoader=$s,t.AnimationMixer=jc,t.AnimationObjectGroup=Vc,t.AnimationUtils=Ds,t.ArcCurve=sl,t.ArrayCamera=aa,t.ArrowHelper=Ou,t.Audio=Mc,t.AudioAnalyser=Rc,t.AudioContext=cc,t.AudioListener=wc,t.AudioLoader=uc,t.AxesHelper=zu,t.AxisHelper=function(t){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new zu(t)},t.BackSide=1,t.BasicDepthPacking=3200,t.BasicShadowMap=0,t.BinaryTextureLoader=function(t){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new rl(t)},t.Bone=Va,t.BooleanKeyframeTrack=Fs,t.BoundingBoxHelper=function(t,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new Du(t,e)},t.Box2=eu,t.Box3=Dt,t.Box3Helper=Iu,t.BoxBufferGeometry=Wn,t.BoxGeometry=Wn,t.BoxHelper=Du,t.BufferAttribute=nn,t.BufferGeometry=Sn,t.BufferGeometryLoader=Kl,t.ByteType=1010,t.Cache=Xs,t.Camera=Zn,t.CameraHelper=Eu,t.CanvasRenderer=function(){console.error("THREE.CanvasRenderer has been removed")},t.CanvasTexture=xo,t.CatmullRomCurve3=pl,t.CineonToneMapping=3,t.CircleBufferGeometry=bo,t.CircleGeometry=bo,t.ClampToEdgeWrapping=d,t.Clock=vc,t.Color=Ke,t.ColorKeyframeTrack=Hs,t.CompressedTexture=yo,t.CompressedTextureLoader=tl,t.ConeBufferGeometry=Mo,t.ConeGeometry=Mo,t.CubeCamera=Kn,t.CubeReflectionMapping=a,t.CubeRefractionMapping=o,t.CubeTexture=$n,t.CubeTextureLoader=nl,t.CubeUVReflectionMapping=c,t.CubeUVRefractionMapping=u,t.CubicBezierCurve=gl,t.CubicBezierCurve3=yl,t.CubicInterpolant=Ns,t.CullFaceBack=1,t.CullFaceFront=2,t.CullFaceFrontBack=3,t.CullFaceNone=0,t.Curve=al,t.CurvePath=Tl,t.CustomBlending=5,t.CustomToneMapping=5,t.CylinderBufferGeometry=wo,t.CylinderGeometry=wo,t.Cylindrical=$c,t.DataTexture=er,t.DataTexture2DArray=Tr,t.DataTexture3D=Er,t.DataTextureLoader=rl,t.DataUtils=Gu,t.DecrementStencilOp=7683,t.DecrementWrapStencilOp=34056,t.DefaultLoadingManager=Zs,t.DepthFormat=L,t.DepthStencilFormat=R,t.DepthTexture=_o,t.DirectionalLight=Vl,t.DirectionalLightHelper=Mu,t.DiscreteInterpolant=Os,t.DodecahedronBufferGeometry=To,t.DodecahedronGeometry=To,t.DoubleSide=2,t.DstAlphaFactor=206,t.DstColorFactor=208,t.DynamicBufferAttribute=function(t,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new nn(t,e).setUsage(rt)},t.DynamicCopyUsage=35050,t.DynamicDrawUsage=rt,t.DynamicReadUsage=35049,t.EdgesGeometry=Co,t.EdgesHelper=function(t,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new so(new Co(t.geometry),new Ka({color:void 0!==e?e:16777215}))},t.EllipseCurve=ol,t.EqualDepth=4,t.EqualStencilFunc=514,t.EquirectangularReflectionMapping=s,t.EquirectangularRefractionMapping=l,t.Euler=pe,t.EventDispatcher=pt,t.ExtrudeBufferGeometry=as,t.ExtrudeGeometry=as,t.FaceColors=1,t.FileLoader=Ks,t.FlatShading=1,t.Float16BufferAttribute=hn,t.Float32Attribute=function(t,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new dn(t,e)},t.Float32BufferAttribute=dn,t.Float64Attribute=function(t,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new pn(t,e)},t.Float64BufferAttribute=pn,t.FloatType=M,t.Fog=pa,t.FogExp2=da,t.Font=ac,t.FontLoader=lc,t.FrontSide=0,t.Frustum=ir,t.GLBufferAttribute=Yc,t.GLSL1="100",t.GLSL3=it,t.GammaEncoding=J,t.GreaterDepth=6,t.GreaterEqualDepth=5,t.GreaterEqualStencilFunc=518,t.GreaterStencilFunc=516,t.GridHelper=yu,t.Group=oa,t.HalfFloatType=S,t.HemisphereLight=Rl,t.HemisphereLightHelper=gu,t.HemisphereLightProbe=hc,t.IcosahedronBufferGeometry=ss,t.IcosahedronGeometry=ss,t.ImageBitmapLoader=rc,t.ImageLoader=el,t.ImageUtils=bt,t.ImmediateRenderObject=au,t.IncrementStencilOp=7682,t.IncrementWrapStencilOp=34055,t.InstancedBufferAttribute=Ql,t.InstancedBufferGeometry=Jl,t.InstancedInterleavedBuffer=Xc,t.InstancedMesh=Qa,t.Int16Attribute=function(t,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new sn(t,e)},t.Int16BufferAttribute=sn,t.Int32Attribute=function(t,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new cn(t,e)},t.Int32BufferAttribute=cn,t.Int8Attribute=function(t,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new rn(t,e)},t.Int8BufferAttribute=rn,t.IntType=1013,t.InterleavedBuffer=ma,t.InterleavedBufferAttribute=ga,t.Interpolant=Is,t.InterpolateDiscrete=G,t.InterpolateLinear=U,t.InterpolateSmooth=k,t.InvertStencilOp=5386,t.JSONLoader=function(){console.error("THREE.JSONLoader has been removed.")},t.KeepStencilOp=et,t.KeyframeTrack=zs,t.LOD=Oa,t.LatheBufferGeometry=ls,t.LatheGeometry=ls,t.Layers=fe,t.LensFlare=function(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")},t.LessDepth=2,t.LessEqualDepth=3,t.LessEqualStencilFunc=515,t.LessStencilFunc=513,t.Light=Ll,t.LightProbe=Xl,t.Line=io,t.Line3=iu,t.LineBasicMaterial=Ka,t.LineCurve=xl,t.LineCurve3=_l,t.LineDashedMaterial=Cs,t.LineLoop=lo,t.LinePieces=1,t.LineSegments=so,t.LineStrip=0,t.LinearEncoding=Y,t.LinearFilter=g,t.LinearInterpolant=Bs,t.LinearMipMapLinearFilter=1008,t.LinearMipMapNearestFilter=1007,t.LinearMipmapLinearFilter=x,t.LinearMipmapNearestFilter=y,t.LinearToneMapping=1,t.Loader=Js,t.LoaderUtils=Zl,t.LoadingManager=Ys,t.LogLuvEncoding=3003,t.LoopOnce=2200,t.LoopPingPong=2202,t.LoopRepeat=2201,t.LuminanceAlphaFormat=1025,t.LuminanceFormat=1024,t.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},t.Material=je,t.MaterialLoader=Yl,t.Math=gt,t.MathUtils=gt,t.Matrix3=_t,t.Matrix4=re,t.MaxEquation=104,t.Mesh=kn,t.MeshBasicMaterial=$e,t.MeshDepthMaterial=$i,t.MeshDistanceMaterial=ta,t.MeshFaceMaterial=function(t){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),t},t.MeshLambertMaterial=Ls,t.MeshMatcapMaterial=Rs,t.MeshNormalMaterial=As,t.MeshPhongMaterial=Ts,t.MeshPhysicalMaterial=Ss,t.MeshStandardMaterial=Ms,t.MeshToonMaterial=Es,t.MinEquation=103,t.MirroredRepeatWrapping=p,t.MixOperation=1,t.MultiMaterial=function(t){return void 0===t&&(t=[]),console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),t.isMultiMaterial=!0,t.materials=t,t.clone=function(){return t.slice()},t},t.MultiplyBlending=4,t.MultiplyOperation=0,t.NearestFilter=f,t.NearestMipMapLinearFilter=1005,t.NearestMipMapNearestFilter=1004,t.NearestMipmapLinearFilter=v,t.NearestMipmapNearestFilter=m,t.NeverDepth=0,t.NeverStencilFunc=512,t.NoBlending=0,t.NoColors=0,t.NoToneMapping=0,t.NormalAnimationBlendMode=q,t.NormalBlending=1,t.NotEqualDepth=7,t.NotEqualStencilFunc=517,t.NumberKeyframeTrack=Gs,t.Object3D=Le,t.ObjectLoader=$l,t.ObjectSpaceNormalMap=1,t.OctahedronBufferGeometry=cs,t.OctahedronGeometry=cs,t.OneFactor=201,t.OneMinusDstAlphaFactor=207,t.OneMinusDstColorFactor=209,t.OneMinusSrcAlphaFactor=205,t.OneMinusSrcColorFactor=203,t.OrthographicCamera=Ul,t.PCFShadowMap=1,t.PCFSoftShadowMap=2,t.PMREMGenerator=ah,t.ParametricBufferGeometry=us,t.ParametricGeometry=us,t.Particle=function(t){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new Da(t)},t.ParticleBasicMaterial=function(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new co(t)},t.ParticleSystem=function(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new mo(t,e)},t.ParticleSystemMaterial=function(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new co(t)},t.Path=El,t.PerspectiveCamera=Jn,t.Plane=De,t.PlaneBufferGeometry=sr,t.PlaneGeometry=sr,t.PlaneHelper=Nu,t.PointCloud=function(t,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new mo(t,e)},t.PointCloudMaterial=function(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new co(t)},t.PointLight=Gl,t.PointLightHelper=pu,t.Points=mo,t.PointsMaterial=co,t.PolarGridHelper=xu,t.PolyhedronBufferGeometry=So,t.PolyhedronGeometry=So,t.PositionalAudio=Lc,t.PropertyBinding=kc,t.PropertyMixer=Cc,t.QuadraticBezierCurve=bl,t.QuadraticBezierCurve3=wl,t.Quaternion=Lt,t.QuaternionKeyframeTrack=ks,t.QuaternionLinearInterpolant=Us,t.REVISION=n,t.RGBADepthPacking=3201,t.RGBAFormat=A,t.RGBAIntegerFormat=1033,t.RGBA_ASTC_10x10_Format=37819,t.RGBA_ASTC_10x5_Format=37816,t.RGBA_ASTC_10x6_Format=37817,t.RGBA_ASTC_10x8_Format=37818,t.RGBA_ASTC_12x10_Format=37820,t.RGBA_ASTC_12x12_Format=37821,t.RGBA_ASTC_4x4_Format=37808,t.RGBA_ASTC_5x4_Format=37809,t.RGBA_ASTC_5x5_Format=37810,t.RGBA_ASTC_6x5_Format=37811,t.RGBA_ASTC_6x6_Format=37812,t.RGBA_ASTC_8x5_Format=37813,t.RGBA_ASTC_8x6_Format=37814,t.RGBA_ASTC_8x8_Format=37815,t.RGBA_BPTC_Format=36492,t.RGBA_ETC2_EAC_Format=H,t.RGBA_PVRTC_2BPPV1_Format=z,t.RGBA_PVRTC_4BPPV1_Format=O,t.RGBA_S3TC_DXT1_Format=P,t.RGBA_S3TC_DXT3_Format=D,t.RGBA_S3TC_DXT5_Format=I,t.RGBDEncoding=tt,t.RGBEEncoding=Q,t.RGBEFormat=1023,t.RGBFormat=E,t.RGBIntegerFormat=1032,t.RGBM16Encoding=$,t.RGBM7Encoding=K,t.RGB_ETC1_Format=36196,t.RGB_ETC2_Format=F,t.RGB_PVRTC_2BPPV1_Format=B,t.RGB_PVRTC_4BPPV1_Format=N,t.RGB_S3TC_DXT1_Format=C,t.RGFormat=1030,t.RGIntegerFormat=1031,t.RawShaderMaterial=ws,t.Ray=ne,t.Raycaster=Zc,t.RectAreaLight=jl,t.RedFormat=1028,t.RedIntegerFormat=1029,t.ReinhardToneMapping=2,t.RepeatWrapping=h,t.ReplaceStencilOp=7681,t.ReverseSubtractEquation=102,t.RingBufferGeometry=hs,t.RingGeometry=hs,t.SRGB8_ALPHA8_ASTC_10x10_Format=37851,t.SRGB8_ALPHA8_ASTC_10x5_Format=37848,t.SRGB8_ALPHA8_ASTC_10x6_Format=37849,t.SRGB8_ALPHA8_ASTC_10x8_Format=37850,t.SRGB8_ALPHA8_ASTC_12x10_Format=37852,t.SRGB8_ALPHA8_ASTC_12x12_Format=37853,t.SRGB8_ALPHA8_ASTC_4x4_Format=37840,t.SRGB8_ALPHA8_ASTC_5x4_Format=37841,t.SRGB8_ALPHA8_ASTC_5x5_Format=37842,t.SRGB8_ALPHA8_ASTC_6x5_Format=37843,t.SRGB8_ALPHA8_ASTC_6x6_Format=37844,t.SRGB8_ALPHA8_ASTC_8x5_Format=37845,t.SRGB8_ALPHA8_ASTC_8x6_Format=37846,t.SRGB8_ALPHA8_ASTC_8x8_Format=37847,t.Scene=fa,t.SceneUtils=dh,t.ShaderChunk=lr,t.ShaderLib=ur,t.ShaderMaterial=Yn,t.ShadowMaterial=bs,t.Shape=Al,t.ShapeBufferGeometry=ds,t.ShapeGeometry=ds,t.ShapePath=ic,t.ShapeUtils=ns,t.ShortType=1011,t.Skeleton=qa,t.SkeletonHelper=hu,t.SkinnedMesh=ka,t.SmoothShading=2,t.Sphere=Yt,t.SphereBufferGeometry=ps,t.SphereGeometry=ps,t.Spherical=Kc,t.SphericalHarmonics3=ql,t.SplineCurve=Ml,t.SpotLight=Bl,t.SpotLightHelper=su,t.Sprite=Da,t.SpriteMaterial=xa,t.SrcAlphaFactor=204,t.SrcAlphaSaturateFactor=210,t.SrcColorFactor=202,t.StaticCopyUsage=35046,t.StaticDrawUsage=nt,t.StaticReadUsage=35045,t.StereoCamera=mc,t.StreamCopyUsage=35042,t.StreamDrawUsage=35040,t.StreamReadUsage=35041,t.StringKeyframeTrack=Vs,t.SubtractEquation=101,t.SubtractiveBlending=3,t.TOUCH={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},t.TangentSpaceNormalMap=0,t.TetrahedronBufferGeometry=fs,t.TetrahedronGeometry=fs,t.TextBufferGeometry=ms,t.TextGeometry=ms,t.Texture=Mt,t.TextureLoader=il,t.TorusBufferGeometry=vs,t.TorusGeometry=vs,t.TorusKnotBufferGeometry=gs,t.TorusKnotGeometry=gs,t.Triangle=Ve,t.TriangleFanDrawMode=2,t.TriangleStripDrawMode=1,t.TrianglesDrawMode=0,t.TubeBufferGeometry=ys,t.TubeGeometry=ys,t.UVMapping=i,t.Uint16Attribute=function(t,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new ln(t,e)},t.Uint16BufferAttribute=ln,t.Uint32Attribute=function(t,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new un(t,e)},t.Uint32BufferAttribute=un,t.Uint8Attribute=function(t,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new an(t,e)},t.Uint8BufferAttribute=an,t.Uint8ClampedAttribute=function(t,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new on(t,e)},t.Uint8ClampedBufferAttribute=on,t.Uniform=qc,t.UniformsLib=cr,t.UniformsUtils=Xn,t.UnsignedByteType=_,t.UnsignedInt248Type=T,t.UnsignedIntType=w,t.UnsignedShort4444Type=1017,t.UnsignedShort5551Type=1018,t.UnsignedShort565Type=1019,t.UnsignedShortType=b,t.VSMShadowMap=3,t.Vector2=yt,t.Vector3=Rt,t.Vector4=Tt,t.VectorKeyframeTrack=Ws,t.Vertex=function(t,e,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new Rt(t,e,n)},t.VertexColors=2,t.VideoTexture=go,t.WebGL1Renderer=ha,t.WebGLCubeRenderTarget=tr,t.WebGLMultisampleRenderTarget=At,t.WebGLRenderTarget=Et,t.WebGLRenderTargetCube=function(t,e,n){return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),new tr(t,n)},t.WebGLRenderer=ua,t.WebGLUtils=ia,t.WireframeGeometry=xs,t.WireframeHelper=function(t,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new so(new xs(t.geometry),new Ka({color:void 0!==e?e:16777215}))},t.WrapAroundEnding=j,t.XHRLoader=function(t){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new Ks(t)},t.ZeroCurvatureEnding=V,t.ZeroFactor=200,t.ZeroSlopeEnding=W,t.ZeroStencilOp=0,t.sRGBEncoding=Z,Object.defineProperty(t,"__esModule",{value:!0})}));
ManagementOKTravel/guns-admin/src/main/webapp/static/js/track2.js
New file
@@ -0,0 +1,3856 @@
THREE.GLTFLoader = ( function () {
    function GLTFLoader( manager ) {
        THREE.Loader.call( this, manager );
        this.dracoLoader = null;
        this.ktx2Loader = null;
        this.meshoptDecoder = null;
        this.pluginCallbacks = [];
        this.register( function ( parser ) {
            return new GLTFMaterialsClearcoatExtension( parser );
        } );
        this.register( function ( parser ) {
            return new GLTFTextureBasisUExtension( parser );
        } );
        this.register( function ( parser ) {
            return new GLTFTextureWebPExtension( parser );
        } );
        this.register( function ( parser ) {
            return new GLTFMaterialsTransmissionExtension( parser );
        } );
        this.register( function ( parser ) {
            return new GLTFLightsExtension( parser );
        } );
        this.register( function ( parser ) {
            return new GLTFMeshoptCompression( parser );
        } );
    }
    GLTFLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), {
        constructor: GLTFLoader,
        load: function ( url, onLoad, onProgress, onError ) {
            var scope = this;
            var resourcePath;
            if ( this.resourcePath !== '' ) {
                resourcePath = this.resourcePath;
            } else if ( this.path !== '' ) {
                resourcePath = this.path;
            } else {
                resourcePath = THREE.LoaderUtils.extractUrlBase( url );
            }
            // Tells the LoadingManager to track an extra item, which resolves after
            // the model is fully loaded. This means the count of items loaded will
            // be incorrect, but ensures manager.onLoad() does not fire early.
            this.manager.itemStart( url );
            var _onError = function ( e ) {
                if ( onError ) {
                    onError( e );
                } else {
                    console.error( e );
                }
                scope.manager.itemError( url );
                scope.manager.itemEnd( url );
            };
            var loader = new THREE.FileLoader( this.manager );
            loader.setPath( this.path );
            loader.setResponseType( 'arraybuffer' );
            loader.setRequestHeader( this.requestHeader );
            loader.setWithCredentials( this.withCredentials );
            loader.load( url, function ( data ) {
                try {
                    scope.parse( data, resourcePath, function ( gltf ) {
                        onLoad( gltf );
                        scope.manager.itemEnd( url );
                    }, _onError );
                } catch ( e ) {
                    _onError( e );
                }
            }, onProgress, _onError );
        },
        setDRACOLoader: function ( dracoLoader ) {
            this.dracoLoader = dracoLoader;
            return this;
        },
        setDDSLoader: function () {
            throw new Error(
                'THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".'
            );
        },
        setKTX2Loader: function ( ktx2Loader ) {
            this.ktx2Loader = ktx2Loader;
            return this;
        },
        setMeshoptDecoder: function ( meshoptDecoder ) {
            this.meshoptDecoder = meshoptDecoder;
            return this;
        },
        register: function ( callback ) {
            if ( this.pluginCallbacks.indexOf( callback ) === - 1 ) {
                this.pluginCallbacks.push( callback );
            }
            return this;
        },
        unregister: function ( callback ) {
            if ( this.pluginCallbacks.indexOf( callback ) !== - 1 ) {
                this.pluginCallbacks.splice( this.pluginCallbacks.indexOf( callback ), 1 );
            }
            return this;
        },
        parse: function ( data, path, onLoad, onError ) {
            var content;
            var extensions = {};
            var plugins = {};
            if ( typeof data === 'string' ) {
                content = data;
            } else {
                var magic = THREE.LoaderUtils.decodeText( new Uint8Array( data, 0, 4 ) );
                if ( magic === BINARY_EXTENSION_HEADER_MAGIC ) {
                    try {
                        extensions[ EXTENSIONS.KHR_BINARY_GLTF ] = new GLTFBinaryExtension( data );
                    } catch ( error ) {
                        if ( onError ) onError( error );
                        return;
                    }
                    content = extensions[ EXTENSIONS.KHR_BINARY_GLTF ].content;
                } else {
                    content = THREE.LoaderUtils.decodeText( new Uint8Array( data ) );
                }
            }
            var json = JSON.parse( content );
            if ( json.asset === undefined || json.asset.version[ 0 ] < 2 ) {
                if ( onError ) onError( new Error( 'THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.' ) );
                return;
            }
            var parser = new GLTFParser( json, {
                path: path || this.resourcePath || '',
                crossOrigin: this.crossOrigin,
                requestHeader: this.requestHeader,
                manager: this.manager,
                ktx2Loader: this.ktx2Loader,
                meshoptDecoder: this.meshoptDecoder
            } );
            parser.fileLoader.setRequestHeader( this.requestHeader );
            for ( var i = 0; i < this.pluginCallbacks.length; i ++ ) {
                var plugin = this.pluginCallbacks[ i ]( parser );
                plugins[ plugin.name ] = plugin;
                // Workaround to avoid determining as unknown extension
                // in addUnknownExtensionsToUserData().
                // Remove this workaround if we move all the existing
                // extension handlers to plugin system
                extensions[ plugin.name ] = true;
            }
            if ( json.extensionsUsed ) {
                for ( var i = 0; i < json.extensionsUsed.length; ++ i ) {
                    var extensionName = json.extensionsUsed[ i ];
                    var extensionsRequired = json.extensionsRequired || [];
                    switch ( extensionName ) {
                        case EXTENSIONS.KHR_MATERIALS_UNLIT:
                            extensions[ extensionName ] = new GLTFMaterialsUnlitExtension();
                            break;
                        case EXTENSIONS.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:
                            extensions[ extensionName ] = new GLTFMaterialsPbrSpecularGlossinessExtension();
                            break;
                        case EXTENSIONS.KHR_DRACO_MESH_COMPRESSION:
                            extensions[ extensionName ] = new GLTFDracoMeshCompressionExtension( json, this.dracoLoader );
                            break;
                        case EXTENSIONS.KHR_TEXTURE_TRANSFORM:
                            extensions[ extensionName ] = new GLTFTextureTransformExtension();
                            break;
                        case EXTENSIONS.KHR_MESH_QUANTIZATION:
                            extensions[ extensionName ] = new GLTFMeshQuantizationExtension();
                            break;
                        default:
                            if ( extensionsRequired.indexOf( extensionName ) >= 0 && plugins[ extensionName ] === undefined ) {
                                console.warn( 'THREE.GLTFLoader: Unknown extension "' + extensionName + '".' );
                            }
                    }
                }
            }
            parser.setExtensions( extensions );
            parser.setPlugins( plugins );
            parser.parse( onLoad, onError );
        }
    } );
    /* GLTFREGISTRY */
    function GLTFRegistry() {
        var objects = {};
        return    {
            get: function ( key ) {
                return objects[ key ];
            },
            add: function ( key, object ) {
                objects[ key ] = object;
            },
            remove: function ( key ) {
                delete objects[ key ];
            },
            removeAll: function () {
                objects = {};
            }
        };
    }
    /*********************************/
    /********** EXTENSIONS ***********/
    /*********************************/
    var EXTENSIONS = {
        KHR_BINARY_GLTF: 'KHR_binary_glTF',
        KHR_DRACO_MESH_COMPRESSION: 'KHR_draco_mesh_compression',
        KHR_LIGHTS_PUNCTUAL: 'KHR_lights_punctual',
        KHR_MATERIALS_CLEARCOAT: 'KHR_materials_clearcoat',
        KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS: 'KHR_materials_pbrSpecularGlossiness',
        KHR_MATERIALS_TRANSMISSION: 'KHR_materials_transmission',
        KHR_MATERIALS_UNLIT: 'KHR_materials_unlit',
        KHR_TEXTURE_BASISU: 'KHR_texture_basisu',
        KHR_TEXTURE_TRANSFORM: 'KHR_texture_transform',
        KHR_MESH_QUANTIZATION: 'KHR_mesh_quantization',
        EXT_TEXTURE_WEBP: 'EXT_texture_webp',
        EXT_MESHOPT_COMPRESSION: 'EXT_meshopt_compression'
    };
    /**
     * Punctual Lights Extension
     *
     * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_lights_punctual
     */
    function GLTFLightsExtension( parser ) {
        this.parser = parser;
        this.name = EXTENSIONS.KHR_LIGHTS_PUNCTUAL;
        // Object3D instance caches
        this.cache = { refs: {}, uses: {} };
    }
    GLTFLightsExtension.prototype._markDefs = function () {
        var parser = this.parser;
        var nodeDefs = this.parser.json.nodes || [];
        for ( var nodeIndex = 0, nodeLength = nodeDefs.length; nodeIndex < nodeLength; nodeIndex ++ ) {
            var nodeDef = nodeDefs[ nodeIndex ];
            if ( nodeDef.extensions
                && nodeDef.extensions[ this.name ]
                && nodeDef.extensions[ this.name ].light !== undefined ) {
                parser._addNodeRef( this.cache, nodeDef.extensions[ this.name ].light );
            }
        }
    };
    GLTFLightsExtension.prototype._loadLight = function ( lightIndex ) {
        var parser = this.parser;
        var cacheKey = 'light:' + lightIndex;
        var dependency = parser.cache.get( cacheKey );
        if ( dependency ) return dependency;
        var json = parser.json;
        var extensions = ( json.extensions && json.extensions[ this.name ] ) || {};
        var lightDefs = extensions.lights || [];
        var lightDef = lightDefs[ lightIndex ];
        var lightNode;
        var color = new THREE.Color( 0xffffff );
        if ( lightDef.color !== undefined ) color.fromArray( lightDef.color );
        var range = lightDef.range !== undefined ? lightDef.range : 0;
        switch ( lightDef.type ) {
            case 'directional':
                lightNode = new THREE.DirectionalLight( color );
                lightNode.target.position.set( 0, 0, - 1 );
                lightNode.add( lightNode.target );
                break;
            case 'point':
                lightNode = new THREE.PointLight( color );
                lightNode.distance = range;
                break;
            case 'spot':
                lightNode = new THREE.SpotLight( color );
                lightNode.distance = range;
                // Handle spotlight properties.
                lightDef.spot = lightDef.spot || {};
                lightDef.spot.innerConeAngle = lightDef.spot.innerConeAngle !== undefined ? lightDef.spot.innerConeAngle : 0;
                lightDef.spot.outerConeAngle = lightDef.spot.outerConeAngle !== undefined ? lightDef.spot.outerConeAngle : Math.PI / 4.0;
                lightNode.angle = lightDef.spot.outerConeAngle;
                lightNode.penumbra = 1.0 - lightDef.spot.innerConeAngle / lightDef.spot.outerConeAngle;
                lightNode.target.position.set( 0, 0, - 1 );
                lightNode.add( lightNode.target );
                break;
            default:
                throw new Error( 'THREE.GLTFLoader: Unexpected light type: ' + lightDef.type );
        }
        // Some lights (e.g. spot) default to a position other than the origin. Reset the position
        // here, because node-level parsing will only override position if explicitly specified.
        lightNode.position.set( 0, 0, 0 );
        lightNode.decay = 2;
        if ( lightDef.intensity !== undefined ) lightNode.intensity = lightDef.intensity;
        lightNode.name = parser.createUniqueName( lightDef.name || ( 'light_' + lightIndex ) );
        dependency = Promise.resolve( lightNode );
        parser.cache.add( cacheKey, dependency );
        return dependency;
    };
    GLTFLightsExtension.prototype.createNodeAttachment = function ( nodeIndex ) {
        var self = this;
        var parser = this.parser;
        var json = parser.json;
        var nodeDef = json.nodes[ nodeIndex ];
        var lightDef = ( nodeDef.extensions && nodeDef.extensions[ this.name ] ) || {};
        var lightIndex = lightDef.light;
        if ( lightIndex === undefined ) return null;
        return this._loadLight( lightIndex ).then( function ( light ) {
            return parser._getNodeRef( self.cache, lightIndex, light );
        } );
    };
    /**
     * Unlit Materials Extension
     *
     * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit
     */
    function GLTFMaterialsUnlitExtension() {
        this.name = EXTENSIONS.KHR_MATERIALS_UNLIT;
    }
    GLTFMaterialsUnlitExtension.prototype.getMaterialType = function () {
        return THREE.MeshBasicMaterial;
    };
    GLTFMaterialsUnlitExtension.prototype.extendParams = function ( materialParams, materialDef, parser ) {
        var pending = [];
        materialParams.color = new THREE.Color( 1.0, 1.0, 1.0 );
        materialParams.opacity = 1.0;
        var metallicRoughness = materialDef.pbrMetallicRoughness;
        if ( metallicRoughness ) {
            if ( Array.isArray( metallicRoughness.baseColorFactor ) ) {
                var array = metallicRoughness.baseColorFactor;
                materialParams.color.fromArray( array );
                materialParams.opacity = array[ 3 ];
            }
            if ( metallicRoughness.baseColorTexture !== undefined ) {
                pending.push( parser.assignTexture( materialParams, 'map', metallicRoughness.baseColorTexture ) );
            }
        }
        return Promise.all( pending );
    };
    /**
     * Clearcoat Materials Extension
     *
     * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_clearcoat
     */
    function GLTFMaterialsClearcoatExtension( parser ) {
        this.parser = parser;
        this.name = EXTENSIONS.KHR_MATERIALS_CLEARCOAT;
    }
    GLTFMaterialsClearcoatExtension.prototype.getMaterialType = function ( materialIndex ) {
        var parser = this.parser;
        var materialDef = parser.json.materials[ materialIndex ];
        if ( ! materialDef.extensions || ! materialDef.extensions[ this.name ] ) return null;
        return THREE.MeshPhysicalMaterial;
    };
    GLTFMaterialsClearcoatExtension.prototype.extendMaterialParams = function ( materialIndex, materialParams ) {
        var parser = this.parser;
        var materialDef = parser.json.materials[ materialIndex ];
        if ( ! materialDef.extensions || ! materialDef.extensions[ this.name ] ) {
            return Promise.resolve();
        }
        var pending = [];
        var extension = materialDef.extensions[ this.name ];
        if ( extension.clearcoatFactor !== undefined ) {
            materialParams.clearcoat = extension.clearcoatFactor;
        }
        if ( extension.clearcoatTexture !== undefined ) {
            pending.push( parser.assignTexture( materialParams, 'clearcoatMap', extension.clearcoatTexture ) );
        }
        if ( extension.clearcoatRoughnessFactor !== undefined ) {
            materialParams.clearcoatRoughness = extension.clearcoatRoughnessFactor;
        }
        if ( extension.clearcoatRoughnessTexture !== undefined ) {
            pending.push( parser.assignTexture( materialParams, 'clearcoatRoughnessMap', extension.clearcoatRoughnessTexture ) );
        }
        if ( extension.clearcoatNormalTexture !== undefined ) {
            pending.push( parser.assignTexture( materialParams, 'clearcoatNormalMap', extension.clearcoatNormalTexture ) );
            if ( extension.clearcoatNormalTexture.scale !== undefined ) {
                var scale = extension.clearcoatNormalTexture.scale;
                // https://github.com/mrdoob/three.js/issues/11438#issuecomment-507003995
                materialParams.clearcoatNormalScale = new THREE.Vector2( scale, - scale );
            }
        }
        return Promise.all( pending );
    };
    /**
     * Transmission Materials Extension
     *
     * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_transmission
     * Draft: https://github.com/KhronosGroup/glTF/pull/1698
     */
    function GLTFMaterialsTransmissionExtension( parser ) {
        this.parser = parser;
        this.name = EXTENSIONS.KHR_MATERIALS_TRANSMISSION;
    }
    GLTFMaterialsTransmissionExtension.prototype.getMaterialType = function ( materialIndex ) {
        var parser = this.parser;
        var materialDef = parser.json.materials[ materialIndex ];
        if ( ! materialDef.extensions || ! materialDef.extensions[ this.name ] ) return null;
        return THREE.MeshPhysicalMaterial;
    };
    GLTFMaterialsTransmissionExtension.prototype.extendMaterialParams = function ( materialIndex, materialParams ) {
        var parser = this.parser;
        var materialDef = parser.json.materials[ materialIndex ];
        if ( ! materialDef.extensions || ! materialDef.extensions[ this.name ] ) {
            return Promise.resolve();
        }
        var pending = [];
        var extension = materialDef.extensions[ this.name ];
        if ( extension.transmissionFactor !== undefined ) {
            materialParams.transmission = extension.transmissionFactor;
        }
        if ( extension.transmissionTexture !== undefined ) {
            pending.push( parser.assignTexture( materialParams, 'transmissionMap', extension.transmissionTexture ) );
        }
        return Promise.all( pending );
    };
    /**
     * BasisU Texture Extension
     *
     * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_texture_basisu
     */
    function GLTFTextureBasisUExtension( parser ) {
        this.parser = parser;
        this.name = EXTENSIONS.KHR_TEXTURE_BASISU;
    }
    GLTFTextureBasisUExtension.prototype.loadTexture = function ( textureIndex ) {
        var parser = this.parser;
        var json = parser.json;
        var textureDef = json.textures[ textureIndex ];
        if ( ! textureDef.extensions || ! textureDef.extensions[ this.name ] ) {
            return null;
        }
        var extension = textureDef.extensions[ this.name ];
        var source = json.images[ extension.source ];
        var loader = parser.options.ktx2Loader;
        if ( ! loader ) {
            if ( json.extensionsRequired && json.extensionsRequired.indexOf( this.name ) >= 0 ) {
                throw new Error( 'THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures' );
            } else {
                // Assumes that the extension is optional and that a fallback texture is present
                return null;
            }
        }
        return parser.loadTextureImage( textureIndex, source, loader );
    };
    /**
     * WebP Texture Extension
     *
     * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_texture_webp
     */
    function GLTFTextureWebPExtension( parser ) {
        this.parser = parser;
        this.name = EXTENSIONS.EXT_TEXTURE_WEBP;
        this.isSupported = null;
    }
    GLTFTextureWebPExtension.prototype.loadTexture = function ( textureIndex ) {
        var name = this.name;
        var parser = this.parser;
        var json = parser.json;
        var textureDef = json.textures[ textureIndex ];
        if ( ! textureDef.extensions || ! textureDef.extensions[ name ] ) {
            return null;
        }
        var extension = textureDef.extensions[ name ];
        var source = json.images[ extension.source ];
        var loader = parser.textureLoader;
        if ( source.uri ) {
            var handler = parser.options.manager.getHandler( source.uri );
            if ( handler !== null ) loader = handler;
        }
        return this.detectSupport().then( function ( isSupported ) {
            if ( isSupported ) return parser.loadTextureImage( textureIndex, source, loader );
            if ( json.extensionsRequired && json.extensionsRequired.indexOf( name ) >= 0 ) {
                throw new Error( 'THREE.GLTFLoader: WebP required by asset but unsupported.' );
            }
            // Fall back to PNG or JPEG.
            return parser.loadTexture( textureIndex );
        } );
    };
    GLTFTextureWebPExtension.prototype.detectSupport = function () {
        if ( ! this.isSupported ) {
            this.isSupported = new Promise( function ( resolve ) {
                var image = new Image();
                // Lossy test image. Support for lossy images doesn't guarantee support for all
                // WebP images, unfortunately.
                image.src = 'data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA';
                image.onload = image.onerror = function () {
                    resolve( image.height === 1 );
                };
            } );
        }
        return this.isSupported;
    };
    /**
     * meshopt BufferView Compression Extension
     *
     * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_meshopt_compression
     */
    function GLTFMeshoptCompression( parser ) {
        this.name = EXTENSIONS.EXT_MESHOPT_COMPRESSION;
        this.parser = parser;
    }
    GLTFMeshoptCompression.prototype.loadBufferView = function ( index ) {
        var json = this.parser.json;
        var bufferView = json.bufferViews[ index ];
        if ( bufferView.extensions && bufferView.extensions[ this.name ] ) {
            var extensionDef = bufferView.extensions[ this.name ];
            var buffer = this.parser.getDependency( 'buffer', extensionDef.buffer );
            var decoder = this.parser.options.meshoptDecoder;
            if ( ! decoder || ! decoder.supported ) {
                if ( json.extensionsRequired && json.extensionsRequired.indexOf( this.name ) >= 0 ) {
                    throw new Error( 'THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files' );
                } else {
                    // Assumes that the extension is optional and that fallback buffer data is present
                    return null;
                }
            }
            return Promise.all( [ buffer, decoder.ready ] ).then( function ( res ) {
                var byteOffset = extensionDef.byteOffset || 0;
                var byteLength = extensionDef.byteLength || 0;
                var count = extensionDef.count;
                var stride = extensionDef.byteStride;
                var result = new ArrayBuffer( count * stride );
                var source = new Uint8Array( res[ 0 ], byteOffset, byteLength );
                decoder.decodeGltfBuffer( new Uint8Array( result ), count, stride, source, extensionDef.mode, extensionDef.filter );
                return result;
            } );
        } else {
            return null;
        }
    };
    /* BINARY EXTENSION */
    var BINARY_EXTENSION_HEADER_MAGIC = 'glTF';
    var BINARY_EXTENSION_HEADER_LENGTH = 12;
    var BINARY_EXTENSION_CHUNK_TYPES = { JSON: 0x4E4F534A, BIN: 0x004E4942 };
    function GLTFBinaryExtension( data ) {
        this.name = EXTENSIONS.KHR_BINARY_GLTF;
        this.content = null;
        this.body = null;
        var headerView = new DataView( data, 0, BINARY_EXTENSION_HEADER_LENGTH );
        this.header = {
            magic: THREE.LoaderUtils.decodeText( new Uint8Array( data.slice( 0, 4 ) ) ),
            version: headerView.getUint32( 4, true ),
            length: headerView.getUint32( 8, true )
        };
        if ( this.header.magic !== BINARY_EXTENSION_HEADER_MAGIC ) {
            throw new Error( 'THREE.GLTFLoader: Unsupported glTF-Binary header.' );
        } else if ( this.header.version < 2.0 ) {
            throw new Error( 'THREE.GLTFLoader: Legacy binary file detected.' );
        }
        var chunkContentsLength = this.header.length - BINARY_EXTENSION_HEADER_LENGTH;
        var chunkView = new DataView( data, BINARY_EXTENSION_HEADER_LENGTH );
        var chunkIndex = 0;
        while ( chunkIndex < chunkContentsLength ) {
            var chunkLength = chunkView.getUint32( chunkIndex, true );
            chunkIndex += 4;
            var chunkType = chunkView.getUint32( chunkIndex, true );
            chunkIndex += 4;
            if ( chunkType === BINARY_EXTENSION_CHUNK_TYPES.JSON ) {
                var contentArray = new Uint8Array( data, BINARY_EXTENSION_HEADER_LENGTH + chunkIndex, chunkLength );
                this.content = THREE.LoaderUtils.decodeText( contentArray );
            } else if ( chunkType === BINARY_EXTENSION_CHUNK_TYPES.BIN ) {
                var byteOffset = BINARY_EXTENSION_HEADER_LENGTH + chunkIndex;
                this.body = data.slice( byteOffset, byteOffset + chunkLength );
            }
            // Clients must ignore chunks with unknown types.
            chunkIndex += chunkLength;
        }
        if ( this.content === null ) {
            throw new Error( 'THREE.GLTFLoader: JSON content not found.' );
        }
    }
    /**
     * DRACO Mesh Compression Extension
     *
     * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression
     */
    function GLTFDracoMeshCompressionExtension( json, dracoLoader ) {
        if ( ! dracoLoader ) {
            throw new Error( 'THREE.GLTFLoader: No DRACOLoader instance provided.' );
        }
        this.name = EXTENSIONS.KHR_DRACO_MESH_COMPRESSION;
        this.json = json;
        this.dracoLoader = dracoLoader;
        this.dracoLoader.preload();
    }
    GLTFDracoMeshCompressionExtension.prototype.decodePrimitive = function ( primitive, parser ) {
        var json = this.json;
        var dracoLoader = this.dracoLoader;
        var bufferViewIndex = primitive.extensions[ this.name ].bufferView;
        var gltfAttributeMap = primitive.extensions[ this.name ].attributes;
        var threeAttributeMap = {};
        var attributeNormalizedMap = {};
        var attributeTypeMap = {};
        for ( var attributeName in gltfAttributeMap ) {
            var threeAttributeName = ATTRIBUTES[ attributeName ] || attributeName.toLowerCase();
            threeAttributeMap[ threeAttributeName ] = gltfAttributeMap[ attributeName ];
        }
        for ( attributeName in primitive.attributes ) {
            var threeAttributeName = ATTRIBUTES[ attributeName ] || attributeName.toLowerCase();
            if ( gltfAttributeMap[ attributeName ] !== undefined ) {
                var accessorDef = json.accessors[ primitive.attributes[ attributeName ] ];
                var componentType = WEBGL_COMPONENT_TYPES[ accessorDef.componentType ];
                attributeTypeMap[ threeAttributeName ] = componentType;
                attributeNormalizedMap[ threeAttributeName ] = accessorDef.normalized === true;
            }
        }
        return parser.getDependency( 'bufferView', bufferViewIndex ).then( function ( bufferView ) {
            return new Promise( function ( resolve ) {
                dracoLoader.decodeDracoFile( bufferView, function ( geometry ) {
                    for ( var attributeName in geometry.attributes ) {
                        var attribute = geometry.attributes[ attributeName ];
                        var normalized = attributeNormalizedMap[ attributeName ];
                        if ( normalized !== undefined ) attribute.normalized = normalized;
                    }
                    resolve( geometry );
                }, threeAttributeMap, attributeTypeMap );
            } );
        } );
    };
    /**
     * Texture Transform Extension
     *
     * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_texture_transform
     */
    function GLTFTextureTransformExtension() {
        this.name = EXTENSIONS.KHR_TEXTURE_TRANSFORM;
    }
    GLTFTextureTransformExtension.prototype.extendTexture = function ( texture, transform ) {
        texture = texture.clone();
        if ( transform.offset !== undefined ) {
            texture.offset.fromArray( transform.offset );
        }
        if ( transform.rotation !== undefined ) {
            texture.rotation = transform.rotation;
        }
        if ( transform.scale !== undefined ) {
            texture.repeat.fromArray( transform.scale );
        }
        if ( transform.texCoord !== undefined ) {
            console.warn( 'THREE.GLTFLoader: Custom UV sets in "' + this.name + '" extension not yet supported.' );
        }
        texture.needsUpdate = true;
        return texture;
    };
    /**
     * Specular-Glossiness Extension
     *
     * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness
     */
    /**
     * A sub class of THREE.StandardMaterial with some of the functionality
     * changed via the `onBeforeCompile` callback
     * @pailhead
     */
    function GLTFMeshStandardSGMaterial( params ) {
        THREE.MeshStandardMaterial.call( this );
        this.isGLTFSpecularGlossinessMaterial = true;
        //various chunks that need replacing
        var specularMapParsFragmentChunk = [
            '#ifdef USE_SPECULARMAP',
            '    uniform sampler2D specularMap;',
            '#endif'
        ].join( '\n' );
        var glossinessMapParsFragmentChunk = [
            '#ifdef USE_GLOSSINESSMAP',
            '    uniform sampler2D glossinessMap;',
            '#endif'
        ].join( '\n' );
        var specularMapFragmentChunk = [
            'vec3 specularFactor = specular;',
            '#ifdef USE_SPECULARMAP',
            '    vec4 texelSpecular = texture2D( specularMap, vUv );',
            '    texelSpecular = sRGBToLinear( texelSpecular );',
            '    // reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture',
            '    specularFactor *= texelSpecular.rgb;',
            '#endif'
        ].join( '\n' );
        var glossinessMapFragmentChunk = [
            'float glossinessFactor = glossiness;',
            '#ifdef USE_GLOSSINESSMAP',
            '    vec4 texelGlossiness = texture2D( glossinessMap, vUv );',
            '    // reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture',
            '    glossinessFactor *= texelGlossiness.a;',
            '#endif'
        ].join( '\n' );
        var lightPhysicalFragmentChunk = [
            'PhysicalMaterial material;',
            'material.diffuseColor = diffuseColor.rgb * ( 1. - max( specularFactor.r, max( specularFactor.g, specularFactor.b ) ) );',
            'vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );',
            'float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );',
            'material.specularRoughness = max( 1.0 - glossinessFactor, 0.0525 ); // 0.0525 corresponds to the base mip of a 256 cubemap.',
            'material.specularRoughness += geometryRoughness;',
            'material.specularRoughness = min( material.specularRoughness, 1.0 );',
            'material.specularColor = specularFactor;',
        ].join( '\n' );
        var uniforms = {
            specular: { value: new THREE.Color().setHex( 0xffffff ) },
            glossiness: { value: 1 },
            specularMap: { value: null },
            glossinessMap: { value: null }
        };
        this._extraUniforms = uniforms;
        this.onBeforeCompile = function ( shader ) {
            for ( var uniformName in uniforms ) {
                shader.uniforms[ uniformName ] = uniforms[ uniformName ];
            }
            shader.fragmentShader = shader.fragmentShader
                .replace( 'uniform float roughness;', 'uniform vec3 specular;' )
                .replace( 'uniform float metalness;', 'uniform float glossiness;' )
                .replace( '#include <roughnessmap_pars_fragment>', specularMapParsFragmentChunk )
                .replace( '#include <metalnessmap_pars_fragment>', glossinessMapParsFragmentChunk )
                .replace( '#include <roughnessmap_fragment>', specularMapFragmentChunk )
                .replace( '#include <metalnessmap_fragment>', glossinessMapFragmentChunk )
                .replace( '#include <lights_physical_fragment>', lightPhysicalFragmentChunk );
        };
        Object.defineProperties( this, {
            specular: {
                get: function () {
                    return uniforms.specular.value;
                },
                set: function ( v ) {
                    uniforms.specular.value = v;
                }
            },
            specularMap: {
                get: function () {
                    return uniforms.specularMap.value;
                },
                set: function ( v ) {
                    uniforms.specularMap.value = v;
                    if ( v ) {
                        this.defines.USE_SPECULARMAP = ''; // USE_UV is set by the renderer for specular maps
                    } else {
                        delete this.defines.USE_SPECULARMAP;
                    }
                }
            },
            glossiness: {
                get: function () {
                    return uniforms.glossiness.value;
                },
                set: function ( v ) {
                    uniforms.glossiness.value = v;
                }
            },
            glossinessMap: {
                get: function () {
                    return uniforms.glossinessMap.value;
                },
                set: function ( v ) {
                    uniforms.glossinessMap.value = v;
                    if ( v ) {
                        this.defines.USE_GLOSSINESSMAP = '';
                        this.defines.USE_UV = '';
                    } else {
                        delete this.defines.USE_GLOSSINESSMAP;
                        delete this.defines.USE_UV;
                    }
                }
            }
        } );
        delete this.metalness;
        delete this.roughness;
        delete this.metalnessMap;
        delete this.roughnessMap;
        this.setValues( params );
    }
    GLTFMeshStandardSGMaterial.prototype = Object.create( THREE.MeshStandardMaterial.prototype );
    GLTFMeshStandardSGMaterial.prototype.constructor = GLTFMeshStandardSGMaterial;
    GLTFMeshStandardSGMaterial.prototype.copy = function ( source ) {
        THREE.MeshStandardMaterial.prototype.copy.call( this, source );
        this.specularMap = source.specularMap;
        this.specular.copy( source.specular );
        this.glossinessMap = source.glossinessMap;
        this.glossiness = source.glossiness;
        delete this.metalness;
        delete this.roughness;
        delete this.metalnessMap;
        delete this.roughnessMap;
        return this;
    };
    function GLTFMaterialsPbrSpecularGlossinessExtension() {
        return {
            name: EXTENSIONS.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,
            specularGlossinessParams: [
                'color',
                'map',
                'lightMap',
                'lightMapIntensity',
                'aoMap',
                'aoMapIntensity',
                'emissive',
                'emissiveIntensity',
                'emissiveMap',
                'bumpMap',
                'bumpScale',
                'normalMap',
                'normalMapType',
                'displacementMap',
                'displacementScale',
                'displacementBias',
                'specularMap',
                'specular',
                'glossinessMap',
                'glossiness',
                'alphaMap',
                'envMap',
                'envMapIntensity',
                'refractionRatio',
            ],
            getMaterialType: function () {
                return GLTFMeshStandardSGMaterial;
            },
            extendParams: function ( materialParams, materialDef, parser ) {
                var pbrSpecularGlossiness = materialDef.extensions[ this.name ];
                materialParams.color = new THREE.Color( 1.0, 1.0, 1.0 );
                materialParams.opacity = 1.0;
                var pending = [];
                if ( Array.isArray( pbrSpecularGlossiness.diffuseFactor ) ) {
                    var array = pbrSpecularGlossiness.diffuseFactor;
                    materialParams.color.fromArray( array );
                    materialParams.opacity = array[ 3 ];
                }
                if ( pbrSpecularGlossiness.diffuseTexture !== undefined ) {
                    pending.push( parser.assignTexture( materialParams, 'map', pbrSpecularGlossiness.diffuseTexture ) );
                }
                materialParams.emissive = new THREE.Color( 0.0, 0.0, 0.0 );
                materialParams.glossiness = pbrSpecularGlossiness.glossinessFactor !== undefined ? pbrSpecularGlossiness.glossinessFactor : 1.0;
                materialParams.specular = new THREE.Color( 1.0, 1.0, 1.0 );
                if ( Array.isArray( pbrSpecularGlossiness.specularFactor ) ) {
                    materialParams.specular.fromArray( pbrSpecularGlossiness.specularFactor );
                }
                if ( pbrSpecularGlossiness.specularGlossinessTexture !== undefined ) {
                    var specGlossMapDef = pbrSpecularGlossiness.specularGlossinessTexture;
                    pending.push( parser.assignTexture( materialParams, 'glossinessMap', specGlossMapDef ) );
                    pending.push( parser.assignTexture( materialParams, 'specularMap', specGlossMapDef ) );
                }
                return Promise.all( pending );
            },
            createMaterial: function ( materialParams ) {
                var material = new GLTFMeshStandardSGMaterial( materialParams );
                material.fog = true;
                material.color = materialParams.color;
                material.map = materialParams.map === undefined ? null : materialParams.map;
                material.lightMap = null;
                material.lightMapIntensity = 1.0;
                material.aoMap = materialParams.aoMap === undefined ? null : materialParams.aoMap;
                material.aoMapIntensity = 1.0;
                material.emissive = materialParams.emissive;
                material.emissiveIntensity = 1.0;
                material.emissiveMap = materialParams.emissiveMap === undefined ? null : materialParams.emissiveMap;
                material.bumpMap = materialParams.bumpMap === undefined ? null : materialParams.bumpMap;
                material.bumpScale = 1;
                material.normalMap = materialParams.normalMap === undefined ? null : materialParams.normalMap;
                material.normalMapType = THREE.TangentSpaceNormalMap;
                if ( materialParams.normalScale ) material.normalScale = materialParams.normalScale;
                material.displacementMap = null;
                material.displacementScale = 1;
                material.displacementBias = 0;
                material.specularMap = materialParams.specularMap === undefined ? null : materialParams.specularMap;
                material.specular = materialParams.specular;
                material.glossinessMap = materialParams.glossinessMap === undefined ? null : materialParams.glossinessMap;
                material.glossiness = materialParams.glossiness;
                material.alphaMap = null;
                material.envMap = materialParams.envMap === undefined ? null : materialParams.envMap;
                material.envMapIntensity = 1.0;
                material.refractionRatio = 0.98;
                return material;
            },
        };
    }
    /**
     * Mesh Quantization Extension
     *
     * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_mesh_quantization
     */
    function GLTFMeshQuantizationExtension() {
        this.name = EXTENSIONS.KHR_MESH_QUANTIZATION;
    }
    /*********************************/
    /********** INTERPOLATION ********/
    /*********************************/
    // Spline Interpolation
    // Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#appendix-c-spline-interpolation
    function GLTFCubicSplineInterpolant( parameterPositions, sampleValues, sampleSize, resultBuffer ) {
        THREE.Interpolant.call( this, parameterPositions, sampleValues, sampleSize, resultBuffer );
    }
    GLTFCubicSplineInterpolant.prototype = Object.create( THREE.Interpolant.prototype );
    GLTFCubicSplineInterpolant.prototype.constructor = GLTFCubicSplineInterpolant;
    GLTFCubicSplineInterpolant.prototype.copySampleValue_ = function ( index ) {
        // Copies a sample value to the result buffer. See description of glTF
        // CUBICSPLINE values layout in interpolate_() function below.
        var result = this.resultBuffer,
            values = this.sampleValues,
            valueSize = this.valueSize,
            offset = index * valueSize * 3 + valueSize;
        for ( var i = 0; i !== valueSize; i ++ ) {
            result[ i ] = values[ offset + i ];
        }
        return result;
    };
    GLTFCubicSplineInterpolant.prototype.beforeStart_ = GLTFCubicSplineInterpolant.prototype.copySampleValue_;
    GLTFCubicSplineInterpolant.prototype.afterEnd_ = GLTFCubicSplineInterpolant.prototype.copySampleValue_;
    GLTFCubicSplineInterpolant.prototype.interpolate_ = function ( i1, t0, t, t1 ) {
        var result = this.resultBuffer;
        var values = this.sampleValues;
        var stride = this.valueSize;
        var stride2 = stride * 2;
        var stride3 = stride * 3;
        var td = t1 - t0;
        var p = ( t - t0 ) / td;
        var pp = p * p;
        var ppp = pp * p;
        var offset1 = i1 * stride3;
        var offset0 = offset1 - stride3;
        var s2 = - 2 * ppp + 3 * pp;
        var s3 = ppp - pp;
        var s0 = 1 - s2;
        var s1 = s3 - pp + p;
        // Layout of keyframe output values for CUBICSPLINE animations:
        //   [ inTangent_1, splineVertex_1, outTangent_1, inTangent_2, splineVertex_2, ... ]
        for ( var i = 0; i !== stride; i ++ ) {
            var p0 = values[ offset0 + i + stride ]; // splineVertex_k
            var m0 = values[ offset0 + i + stride2 ] * td; // outTangent_k * (t_k+1 - t_k)
            var p1 = values[ offset1 + i + stride ]; // splineVertex_k+1
            var m1 = values[ offset1 + i ] * td; // inTangent_k+1 * (t_k+1 - t_k)
            result[ i ] = s0 * p0 + s1 * m0 + s2 * p1 + s3 * m1;
        }
        return result;
    };
    /*********************************/
    /********** INTERNALS ************/
    /*********************************/
    /* CONSTANTS */
    var WEBGL_CONSTANTS = {
        FLOAT: 5126,
        //FLOAT_MAT2: 35674,
        FLOAT_MAT3: 35675,
        FLOAT_MAT4: 35676,
        FLOAT_VEC2: 35664,
        FLOAT_VEC3: 35665,
        FLOAT_VEC4: 35666,
        LINEAR: 9729,
        REPEAT: 10497,
        SAMPLER_2D: 35678,
        POINTS: 0,
        LINES: 1,
        LINE_LOOP: 2,
        LINE_STRIP: 3,
        TRIANGLES: 4,
        TRIANGLE_STRIP: 5,
        TRIANGLE_FAN: 6,
        UNSIGNED_BYTE: 5121,
        UNSIGNED_SHORT: 5123
    };
    var WEBGL_COMPONENT_TYPES = {
        5120: Int8Array,
        5121: Uint8Array,
        5122: Int16Array,
        5123: Uint16Array,
        5125: Uint32Array,
        5126: Float32Array
    };
    var WEBGL_FILTERS = {
        9728: THREE.NearestFilter,
        9729: THREE.LinearFilter,
        9984: THREE.NearestMipmapNearestFilter,
        9985: THREE.LinearMipmapNearestFilter,
        9986: THREE.NearestMipmapLinearFilter,
        9987: THREE.LinearMipmapLinearFilter
    };
    var WEBGL_WRAPPINGS = {
        33071: THREE.ClampToEdgeWrapping,
        33648: THREE.MirroredRepeatWrapping,
        10497: THREE.RepeatWrapping
    };
    var WEBGL_TYPE_SIZES = {
        'SCALAR': 1,
        'VEC2': 2,
        'VEC3': 3,
        'VEC4': 4,
        'MAT2': 4,
        'MAT3': 9,
        'MAT4': 16
    };
    var ATTRIBUTES = {
        POSITION: 'position',
        NORMAL: 'normal',
        TANGENT: 'tangent',
        TEXCOORD_0: 'uv',
        TEXCOORD_1: 'uv2',
        COLOR_0: 'color',
        WEIGHTS_0: 'skinWeight',
        JOINTS_0: 'skinIndex',
    };
    var PATH_PROPERTIES = {
        scale: 'scale',
        translation: 'position',
        rotation: 'quaternion',
        weights: 'morphTargetInfluences'
    };
    var INTERPOLATION = {
        CUBICSPLINE: undefined, // We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
                                // keyframe track will be initialized with a default interpolation type, then modified.
        LINEAR: THREE.InterpolateLinear,
        STEP: THREE.InterpolateDiscrete
    };
    var ALPHA_MODES = {
        OPAQUE: 'OPAQUE',
        MASK: 'MASK',
        BLEND: 'BLEND'
    };
    /* UTILITY FUNCTIONS */
    function resolveURL( url, path ) {
        // Invalid URL
        if ( typeof url !== 'string' || url === '' ) return '';
        // Host Relative URL
        if ( /^https?:\/\//i.test( path ) && /^\//.test( url ) ) {
            path = path.replace( /(^https?:\/\/[^\/]+).*/i, '$1' );
        }
        // Absolute URL http://,https://,//
        if ( /^(https?:)?\/\//i.test( url ) ) return url;
        // Data URI
        if ( /^data:.*,.*$/i.test( url ) ) return url;
        // Blob URL
        if ( /^blob:.*$/i.test( url ) ) return url;
        // Relative URL
        return path + url;
    }
    /**
     * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#default-material
     */
    function createDefaultMaterial( cache ) {
        if ( cache[ 'DefaultMaterial' ] === undefined ) {
            cache[ 'DefaultMaterial' ] = new THREE.MeshStandardMaterial( {
                color: 0xFFFFFF,
                emissive: 0x000000,
                metalness: 1,
                roughness: 1,
                transparent: false,
                depthTest: true,
                side: THREE.FrontSide
            } );
        }
        return cache[ 'DefaultMaterial' ];
    }
    function addUnknownExtensionsToUserData( knownExtensions, object, objectDef ) {
        // Add unknown glTF extensions to an object's userData.
        for ( var name in objectDef.extensions ) {
            if ( knownExtensions[ name ] === undefined ) {
                object.userData.gltfExtensions = object.userData.gltfExtensions || {};
                object.userData.gltfExtensions[ name ] = objectDef.extensions[ name ];
            }
        }
    }
    /**
     * @param {THREE.Object3D|THREE.Material|THREE.BufferGeometry} object
     * @param {GLTF.definition} gltfDef
     */
    function assignExtrasToUserData( object, gltfDef ) {
        if ( gltfDef.extras !== undefined ) {
            if ( typeof gltfDef.extras === 'object' ) {
                Object.assign( object.userData, gltfDef.extras );
            } else {
                console.warn( 'THREE.GLTFLoader: Ignoring primitive type .extras, ' + gltfDef.extras );
            }
        }
    }
    /**
     * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#morph-targets
     *
     * @param {THREE.BufferGeometry} geometry
     * @param {Array<GLTF.Target>} targets
     * @param {GLTFParser} parser
     * @return {Promise<THREE.BufferGeometry>}
     */
    function addMorphTargets( geometry, targets, parser ) {
        var hasMorphPosition = false;
        var hasMorphNormal = false;
        for ( var i = 0, il = targets.length; i < il; i ++ ) {
            var target = targets[ i ];
            if ( target.POSITION !== undefined ) hasMorphPosition = true;
            if ( target.NORMAL !== undefined ) hasMorphNormal = true;
            if ( hasMorphPosition && hasMorphNormal ) break;
        }
        if ( ! hasMorphPosition && ! hasMorphNormal ) return Promise.resolve( geometry );
        var pendingPositionAccessors = [];
        var pendingNormalAccessors = [];
        for ( var i = 0, il = targets.length; i < il; i ++ ) {
            var target = targets[ i ];
            if ( hasMorphPosition ) {
                var pendingAccessor = target.POSITION !== undefined
                    ? parser.getDependency( 'accessor', target.POSITION )
                    : geometry.attributes.position;
                pendingPositionAccessors.push( pendingAccessor );
            }
            if ( hasMorphNormal ) {
                var pendingAccessor = target.NORMAL !== undefined
                    ? parser.getDependency( 'accessor', target.NORMAL )
                    : geometry.attributes.normal;
                pendingNormalAccessors.push( pendingAccessor );
            }
        }
        return Promise.all( [
            Promise.all( pendingPositionAccessors ),
            Promise.all( pendingNormalAccessors )
        ] ).then( function ( accessors ) {
            var morphPositions = accessors[ 0 ];
            var morphNormals = accessors[ 1 ];
            if ( hasMorphPosition ) geometry.morphAttributes.position = morphPositions;
            if ( hasMorphNormal ) geometry.morphAttributes.normal = morphNormals;
            geometry.morphTargetsRelative = true;
            return geometry;
        } );
    }
    /**
     * @param {THREE.Mesh} mesh
     * @param {GLTF.Mesh} meshDef
     */
    function updateMorphTargets( mesh, meshDef ) {
        mesh.updateMorphTargets();
        if ( meshDef.weights !== undefined ) {
            for ( var i = 0, il = meshDef.weights.length; i < il; i ++ ) {
                mesh.morphTargetInfluences[ i ] = meshDef.weights[ i ];
            }
        }
        // .extras has user-defined data, so check that .extras.targetNames is an array.
        if ( meshDef.extras && Array.isArray( meshDef.extras.targetNames ) ) {
            var targetNames = meshDef.extras.targetNames;
            if ( mesh.morphTargetInfluences.length === targetNames.length ) {
                mesh.morphTargetDictionary = {};
                for ( var i = 0, il = targetNames.length; i < il; i ++ ) {
                    mesh.morphTargetDictionary[ targetNames[ i ] ] = i;
                }
            } else {
                console.warn( 'THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.' );
            }
        }
    }
    function createPrimitiveKey( primitiveDef ) {
        var dracoExtension = primitiveDef.extensions && primitiveDef.extensions[ EXTENSIONS.KHR_DRACO_MESH_COMPRESSION ];
        var geometryKey;
        if ( dracoExtension ) {
            geometryKey = 'draco:' + dracoExtension.bufferView
                + ':' + dracoExtension.indices
                + ':' + createAttributesKey( dracoExtension.attributes );
        } else {
            geometryKey = primitiveDef.indices + ':' + createAttributesKey( primitiveDef.attributes ) + ':' + primitiveDef.mode;
        }
        return geometryKey;
    }
    function createAttributesKey( attributes ) {
        var attributesKey = '';
        var keys = Object.keys( attributes ).sort();
        for ( var i = 0, il = keys.length; i < il; i ++ ) {
            attributesKey += keys[ i ] + ':' + attributes[ keys[ i ] ] + ';';
        }
        return attributesKey;
    }
    /* GLTF PARSER */
    function GLTFParser( json, options ) {
        this.json = json || {};
        this.extensions = {};
        this.plugins = {};
        this.options = options || {};
        // loader object cache
        this.cache = new GLTFRegistry();
        // associations between Three.js objects and glTF elements
        this.associations = new Map();
        // BufferGeometry caching
        this.primitiveCache = {};
        // Object3D instance caches
        this.meshCache = { refs: {}, uses: {} };
        this.cameraCache = { refs: {}, uses: {} };
        this.lightCache = { refs: {}, uses: {} };
        // Track node names, to ensure no duplicates
        this.nodeNamesUsed = {};
        // Use an ImageBitmapLoader if imageBitmaps are supported. Moves much of the
        // expensive work of uploading a texture to the GPU off the main thread.
        if ( typeof createImageBitmap !== 'undefined' && /Firefox/.test( navigator.userAgent ) === false ) {
            this.textureLoader = new THREE.ImageBitmapLoader( this.options.manager );
        } else {
            this.textureLoader = new THREE.TextureLoader( this.options.manager );
        }
        this.textureLoader.setCrossOrigin( this.options.crossOrigin );
        this.textureLoader.setRequestHeader( this.options.requestHeader );
        this.fileLoader = new THREE.FileLoader( this.options.manager );
        this.fileLoader.setResponseType( 'arraybuffer' );
        if ( this.options.crossOrigin === 'use-credentials' ) {
            this.fileLoader.setWithCredentials( true );
        }
    }
    GLTFParser.prototype.setExtensions = function ( extensions ) {
        this.extensions = extensions;
    };
    GLTFParser.prototype.setPlugins = function ( plugins ) {
        this.plugins = plugins;
    };
    GLTFParser.prototype.parse = function ( onLoad, onError ) {
        var parser = this;
        var json = this.json;
        var extensions = this.extensions;
        // Clear the loader cache
        this.cache.removeAll();
        // Mark the special nodes/meshes in json for efficient parse
        this._invokeAll( function ( ext ) {
            return ext._markDefs && ext._markDefs();
        } );
        Promise.all( this._invokeAll( function ( ext ) {
            return ext.beforeRoot && ext.beforeRoot();
        } ) ).then( function () {
            return Promise.all( [
                parser.getDependencies( 'scene' ),
                parser.getDependencies( 'animation' ),
                parser.getDependencies( 'camera' ),
            ] );
        } ).then( function ( dependencies ) {
            var result = {
                scene: dependencies[ 0 ][ json.scene || 0 ],
                scenes: dependencies[ 0 ],
                animations: dependencies[ 1 ],
                cameras: dependencies[ 2 ],
                asset: json.asset,
                parser: parser,
                userData: {}
            };
            addUnknownExtensionsToUserData( extensions, result, json );
            assignExtrasToUserData( result, json );
            Promise.all( parser._invokeAll( function ( ext ) {
                return ext.afterRoot && ext.afterRoot( result );
            } ) ).then( function () {
                onLoad( result );
            } );
        } ).catch( onError );
    };
    /**
     * Marks the special nodes/meshes in json for efficient parse.
     */
    GLTFParser.prototype._markDefs = function () {
        var nodeDefs = this.json.nodes || [];
        var skinDefs = this.json.skins || [];
        var meshDefs = this.json.meshes || [];
        // Nothing in the node definition indicates whether it is a Bone or an
        // Object3D. Use the skins' joint references to mark bones.
        for ( var skinIndex = 0, skinLength = skinDefs.length; skinIndex < skinLength; skinIndex ++ ) {
            var joints = skinDefs[ skinIndex ].joints;
            for ( var i = 0, il = joints.length; i < il; i ++ ) {
                nodeDefs[ joints[ i ] ].isBone = true;
            }
        }
        // Iterate over all nodes, marking references to shared resources,
        // as well as skeleton joints.
        for ( var nodeIndex = 0, nodeLength = nodeDefs.length; nodeIndex < nodeLength; nodeIndex ++ ) {
            var nodeDef = nodeDefs[ nodeIndex ];
            if ( nodeDef.mesh !== undefined ) {
                this._addNodeRef( this.meshCache, nodeDef.mesh );
                // Nothing in the mesh definition indicates whether it is
                // a SkinnedMesh or Mesh. Use the node's mesh reference
                // to mark SkinnedMesh if node has skin.
                if ( nodeDef.skin !== undefined ) {
                    meshDefs[ nodeDef.mesh ].isSkinnedMesh = true;
                }
            }
            if ( nodeDef.camera !== undefined ) {
                this._addNodeRef( this.cameraCache, nodeDef.camera );
            }
        }
    };
    /**
     * Counts references to shared node / Object3D resources. These resources
     * can be reused, or "instantiated", at multiple nodes in the scene
     * hierarchy. Mesh, Camera, and Light instances are instantiated and must
     * be marked. Non-scenegraph resources (like Materials, Geometries, and
     * Textures) can be reused directly and are not marked here.
     *
     * Example: CesiumMilkTruck sample model reuses "Wheel" meshes.
     */
    GLTFParser.prototype._addNodeRef = function ( cache, index ) {
        if ( index === undefined ) return;
        if ( cache.refs[ index ] === undefined ) {
            cache.refs[ index ] = cache.uses[ index ] = 0;
        }
        cache.refs[ index ] ++;
    };
    /** Returns a reference to a shared resource, cloning it if necessary. */
    GLTFParser.prototype._getNodeRef = function ( cache, index, object ) {
        if ( cache.refs[ index ] <= 1 ) return object;
        var ref = object.clone();
        ref.name += '_instance_' + ( cache.uses[ index ] ++ );
        return ref;
    };
    GLTFParser.prototype._invokeOne = function ( func ) {
        var extensions = Object.values( this.plugins );
        extensions.push( this );
        for ( var i = 0; i < extensions.length; i ++ ) {
            var result = func( extensions[ i ] );
            if ( result ) return result;
        }
    };
    GLTFParser.prototype._invokeAll = function ( func ) {
        var extensions = Object.values( this.plugins );
        extensions.unshift( this );
        var pending = [];
        for ( var i = 0; i < extensions.length; i ++ ) {
            var result = func( extensions[ i ] );
            if ( result ) pending.push( result );
        }
        return pending;
    };
    /**
     * Requests the specified dependency asynchronously, with caching.
     * @param {string} type
     * @param {number} index
     * @return {Promise<THREE.Object3D|THREE.Material|THREE.Texture|THREE.AnimationClip|ArrayBuffer|Object>}
     */
    GLTFParser.prototype.getDependency = function ( type, index ) {
        var cacheKey = type + ':' + index;
        var dependency = this.cache.get( cacheKey );
        if ( ! dependency ) {
            switch ( type ) {
                case 'scene':
                    dependency = this.loadScene( index );
                    break;
                case 'node':
                    dependency = this.loadNode( index );
                    break;
                case 'mesh':
                    dependency = this._invokeOne( function ( ext ) {
                        return ext.loadMesh && ext.loadMesh( index );
                    } );
                    break;
                case 'accessor':
                    dependency = this.loadAccessor( index );
                    break;
                case 'bufferView':
                    dependency = this._invokeOne( function ( ext ) {
                        return ext.loadBufferView && ext.loadBufferView( index );
                    } );
                    break;
                case 'buffer':
                    dependency = this.loadBuffer( index );
                    break;
                case 'material':
                    dependency = this._invokeOne( function ( ext ) {
                        return ext.loadMaterial && ext.loadMaterial( index );
                    } );
                    break;
                case 'texture':
                    dependency = this._invokeOne( function ( ext ) {
                        return ext.loadTexture && ext.loadTexture( index );
                    } );
                    break;
                case 'skin':
                    dependency = this.loadSkin( index );
                    break;
                case 'animation':
                    dependency = this.loadAnimation( index );
                    break;
                case 'camera':
                    dependency = this.loadCamera( index );
                    break;
                default:
                    throw new Error( 'Unknown type: ' + type );
            }
            this.cache.add( cacheKey, dependency );
        }
        return dependency;
    };
    /**
     * Requests all dependencies of the specified type asynchronously, with caching.
     * @param {string} type
     * @return {Promise<Array<Object>>}
     */
    GLTFParser.prototype.getDependencies = function ( type ) {
        var dependencies = this.cache.get( type );
        if ( ! dependencies ) {
            var parser = this;
            var defs = this.json[ type + ( type === 'mesh' ? 'es' : 's' ) ] || [];
            dependencies = Promise.all( defs.map( function ( def, index ) {
                return parser.getDependency( type, index );
            } ) );
            this.cache.add( type, dependencies );
        }
        return dependencies;
    };
    /**
     * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
     * @param {number} bufferIndex
     * @return {Promise<ArrayBuffer>}
     */
    GLTFParser.prototype.loadBuffer = function ( bufferIndex ) {
        var bufferDef = this.json.buffers[ bufferIndex ];
        var loader = this.fileLoader;
        if ( bufferDef.type && bufferDef.type !== 'arraybuffer' ) {
            throw new Error( 'THREE.GLTFLoader: ' + bufferDef.type + ' buffer type is not supported.' );
        }
        // If present, GLB container is required to be the first buffer.
        if ( bufferDef.uri === undefined && bufferIndex === 0 ) {
            return Promise.resolve( this.extensions[ EXTENSIONS.KHR_BINARY_GLTF ].body );
        }
        var options = this.options;
        return new Promise( function ( resolve, reject ) {
            loader.load( resolveURL( bufferDef.uri, options.path ), resolve, undefined, function () {
                reject( new Error( 'THREE.GLTFLoader: Failed to load buffer "' + bufferDef.uri + '".' ) );
            } );
        } );
    };
    /**
     * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
     * @param {number} bufferViewIndex
     * @return {Promise<ArrayBuffer>}
     */
    GLTFParser.prototype.loadBufferView = function ( bufferViewIndex ) {
        var bufferViewDef = this.json.bufferViews[ bufferViewIndex ];
        return this.getDependency( 'buffer', bufferViewDef.buffer ).then( function ( buffer ) {
            var byteLength = bufferViewDef.byteLength || 0;
            var byteOffset = bufferViewDef.byteOffset || 0;
            return buffer.slice( byteOffset, byteOffset + byteLength );
        } );
    };
    /**
     * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#accessors
     * @param {number} accessorIndex
     * @return {Promise<THREE.BufferAttribute|THREE.InterleavedBufferAttribute>}
     */
    GLTFParser.prototype.loadAccessor = function ( accessorIndex ) {
        var parser = this;
        var json = this.json;
        var accessorDef = this.json.accessors[ accessorIndex ];
        if ( accessorDef.bufferView === undefined && accessorDef.sparse === undefined ) {
            // Ignore empty accessors, which may be used to declare runtime
            // information about attributes coming from another source (e.g. Draco
            // compression extension).
            return Promise.resolve( null );
        }
        var pendingBufferViews = [];
        if ( accessorDef.bufferView !== undefined ) {
            pendingBufferViews.push( this.getDependency( 'bufferView', accessorDef.bufferView ) );
        } else {
            pendingBufferViews.push( null );
        }
        if ( accessorDef.sparse !== undefined ) {
            pendingBufferViews.push( this.getDependency( 'bufferView', accessorDef.sparse.indices.bufferView ) );
            pendingBufferViews.push( this.getDependency( 'bufferView', accessorDef.sparse.values.bufferView ) );
        }
        return Promise.all( pendingBufferViews ).then( function ( bufferViews ) {
            var bufferView = bufferViews[ 0 ];
            var itemSize = WEBGL_TYPE_SIZES[ accessorDef.type ];
            var TypedArray = WEBGL_COMPONENT_TYPES[ accessorDef.componentType ];
            // For VEC3: itemSize is 3, elementBytes is 4, itemBytes is 12.
            var elementBytes = TypedArray.BYTES_PER_ELEMENT;
            var itemBytes = elementBytes * itemSize;
            var byteOffset = accessorDef.byteOffset || 0;
            var byteStride = accessorDef.bufferView !== undefined ? json.bufferViews[ accessorDef.bufferView ].byteStride : undefined;
            var normalized = accessorDef.normalized === true;
            var array, bufferAttribute;
            // The buffer is not interleaved if the stride is the item size in bytes.
            if ( byteStride && byteStride !== itemBytes ) {
                // Each "slice" of the buffer, as defined by 'count' elements of 'byteStride' bytes, gets its own InterleavedBuffer
                // This makes sure that IBA.count reflects accessor.count properly
                var ibSlice = Math.floor( byteOffset / byteStride );
                var ibCacheKey = 'InterleavedBuffer:' + accessorDef.bufferView + ':' + accessorDef.componentType + ':' + ibSlice + ':' + accessorDef.count;
                var ib = parser.cache.get( ibCacheKey );
                if ( ! ib ) {
                    array = new TypedArray( bufferView, ibSlice * byteStride, accessorDef.count * byteStride / elementBytes );
                    // Integer parameters to IB/IBA are in array elements, not bytes.
                    ib = new THREE.InterleavedBuffer( array, byteStride / elementBytes );
                    parser.cache.add( ibCacheKey, ib );
                }
                bufferAttribute = new THREE.InterleavedBufferAttribute( ib, itemSize, ( byteOffset % byteStride ) / elementBytes, normalized );
            } else {
                if ( bufferView === null ) {
                    array = new TypedArray( accessorDef.count * itemSize );
                } else {
                    array = new TypedArray( bufferView, byteOffset, accessorDef.count * itemSize );
                }
                bufferAttribute = new THREE.BufferAttribute( array, itemSize, normalized );
            }
            // https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#sparse-accessors
            if ( accessorDef.sparse !== undefined ) {
                var itemSizeIndices = WEBGL_TYPE_SIZES.SCALAR;
                var TypedArrayIndices = WEBGL_COMPONENT_TYPES[ accessorDef.sparse.indices.componentType ];
                var byteOffsetIndices = accessorDef.sparse.indices.byteOffset || 0;
                var byteOffsetValues = accessorDef.sparse.values.byteOffset || 0;
                var sparseIndices = new TypedArrayIndices( bufferViews[ 1 ], byteOffsetIndices, accessorDef.sparse.count * itemSizeIndices );
                var sparseValues = new TypedArray( bufferViews[ 2 ], byteOffsetValues, accessorDef.sparse.count * itemSize );
                if ( bufferView !== null ) {
                    // Avoid modifying the original ArrayBuffer, if the bufferView wasn't initialized with zeroes.
                    bufferAttribute = new THREE.BufferAttribute( bufferAttribute.array.slice(), bufferAttribute.itemSize, bufferAttribute.normalized );
                }
                for ( var i = 0, il = sparseIndices.length; i < il; i ++ ) {
                    var index = sparseIndices[ i ];
                    bufferAttribute.setX( index, sparseValues[ i * itemSize ] );
                    if ( itemSize >= 2 ) bufferAttribute.setY( index, sparseValues[ i * itemSize + 1 ] );
                    if ( itemSize >= 3 ) bufferAttribute.setZ( index, sparseValues[ i * itemSize + 2 ] );
                    if ( itemSize >= 4 ) bufferAttribute.setW( index, sparseValues[ i * itemSize + 3 ] );
                    if ( itemSize >= 5 ) throw new Error( 'THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.' );
                }
            }
            return bufferAttribute;
        } );
    };
    /**
     * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures
     * @param {number} textureIndex
     * @return {Promise<THREE.Texture>}
     */
    GLTFParser.prototype.loadTexture = function ( textureIndex ) {
        var json = this.json;
        var options = this.options;
        var textureDef = json.textures[ textureIndex ];
        var source = json.images[ textureDef.source ];
        var loader = this.textureLoader;
        if ( source.uri ) {
            var handler = options.manager.getHandler( source.uri );
            if ( handler !== null ) loader = handler;
        }
        return this.loadTextureImage( textureIndex, source, loader );
    };
    GLTFParser.prototype.loadTextureImage = function ( textureIndex, source, loader ) {
        var parser = this;
        var json = this.json;
        var options = this.options;
        var textureDef = json.textures[ textureIndex ];
        var URL = self.URL || self.webkitURL;
        var sourceURI = source.uri;
        var isObjectURL = false;
        var hasAlpha = true;
        if ( source.mimeType === 'image/jpeg' ) hasAlpha = false;
        if ( source.bufferView !== undefined ) {
            // Load binary image data from bufferView, if provided.
            sourceURI = parser.getDependency( 'bufferView', source.bufferView ).then( function ( bufferView ) {
                if ( source.mimeType === 'image/png' ) {
                    // Inspect the PNG 'IHDR' chunk to determine whether the image could have an
                    // alpha channel. This check is conservative — the image could have an alpha
                    // channel with all values == 1, and the indexed type (colorType == 3) only
                    // sometimes contains alpha.
                    //
                    // https://en.wikipedia.org/wiki/Portable_Network_Graphics#File_header
                    var colorType = new DataView( bufferView, 25, 1 ).getUint8( 0, false );
                    hasAlpha = colorType === 6 || colorType === 4 || colorType === 3;
                }
                isObjectURL = true;
                var blob = new Blob( [ bufferView ], { type: source.mimeType } );
                sourceURI = URL.createObjectURL( blob );
                return sourceURI;
            } );
        } else if ( source.uri === undefined ) {
            throw new Error( 'THREE.GLTFLoader: Image ' + textureIndex + ' is missing URI and bufferView' );
        }
        return Promise.resolve( sourceURI ).then( function ( sourceURI ) {
            return new Promise( function ( resolve, reject ) {
                var onLoad = resolve;
                if ( loader.isImageBitmapLoader === true ) {
                    onLoad = function ( imageBitmap ) {
                        resolve( new THREE.CanvasTexture( imageBitmap ) );
                    };
                }
                loader.load( resolveURL( sourceURI, options.path ), onLoad, undefined, reject );
            } );
        } ).then( function ( texture ) {
            // Clean up resources and configure Texture.
            if ( isObjectURL === true ) {
                URL.revokeObjectURL( sourceURI );
            }
            texture.flipY = false;
            if ( textureDef.name ) texture.name = textureDef.name;
            // When there is definitely no alpha channel in the texture, set RGBFormat to save space.
            if ( ! hasAlpha ) texture.format = THREE.RGBFormat;
            var samplers = json.samplers || {};
            var sampler = samplers[ textureDef.sampler ] || {};
            texture.magFilter = WEBGL_FILTERS[ sampler.magFilter ] || THREE.LinearFilter;
            texture.minFilter = WEBGL_FILTERS[ sampler.minFilter ] || THREE.LinearMipmapLinearFilter;
            texture.wrapS = WEBGL_WRAPPINGS[ sampler.wrapS ] || THREE.RepeatWrapping;
            texture.wrapT = WEBGL_WRAPPINGS[ sampler.wrapT ] || THREE.RepeatWrapping;
            parser.associations.set( texture, {
                type: 'textures',
                index: textureIndex
            } );
            return texture;
        } );
    };
    /**
     * Asynchronously assigns a texture to the given material parameters.
     * @param {Object} materialParams
     * @param {string} mapName
     * @param {Object} mapDef
     * @return {Promise}
     */
    GLTFParser.prototype.assignTexture = function ( materialParams, mapName, mapDef ) {
        var parser = this;
        return this.getDependency( 'texture', mapDef.index ).then( function ( texture ) {
            // Materials sample aoMap from UV set 1 and other maps from UV set 0 - this can't be configured
            // However, we will copy UV set 0 to UV set 1 on demand for aoMap
            if ( mapDef.texCoord !== undefined && mapDef.texCoord != 0 && ! ( mapName === 'aoMap' && mapDef.texCoord == 1 ) ) {
                console.warn( 'THREE.GLTFLoader: Custom UV set ' + mapDef.texCoord + ' for texture ' + mapName + ' not yet supported.' );
            }
            if ( parser.extensions[ EXTENSIONS.KHR_TEXTURE_TRANSFORM ] ) {
                var transform = mapDef.extensions !== undefined ? mapDef.extensions[ EXTENSIONS.KHR_TEXTURE_TRANSFORM ] : undefined;
                if ( transform ) {
                    var gltfReference = parser.associations.get( texture );
                    texture = parser.extensions[ EXTENSIONS.KHR_TEXTURE_TRANSFORM ].extendTexture( texture, transform );
                    parser.associations.set( texture, gltfReference );
                }
            }
            materialParams[ mapName ] = texture;
        } );
    };
    /**
     * Assigns final material to a Mesh, Line, or Points instance. The instance
     * already has a material (generated from the glTF material options alone)
     * but reuse of the same glTF material may require multiple threejs materials
     * to accommodate different primitive types, defines, etc. New materials will
     * be created if necessary, and reused from a cache.
     * @param  {THREE.Object3D} mesh Mesh, Line, or Points instance.
     */
    GLTFParser.prototype.assignFinalMaterial = function ( mesh ) {
        var geometry = mesh.geometry;
        var material = mesh.material;
        var useVertexTangents = geometry.attributes.tangent !== undefined;
        var useVertexColors = geometry.attributes.color !== undefined;
        var useFlatShading = geometry.attributes.normal === undefined;
        var useSkinning = mesh.isSkinnedMesh === true;
        var useMorphTargets = Object.keys( geometry.morphAttributes ).length > 0;
        var useMorphNormals = useMorphTargets && geometry.morphAttributes.normal !== undefined;
        if ( mesh.isPoints ) {
            var cacheKey = 'PointsMaterial:' + material.uuid;
            var pointsMaterial = this.cache.get( cacheKey );
            if ( ! pointsMaterial ) {
                pointsMaterial = new THREE.PointsMaterial();
                THREE.Material.prototype.copy.call( pointsMaterial, material );
                pointsMaterial.color.copy( material.color );
                pointsMaterial.map = material.map;
                pointsMaterial.sizeAttenuation = false; // glTF spec says points should be 1px
                this.cache.add( cacheKey, pointsMaterial );
            }
            material = pointsMaterial;
        } else if ( mesh.isLine ) {
            var cacheKey = 'LineBasicMaterial:' + material.uuid;
            var lineMaterial = this.cache.get( cacheKey );
            if ( ! lineMaterial ) {
                lineMaterial = new THREE.LineBasicMaterial();
                THREE.Material.prototype.copy.call( lineMaterial, material );
                lineMaterial.color.copy( material.color );
                this.cache.add( cacheKey, lineMaterial );
            }
            material = lineMaterial;
        }
        // Clone the material if it will be modified
        if ( useVertexTangents || useVertexColors || useFlatShading || useSkinning || useMorphTargets ) {
            var cacheKey = 'ClonedMaterial:' + material.uuid + ':';
            if ( material.isGLTFSpecularGlossinessMaterial ) cacheKey += 'specular-glossiness:';
            if ( useSkinning ) cacheKey += 'skinning:';
            if ( useVertexTangents ) cacheKey += 'vertex-tangents:';
            if ( useVertexColors ) cacheKey += 'vertex-colors:';
            if ( useFlatShading ) cacheKey += 'flat-shading:';
            if ( useMorphTargets ) cacheKey += 'morph-targets:';
            if ( useMorphNormals ) cacheKey += 'morph-normals:';
            var cachedMaterial = this.cache.get( cacheKey );
            if ( ! cachedMaterial ) {
                cachedMaterial = material.clone();
                if ( useSkinning ) cachedMaterial.skinning = true;
                if ( useVertexColors ) cachedMaterial.vertexColors = true;
                if ( useFlatShading ) cachedMaterial.flatShading = true;
                if ( useMorphTargets ) cachedMaterial.morphTargets = true;
                if ( useMorphNormals ) cachedMaterial.morphNormals = true;
                if ( useVertexTangents ) {
                    cachedMaterial.vertexTangents = true;
                    // https://github.com/mrdoob/three.js/issues/11438#issuecomment-507003995
                    if ( cachedMaterial.normalScale ) cachedMaterial.normalScale.y *= - 1;
                    if ( cachedMaterial.clearcoatNormalScale ) cachedMaterial.clearcoatNormalScale.y *= - 1;
                }
                this.cache.add( cacheKey, cachedMaterial );
                this.associations.set( cachedMaterial, this.associations.get( material ) );
            }
            material = cachedMaterial;
        }
        // workarounds for mesh and geometry
        if ( material.aoMap && geometry.attributes.uv2 === undefined && geometry.attributes.uv !== undefined ) {
            geometry.setAttribute( 'uv2', geometry.attributes.uv );
        }
        mesh.material = material;
    };
    GLTFParser.prototype.getMaterialType = function ( /* materialIndex */ ) {
        return THREE.MeshStandardMaterial;
    };
    /**
     * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
     * @param {number} materialIndex
     * @return {Promise<THREE.Material>}
     */
    GLTFParser.prototype.loadMaterial = function ( materialIndex ) {
        var parser = this;
        var json = this.json;
        var extensions = this.extensions;
        var materialDef = json.materials[ materialIndex ];
        var materialType;
        var materialParams = {};
        var materialExtensions = materialDef.extensions || {};
        var pending = [];
        if ( materialExtensions[ EXTENSIONS.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS ] ) {
            var sgExtension = extensions[ EXTENSIONS.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS ];
            materialType = sgExtension.getMaterialType();
            pending.push( sgExtension.extendParams( materialParams, materialDef, parser ) );
        } else if ( materialExtensions[ EXTENSIONS.KHR_MATERIALS_UNLIT ] ) {
            var kmuExtension = extensions[ EXTENSIONS.KHR_MATERIALS_UNLIT ];
            materialType = kmuExtension.getMaterialType();
            pending.push( kmuExtension.extendParams( materialParams, materialDef, parser ) );
        } else {
            // Specification:
            // https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#metallic-roughness-material
            var metallicRoughness = materialDef.pbrMetallicRoughness || {};
            materialParams.color = new THREE.Color( 1.0, 1.0, 1.0 );
            materialParams.opacity = 1.0;
            if ( Array.isArray( metallicRoughness.baseColorFactor ) ) {
                var array = metallicRoughness.baseColorFactor;
                materialParams.color.fromArray( array );
                materialParams.opacity = array[ 3 ];
            }
            if ( metallicRoughness.baseColorTexture !== undefined ) {
                pending.push( parser.assignTexture( materialParams, 'map', metallicRoughness.baseColorTexture ) );
            }
            materialParams.metalness = metallicRoughness.metallicFactor !== undefined ? metallicRoughness.metallicFactor : 1.0;
            materialParams.roughness = metallicRoughness.roughnessFactor !== undefined ? metallicRoughness.roughnessFactor : 1.0;
            if ( metallicRoughness.metallicRoughnessTexture !== undefined ) {
                pending.push( parser.assignTexture( materialParams, 'metalnessMap', metallicRoughness.metallicRoughnessTexture ) );
                pending.push( parser.assignTexture( materialParams, 'roughnessMap', metallicRoughness.metallicRoughnessTexture ) );
            }
            materialType = this._invokeOne( function ( ext ) {
                return ext.getMaterialType && ext.getMaterialType( materialIndex );
            } );
            pending.push( Promise.all( this._invokeAll( function ( ext ) {
                return ext.extendMaterialParams && ext.extendMaterialParams( materialIndex, materialParams );
            } ) ) );
        }
        if ( materialDef.doubleSided === true ) {
            materialParams.side = THREE.DoubleSide;
        }
        var alphaMode = materialDef.alphaMode || ALPHA_MODES.OPAQUE;
        if ( alphaMode === ALPHA_MODES.BLEND ) {
            materialParams.transparent = true;
            // See: https://github.com/mrdoob/three.js/issues/17706
            materialParams.depthWrite = false;
        } else {
            materialParams.transparent = false;
            if ( alphaMode === ALPHA_MODES.MASK ) {
                materialParams.alphaTest = materialDef.alphaCutoff !== undefined ? materialDef.alphaCutoff : 0.5;
            }
        }
        if ( materialDef.normalTexture !== undefined && materialType !== THREE.MeshBasicMaterial ) {
            pending.push( parser.assignTexture( materialParams, 'normalMap', materialDef.normalTexture ) );
            // https://github.com/mrdoob/three.js/issues/11438#issuecomment-507003995
            materialParams.normalScale = new THREE.Vector2( 1, - 1 );
            if ( materialDef.normalTexture.scale !== undefined ) {
                materialParams.normalScale.set( materialDef.normalTexture.scale, - materialDef.normalTexture.scale );
            }
        }
        if ( materialDef.occlusionTexture !== undefined && materialType !== THREE.MeshBasicMaterial ) {
            pending.push( parser.assignTexture( materialParams, 'aoMap', materialDef.occlusionTexture ) );
            if ( materialDef.occlusionTexture.strength !== undefined ) {
                materialParams.aoMapIntensity = materialDef.occlusionTexture.strength;
            }
        }
        if ( materialDef.emissiveFactor !== undefined && materialType !== THREE.MeshBasicMaterial ) {
            materialParams.emissive = new THREE.Color().fromArray( materialDef.emissiveFactor );
        }
        if ( materialDef.emissiveTexture !== undefined && materialType !== THREE.MeshBasicMaterial ) {
            pending.push( parser.assignTexture( materialParams, 'emissiveMap', materialDef.emissiveTexture ) );
        }
        return Promise.all( pending ).then( function () {
            var material;
            if ( materialType === GLTFMeshStandardSGMaterial ) {
                material = extensions[ EXTENSIONS.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS ].createMaterial( materialParams );
            } else {
                material = new materialType( materialParams );
            }
            if ( materialDef.name ) material.name = materialDef.name;
            // baseColorTexture, emissiveTexture, and specularGlossinessTexture use sRGB encoding.
            if ( material.map ) material.map.encoding = THREE.sRGBEncoding;
            if ( material.emissiveMap ) material.emissiveMap.encoding = THREE.sRGBEncoding;
            assignExtrasToUserData( material, materialDef );
            parser.associations.set( material, { type: 'materials', index: materialIndex } );
            if ( materialDef.extensions ) addUnknownExtensionsToUserData( extensions, material, materialDef );
            return material;
        } );
    };
    /** When Object3D instances are targeted by animation, they need unique names. */
    GLTFParser.prototype.createUniqueName = function ( originalName ) {
        var sanitizedName = THREE.PropertyBinding.sanitizeNodeName( originalName || '' );
        var name = sanitizedName;
        for ( var i = 1; this.nodeNamesUsed[ name ]; ++ i ) {
            name = sanitizedName + '_' + i;
        }
        this.nodeNamesUsed[ name ] = true;
        return name;
    };
    /**
     * @param {THREE.BufferGeometry} geometry
     * @param {GLTF.Primitive} primitiveDef
     * @param {GLTFParser} parser
     */
    function computeBounds( geometry, primitiveDef, parser ) {
        var attributes = primitiveDef.attributes;
        var box = new THREE.Box3();
        if ( attributes.POSITION !== undefined ) {
            var accessor = parser.json.accessors[ attributes.POSITION ];
            var min = accessor.min;
            var max = accessor.max;
            // glTF requires 'min' and 'max', but VRM (which extends glTF) currently ignores that requirement.
            if ( min !== undefined && max !== undefined ) {
                box.set(
                    new THREE.Vector3( min[ 0 ], min[ 1 ], min[ 2 ] ),
                    new THREE.Vector3( max[ 0 ], max[ 1 ], max[ 2 ] ) );
            } else {
                console.warn( 'THREE.GLTFLoader: Missing min/max properties for accessor POSITION.' );
                return;
            }
        } else {
            return;
        }
        var targets = primitiveDef.targets;
        if ( targets !== undefined ) {
            var maxDisplacement = new THREE.Vector3();
            var vector = new THREE.Vector3();
            for ( var i = 0, il = targets.length; i < il; i ++ ) {
                var target = targets[ i ];
                if ( target.POSITION !== undefined ) {
                    var accessor = parser.json.accessors[ target.POSITION ];
                    var min = accessor.min;
                    var max = accessor.max;
                    // glTF requires 'min' and 'max', but VRM (which extends glTF) currently ignores that requirement.
                    if ( min !== undefined && max !== undefined ) {
                        // we need to get max of absolute components because target weight is [-1,1]
                        vector.setX( Math.max( Math.abs( min[ 0 ] ), Math.abs( max[ 0 ] ) ) );
                        vector.setY( Math.max( Math.abs( min[ 1 ] ), Math.abs( max[ 1 ] ) ) );
                        vector.setZ( Math.max( Math.abs( min[ 2 ] ), Math.abs( max[ 2 ] ) ) );
                        // Note: this assumes that the sum of all weights is at most 1. This isn't quite correct - it's more conservative
                        // to assume that each target can have a max weight of 1. However, for some use cases - notably, when morph targets
                        // are used to implement key-frame animations and as such only two are active at a time - this results in very large
                        // boxes. So for now we make a box that's sometimes a touch too small but is hopefully mostly of reasonable size.
                        maxDisplacement.max( vector );
                    } else {
                        console.warn( 'THREE.GLTFLoader: Missing min/max properties for accessor POSITION.' );
                    }
                }
            }
            // As per comment above this box isn't conservative, but has a reasonable size for a very large number of morph targets.
            box.expandByVector( maxDisplacement );
        }
        geometry.boundingBox = box;
        var sphere = new THREE.Sphere();
        box.getCenter( sphere.center );
        sphere.radius = box.min.distanceTo( box.max ) / 2;
        geometry.boundingSphere = sphere;
    }
    /**
     * @param {THREE.BufferGeometry} geometry
     * @param {GLTF.Primitive} primitiveDef
     * @param {GLTFParser} parser
     * @return {Promise<THREE.BufferGeometry>}
     */
    function addPrimitiveAttributes( geometry, primitiveDef, parser ) {
        var attributes = primitiveDef.attributes;
        var pending = [];
        function assignAttributeAccessor( accessorIndex, attributeName ) {
            return parser.getDependency( 'accessor', accessorIndex )
                .then( function ( accessor ) {
                    geometry.setAttribute( attributeName, accessor );
                } );
        }
        for ( var gltfAttributeName in attributes ) {
            var threeAttributeName = ATTRIBUTES[ gltfAttributeName ] || gltfAttributeName.toLowerCase();
            // Skip attributes already provided by e.g. Draco extension.
            if ( threeAttributeName in geometry.attributes ) continue;
            pending.push( assignAttributeAccessor( attributes[ gltfAttributeName ], threeAttributeName ) );
        }
        if ( primitiveDef.indices !== undefined && ! geometry.index ) {
            var accessor = parser.getDependency( 'accessor', primitiveDef.indices ).then( function ( accessor ) {
                geometry.setIndex( accessor );
            } );
            pending.push( accessor );
        }
        assignExtrasToUserData( geometry, primitiveDef );
        computeBounds( geometry, primitiveDef, parser );
        return Promise.all( pending ).then( function () {
            return primitiveDef.targets !== undefined
                ? addMorphTargets( geometry, primitiveDef.targets, parser )
                : geometry;
        } );
    }
    /**
     * @param {THREE.BufferGeometry} geometry
     * @param {Number} drawMode
     * @return {THREE.BufferGeometry}
     */
    function toTrianglesDrawMode( geometry, drawMode ) {
        var index = geometry.getIndex();
        // generate index if not present
        if ( index === null ) {
            var indices = [];
            var position = geometry.getAttribute( 'position' );
            if ( position !== undefined ) {
                for ( var i = 0; i < position.count; i ++ ) {
                    indices.push( i );
                }
                geometry.setIndex( indices );
                index = geometry.getIndex();
            } else {
                console.error( 'THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible.' );
                return geometry;
            }
        }
        //
        var numberOfTriangles = index.count - 2;
        var newIndices = [];
        if ( drawMode === THREE.TriangleFanDrawMode ) {
            // gl.TRIANGLE_FAN
            for ( var i = 1; i <= numberOfTriangles; i ++ ) {
                newIndices.push( index.getX( 0 ) );
                newIndices.push( index.getX( i ) );
                newIndices.push( index.getX( i + 1 ) );
            }
        } else {
            // gl.TRIANGLE_STRIP
            for ( var i = 0; i < numberOfTriangles; i ++ ) {
                if ( i % 2 === 0 ) {
                    newIndices.push( index.getX( i ) );
                    newIndices.push( index.getX( i + 1 ) );
                    newIndices.push( index.getX( i + 2 ) );
                } else {
                    newIndices.push( index.getX( i + 2 ) );
                    newIndices.push( index.getX( i + 1 ) );
                    newIndices.push( index.getX( i ) );
                }
            }
        }
        if ( ( newIndices.length / 3 ) !== numberOfTriangles ) {
            console.error( 'THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.' );
        }
        // build final geometry
        var newGeometry = geometry.clone();
        newGeometry.setIndex( newIndices );
        return newGeometry;
    }
    /**
     * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#geometry
     *
     * Creates BufferGeometries from primitives.
     *
     * @param {Array<GLTF.Primitive>} primitives
     * @return {Promise<Array<THREE.BufferGeometry>>}
     */
    GLTFParser.prototype.loadGeometries = function ( primitives ) {
        var parser = this;
        var extensions = this.extensions;
        var cache = this.primitiveCache;
        function createDracoPrimitive( primitive ) {
            return extensions[ EXTENSIONS.KHR_DRACO_MESH_COMPRESSION ]
                .decodePrimitive( primitive, parser )
                .then( function ( geometry ) {
                    return addPrimitiveAttributes( geometry, primitive, parser );
                } );
        }
        var pending = [];
        for ( var i = 0, il = primitives.length; i < il; i ++ ) {
            var primitive = primitives[ i ];
            var cacheKey = createPrimitiveKey( primitive );
            // See if we've already created this geometry
            var cached = cache[ cacheKey ];
            if ( cached ) {
                // Use the cached geometry if it exists
                pending.push( cached.promise );
            } else {
                var geometryPromise;
                if ( primitive.extensions && primitive.extensions[ EXTENSIONS.KHR_DRACO_MESH_COMPRESSION ] ) {
                    // Use DRACO geometry if available
                    geometryPromise = createDracoPrimitive( primitive );
                } else {
                    // Otherwise create a new geometry
                    geometryPromise = addPrimitiveAttributes( new THREE.BufferGeometry(), primitive, parser );
                }
                // Cache this geometry
                cache[ cacheKey ] = { primitive: primitive, promise: geometryPromise };
                pending.push( geometryPromise );
            }
        }
        return Promise.all( pending );
    };
    /**
     * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes
     * @param {number} meshIndex
     * @return {Promise<THREE.Group|THREE.Mesh|THREE.SkinnedMesh>}
     */
    GLTFParser.prototype.loadMesh = function ( meshIndex ) {
        var parser = this;
        var json = this.json;
        var extensions = this.extensions;
        var meshDef = json.meshes[ meshIndex ];
        var primitives = meshDef.primitives;
        var pending = [];
        for ( var i = 0, il = primitives.length; i < il; i ++ ) {
            var material = primitives[ i ].material === undefined
                ? createDefaultMaterial( this.cache )
                : this.getDependency( 'material', primitives[ i ].material );
            pending.push( material );
        }
        pending.push( parser.loadGeometries( primitives ) );
        return Promise.all( pending ).then( function ( results ) {
            var materials = results.slice( 0, results.length - 1 );
            var geometries = results[ results.length - 1 ];
            var meshes = [];
            for ( var i = 0, il = geometries.length; i < il; i ++ ) {
                var geometry = geometries[ i ];
                var primitive = primitives[ i ];
                // 1. create Mesh
                var mesh;
                var material = materials[ i ];
                if ( primitive.mode === WEBGL_CONSTANTS.TRIANGLES ||
                    primitive.mode === WEBGL_CONSTANTS.TRIANGLE_STRIP ||
                    primitive.mode === WEBGL_CONSTANTS.TRIANGLE_FAN ||
                    primitive.mode === undefined ) {
                    // .isSkinnedMesh isn't in glTF spec. See ._markDefs()
                    mesh = meshDef.isSkinnedMesh === true
                        ? new THREE.SkinnedMesh( geometry, material )
                        : new THREE.Mesh( geometry, material );
                    if ( mesh.isSkinnedMesh === true && ! mesh.geometry.attributes.skinWeight.normalized ) {
                        // we normalize floating point skin weight array to fix malformed assets (see #15319)
                        // it's important to skip this for non-float32 data since normalizeSkinWeights assumes non-normalized inputs
                        mesh.normalizeSkinWeights();
                    }
                    if ( primitive.mode === WEBGL_CONSTANTS.TRIANGLE_STRIP ) {
                        mesh.geometry = toTrianglesDrawMode( mesh.geometry, THREE.TriangleStripDrawMode );
                    } else if ( primitive.mode === WEBGL_CONSTANTS.TRIANGLE_FAN ) {
                        mesh.geometry = toTrianglesDrawMode( mesh.geometry, THREE.TriangleFanDrawMode );
                    }
                } else if ( primitive.mode === WEBGL_CONSTANTS.LINES ) {
                    mesh = new THREE.LineSegments( geometry, material );
                } else if ( primitive.mode === WEBGL_CONSTANTS.LINE_STRIP ) {
                    mesh = new THREE.Line( geometry, material );
                } else if ( primitive.mode === WEBGL_CONSTANTS.LINE_LOOP ) {
                    mesh = new THREE.LineLoop( geometry, material );
                } else if ( primitive.mode === WEBGL_CONSTANTS.POINTS ) {
                    mesh = new THREE.Points( geometry, material );
                } else {
                    throw new Error( 'THREE.GLTFLoader: Primitive mode unsupported: ' + primitive.mode );
                }
                if ( Object.keys( mesh.geometry.morphAttributes ).length > 0 ) {
                    updateMorphTargets( mesh, meshDef );
                }
                mesh.name = parser.createUniqueName( meshDef.name || ( 'mesh_' + meshIndex ) );
                assignExtrasToUserData( mesh, meshDef );
                if ( primitive.extensions ) addUnknownExtensionsToUserData( extensions, mesh, primitive );
                parser.assignFinalMaterial( mesh );
                meshes.push( mesh );
            }
            if ( meshes.length === 1 ) {
                return meshes[ 0 ];
            }
            var group = new THREE.Group();
            for ( var i = 0, il = meshes.length; i < il; i ++ ) {
                group.add( meshes[ i ] );
            }
            return group;
        } );
    };
    /**
     * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras
     * @param {number} cameraIndex
     * @return {Promise<THREE.Camera>}
     */
    GLTFParser.prototype.loadCamera = function ( cameraIndex ) {
        var camera;
        var cameraDef = this.json.cameras[ cameraIndex ];
        var params = cameraDef[ cameraDef.type ];
        if ( ! params ) {
            console.warn( 'THREE.GLTFLoader: Missing camera parameters.' );
            return;
        }
        if ( cameraDef.type === 'perspective' ) {
            camera = new THREE.PerspectiveCamera( THREE.MathUtils.radToDeg( params.yfov ), params.aspectRatio || 1, params.znear || 1, params.zfar || 2e6 );
        } else if ( cameraDef.type === 'orthographic' ) {
            camera = new THREE.OrthographicCamera( - params.xmag, params.xmag, params.ymag, - params.ymag, params.znear, params.zfar );
        }
        if ( cameraDef.name ) camera.name = this.createUniqueName( cameraDef.name );
        assignExtrasToUserData( camera, cameraDef );
        return Promise.resolve( camera );
    };
    /**
     * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
     * @param {number} skinIndex
     * @return {Promise<Object>}
     */
    GLTFParser.prototype.loadSkin = function ( skinIndex ) {
        var skinDef = this.json.skins[ skinIndex ];
        var skinEntry = { joints: skinDef.joints };
        if ( skinDef.inverseBindMatrices === undefined ) {
            return Promise.resolve( skinEntry );
        }
        return this.getDependency( 'accessor', skinDef.inverseBindMatrices ).then( function ( accessor ) {
            skinEntry.inverseBindMatrices = accessor;
            return skinEntry;
        } );
    };
    /**
     * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations
     * @param {number} animationIndex
     * @return {Promise<THREE.AnimationClip>}
     */
    GLTFParser.prototype.loadAnimation = function ( animationIndex ) {
        var json = this.json;
        var animationDef = json.animations[ animationIndex ];
        var pendingNodes = [];
        var pendingInputAccessors = [];
        var pendingOutputAccessors = [];
        var pendingSamplers = [];
        var pendingTargets = [];
        for ( var i = 0, il = animationDef.channels.length; i < il; i ++ ) {
            var channel = animationDef.channels[ i ];
            var sampler = animationDef.samplers[ channel.sampler ];
            var target = channel.target;
            var name = target.node !== undefined ? target.node : target.id; // NOTE: target.id is deprecated.
            var input = animationDef.parameters !== undefined ? animationDef.parameters[ sampler.input ] : sampler.input;
            var output = animationDef.parameters !== undefined ? animationDef.parameters[ sampler.output ] : sampler.output;
            pendingNodes.push( this.getDependency( 'node', name ) );
            pendingInputAccessors.push( this.getDependency( 'accessor', input ) );
            pendingOutputAccessors.push( this.getDependency( 'accessor', output ) );
            pendingSamplers.push( sampler );
            pendingTargets.push( target );
        }
        return Promise.all( [
            Promise.all( pendingNodes ),
            Promise.all( pendingInputAccessors ),
            Promise.all( pendingOutputAccessors ),
            Promise.all( pendingSamplers ),
            Promise.all( pendingTargets )
        ] ).then( function ( dependencies ) {
            var nodes = dependencies[ 0 ];
            var inputAccessors = dependencies[ 1 ];
            var outputAccessors = dependencies[ 2 ];
            var samplers = dependencies[ 3 ];
            var targets = dependencies[ 4 ];
            var tracks = [];
            for ( var i = 0, il = nodes.length; i < il; i ++ ) {
                var node = nodes[ i ];
                var inputAccessor = inputAccessors[ i ];
                var outputAccessor = outputAccessors[ i ];
                var sampler = samplers[ i ];
                var target = targets[ i ];
                if ( node === undefined ) continue;
                node.updateMatrix();
                node.matrixAutoUpdate = true;
                var TypedKeyframeTrack;
                switch ( PATH_PROPERTIES[ target.path ] ) {
                    case PATH_PROPERTIES.weights:
                        TypedKeyframeTrack = THREE.NumberKeyframeTrack;
                        break;
                    case PATH_PROPERTIES.rotation:
                        TypedKeyframeTrack = THREE.QuaternionKeyframeTrack;
                        break;
                    case PATH_PROPERTIES.position:
                    case PATH_PROPERTIES.scale:
                    default:
                        TypedKeyframeTrack = THREE.VectorKeyframeTrack;
                        break;
                }
                var targetName = node.name ? node.name : node.uuid;
                var interpolation = sampler.interpolation !== undefined ? INTERPOLATION[ sampler.interpolation ] : THREE.InterpolateLinear;
                var targetNames = [];
                if ( PATH_PROPERTIES[ target.path ] === PATH_PROPERTIES.weights ) {
                    // Node may be a THREE.Group (glTF mesh with several primitives) or a THREE.Mesh.
                    node.traverse( function ( object ) {
                        if ( object.isMesh === true && object.morphTargetInfluences ) {
                            targetNames.push( object.name ? object.name : object.uuid );
                        }
                    } );
                } else {
                    targetNames.push( targetName );
                }
                var outputArray = outputAccessor.array;
                if ( outputAccessor.normalized ) {
                    var scale;
                    if ( outputArray.constructor === Int8Array ) {
                        scale = 1 / 127;
                    } else if ( outputArray.constructor === Uint8Array ) {
                        scale = 1 / 255;
                    } else if ( outputArray.constructor == Int16Array ) {
                        scale = 1 / 32767;
                    } else if ( outputArray.constructor === Uint16Array ) {
                        scale = 1 / 65535;
                    } else {
                        throw new Error( 'THREE.GLTFLoader: Unsupported output accessor component type.' );
                    }
                    var scaled = new Float32Array( outputArray.length );
                    for ( var j = 0, jl = outputArray.length; j < jl; j ++ ) {
                        scaled[ j ] = outputArray[ j ] * scale;
                    }
                    outputArray = scaled;
                }
                for ( var j = 0, jl = targetNames.length; j < jl; j ++ ) {
                    var track = new TypedKeyframeTrack(
                        targetNames[ j ] + '.' + PATH_PROPERTIES[ target.path ],
                        inputAccessor.array,
                        outputArray,
                        interpolation
                    );
                    // Override interpolation with custom factory method.
                    if ( sampler.interpolation === 'CUBICSPLINE' ) {
                        track.createInterpolant = function InterpolantFactoryMethodGLTFCubicSpline( result ) {
                            // A CUBICSPLINE keyframe in glTF has three output values for each input value,
                            // representing inTangent, splineVertex, and outTangent. As a result, track.getValueSize()
                            // must be divided by three to get the interpolant's sampleSize argument.
                            return new GLTFCubicSplineInterpolant( this.times, this.values, this.getValueSize() / 3, result );
                        };
                        // Mark as CUBICSPLINE. `track.getInterpolation()` doesn't support custom interpolants.
                        track.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = true;
                    }
                    tracks.push( track );
                }
            }
            var name = animationDef.name ? animationDef.name : 'animation_' + animationIndex;
            return new THREE.AnimationClip( name, undefined, tracks );
        } );
    };
    /**
     * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#nodes-and-hierarchy
     * @param {number} nodeIndex
     * @return {Promise<THREE.Object3D>}
     */
    GLTFParser.prototype.loadNode = function ( nodeIndex ) {
        var json = this.json;
        var extensions = this.extensions;
        var parser = this;
        var nodeDef = json.nodes[ nodeIndex ];
        // reserve node's name before its dependencies, so the root has the intended name.
        var nodeName = nodeDef.name ? parser.createUniqueName( nodeDef.name ) : '';
        return ( function () {
            var pending = [];
            if ( nodeDef.mesh !== undefined ) {
                pending.push( parser.getDependency( 'mesh', nodeDef.mesh ).then( function ( mesh ) {
                    var node = parser._getNodeRef( parser.meshCache, nodeDef.mesh, mesh );
                    // if weights are provided on the node, override weights on the mesh.
                    if ( nodeDef.weights !== undefined ) {
                        node.traverse( function ( o ) {
                            if ( ! o.isMesh ) return;
                            for ( var i = 0, il = nodeDef.weights.length; i < il; i ++ ) {
                                o.morphTargetInfluences[ i ] = nodeDef.weights[ i ];
                            }
                        } );
                    }
                    return node;
                } ) );
            }
            if ( nodeDef.camera !== undefined ) {
                pending.push( parser.getDependency( 'camera', nodeDef.camera ).then( function ( camera ) {
                    return parser._getNodeRef( parser.cameraCache, nodeDef.camera, camera );
                } ) );
            }
            parser._invokeAll( function ( ext ) {
                return ext.createNodeAttachment && ext.createNodeAttachment( nodeIndex );
            } ).forEach( function ( promise ) {
                pending.push( promise );
            } );
            return Promise.all( pending );
        }() ).then( function ( objects ) {
            var node;
            // .isBone isn't in glTF spec. See ._markDefs
            if ( nodeDef.isBone === true ) {
                node = new THREE.Bone();
            } else if ( objects.length > 1 ) {
                node = new THREE.Group();
            } else if ( objects.length === 1 ) {
                node = objects[ 0 ];
            } else {
                node = new THREE.Object3D();
            }
            if ( node !== objects[ 0 ] ) {
                for ( var i = 0, il = objects.length; i < il; i ++ ) {
                    node.add( objects[ i ] );
                }
            }
            if ( nodeDef.name ) {
                node.userData.name = nodeDef.name;
                node.name = nodeName;
            }
            assignExtrasToUserData( node, nodeDef );
            if ( nodeDef.extensions ) addUnknownExtensionsToUserData( extensions, node, nodeDef );
            if ( nodeDef.matrix !== undefined ) {
                var matrix = new THREE.Matrix4();
                matrix.fromArray( nodeDef.matrix );
                node.applyMatrix4( matrix );
            } else {
                if ( nodeDef.translation !== undefined ) {
                    node.position.fromArray( nodeDef.translation );
                }
                if ( nodeDef.rotation !== undefined ) {
                    node.quaternion.fromArray( nodeDef.rotation );
                }
                if ( nodeDef.scale !== undefined ) {
                    node.scale.fromArray( nodeDef.scale );
                }
            }
            parser.associations.set( node, { type: 'nodes', index: nodeIndex } );
            return node;
        } );
    };
    /**
     * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes
     * @param {number} sceneIndex
     * @return {Promise<THREE.Group>}
     */
    GLTFParser.prototype.loadScene = function () {
        // scene node hierachy builder
        function buildNodeHierachy( nodeId, parentObject, json, parser ) {
            var nodeDef = json.nodes[ nodeId ];
            return parser.getDependency( 'node', nodeId ).then( function ( node ) {
                if ( nodeDef.skin === undefined ) return node;
                // build skeleton here as well
                var skinEntry;
                return parser.getDependency( 'skin', nodeDef.skin ).then( function ( skin ) {
                    skinEntry = skin;
                    var pendingJoints = [];
                    for ( var i = 0, il = skinEntry.joints.length; i < il; i ++ ) {
                        pendingJoints.push( parser.getDependency( 'node', skinEntry.joints[ i ] ) );
                    }
                    return Promise.all( pendingJoints );
                } ).then( function ( jointNodes ) {
                    node.traverse( function ( mesh ) {
                        if ( ! mesh.isMesh ) return;
                        var bones = [];
                        var boneInverses = [];
                        for ( var j = 0, jl = jointNodes.length; j < jl; j ++ ) {
                            var jointNode = jointNodes[ j ];
                            if ( jointNode ) {
                                bones.push( jointNode );
                                var mat = new THREE.Matrix4();
                                if ( skinEntry.inverseBindMatrices !== undefined ) {
                                    mat.fromArray( skinEntry.inverseBindMatrices.array, j * 16 );
                                }
                                boneInverses.push( mat );
                            } else {
                                console.warn( 'THREE.GLTFLoader: Joint "%s" could not be found.', skinEntry.joints[ j ] );
                            }
                        }
                        mesh.bind( new THREE.Skeleton( bones, boneInverses ), mesh.matrixWorld );
                    } );
                    return node;
                } );
            } ).then( function ( node ) {
                // build node hierachy
                parentObject.add( node );
                var pending = [];
                if ( nodeDef.children ) {
                    var children = nodeDef.children;
                    for ( var i = 0, il = children.length; i < il; i ++ ) {
                        var child = children[ i ];
                        pending.push( buildNodeHierachy( child, node, json, parser ) );
                    }
                }
                return Promise.all( pending );
            } );
        }
        return function loadScene( sceneIndex ) {
            var json = this.json;
            var extensions = this.extensions;
            var sceneDef = this.json.scenes[ sceneIndex ];
            var parser = this;
            // Loader returns Group, not Scene.
            // See: https://github.com/mrdoob/three.js/issues/18342#issuecomment-578981172
            var scene = new THREE.Group();
            if ( sceneDef.name ) scene.name = parser.createUniqueName( sceneDef.name );
            assignExtrasToUserData( scene, sceneDef );
            if ( sceneDef.extensions ) addUnknownExtensionsToUserData( extensions, scene, sceneDef );
            var nodeIds = sceneDef.nodes || [];
            var pending = [];
            for ( var i = 0, il = nodeIds.length; i < il; i ++ ) {
                pending.push( buildNodeHierachy( nodeIds[ i ], scene, json, parser ) );
            }
            return Promise.all( pending ).then( function () {
                return scene;
            } );
        };
    }();
    return GLTFLoader;
} )();
ManagementOKTravel/guns-admin/src/main/webapp/static/js/track3.js
New file
@@ -0,0 +1,16 @@
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports,require("three")):"function"==typeof define&&define.amd?define(["exports","three"],i):i((t="undefined"!=typeof globalThis?globalThis:t||self).Track={},t.THREE)}(this,(function(t,i){"use strict";function s(t){var i=Object.create(null);return t&&Object.keys(t).forEach((function(s){if("default"!==s){var e=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(i,s,e.get?e:{enumerable:!0,get:function(){return t[s]}})}})),i.default=t,Object.freeze(i)}var e=s(i);class h{constructor(t){this.t=null!=t?t:h.guid()}getHandlers(t){let i=this.i||(this.i=new Map);return i.has(t)||i.set(t,new Map),i.get(t)}on(t,i){"function"==typeof i&&this.getHandlers(t).set(i,h.guid())}addEventListener(t,i){this.on(t,i)}off(t,i){var s;let e=this.getHandlers(t);i?e.has(i)&&e.delete(i):null===(s=this.i)||void 0===s||s.clear()}removeEventListener(t,i){this.off(t,i)}fire(t,i){let s=Array.from(this.getHandlers(t).entries());for(let t=0;t<s.length;t++)s[t][0].call(this,i)}dispatchEvent(t,i){this.fire(t,i)}destroy(){var t;null===(t=this.i)||void 0===t||t.clear(),this.i=null}get hashCode(){return this.t}static guid(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){let i=16*Math.random()|0;return("x"==t?i:3&i|8).toString(16)}))}}
    /******************************************************************************
     Copyright (c) Microsoft Corporation.
     Permission to use, copy, modify, and/or distribute this software for any
     purpose with or without fee is hereby granted.
     THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
     REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
     AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
     INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
     LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
     OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
     PERFORMANCE OF THIS SOFTWARE.
     ***************************************************************************** */
    /* global Reflect, Promise, SuppressedError, Symbol */function r(t,i,s,e){var h,r=arguments.length,n=r<3?i:null===e?e=Object.getOwnPropertyDescriptor(i,s):e;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,i,s,e);else for(var o=t.length-1;o>=0;o--)(h=t[o])&&(n=(r<3?h(n):r>3?h(i,s,n):h(i,s))||n);return r>3&&n&&Object.defineProperty(i,s,n),n}function n(t){const i=new Map;return class extends t{constructor(...s){const e=i.get(t);if(e)return e;const h=super(...s);return i.set(t,h),h}}}"function"==typeof SuppressedError&&SuppressedError;let o=class{constructor(t){this.animationId=null,this.isAnimating=!0,this.AFFMap={},this.timestamp=0,this.rAFLoop=t=>{this.animationId=requestAnimationFrame(this.rAFLoop);let i=t-this.timestamp;if(this.timestamp=t,this.frameFn&&this.frameFn(),this.isAnimating)for(const t in this.AFFMap)this.AFFMap[t](i)},this.frameFn=t,this.rAFLoop(0)}setFrameFn(t){this.frameFn=t}addAnimationFrameFunc(t,i){this.AFFMap[t]=i,i(0)}removeAnimationFrameFunc(t){delete this.AFFMap[t]}destroyed(){this.animationId&&cancelAnimationFrame(this.animationId)}start(){this.isAnimating||(this.isAnimating=!0)}pause(){this.isAnimating&&(this.isAnimating=!1)}resume(){this.isAnimating||(this.isAnimating=!0)}stop(){this.pause()}};o=r([n],o);var a=o;function l(t,i){return Math.sqrt(Math.pow(i[0]-t[0],2)+Math.pow(i[1]-t[1],2))}function u(t,i){let[s,e]=t,[h,r]=i;const n=h-s,o=r-e,a=Math.sqrt(n*n+o*o);if(0===a)return 0;const l=n/a,u=o/a;let c=Math.atan2(u,l)*(180/Math.PI);return c=90-c,c<0&&(c+=360),c}function c(t,i,s){let[e,h]=t,[r,n]=i,[o,a]=s,l=o-r,u=a-n,c=((e-r)*l+(h-n)*u)/(l*l+u*u);return c=Math.max(0,Math.min(1,c)),[r+c*l,n+c*u]}function d(t,i){const s=t.toLowerCase();for(const t of i)if(s.includes(t))return!0;return!1}function p(){var t=(new Date).getTime();return"xxxyxxxy".replace(/[xy]/g,(function(i){var s=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==i?s:3&s|8).toString(16)}))}const v=(t,i,s,e,h)=>{const r=3*(i.x-t.x),n=3*(s.x-i.x)-r,o=e.x-t.x-r-n,a=3*(i.y-t.y),l=3*(s.y-i.y)-a,u=e.y-t.y-a-l;return{x:((o*h+n)*h+r)*h+t.x,y:((u*h+l)*h+a)*h+t.y}};function f(t){return t<=0?-t:360-t}function m(t){let i=t%360;return Math.abs(i)>180&&(i%=180,i>0?i-=180:i+=180),i}function g(t,i){return i=m(i),t=m(t),m(t-i)}function M(t,i=10){const s=t.toFixed(i);return parseFloat(s)}let x=class extends h{constructor(){super()}getMap(){return this.map}getMapPixelDistance(t,i){if(!this.map)return 0;const s=this.map.pointToPixel(t),e=this.map.pointToPixel(i);return Math.sqrt(Math.pow(s.x-e.x,2)+Math.pow(s.y-e.y,2))}getLinearPoints(t,i,s){if(!this.map||s<1)return[];let e=this.map.lnglatToMercator(t.lng,t.lat),h=this.map.lnglatToMercator(i.lng,i.lat);const r=(h[0]-e[0])/s,n=(h[1]-e[1])/s,o=[];for(let t=1;t<=s;t++){const i=e[0]+t*r,s=e[1]+t*n;let h=this.map.mercatorToLnglat(i,s);o.push(new BMapGL.Point(h[0],h[1]))}return o.push(i),o}getLinearAngles(t,i,s){let e=i/s,h=[];for(let i=1;i<=s;i++){const s=m(t+i*e);h.push(s)}return h}lnglatToMercator(t){return this.map?this.map.lnglatToMercator(t.lng,t.lat):null}drawOnce(){var t;null===(t=this.map)||void 0===t||t._drawFrame()}setMap(t){this.map=t,this.fire("mapReady",{map:t}),t.on("click",(i=>{this.fire("click",{e:i,map:t})})),t.on("movestart",(i=>{this.fire("movestart",{e:i,map:t})})),t.on("moveend",(i=>{this.fire("moveend",{e:i,map:t})})),t.on("zoomstart",(i=>{this.fire("zoomstart",{e:i,map:t})})),t.on("zoomend",(i=>{this.fire("zoomend",{e:i,map:t})})),t.on("onmapstatusidle_inner",(i=>{this.fire("onmapstatusidle_inner",{e:i,map:t})})),t.on("zoom_changed",(i=>{this.fire("zoom_changed",{e:i,map:t})})),t.on("moving",(i=>{this.fire("moving",{e:i,map:t})}))}};x=r([n],x);const y=new x;var w,k,L,P,T,_;t.StatusCodes=void 0,(w=t.StatusCodes||(t.StatusCodes={}))[w.INIT=0]="INIT",w[w.PLAY=1]="PLAY",w[w.PAUSE=2]="PAUSE",w[w.STOP=3]="STOP",w[w.FINISH=4]="FINISH",t.MapCodes=void 0,(k=t.MapCodes||(t.MapCodes={})).ADD_TO_MAP="addtomap",k.REMOVE_FROM_MAP="removefrommap",k.CLICK="click",k.MOUSE_OVER="mouseover",k.MOUSE_OUT="mouseout",t.LineCodes=void 0,(L=t.LineCodes||(t.LineCodes={})).STATUS="status",L.PROCESS="process",L.GUIDE_STATUS="guideChange",t.PointCodes=void 0,(P=t.PointCodes||(t.PointCodes={})).SET_TRACK_POINT="moveTo",P.CHANGE_POINT="pointChange",P.CHANGE_ROTATION="rotationChange",t.GuidCodes=void 0,(T=t.GuidCodes||(t.GuidCodes={})).ADD_TO_MAP="added",T.REMOVE_FROM_MAP="removed",T.IDLE="idle",t.ViewCodes=void 0,(_=t.ViewCodes||(t.ViewCodes={})).UPDATE_FEATURE="updateFeature",_.UPDATE_RENDER="updateRender",_.UPDATE_TRACK_POINT="trackPointChange";class b extends h{constructor(t,i){var s;super(),this.type="roadLine",this.h=[],this.o=[],this.trace=0,this.l=!1,this.duration=0,this.properties={},this.u=0,this.p=!1,this.v=!0,this.type=t,this.style=i.style||{},this.linearTexture=i.linearTexture||[],this.o=i.gradientColor||[],this.rank=i.rank||0,this.v=null===(s=i.visible)||void 0===s||s,this.properties=i.properties||{},this.m()}get visible(){return this.v}set visible(t){this.v=t,this.M()}setMovePoint(t){let i=y.getMap();this.k&&(i?this.k.removeFromMap(i):this.k.isDestroyed=!0),this.k=t,this.k.isDestroyed=!1,i?t.addToMap(i,!(!this.duration||"livetrack"!==this.type)):y.on("mapReady",(()=>{!this.k.isDestroyed&&t.addToMap(y.getMap(),!(!this.duration||"livetrack"!==this.type))}))}addTrackPoint(t,i){this.h.push(t),i?this.L(t.getPoint()):this.P(t.getPoint())}getTrackPoints(){return this.h}getPoints(){return this.h.map((t=>t.getPoint()))}getBBox(){return this.h.length?this.h.reduce(((t,i)=>{let s=t[0],e=t[1],h=t[2],r=t[3];return s>i.getPoint().lng&&(s=i.getPoint().lng),e>i.getPoint().lat&&(e=i.getPoint().lat),h<i.getPoint().lng&&(h=i.getPoint().lng),r<i.getPoint().lat&&(r=i.getPoint().lat),[s,e,h,r]}),[180,90,-180,-90]):null}getDistance(){let t=0;for(let i=0;i<this.h.length-1;i++){let s=this.h[i],e=this.h[i+1],h=s.getPointMC(),r=e.getPointMC();t+=l([h.lng,h.lat],[r.lng,r.lat])}return t}P(t){this.T.geometry.coordinates.push([t.lng,t.lat]),this.M(t)}L(t){let i=this.T.geometry;i.coordinates[i.coordinates.length-1]=[t.lng,t.lat],this.M(t)}_(){let t=this.T.geometry;t.coordinates=[];for(let i of this.h)t.coordinates.push([i.getPoint().lng,i.getPoint().lat]);this.owner&&this.M()}clearTrackPoint(){this.h=[],this.T.geometry.coordinates=[],this.M()}m(){let t={type:"Feature",geometry:{type:"LineString",coordinates:[]},properties:this.properties};this.T=this.C(t)}M(i){var s;"livetrack"===this.type&&this.G(i),null===(s=this.owner)||void 0===s||s.dispatchEvent(t.ViewCodes.UPDATE_FEATURE,{uuid:this.uuid,styleCode:this.B,F:this.F})}A(){var i;null===(i=this.owner)||void 0===i||i.dispatchEvent(t.ViewCodes.UPDATE_RENDER,{uuid:this.uuid,styleCode:this.B,F:this.F})}O(i,s){var e;null===(e=this.owner)||void 0===e||e.dispatchEvent(t.ViewCodes.UPDATE_TRACK_POINT,{uuid:this.uuid,point:i,angle:this.p?void 0:s,timeSpan:this.duration?0:1})}D(t){this.owner=t}S(){}setProperty(t){this.properties=t,this.T.properties=Object.assign(this.properties,{uuid:this.uuid}),this._()}getProperty(){return this.properties}setGradientColors(t){this.o=t,this.M()}setGradientColor(t){this.o.push(t),this.M()}getGradientColors(){return this.o}C(t){let i=p();return this.uuid=i,t.properties?t.properties.uuid=i:t.properties={uuid:i},t}getFeature(){return this.T}getRotation(t,i){var s,e;let h=0;if(this.h.length>=0&&this.h.length>=t+1){let r=this.h[t];if(void 0!==r.getRotation()&&void 0===i)h=r.getRotation();else if(i){let t=r.getPointMCArray(),e=i.getPointMCArray();h=t[0]===e[0]&&t[1]===e[1]?null!==(s=r.getRotation())&&void 0!==s?s:0:u(t,e)}else if(t-1>=0){let i=this.h[t-1],s=i.getPointMCArray(),n=r.getPointMCArray();h=s[0]===n[0]&&s[1]===n[1]?null!==(e=i.getRotation())&&void 0!==e?e:0:u(s,n)}}return h}getUUID(){return this.uuid}}class C extends b{constructor(i){var s;(i=i||{}).rank=null!==(s=i.rank)&&void 0!==s?s:1,super("localtrack",i),this.elapsed=0,this.isAnimating=!1,this.distance=-1,this.j=[],this.I=t.StatusCodes.INIT,this.R=0,this.h=i.trackPath||[],this.speedMode=i.speedMode||1,this.duration=i.duration||60,this.l=!0,this._(),this.initAnimation(),this.N=this.N.bind(this),this.U=this.V.bind(this)()}set status(i){this.I=i,this.fire(t.LineCodes.STATUS,this.I)}get status(){return this.I}set process(i){this.R=i,this.fire(t.LineCodes.PROCESS,this.R)}get process(){return this.R}initAnimation(){for(let t=0;t<this.h.length-1;t++){let i=this.h[t],s=this.h[t+1];i.timeStamp&&s.timeStamp||(this.speedMode=0)}this.distance=this.getDistance();let t=this.h[0],i=this.h[this.h.length-1];this.animationVelocity=this.distance/this.duration,t.timeStamp&&i.timeStamp&&(this.realTime=i.timeStamp-t.timeStamp,this.realVelocity=this.distance/this.realTime);for(let t=0;t<this.h.length-1;t++){let i=this.h[t],s=this.h[t+1],e=i.getPointMC(),h=s.getPointMC(),r=l([e.lng,e.lat],[h.lng,h.lat]),n=0;if(n=0!==r||0===t?u([e.lng,e.lat],[h.lng,h.lat]):this.j[this.j.length-1].angle,this.speedMode&&i.timeStamp&&s.timeStamp){let e=s.timeStamp-i.timeStamp,h=r/e,o=e/this.realTime*this.duration,a=r/o;this.j[t]={distance:r,realTime:e,realVelocity:h,duration:o,animationVelocity:a,angle:n}}else{let i=r/this.distance*this.duration,s=this.distance/this.duration;this.j[t]={distance:r,duration:i,animationVelocity:s,angle:n}}}}N(i){if(this.isAnimating){const s=i/1e3+this.elapsed,e=Math.min(s/this.duration,1);this.elapsed=s,this.process=e,e<1?this.q(s):(this.trace<this.distance&&this.q(this.duration),this.isAnimating=!1,this.process=1,this.status!==t.StatusCodes.FINISH&&this.H(this.trace+100),setTimeout((()=>{this.status=t.StatusCodes.FINISH}),600))}}startAnimation(){this.isAnimating||(this.isAnimating=!0,this.status=t.StatusCodes.PLAY)}pauseAnimation(){this.isAnimating&&(this.isAnimating=!1,this.status=t.StatusCodes.PAUSE)}resumeAnimation(){this.isAnimating||(this.isAnimating=!0,this.status=t.StatusCodes.PLAY)}stopAnimation(){this.q(0),this.pauseAnimation(),this.elapsed=0,this.status=t.StatusCodes.STOP}q(t){var i,s,e;let h=this.U(null!=t?t:this.elapsed);if(h){this.H(h.trace);let t=BMapGL.Projection.convertMC2LL(new BMapGL.Point(h.point[0],h.point[1]));(null===(i=this.owner)||void 0===i?void 0:i.W)===this.uuid&&this.O(t,h.linearAngle),null===(s=this.k)||void 0===s||s.setPoint(t),null===(e=this.k)||void 0===e||e.setRotation(h.angle)}}H(i){this.trace=i,this.A(),this.isAnimating||(i>=this.distance?setTimeout((()=>{this.status=t.StatusCodes.FINISH}),600):this.status=0===i?t.StatusCodes.INIT:t.StatusCodes.PLAY,this.process=Math.max(Math.round(i/this.distance*100)/100,1))}Z(t,i){let s=0;for(let i=0;i<t;i++)s+=this.j[i].distance;this.H(s+i)}resetTrackPath(t){let i=this.isAnimating;i?this.stopAnimation():this.elapsed=0,t&&(this.h=t,this._(),this.initAnimation()),this.q(0),i&&this.startAnimation()}setElapsed(t){this.elapsed=t,this.q(this.elapsed)}setProcess(t){t=Math.min(Math.max(t,0),1),this.setElapsed(t*this.duration)}getInfoByProcess(t){let i=(t=Math.min(Math.max(t,0),1))*this.duration,s=this.J(i);return s?{point:BMapGL.Projection.convertMC2LL(new BMapGL.Point(s.point[0],s.point[1])),trace:s.trace,elapsed:s.time,angle:s.angle}:null}setMovePoint(t){super.setMovePoint(t),this.h.length>0&&isNaN(this.k.getRotation())&&(this.k.setPoint(this.h[0].getPoint()),this.k.setRotation(this.getStepInfoByIndex(0).angle))}getStepInfoByIndex(t){return this.j[t]}V(){let t=0,i=0,s=0;return e=>{e<t&&(t=0,i=0,s=0);let h=this.J(e,s,t,i);return h&&(t=h.time,i=h.distance,s=h.index),h}}J(t,i=0,s=0,e=0){let h=s,r=e;for(let s=i;s<this.h.length-1;s++){let i=this.j[s].duration;if(h<=t&&t<=M(h+i)){let e=t-h,n=this.h[s].getPointMC(),o=this.j[s],a=o.animationVelocity*e,l=a*Math.sin(o.angle/180*Math.PI),u=a*Math.cos(o.angle/180*Math.PI),c=[n.lng+l,n.lat+u],d=m(o.angle);if(s-1>=0){let t=this.j[s-1].angle;this.p&&(t=f(y.getMap().getHeading())+this.owner.getCruiseOptions().cruiseLookAt);let h=g(o.angle,t);Math.abs(h)>=this.owner.getCruiseOptions().minRotation?(this.p=!1,d=m(t+h*(e/i))):(this.p=!0,d=t)}return{index:s,time:h,point:c,trace:r+a,angle:o.angle,linearAngle:d,distance:r}}h+=i,r+=this.j[s].distance}return null}matchTrackPoint(t,i){let s=1/0;if(this.h.length<2)return{index:0,matchPoint:null,matchDist:s,segmentDist:0};let e=this.h[0].getPointMCArray(),h=-1;for(let r=t;r<this.h.length-1;r++){let t=c(i,this.h[r].getPointMCArray(),this.h[r+1].getPointMCArray()),n=l(t,i);n<s&&(s=n,e=t,h=r)}return{index:h,matchPoint:e,matchDist:s,segmentDist:l(e,this.h[h].getPointMCArray())}}}class G{constructor(t,i){this.Y=t,this.X=i,this.K()}K(){var t,i;this.rotation=null===(t=this.X)||void 0===t?void 0:t.rotation,this.timeStamp=null===(i=this.X)||void 0===i?void 0:i.timeStamp}getPoint(){return this.Y}setPoint(t){this.Y=t}getPointMC(){return BMapGL.Projection.convertLL2MC(this.Y)}getPointMCArray(){let t=BMapGL.Projection.convertLL2MC(this.Y);return[t.lng,t.lat]}getRotation(){return this.rotation}setRotation(t){this.rotation=t}getTimeStamp(){return this.timeStamp}getOptions(t){return t?this.X[t]:this.X}serialize(){return{type:"TrackPoint",point:{lat:this.getPoint().lat,lng:this.getPoint().lng},options:Object.assign({},this.X)}}static deserialize(t){if("TrackPoint"===t.type){let i=new BMapGL.Point(t.point.lng,t.point.lat),s=t.options;return new G(i,s)}}clone(){return new G(new BMapGL.Point(this.Y.lng,this.Y.lat),Object.assign({},this.X))}}class B extends b{constructor(i){var s;(i=i||{}).rank=null!==(s=i.rank)&&void 0!==s?s:2,super("livetrack",i),this.$=[],this.tt=null,this.it=!0,this.st=t.GuidCodes.IDLE,this.guidStyle=i.guideStyle||{},this.guidProperty=i.guidProperty||{},this.minMatchDist=i.minMatchDist||10,this.duration=i.duration||0,this.duration&&(this.l=!0),this.N=this.N.bind(this)}get guidTrackStatus(){return this.st}set guidTrackStatus(i){this.st=i,this.dispatchEvent(t.LineCodes.GUIDE_STATUS,{status:this.st})}D(i){super.D(i),this.guidTrackStatus===t.GuidCodes.IDLE&&this.guidTrack&&(this.owner.addTrackLine(this.guidTrack),this.guidTrackStatus=t.GuidCodes.ADD_TO_MAP)}S(){var i;this.guidTrackStatus===t.GuidCodes.ADD_TO_MAP&&(null===(i=this.owner)||void 0===i||i.removeTrackLine(this.guidTrack),this.guidTrackStatus=t.GuidCodes.REMOVE_FROM_MAP),super.S()}setGuidTrackPath(i){this.guidTrack?this.guidTrack.resetTrackPath(i):(this.guidTrack=new C({trackPath:i,linearTexture:this.guidStyle.linearTexture,style:this.guidStyle.style,gradientColor:this.guidStyle.gradientColor,properties:this.guidProperty}),this.owner&&(this.owner.addTrackLine(this.guidTrack),this.guidTrackStatus=t.GuidCodes.ADD_TO_MAP)),this.guidIndex=0}getGuidTrack(){return this.guidTrack}clearTrackPoint(){var t;super.clearTrackPoint(),this.guidIndex=0,null===(t=this.guidTrack)||void 0===t||t.resetTrackPath()}N(t){if((new Date).getTime(),this.$.length){if(1===this.$.length&&this.tt)return this.addTrackPoint(this.tt,!0),this.et(this.tt),this.$.length=0,void(this.tt=null);this.it?(this.P(this.$[0]),this.it=!1):this.L(this.$[0]),this.k.setPoint(this.$[0]),this.ht(this.$[0]),this.$.shift()}}G(t){if(this.guidTrack){if(!t)return;let i=y.lnglatToMercator(t);if(!i)return;let{index:s,matchPoint:e,matchDist:h,segmentDist:r}=this.guidTrack.matchTrackPoint(this.guidIndex,i);e&&h<=this.minMatchDist&&(this.guidIndex=s,this.guidTrack.Z(s,r))}}setMovePoint(i){super.setMovePoint(i),this.k.addEventListener(t.PointCodes.SET_TRACK_POINT,(t=>{let i=t.trackPoint,s=null,e=0,h=0;if(this.$.length&&this.tt&&(this.addTrackPoint(this.tt,!this.it),this.et(this.tt),s=this.$[0],this.$.length=0,this.tt=null),this.h.length&&this.duration&&!t.emit&&this.owner){let t=[];if(s?(t=y.getLinearPoints(s,i.getPoint(),this.duration/16.6),e=s.rotation):(s=this.h[this.h.length-1],t=y.getLinearPoints(s.getPoint(),i.getPoint(),this.duration/16.6),e=m(this.getRotation(this.getTrackPoints().length-1))),t&&t.length>=this.owner.getCruiseOptions().minRotation){this.p&&(e=f(y.getMap().getHeading())+this.owner.getCruiseOptions().cruiseLookAt),h=m(this.getRotation(this.getTrackPoints().length-1,i));let s=g(h,e);if(Math.abs(s)>=5){this.p=!1;let i=y.getLinearAngles(e,s,t.length);t.forEach(((t,s)=>{t.rotation=i[s]}))}else this.p=!0,t.forEach(((t,i)=>{t.rotation=e}));this.$=t,this.tt=i.clone(),this.it=!0}else this.addTrackPoint(i),this.et(i)}else this.addTrackPoint(i),this.et(i,t.emit)}))}et(t,i){var s;this.k&&(this.k.setPoint(t.getPoint()),void 0!==t.getRotation()&&(null===(s=this.k)||void 0===s||s.setRotation(t.getRotation())),i||(1===this.getPoints().length&&void 0!==this.k.getRotation()&&t.setRotation(this.k.getRotation()),this.ht(t)))}ht(t){var i,s,e;let h=t instanceof G?t.getPoint():t;if(t instanceof BMapGL.Point&&void 0!==t.rotation)return null===(i=this.k)||void 0===i||i.setRotation(function(t){let i=t%360;return t<0&&(i+=360),i}(t.rotation)),void this.O(h,t.rotation);if(t instanceof G&&void 0!==t.getRotation())this.O(h,m(t.getRotation()));else{if(this.h.length){let i=t instanceof G?this.h.length-2:this.h.length-1,r=this.h[i<0?0:i],n=y.lnglatToMercator(h);if(n){let i=r.getPointMCArray(),o=0;return i[0]===n[0]&&i[1]===n[1]?void(o=null!==(s=r.getRotation())&&void 0!==s?s:0):(o=u(r.getPointMCArray(),n),this.O(h,m(Math.round(o))),void(t instanceof G&&void 0===t.getRotation()&&(t.setRotation(Math.round(o)),null===(e=this.k)||void 0===e||e.setRotation(o))))}}this.O(h)}}}class F extends h{constructor(t,i,s){super(),this.rt=new Map,this.nt=new Map,this.ot=new Map,this.lt=20,this.ut=10,this.ct=100,this.dt=t,this.vt=i,this.X=s||{},this.X.enablePicked=!0}ft(t){let i,s=this.gt(t);if(t.B=s,t instanceof B)if(this.nt.has(s)){let e=this.nt.get(s);i=this.ot.get(e),i.Mt=i.Mt||[],i.Mt.push(t.uuid),t.F=e;let h=this.xt(t,i.style_opt);i.setStyleOptions(h),i.resolveStyle()}else{let e=p();i=this.yt(t,!1),t.F=e,this.nt.set(s,e),this.ot.set(e,i)}else if(this.rt.has(s)){let e=this.rt.get(s),h=!1;for(let s=0;s<e.length;s++){const r=e[s],n=this.ot.get(r);if(n.Mt.length<this.lt){n.Mt.push(t.uuid),i=n,h=!0,t.F=r;let s=this.xt(t,i.style_opt);i.setStyleOptions(s),i.resolveStyle();break}}if(!h){let s=p();i=this.yt(t,!0),e.push(s),t.F=s,this.ot.set(s,i)}}else{let e=p();i=this.yt(t,!0),this.rt.set(s,[e]),this.ot.set(e,i),t.F=e}i instanceof BMapGL.LineLayer&&this.wt(i)}kt(t){let i=t.F,s=this.ot.get(i);if(s){let e=s.Mt.indexOf(t.uuid);if(e>-1){if(s.Mt.splice(e,1),0===s.Mt.length&&t instanceof C){this.dt.removeNormalLayer(s),this.ot.delete(i);let e=this.rt.get(t.B)||[];return void e.splice(null==e?void 0:e.indexOf(i),1)}this.wt(s)}}}Lt(t){t||(t=Array.from(this.ot.keys())),t.forEach((t=>{let i=this.ot.get(t);i&&this.wt(i)}))}wt(t){let i=[],s=t.Mt;for(let t=0;t<s.length;t++){const e=s[t];let h=this.vt.get(e);h&&h.visible&&(h.getFeature().rank=h.rank,i.push(h.getFeature()))}let e={type:"FeatureCollection",features:i.sort(((t,i)=>t.rank-i.rank))};t.setData(e)}gt(t){let i=this.X.style||{},s=this.X.linearTexture||t.linearTexture,e=t.style.traceDisappear||!!i.traceDisappear,h=t.style.traceStart||!!i.traceStart,r={linear:s,traceColor:t.style.traceColor||i.traceColor,traceDisappear:e,traceStart:h,sequence:t.style.sequence||!!i.sequence,marginLength:t.style.marginLength||i.marginLength,linksLine:t.style.linksLine||i.linksLine,arrowColor:t.style.arrowColor||i.arrowColor};return function(t){let i=0;for(let s=0;s<t.length;s++)i=(i<<5)-i+t.charCodeAt(s),i|=0;return i}(JSON.stringify(r))}yt(i,s=!1){let e=this.createLineLayerOptions(s,this.X);e.zIndex=s?++this.ut:++this.ct,this.X.crs&&(e.crs=this.X.crs),this.xt(i,e.style),i.linearTexture.length>0&&(e.isLinear=!0,e.linearTexture=i.linearTexture||[[0,"green"],[.5,"blue"],[1,"red"]]),e.isLinear&&(e.style.linksLine=!0),["traceColor","traceDisappear","traceStart","sequence","marginLength","linksLine","arrowColor"].forEach((t=>{void 0!==i.style[t]&&(e.style[t]=i.style[t])}));let h=new BMapGL.LineLayer(e);h.Mt=[i.uuid];let r=this;return h.addEventListener("click",(function(i){if(i.value&&i.value.dataIndex>-1){h.selectedIndex=-1;let s=h.Mt[i.value.dataIndex],e=r.vt.get(s);e&&e.fire(t.MapCodes.CLICK,i)}})),h.addEventListener("mousemove",(function(i){if(i.value&&i.value.dataIndex>-1){let s=h.Mt[i.value.dataIndex],e=r.vt.get(s);for(let[s,h]of r.vt)h!==e&&1===h.u&&(e.fire(t.MapCodes.MOUSE_OUT,i),e.u=0);e&&0===e.u&&(e.fire(t.MapCodes.MOUSE_OVER,i),e.u=1)}if(i.value&&-1===i.value.dataIndex)for(let[s,e]of r.vt)e&&1===e.u&&(e.fire(t.MapCodes.MOUSE_OUT,i),e.u=0)})),this.dt.addNormalLayer(h),h}createLineLayerOptions(t,i){i=i||{};let s=this,e={style:Object.assign(i.style||{},{verticesValueControl:function(t){let i=this.Mt[t];return s.vt.get(i).getGradientColors()},traceControl:t?function(t){let i=[],e=this;return t.forEach((function(t){let h=e.Mt[t],r=s.vt.get(h);r.style.traceDisappear&&!1===r.style.traceStart?i.push(r.trace):i.push(r.trace||-1)})),i}:void 0}),isLinear:!!(i.linearTexture&&i.linearTexture.length>0),linearTexture:void 0,enablePicked:i.enablePicked};return e.isLinear&&(e.linearTexture=i.linearTexture||[[0,"green"],[.5,"blue"],[1,"red"]]),e}xt(t,i){const s=["strokeWeight","borderColor","borderWeight","strokeOpacity","strokeTextureUrl","strokeTextureWidth","strokeTextureHeight","strokeLineJoin","strokeColor","strokeStyle","dashArray"],e={strokeWeight:["match",["get","uuid"],2],borderColor:["match",["get","uuid"],"rgba(27, 142, 236, 1)"],borderWeight:["match",["get","uuid"],0],strokeOpacity:["match",["get","uuid"],1],strokeTextureUrl:["match",["get","uuid"],""],strokeTextureWidth:["match",["get","uuid"],16],strokeTextureHeight:["match",["get","uuid"],16],strokeLineJoin:["match",["get","uuid"],"round"],strokeLineCap:["match",["get","uuid"],"square"],strokeColor:["match",["get","uuid"],"rgba(25, 25, 250, 1)"],strokeStyle:["match",["get","uuid"],"solid"],dashArray:["match",["get","uuid"],[8,4]]},h=["match","get","case","step"];let r,n=t.style,o=t.uuid;for(r of s)if(n.hasOwnProperty(r))if(null==i?void 0:i.hasOwnProperty(r)){let t=i[r],s=JSON.stringify(t);if(d(s,h))i[r]=e[r],i[r].splice(i[r].length-1,0,o,n[r]),i[r][i[r].length-1]=t;else if(s.indexOf("uuid")>-1){let i=t[t.length-1];t[i].splice(t[i].length-1,0,o,n[r])}else{let s=e[r];s.splice(s.length-1,0,o,n[r]),s[s.length-1]=t,i[r]=s}}else{let t=e[r];t.splice(t.length-1,0,o,n[r]),i[r]=t}return i}destroy(){var t;this.vt.clear();for(const i of this.ot.values())null===(t=this.dt)||void 0===t||t.removeNormalLayer(i);this.ot.clear()}}let A=class{constructor(t,i){this.Pt=[{x:0,y:0},{x:0,y:0},{x:1,y:1},{x:1,y:1}],this.Tt={rotationDuration:500,positionDuration:100,delay:0,timingFuntion:"linear"},this._t=[],this.bt=[],this.Ct=[],this.cruisePosition=[0,0],this.cruiseLookAt=0,this.fixedLookAt=!0,this.minRotation=2,this.dt=t,this.setCruiseOptions(i||{}),this.Gt(this.Tt.timingFuntion),this.Bt.bind(this),t.addEventListener("movestart",(t=>{t.isGesture,t.isGesture&&this.Ft()})),t.addEventListener("zoomstart",(t=>{t.isGesture&&this.Ft()}))}setCruiseOptions(t){var i;t.animationOptions&&Object.assign(this.Tt,t.animationOptions),this.cruisePosition=(null==t?void 0:t.cruisePosition)||[0,0],this.cruiseLookAt=(null==t?void 0:t.cruiseLookAt)||0,this.fixedLookAt=null===(i=null==t?void 0:t.fixedLookAt)||void 0===i||i,this.minRotation=(null==t?void 0:t.minRotation)||2}getCruiseOptions(){return{cruisePosition:this.cruisePosition,cruiseLookAt:this.cruiseLookAt,fixedLookAt:this.fixedLookAt,minRotation:this.minRotation}}At(){this.Ot||(this._t.length&&(this.dt.setHeading(this._t[0],{noAnimation:!0}),this._t.shift()),this.bt.length&&(this.dt.setTilt(this.bt[0],{noAnimation:!0}),this.bt.shift()),this.Ct.length&&(this.dt.setCenter(this.Ct[0],{noAnimation:!0}),this.Ct.shift()))}setCruisePosition(t){this.cruisePosition=t}setCruiseLookAt(t){this.cruiseLookAt=t}Bt(t,i,s,e){if(!this.Ot){if(i=void 0!==i?function(t){return t<=180?-t:360-t}(i-this.cruiseLookAt):this.dt.getHeading(),this._t=[],this.Ct=[],0===this.Ct.length){let h=this.dt.getHeading(),r=this.dt.getCenter();if(0===this.cruisePosition[0]&&0===this.cruisePosition[1]||(t=this.dt.overlayPixelToPoint(new BMapGL.Pixel(this.dt.width/2-this.cruisePosition[0],this.dt.height/2+this.cruisePosition[1]),{heading:this.fixedLookAt?i:h,tilt:s,center:t})),0===e)return this.dt.setCenter(t,{noAnimation:!0}),void(this.fixedLookAt&&this.dt.setHeading(i,{noAnimation:!0}));{let i=t.lng-r.lng,s=t.lat-r.lat;this.Dt(i,s,r,t)}}this.fixedLookAt&&this.St(i,s)}}St(t,i){var s,e,h;let r=Math.floor((null!==(s=this.Tt.rotationDuration)&&void 0!==s?s:500)/16.6),n=null!==(e=this._t[this._t.length-1])&&void 0!==e?e:this.dt.getHeading(),o=null!==(h=this.bt[this.bt.length-1])&&void 0!==h?h:this.dt.getTilt(),a=g(t,n),l=i-o;for(let t=0;t<r;t++){let i=v(this.Pt[0],this.Pt[1],this.Pt[2],this.Pt[3],(t+1)/r);Math.abs(a)>5&&(this._t[this._t.length]=m(n+a*i.y)),Math.abs(l)>2&&(this.bt[this.bt.length]=l*i.y+o)}Math.abs(a)>5&&this._t.push(t)}Dt(t,i,s,e){var h;let r=Math.floor((null!==(h=this.Tt.positionDuration)&&void 0!==h?h:100)/16.6);for(let e=0;e<r;e++){let h=v(this.Pt[0],this.Pt[1],this.Pt[2],this.Pt[3],(e+1)/r);if(Math.abs(t)>1e-6||Math.abs(i)>1e-6){let e=s.lat+i*h.y,r=s.lng+t*h.y;this.Ct[this.Ct.length]=new BMapGL.Point(r,e)}}this.Ct.push(e)}Gt(t){if("string"==typeof t)switch(t){case"ease":this.Pt=[{x:0,y:0},{x:.25,y:.1},{x:.25,y:1},{x:1,y:1}];break;case"linear":default:this.Pt=[{x:0,y:0},{x:0,y:0},{x:1,y:1},{x:1,y:1}];break;case"ease-in":this.Pt=[{x:0,y:0},{x:.42,y:0},{x:1,y:1},{x:1,y:1}];break;case"ease-out":this.Pt=[{x:0,y:0},{x:0,y:0},{x:.58,y:1},{x:1,y:1}];break;case"ease-in-out":this.Pt=[{x:0,y:0},{x:.42,y:0},{x:.58,y:1},{x:1,y:1}]}else Array.isArray(t)&&(this.Pt=[{x:0,y:0},{x:t[0].x,y:t[0].y},{x:t[1].x,y:t[1].y},{x:1,y:1}])}Ft(){this.Ot&&clearTimeout(this.Ot),this.Ot=window.setTimeout((()=>{clearTimeout(this.Ot),this.Ot=0,this.Ct=[]}),2e3)}};A=r([n],A);var O=A;let D=class extends h{constructor(){super(),this.jt=new Map,this.It=new Map}getLayer(i){if(this.Rt)return i&&i.addNormalLayer(this.Rt),this.Rt;{if(null==e)throw new Error("three.js is required");this.Rt=new BMapGL.ThreeLayer({enablePicked:!0,alpha:!0,zIndex:1e3,isTop:!0,isLowText:!0,onRender:function(t,i,s){t.render(i,s)}}),this.Rt.addEventListener("click",(function(i){if(i.value&&i.value.length>0){let s=i.value[0].owner;s&&s.fire(t.MapCodes.CLICK,i)}}));let s=this;return this.Rt.addEventListener("mousemove",(function(i){if(i.value&&i.value.length>0){let e=i.value[0].owner;e&&s.fire(t.MapCodes.MOUSE_OVER,i),e&&0===e.u&&(e.u=1,e.fire(t.MapCodes.MOUSE_OVER,i))}i.value||s.fire(t.MapCodes.MOUSE_OUT,i)})),i&&i.addNormalLayer(this.Rt),this.Rt}}loadModel(t){if(null==e)throw new Error("three.js is required");return new Promise(((i,s)=>{this.jt.has(t)?i(this.jt.get(t).clone(!0)):(new e.GLTFLoader).load(t,(s=>{this.jt.set(t,s.scene.clone(!0)),i(s.scene)}))}))}addModel(t,i){this.It.set(t.uuid,t),this.getLayer(i).add(t)}removeModel(t){t&&(this.It.delete(t.uuid),this.getLayer().remove(t))}getModel(t){return this.It.get(t)}destroy(t){this.It.forEach((t=>{t.traverse((t=>{var i,s;t instanceof e.Mesh&&(null===(i=t.geometry)||void 0===i||i.dispose(),null===(s=t.material)||void 0===s||s.dispose())}))})),this.It=new Map,this.jt.forEach((t=>{t.traverse((t=>{var i,s;t instanceof e.Mesh&&(null===(i=t.geometry)||void 0===i||i.dispose(),null===(s=t.material)||void 0===s||s.dispose())}))})),this.jt=new Map,null==t||t.removeNormalLayer(this.Rt),super.destroy()}};D=r([n],D);const S=new D;class j extends h{constructor(t){super(),this.Nt={},this.Ut=!1,this.status="init",this.zt=new Map,this.X=t,void 0!==t.rotation&&this.setRotation(t.rotation),this.Vt()}Et(t){this.qt=t}Ht(){return this.qt}getOptions(){return this.X}addToMap(t,i){if(this.status="onmap",this.Ut=!!i,this.zt.size)for(let[t,i]of this.zt)i.forEach((i=>{this.qt.addEventListener(t,i)}));this.zt.clear()}removeFromMap(t){this.status="destroyed",this.zt.clear()}on(t,i){if("function"==typeof i&&(super.on(t,i),!(e&&e.Group&&this.qt instanceof e.Group)&&"onclick|onmouseover|onmouseout".indexOf(t.toLocaleLowerCase())>-1))if("onmap"===this.status)this.Ht().addEventListener(t,i);else if("init"===this.status){let s=this.zt.get(t);s?s.push(i):this.zt.set(t,[i])}}off(t,i){if(super.off(t,i),!(e&&e.Group&&this.qt instanceof e.Group)&&i&&"onclick|onmouseover|onmouseout".indexOf(t.toLocaleLowerCase())>-1)if("onmap"===this.status)this.Ht().removeEventListener(t,i);else if("init"===this.status){let s=this.zt.get(t);s&&s.indexOf(i)>-1&&s.splice(s.indexOf(i),1)}}moveTo(i,s){this.Ut&&!s||(this.setPoint(i.getPoint()),void 0!==i.getRotation()&&this.setRotation(i.getRotation())),this.dispatchEvent(t.PointCodes.SET_TRACK_POINT,{trackPoint:i,emit:!!s})}setPoint(i,s){return!(this.Wt&&this.Wt.equals(i)||(this.Wt=i,this.dispatchEvent(t.PointCodes.CHANGE_POINT,{point:i}),0))}getPoint(){return this.Wt}setRotation(i){return!(!isNaN(this.Zt)&&!isNaN(this.Jt)&&this.Jt===i||(this.Jt=i,this.dispatchEvent(t.PointCodes.CHANGE_ROTATION,{rotation:i}),0))}getRotation(){return this.Jt}getProperty(){return this.Nt}setProperty(t){this.Nt=t}get isDestroyed(){return"destroyed"===this.status}set isDestroyed(t){this.status=t?"destroyed":"init"}}const I="./images/car.png",R=[16,32],N=[90,90,0];t.CustomPoint=class extends j{constructor(t){var i;let s=t||{},e=Object.assign({},{fixBottom:!0,minZoom:3,maxZoom:21,offsetY:0,rotationInit:0,useTranslate:!0,rotationFlip:!0,autoFollowHeadingChanged:!0,synUpdate:!0},null!==(i=s.style)&&void 0!==i?i:{});e.point=s.point,s.style=e,super(s)}Vt(){var t;let i=this.getOptions().createDom,s=null!==(t=this.getOptions().style)&&void 0!==t?t:{};this.Et(new BMapGL.CustomOverlay(i,s)),this.Yt=this.Ht()}addToMap(i,s){void 0!==this.Jt&&this.setRotation(this.Jt),i.addOverlay(this.Yt),this.fire(t.MapCodes.ADD_TO_MAP,{map:i}),super.addToMap(i,s)}removeFromMap(i){i.removeOverlay(this.Yt),this.fire(t.MapCodes.REMOVE_FROM_MAP,{map:i}),super.removeFromMap(i)}setPoint(t){return!!super.setPoint(t)&&(this.Y=[t.lng,t.lat,0],this.Yt.setPoint(t,!0),!0)}setRotation(t){return!(!super.setRotation(t)||!this.Yt||(this.Zt=t,this.Yt.setRotationOrigin(t),0))}},t.GroundPoint=class extends j{constructor(t){var i,s;let e=t||{};const h=R;let r={scale:1,rotation:0,anchor:new BMapGL.Size(.5,.5),offset:new BMapGL.Size(0,0),level:18,type:"image",size:new BMapGL.Size(...h),url:I,opacity:1},n=Object.assign({},r,null!==(i=e.style)&&void 0!==i?i:{});e.style=n,super(e),this.adjustSize=!0,this.baseLevel=18,this.baseLevel=n.level,this.adjustSize=null!==(s=e.adjustSize)&&void 0!==s?s:this.adjustSize,this.adjustSize&&y.on("zoom_changed",(({e:t,map:i})=>{this.setScale(Math.pow(2,this.baseLevel-i.getZoom()))}))}Vt(){var t,i;let s=null!==(t=this.getOptions().point)&&void 0!==t?t:new BMapGL.Point(0,0),e=null!==(i=this.getOptions().style)&&void 0!==i?i:{};this.Et(new BMapGL.GroundPoint(s,e)),this.Yt=this.Ht()}setPoint(t){return!!super.setPoint(t)&&(this.Y=[t.lng,t.lat,0],this.Yt.setPoint(t),!0)}setRotation(t){return!(!super.setRotation(t)||!this.Yt||(this.Zt=t,this.Yt.setRotation(t),0))}addToMap(i,s){this.adjustSize&&this.setScale(Math.pow(2,this.baseLevel-i.getZoom())),void 0!==this.Jt&&this.setRotation(this.Jt),i.addOverlay(this.Yt),this.fire(t.MapCodes.ADD_TO_MAP,{map:i}),super.addToMap(i,s)}removeFromMap(i){i.removeOverlay(this.Yt),this.fire(t.MapCodes.REMOVE_FROM_MAP,{map:i}),super.removeFromMap(i)}setScale(t){this.Xt=t,this.Yt.setScale(t)}},t.LiveTrack=B,t.LocalTrack=C,t.MarkerPoint=class extends j{constructor(t){var i;let s=t||{};const e=R;let h={icon:new BMapGL.Icon(I,new BMapGL.Size(...e)),autoFollowHeadingChanged:!0},r=Object.assign({},h,null!==(i=s.style)&&void 0!==i?i:{});s.style=r,super(s)}Vt(){var t,i;let s=null!==(t=this.getOptions().point)&&void 0!==t?t:new BMapGL.Point(0,0),e=null!==(i=this.getOptions().style)&&void 0!==i?i:{};this.Et(new BMapGL.Marker(s,e)),this.Yt=this.Ht()}addToMap(i,s){void 0!==this.Jt&&this.setRotation(this.Jt),i.addOverlay(this.Yt),this.fire(t.MapCodes.ADD_TO_MAP,{map:i}),super.addToMap(i,s)}removeFromMap(i){i.removeOverlay(this.Yt),this.fire(t.MapCodes.REMOVE_FROM_MAP,{map:i}),super.removeFromMap(i)}setPoint(t){return!!super.setPoint(t)&&(this.Y=[t.lng,t.lat,0],this.Yt.setPosition(t),!0)}setRotation(t){return!(!super.setRotation(t)||!this.Yt||(this.Zt=t,this.Yt.setRotationOrigin(t),0))}},t.ModelPoint=class extends j{constructor(t){var i,s;let e=t||{},h={url:"./images/bus.glb",scale:9,level:18,rotationX:N[0],rotationY:N[1],rotationZ:N[2]},r=Object.assign({},h,null!==(i=e.style)&&void 0!==i?i:{});e.style=r,super(e),this.adjustSize=!0,this.baseLevel=18,this.u=0,this.baseLevel=r.level,this.adjustSize=null!==(s=e.adjustSize)&&void 0!==s?s:this.adjustSize,this.adjustSize&&y.on("zoom_changed",(({e:t,map:i})=>{this.setScale(Math.pow(2,this.baseLevel-i.getZoom()))}))}Vt(){let i=this.getOptions().style;i&&i.url&&(S.loadModel(i.url).then((t=>{var s,e,h,r,n,o;this.Et(t),this.Yt=this.Ht(),this.Yt.owner=this,this.setRotationXYZ(null!==(s=null==i?void 0:i.rotationX)&&void 0!==s?s:0,null!==(e=null==i?void 0:i.rotationY)&&void 0!==e?e:0,null!==(h=null==i?void 0:i.rotationZ)&&void 0!==h?h:0),this.Kt?(this.setScale(null!==(r=this.Xt)&&void 0!==r?r:null==i?void 0:i.scale),this.setRotation(null!==(n=this.Jt)&&void 0!==n?n:null==i?void 0:i.rotationY),this.Kt()):this.setScale(null!==(o=null==i?void 0:i.scale)&&void 0!==o?o:1)})),S.on(t.MapCodes.MOUSE_OVER,(i=>{i.value[0].owner!==this&&1===this.u&&(this.u=0,this.fire(t.MapCodes.MOUSE_OUT,i))})),S.on(t.MapCodes.MOUSE_OUT,(i=>{1===this.u&&(this.fire(t.MapCodes.MOUSE_OUT,i),this.u=0)})))}addToMap(t,i){this.Yt?this.Qt(t,i):this.Kt=()=>{this.Qt(t,i)}}Qt(i,s){this.adjustSize&&this.setScale(Math.pow(2,this.baseLevel-i.getZoom())),this.Y?this.setPosition(...this.Y):this.setPoint(this.getOptions().point,i),void 0!==this.Jt&&this.setRotation(this.Jt),S.addModel(this.Yt,i),this.fire(t.MapCodes.ADD_TO_MAP,{map:i}),super.addToMap(i,s)}removeFromMap(i){S.removeModel(this.Yt),this.fire(t.MapCodes.REMOVE_FROM_MAP,{map:i}),super.removeFromMap(i)}setPoint(t,i){if(super.setPoint(t)){if(i||(i=y.getMap()),!i)return!1;let s=i.toFormatCoords([[t.lng,t.lat]]);return this.setPosition(s[0][0],s[0][1]),!0}return!1}setRotation(t){var i;if(isNaN(t)&&(t=0),super.setRotation(t)&&this.Yt){let s=this.getOptions().style,e=Math.PI*((null!==(i=null==s?void 0:s.rotationY)&&void 0!==i?i:0)-(null!=t?t:0))/180;return this.Yt&&(this.Zt=t,this.Yt.rotation.y=e,y.drawOnce()),!0}return!1}setPosition(t,i,s){this.Y=[t,i,null!=s?s:this.Y?this.Y[2]:0],this.Yt&&(this.Yt.position.set(...this.Y),y.drawOnce())}setPositionZ(t){this.Y&&(this.Y[2]=t),this.Yt&&(this.Yt.position.z=t,y.drawOnce())}setRotationXYZ(t,i,s){this.Yt&&(this.Yt.rotation.x=Math.PI*(t/180),this.Yt.rotation.y=Math.PI*(i/180),this.Yt.rotation.z=Math.PI*(s/180),y.drawOnce())}setScale(t){var i,s;if(isNaN(t)||0===t)return;let e=this.getOptions().style,h=null!==(i=null==e?void 0:e.scale)&&void 0!==i?i:1;this.Xt=h*(null!=t?t:1),null===(s=this.Yt)||void 0===s||s.scale.set(this.Xt,this.Xt,this.Xt),y.drawOnce()}},t.MovePoint=j,t.TrackLine=b,t.TrackPoint=G,t.View=class extends h{constructor(i,s){super(),this.$t=[],this.dt=i,this.options=s||{},i.config.markerUseRound=!1,y.setMap(this.dt),this.roadTrackMap=new Map,this.ti=new F(i,this.roadTrackMap,this.options.lineLayerOptions),this.ii=new O(i,this.options.cruiseOptions||{}),this.si=new a(this.ei.bind(this)),this.addEventListener(t.ViewCodes.UPDATE_FEATURE,(t=>{let{F:i}=t;-1===this.$t.findIndex((t=>t===i))&&this.$t.push(i)})),this.addEventListener(t.ViewCodes.UPDATE_RENDER,(t=>{this.dt._drawFrame()})),this.addEventListener(t.ViewCodes.UPDATE_TRACK_POINT,(t=>{this.W&&this.W===t.uuid&&this.ii.Bt(t.point,t.angle,i.getTilt(),t.timeSpan)}))}addTrackLine(t){this.roadTrackMap.set(t.uuid,t),this.ti.ft(t),t.D(this),t.l&&this.si.addAnimationFrameFunc(t.uuid,t.N)}removeTrackLine(t){this.roadTrackMap.delete(t.uuid),this.ti.kt(t),t.S(),this.si.removeAnimationFrameFunc(t.uuid)}focusTrack(t){this.W=t?t.getUUID():""}getFocusTrack(){return this.roadTrackMap.get(this.W)}setCruiseOptions(t){this.ii.setCruiseOptions(t)}getCruiseOptions(){return this.ii.getCruiseOptions()}destroy(){this.si.destroyed(),this.roadTrackMap.forEach((t=>{this.removeTrackLine(t)})),S.destroy(this.dt),this.ti.destroy()}Lt(){this.$t&&(this.ti.Lt(this.$t),this.$t=[])}ei(){this.Lt(),this.ii.At()}}}));
ManagementOKTravel/guns-admin/src/main/webapp/static/modular/system/tOrderTaxi/tOrderTaxi_info.js
@@ -125,10 +125,157 @@
    ajax.start();
}
var map = new BMapGL.Map('allmap', {
    style: 'grayed-out',
    displayOptions: {
        indoor: false,
        poiText: false,
        poiIcon: false,
        building: false,
    }
});
var point = new BMapGL.Point(demo_data[0][0], demo_data[0][1]);
var map = new BMapGL.Map("container");          // 创建地图实例
var point = new BMapGL.Point(116.404, 39.915);  // 创建点坐标
map.centerAndZoom(point, 15);
map.centerAndZoom(point, 18);
map.enableScrollWheelZoom(true);
map.setTilt(35);
var track = new Track.View(map, {
    lineLayerOptions: {
        style: {
            strokeWeight: 8,
            strokeLineJoin: 'round',
            strokeLineCap: 'round'
        },
    }
});
var trackData = [];
var colorOffset = [];
function orderTrack(data) {
    for(var item in data){
        var point = new BMapGL.Point(data[item].longitude, data[item].latitude);
        var trackPoint = new Track.TrackPoint(point);
        trackData.push(trackPoint);
        // 不同速度区间对应颜色
        var choose = [0.9, 0.5, 0.1];
        var color = choose[Math.floor(Math.random() * choose.length)];
        colorOffset.push(color);
    }
}
var startMarker = new BMapGL.Marker(trackData[0].getPoint(), {
    icon: new BMapGL.Icon('https://mapopen-pub-jsapi.bj.bcebos.com/jsapiGlgeo/img/start.png', new BMapGL.Size(25, 40)),
    offset: new BMapGL.Size(0, -16),
});
map.addOverlay(startMarker);
var endMarker = new BMapGL.Marker(trackData[trackData.length-1].getPoint(), {
    icon: new BMapGL.Icon('https://mapopen-pub-jsapi.bj.bcebos.com/jsapiGlgeo/img/end.png', new BMapGL.Size(25, 40)),
    offset: new BMapGL.Size(0, -16),
});
map.addOverlay(endMarker);
var duration = 60000;
var step = duration / trackData.length;
var trackRoad = new Track.LiveTrack({
    // visible: false,
    duration: step,
    linearTexture: [[0, '#f45e0c'], [0.5, '#f6cd0e'], [1, '#2ad61d']],
    guideStyle: {
        style:{
            traceDisappear: false,
            traceStart: true,
            sequence: true,
            marginLength: 32,
            arrowColor: '#fff',
            strokeColor: 'rgba(27, 142, 236, 1)',
            strokeTextureUrl: 'https://mapopen-pub-jsapi.bj.bcebos.com/jsapiGlgeo/img/down.png',
            strokeTextureWidth: 64,
            strokeTextureHeight: 32,
        }
    },
});
trackRoad.setGuidTrackPath(trackData);
trackRoad.on(Track.LineCodes.GUIDE_STATUS, (e) => {
    if (e.status === Track.GuidCodes.ADD_TO_MAP) {
        var guidTrack = trackRoad.getGuidTrack();
        guidTrack.on(Track.LineCodes.STATUS, (status) => {
            switch (status) {
                case Track.StatusCodes.FINISH:
                    var box = trackRoad.getBBox();
                    if(box){
                        var bounds = [new BMapGL.Point(box[0], box[1]), new BMapGL.Point(box[2], box[3])];
                        map.setViewport(bounds);
                    }
                    break;
                default:
                    break;
            }
        });
    }
});
var movePoint = new Track.ModelPoint({ point: trackData[0].getPoint(), style:{
        url: 'https://mapopen-pub-jsapi.bj.bcebos.com/jsapiGlgeo/img/bus.glb',
        scale: 9,
        level: 18,
        rotationX: 90,
        rotationY: 90,
        rotationZ: 0
    } });
movePoint.setRotation(trackRoad.getGuidTrack().getStepInfoByIndex(0).angle);
trackRoad.setMovePoint(movePoint);
track.addTrackLine(trackRoad);
track.focusTrack(trackRoad);
var ani;
var start = null;
var index = 0;
var finishIndex = 0;
function startAnimation(timestamp) {
    if (!start) start = timestamp;
    var progress = timestamp - start;
    var next = step * (index - finishIndex);
    if(progress > next){
        if(index<trackData.length){
            movePoint.moveTo(trackData[index]);
            var obj = trackRoad.getGuidTrack().getStepInfoByIndex(index);
            trackRoad.setGradientColors(colorOffset.slice(0,index+1));
            index++;
        }else{
            pauseAnimation();
        }
    }
    ani = requestAnimationFrame(startAnimation);
}
function stopAnimation() {
    pauseAnimation();
    index = 0;
    finishIndex = index;
    start = null;
    trackRoad.clearTrackPoint();
    movePoint.setPoint(trackData[0].getPoint());
    movePoint.setRotation(trackRoad.getGuidTrack().getStepInfoByIndex(0).angle);
}
function pauseAnimation() {
    cancelAnimationFrame(ani);
    finishIndex = index;
    start = null;
}
function resumeAnimation() {
    startAnimation();
}
$(function() {
    $('#orderType').on('change', function () {
        if($(this).val() == 1){
@@ -164,68 +311,4 @@
    });
}
var marker, lineArr = [];
function orderTrack(data) {
    for(var i in data){
        var waypoints = [];
        var lon = parseFloat(data[i].lon);
        var lat = parseFloat(data[i].lat);
        waypoints.push(lon);
        waypoints.push(lat);
        lineArr.push(waypoints);
    }
    marker = new AMap.Marker({
        map: map,
        position: lineArr[0],
        icon: "https://webapi.amap.com/images/car.png",
        offset: new AMap.Pixel(-26, -13),
        autoRotation: true,
        angle:-90,
    });
    // 绘制轨迹
    var polyline = new AMap.Polyline({
        map: map,
        path: lineArr,
        showDir:true,
        strokeColor: "#28F",  //线颜色
        // strokeOpacity: 1,     //线透明度
        strokeWeight: 6,      //线宽
        // strokeStyle: "solid"  //线样式
    });
    var passedPolyline = new AMap.Polyline({
        map: map,
        // path: lineArr,
        strokeColor: "#AF5",  //线颜色
        // strokeOpacity: 1,     //线透明度
        strokeWeight: 6,      //线宽
        // strokeStyle: "solid"  //线样式
    });
    marker.on('moving', function (e) {
        passedPolyline.setPath(e.passedPath);
    });
    map.setFitView();
}
function startAnimation () {
    marker.moveAlong(lineArr, 200);
}
function pauseAnimation () {
    marker.pauseMove();
}
function resumeAnimation () {
    marker.resumeMove();
}
function stopAnimation () {
    marker.stopMove();
}
UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/GDMapGeocodingUtil.java
@@ -20,7 +20,7 @@
@Component
public class GDMapGeocodingUtil {
    private String key = "9de4f857805bc84051aa13adeb2c44c8";
    private String key = "WQhfsluNzEeUHUxoH4jc4JiCQOXw4Mnx";
    @Autowired
    private RestTemplate restTemplate;
@@ -80,25 +80,22 @@
    public Map<String, Object> geocoding(String address){
        Map<String, Object> map = new HashMap<>();
        String url = "https://restapi.amap.com/v3/geocode/geo?key=" + key + "&output=JSON&address=" + address;
        String url = "https://api.map.baidu.com/geocoding/v3/?address"+ address+"&output=json&ak=" +key+"&ret_coordtype="+"bd09ll";
        String forObject = restTemplate.getForObject(url, String.class);
        JSONObject jsonObject = JSON.parseObject(forObject);
        String status = jsonObject.getString("status");
        List<String> list = new ArrayList<>();
        if(status.equals("1")){
            JSONArray geocodes = jsonObject.getJSONArray("geocodes");
            for(int i = 0; i < geocodes.size(); i++){
                String location = geocodes.getJSONObject(i).getString("location");
                list.add(location);
            }
        if(status.equals("0")){
            JSONObject result = jsonObject.getJSONObject("result");
            JSONObject location = result.getJSONObject("location");
            String lng = location.getString("lng");
            String lat = location.getString("lat");
            list.add(lat+","+lng);
        }
        map.put("status", 0);
        map.put("data", list);
        return map;
    }
    /**
     * 根据经纬度获取行政区域信息
     * @param lon
@@ -107,17 +104,14 @@
     * @throws Exception
     */
    public Map<String, String> geocode(String lon, String lan) throws Exception{
        String url = "https://restapi.amap.com/v3/geocode/regeo?key=" + key + "&location=" + lon + "," + lan;
        String url = "https://api.map.baidu.com/reverse_geocoding/v3/?ak=" + key +"&output=json&coordtype=bd09ll"+"&location=" + lan + "," + lon;
        String forObject = restTemplate.getForObject(url, String.class);
        JSONObject jsonObject = JSON.parseObject(forObject);
        Map<String, String> map = new HashMap<>();
//        gdInterfaceService.saveData("https://restapi.amap.com/v3/geocode/regeo", "经纬度转行政区域");
        if(jsonObject.getString("status").equals("1")){
            JSONObject regeocode = jsonObject.getJSONObject("regeocode");
            JSONObject addressComponent = regeocode.getJSONObject("addressComponent");
            String address = regeocode.getString("formatted_address");
        if(jsonObject.getString("status").equals("0")){
            JSONObject result = jsonObject.getJSONObject("result");
            JSONObject addressComponent = result.getJSONObject("addressComponent");
            String address = result.getString("formatted_address");
            map.put("address", address);
            String code = addressComponent.getString("adcode");
            String province = addressComponent.getString("province");
UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/TraceTrack.java
New file
@@ -0,0 +1,99 @@
package com.stylefeng.guns.modular.system.util;// 检测到您当前的ak设置了IP白名单校验
// 您的IP白名单中的IP非公网IP,请设置为公网IP,否则将请求失败:
// 请在IP地址为0.0.0.0/0 外网IP的计算发起请求,否则将请求失败
import org.springframework.stereotype.Component;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.util.TreeMap;
import java.util.Map;
@Component
public class TraceTrack {
    public static String Host = "https://yingyan.baidu.com";
    public static String URI = "/api/v3/entity/add";
    public static String AK = "WQhfsluNzEeUHUxoH4jc4JiCQOXw4Mnx";
    public static void main(String[] args) throws Exception {
        // 请求参数
        String entity_name = "entity_1";
        String entity_desc = "zhangsan";
        // POST请求,此处使用TreeMap,默认按key排序
        extracted();
    }
    private static void extracted() throws Exception {
        Map params = new TreeMap<String, String>();
        params.put("ak", AK);
        params.put("service_id", "241187");
        params.put("entity_name", "entity_1");
        params.put("entity_desc", "zhangsan");
        String URL = Host + URI;
        TraceTrack ta = new TraceTrack();
        ta.requestPost(URL, params);
    }
    /** 发送POST请求 */
    public void requestPost(String strUrl, Map<String, String> param) throws Exception {
        if (strUrl == null || strUrl.length() <= 0 || param == null || param.size() <= 0) {
            return;
        }
        // 构造x-www-form-urlencoded格式的字符串
        StringBuffer queryString = new StringBuffer();
        for (Map.Entry<?, ?> pair : param.entrySet()) {
            queryString.append(pair.getKey() + "=");
            queryString.append(URLEncoder.encode((String) pair.getValue(), "UTF-8") + "&");
        }
        if (queryString.length() > 0) {
          queryString.deleteCharAt(queryString.length() - 1);
        }
        String result = "";
        try {
          URL url = new URL(strUrl);
          HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
          urlConnection.setRequestMethod("POST");
          //设置连接的超时值为3000毫秒,超时将抛出SocketTimeoutException异常
          urlConnection.setConnectTimeout(3000);
          //设置读取的超时值为3000毫秒,超时将抛出SocketTimeoutException异常
          urlConnection.setReadTimeout(3000);
          //将url连接用于输出,这样才能使用getOutputStream()。getOutputStream()返回的输出流用于传输数据
          urlConnection.setDoOutput(true);
          //设置Content-Type
          urlConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
          //getOutputStream()返回的输出流,用于写入参数数据。
          OutputStream outputStream = urlConnection.getOutputStream();
          outputStream.write(queryString.toString().getBytes());
          outputStream.flush();
          outputStream.close();
          //此时将调用接口方法。getInputStream()返回的输入流可以读取返回的数据。
          InputStreamReader isr = new InputStreamReader(urlConnection.getInputStream());
          BufferedReader reader = new BufferedReader(isr);
          StringBuffer buffer = new StringBuffer();
          String line;
          while ((line = reader.readLine()) != null) {
              buffer.append(line);
          }
          reader.close();
          isr.close();
          System.out.println("返回的内容: " + buffer.toString());
      } catch (IOException e) {
          e.printStackTrace();
      }
  }
}